aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/EventManager.h
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-20 16:35:58 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-20 16:35:58 +0100
commit5f76ad1dde34fc0cf7b8ea63befa8917da94fe5c (patch)
treea393216d0e3beb6d226c6081350a83d1a897748f /src/crepe/api/EventManager.h
parentce14236bd08469737185962d0be11d72c442b60e (diff)
save before big refactor
Diffstat (limited to 'src/crepe/api/EventManager.h')
-rw-r--r--src/crepe/api/EventManager.h27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/crepe/api/EventManager.h b/src/crepe/api/EventManager.h
index 8fd22f4..eccb0bf 100644
--- a/src/crepe/api/EventManager.h
+++ b/src/crepe/api/EventManager.h
@@ -91,35 +91,28 @@ public:
*/
void clear();
private:
+
+ /**
+ * \brief Default constructor for the EventManager.
+ *
+ * This constructor is private to enforce the singleton pattern.
+ */
+ EventManager() = default;
struct QueueEntry {
std::unique_ptr<Event> event;
- int channel = 0;
+ int channel = CHANNEL_ALL;
std::type_index type;
int priority = 0;
};
struct CallbackEntry {
std::unique_ptr<IEventHandlerWrapper> callback;
- int channel = 0;
- std::type_index type;
+ int channel = CHANNEL_ALL;
int priority = 0;
};
- /**
- * \brief Default constructor for the EventManager.
- *
- * This constructor is private to enforce the singleton pattern.
- */
- EventManager() = default;
-
//! The queue of events to be processed.
std::vector<QueueEntry> events_queue;
//! Registered event handlers.
- std::unordered_map<std::type_index, std::vector<std::unique_ptr<IEventHandlerWrapper>>>
- subscribers;
- //! Event handlers indexed by event ID.
- std::unordered_map<
- std::type_index,
- std::unordered_map<int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>>
- subscribers_by_event_id;
+ std::unordered_map<std::type_index,std::vector<CallbackEntry>> subscribers;
};