#pragma once #include #include #include #include #include "Session.h" /* * A session always belongs to a client ID, therefore the session ID is always the nodeID of the * corresponding client */ class SessionStore { public: SessionStore() {} std::shared_ptr referenceSession(NumNodeID sessionID) const; std::shared_ptr referenceOrAddSession(NumNodeID sessionID); std::list> syncSessions(const std::vector& masterList); size_t getAllSessionIDs(NumNodeIDList* outSessionIDs) const; size_t getSize() const; void serializeForTarget(Serializer& ser, uint16_t targetID) const; void deserializeForTarget(Deserializer& des, uint16_t targetID); bool loadFromFile(std::string filePath, uint16_t targetID); bool saveToFile(std::string filePath, uint16_t targetID) const; private: std::map> sessions; mutable Mutex mutex; };