Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Samples/TemporalSubscriber.cpp (1 of 4 files). Show all
Unified · Split
| @@ -28,8 +28,7 @@ using namespace GSF; · 27 unmodified lines | |||
| 28 | using namespace GSF::Data; | 28 | using namespace GSF::Data; |
| 29 | using namespace GSF::TimeSeries; | 29 | using namespace GSF::TimeSeries; |
| 30 | 30 | ||
| 31 | GSF::Data::DataSetPtr TemporalSubscriber::s_historyDataSet = nullptr; | 31 | GSF::Data::DataSetPtr TemporalSubscriber::s_history = nullptr; |
| 32 | GSF::Data::DataTablePtr TemporalSubscriber::s_history = nullptr; | ||
| 33 | 32 | ||
| 34 | TemporalSubscriber::TemporalSubscriber(SubscriberConnectionPtr connection) : | 33 | TemporalSubscriber::TemporalSubscriber(SubscriberConnectionPtr connection) : |
| 35 | m_connection(std::move(connection)), | 34 | m_connection(std::move(connection)), |
| @@ -39,13 +38,10 @@ TemporalSubscriber::TemporalSubscriber(SubscriberConnectionPtr connection) : · 3 unmodified lines | |||
| 39 | m_currentRow(0), | 38 | m_currentRow(0), |
| 40 | m_stopped(false) | 39 | m_stopped(false) |
| 41 | { | 40 | { |
| 42 | if (s_historyDataSet == nullptr) | 41 | if (s_history == nullptr) |
| 43 | { | 42 | s_history = DataSet::FromXml("History.xml"); |
| 44 | s_historyDataSet = DataSet::FromXml("History.xml"); | ||
| 45 | s_history = DataSet::FromXml("History.xml")->Table("History"); | ||
| 46 | } | ||
| 47 | 43 | ||
| 48 | m_lastRow = s_history->RowCount() - 1; | 44 | m_lastRow = s_history->Table("History")->RowCount() - 1; |
| 49 | 45 | ||
| 50 | if (m_lastRow < 0) | 46 | if (m_lastRow < 0) |
| 51 | throw runtime_error("No history available - run with \"GenHistory\" argument."); | 47 | throw runtime_error("No history available - run with \"GenHistory\" argument."); |
| @@ -73,8 +69,8 @@ void TemporalSubscriber::SendTemporalData() · 21 unmodified lines | |||
| 73 | { | 69 | { |
| 74 | if (m_stopped) | 70 | if (m_stopped) |
| 75 | return; | 71 | return; |
| 76 | 72 | ||
| 77 | static DataTable& history = *s_history; | 73 | static DataTable& history = *s_history->Table("History"); |
| 78 | static const int32_t signalIDColumn = history["SignalID"]->Index(); | 74 | static const int32_t signalIDColumn = history["SignalID"]->Index(); |
| 79 | static const int32_t timestampColumn = history["Timestamp"]->Index(); | 75 | static const int32_t timestampColumn = history["Timestamp"]->Index(); |
| 80 | static const int32_t valueColumn = history["Value"]->Index(); | 76 | static const int32_t valueColumn = history["Value"]->Index(); |