Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Samples/TemporalSubscriber.cpp (1 of 13 files). Show all
Unified · Split
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | //****************************************************************************************************** | 22 | //****************************************************************************************************** |
| 23 | 23 | ||
| 24 | #include "TemporalSubscriber.h" | 24 | #include "TemporalSubscriber.h" |
| 25 | #include <utility> | ||
| 25 | 26 | ||
| 26 | using namespace std; | 27 | using namespace std; |
| 27 | using namespace GSF; | 28 | using namespace GSF; |
| @@ -31,12 +32,9 @@ using namespace GSF::TimeSeries; · 3 unmodified lines | |||
| 31 | GSF::Data::DataSetPtr TemporalSubscriber::s_historyDataSet = nullptr; | 32 | GSF::Data::DataSetPtr TemporalSubscriber::s_historyDataSet = nullptr; |
| 32 | GSF::Data::DataTablePtr TemporalSubscriber::s_history = nullptr; | 33 | GSF::Data::DataTablePtr TemporalSubscriber::s_history = nullptr; |
| 33 | 34 | ||
| 34 | TemporalSubscriber::TemporalSubscriber(const SubscriberConnectionPtr& connection, const std::function<void(const GSF::Guid&)>& removeHandler) : | 35 | TemporalSubscriber::TemporalSubscriber(TemporalSubscriberConnectionPtr connection) : |
| 35 | m_connection(connection), | 36 | m_connection(std::move(connection)), |
| 36 | m_removeHandler(removeHandler), | 37 | m_currentTimestamp(m_connection->GetStartTicks()), |
| 37 | m_startTimestamp(ToTicks(m_connection->GetStartTimeConstraint())), | ||
| 38 | m_stopTimestamp(ToTicks(m_connection->GetStopTimeConstraint())), | ||
| 39 | m_currentTimestamp(m_startTimestamp), | ||
| 40 | m_currentRow(0), | 38 | m_currentRow(0), |
| 41 | m_stopped(false) | 39 | m_stopped(false) |
| 42 | { | 40 | { |
| @@ -105,7 +103,7 @@ void TemporalSubscriber::SendTemporalData() · 62 unmodified lines | |||
| 105 | // Setup next publication timestamp | 103 | // Setup next publication timestamp |
| 106 | m_currentTimestamp += HistoryInterval; | 104 | m_currentTimestamp += HistoryInterval; |
| 107 | 105 | ||
| 108 | if (m_currentTimestamp > m_stopTimestamp) | 106 | if (m_currentTimestamp > m_connection->GetStopTicks()) |
| 109 | CompleteTemporalSubscription(); | 107 | CompleteTemporalSubscription(); |
| 110 | } | 108 | } |
| 111 | 109 | ||
| @@ -117,5 +115,4 @@ void TemporalSubscriber::CompleteTemporalSubscription() · 5 unmodified lines | |||
| 117 | m_stopped = true; | 115 | m_stopped = true; |
| 118 | m_processTimer->Stop(); | 116 | m_processTimer->Stop(); |
| 119 | m_connection->CompleteTemporalSubscription(); | 117 | m_connection->CompleteTemporalSubscription(); |
| 120 | m_removeHandler(m_connection->GetInstanceID()); | ||
| 121 | } | 118 | } |