aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/include/eventManager.h
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-10-02 16:10:22 +0200
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-10-02 16:10:22 +0200
commit94d591b69c45470480db477bc4000ef35019e18b (patch)
tree93732b405747cbd97a5b0aa786f2399823c0661b /mwe/events/include/eventManager.h
parent4628638f952f882e494788ca1cf880a029eba5ab (diff)
created event classes and start of eventManager
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;
+};