Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Samples/SubscriberHandler.cpp (1 of 5 files). Show all
Unified · Split
| @@ -25,11 +25,11 @@ · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | // TODO: These includes are just for temporary testing code | 26 | // TODO: These includes are just for temporary testing code |
| 27 | #include "../Common/Convert.h" | 27 | #include "../Common/Convert.h" |
| 28 | #include <boost/lexical_cast.hpp> | ||
| 29 | #include <boost/uuid/uuid_io.hpp> | 28 | #include <boost/uuid/uuid_io.hpp> |
| 30 | #include <iostream> | 29 | #include <iostream> |
| 31 | 30 | ||
| 32 | using namespace std; | 31 | using namespace std; |
| 32 | using namespace GSF; | ||
| 33 | using namespace GSF::TimeSeries; | 33 | using namespace GSF::TimeSeries; |
| 34 | 34 | ||
| 35 | SubscriberHandler::SubscriberHandler(const string& name) | 35 | SubscriberHandler::SubscriberHandler(const string& name) |
| @@ -151,27 +151,27 @@ void SubscriberHandler::ReceivedNewMeasurements(const vector<MeasurementPtr>& me · 115 unmodified lines | |||
| 151 | const string TimestampFormat = "%Y-%m-%d %H:%M:%S.%f"; | 151 | const string TimestampFormat = "%Y-%m-%d %H:%M:%S.%f"; |
| 152 | const uint32_t MaxTimestampSize = 80; | 152 | const uint32_t MaxTimestampSize = 80; |
| 153 | 153 | ||
| 154 | //static long processCount = 0; | 154 | static long processCount = 0; |
| 155 | static char timestamp[MaxTimestampSize]; | 155 | static char timestamp[MaxTimestampSize]; |
| 156 | //static const long interval = 5 * 60; | 156 | static const long interval = 5 * 60; |
| 157 | //const long measurementCount = measurements.size(); | 157 | const long measurementCount = measurements.size(); |
| 158 | const bool showMessage = true; // (processCount + measurementCount >= (processCount / interval + 1) * interval); | 158 | const bool showMessage = true; // (processCount + measurementCount >= (processCount / interval + 1) * interval); |
| 159 | 159 | ||
| 160 | //processCount += measurementCount; | 160 | processCount += measurementCount; |
| 161 | 161 | ||
| 162 | // Only display messages every few seconds | 162 | // Only display messages every few seconds |
| 163 | if (showMessage) | 163 | if (showMessage) |
| 164 | { | 164 | { |
| 165 | stringstream message; | 165 | stringstream message; |
| 166 | 166 | ||
| 167 | //message << GetTotalMeasurementsReceived() << " measurements received so far..." << endl; | 167 | message << GetTotalMeasurementsReceived() << " measurements received so far..." << endl; |
| 168 | 168 | ||
| 169 | if (TicksToString(timestamp, MaxTimestampSize, TimestampFormat, measurements[0]->Timestamp)) | 169 | if (TicksToString(timestamp, MaxTimestampSize, TimestampFormat, measurements[0]->Timestamp)) |
| 170 | message << string(timestamp); | 170 | message << string(timestamp); |
| 171 | 171 | ||
| 172 | //message << "Signal ID: " << boost::lexical_cast<string>(measurements[0]->SignalID) << endl; | 172 | message << "Signal ID: " << boost::lexical_cast<string>(measurements[0]->SignalID) << endl; |
| 173 | 173 | ||
| 174 | //message << "Point\tValue" << endl; | 174 | message << "Point\tValue" << endl; |
| 175 | 175 | ||
| 176 | for (const auto& measurement : measurements) | 176 | for (const auto& measurement : measurements) |
| 177 | message << '\t' << measurement->ID << '\t' << measurement->Value; | 177 | message << '\t' << measurement->ID << '\t' << measurement->Value; |