#pragma once #include #include #include #include "PublisherType.h" using namespace std::chrono; class PublisherData { private: unsigned int publisherID; const PublisherType publisherType; system_clock::time_point time_generated; std::vector values; public: //constructors PublisherData(const int _publisherID, PublisherType pubType, float value); PublisherData(const int _publisherID, PublisherType pubType, std::vector _values); PublisherData(); //void updateTime() { this->time_generated = system_clock::now(); } inline void addData(const float data) { values.push_back(data); } std::string toString()const; unsigned int getID() { return publisherID; } void setID(unsigned int id) { this->publisherID = id; }; std::vector& getValues() { return values; }; //getter/setter PublisherType getType()const { return publisherType; } system_clock::time_point getTimeGenerated()const { return time_generated; } 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&); };