aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/include/eventManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'mwe/events/include/eventManager.h')
-rw-r--r--mwe/events/include/eventManager.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/mwe/events/include/eventManager.h b/mwe/events/include/eventManager.h
new file mode 100644
index 0000000..93def36
--- /dev/null
+++ b/mwe/events/include/eventManager.h
@@ -0,0 +1,18 @@
+#pragma once
+#include <unordered_map>
+#include <memory>
+#include "event.h"
+#include "eventHandler.h"
+using EventType = int;
+using EventId = int;
+class EventManager{
+ public:
+
+ void subscribe(EventId eventId,std::unique_ptr<IEventHandlerWrapper>&& handler);
+ void unsubscribe(EventId eventId, const std::string& handlerName);
+ void dispatchEvents();
+ void triggerEvent(EventId eventId);
+ void queueEvent();
+ private:
+ std::unordered_map<EventType, std::vector<std::unique_ptr<IEventHandlerWrapper>>> m_subscribers;
+};