#pragma once #include #include #include #include #include "Peer.hpp" #include "events/types.hpp" #include "events/base/BaseEvent.hpp" #include "tasks/types.hpp" #include "tasks/base/BaseTask.hpp" #include "utils/StatList.hpp" class EventManager { public: EventManager(); void loop(); void loopSender(); void loopReceiver(); private: std::thread senderThread; /// the thread sending communication std::thread receiverThread; /// the thread receiving communication std::map> eventRegistry; /// hold the event to call depending on the event type std::map> taskRegistry; /// hold the task to call depending on the server status StatList> peers; /// list of peers found std::shared_ptr server; /// the peer used as a server int eventSocket; /// the socket used to communicate drp::task::TaskType status; /// our current status std::uint8_t channel; /// the packet channel currently used };