123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #pragma once
- #include <chrono>
- #include <vector>
- #include <iostream>
- #include "PublisherType.h"
-
- using namespace std::chrono;
- typedef unsigned int u_int;
-
- class PublisherData
- {
- private:
- u_int publisherID;
- const PublisherType publisherType;
- system_clock::time_point time_generated;
- std::vector<float> values;
-
- public:
- //constructors
- PublisherData(const int _publisherID, PublisherType pubType, float value);
- PublisherData(const int _publisherID, PublisherType pubType, std::vector<float> _values);
- PublisherData();
-
- //void updateTime() { this->time_generated = system_clock::now(); }
- inline void addData(const float data) { values.push_back(data); }
-
- u_int getID() { return publisherID; }
- std::vector<float>& getValues() { return values; };
-
- //getter/setter
- PublisherType getType()const { return publisherType; }
- system_clock::time_point getTimeGenerated()const { return time_generated; }
- void setTimeGenerated(const std::chrono::system_clock::time_point t) { time_generated = t; }
-
-
- bool hasData()const { return values.size() == 0 ? false : true; }
-
- //operator
- friend std::ostream& operator<<(std::ostream&, const PublisherData&);
- friend std::istream& operator>>(std::istream&, PublisherData&);
- };
|