1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #pragma once
- #include <chrono>
- #include <vector>
- #include <iostream>
- #include "PublisherType.h"
-
- using namespace std::chrono;
-
- class PublisherData
- {
- private:
- unsigned 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); }
-
- std::string toString()const;
- unsigned int getID() { return publisherID; }
- void setID(unsigned int id) { this->publisherID = id; };
- std::vector<float>& 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&);
-
-
- };
-
|