#pragma once #include #include #include #include #include #include #include #include "PublisherData.h" constexpr auto READ_BUFFER_SIZE = 4096; typedef std::map> data_key_map; using namespace std::chrono; class DataModel { public: //Sigleton Methods static std::unique_ptr& Instance(); static void Destroy(); static void Create(); void savePublishedData(PublisherData data); data_key_map& getSavedPublishedData() { return savedPublishedData; }; //saves collected data after a certain amount of time points void checkIfToFlush(bool keepDataLocally = false); private: //static instance which can be accessed by calling DataModel::Instance() static std::unique_ptr instance; //Data from publishers, one elemt in outer vector for one id //Each id consists of a vector of PublisherData (use map to make the id become a unique key) data_key_map savedPublishedData; //ostream operators (read and write dataModel data from streams) friend std::ostream& operator<<(std::ostream& os, DataModel& dataModel); friend std::istream& operator>>(std::istream& is, DataModel& dataModel); };