aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/include/eventManager.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2025-01-11 21:32:30 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2025-01-11 21:32:30 +0100
commita6803980f1e74ecf1abb007b7c77f00d2cd92c43 (patch)
tree425ca961b27117d6e5d5fa0ae5cfca93351e0b33 /mwe/events/include/eventManager.h
parent6bc0025e4c24ed6659d993f3469c10615fb0e273 (diff)
parent525636bb2158ecea68ebb9d6b8d2dc722524c5e5 (diff)
merge master into loek/doxygen
Diffstat (limited to 'mwe/events/include/eventManager.h')
-rw-r--r--mwe/events/include/eventManager.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/mwe/events/include/eventManager.h b/mwe/events/include/eventManager.h
index 30e927f..43906e8 100644
--- a/mwe/events/include/eventManager.h
+++ b/mwe/events/include/eventManager.h
@@ -18,8 +18,8 @@ public:
}
void shutdown();
- void subscribe(int eventType, std::unique_ptr<IEventHandlerWrapper> && handler,
- int eventId);
+ void
+ subscribe(int eventType, std::unique_ptr<IEventHandlerWrapper> && handler, int eventId);
void unsubscribe(int eventType, const std::string & handlerName, int eventId);
void triggerEvent(const Event & event_, int eventId);
void queueEvent(std::unique_ptr<Event> && event_, int eventId);
@@ -35,19 +35,23 @@ private:
};
template <typename EventType>
-inline void subscribe(const EventHandler<EventType> & callback, int eventId = 0,
- const bool unsubscribeOnSuccess = false) {
+inline void subscribe(
+ const EventHandler<EventType> & callback, int eventId = 0,
+ const bool unsubscribeOnSuccess = false
+) {
std::unique_ptr<IEventHandlerWrapper> handler
= std::make_unique<EventHandlerWrapper<EventType>>(callback, unsubscribeOnSuccess);
- EventManager::getInstance().subscribe(EventType::getStaticEventType(), std::move(handler),
- eventId);
+ EventManager::getInstance().subscribe(
+ EventType::getStaticEventType(), std::move(handler), eventId
+ );
}
template <typename EventType>
inline void unsubscribe(const EventHandler<EventType> & callback, int eventId = 0) {
const std::string handlerName = callback.target_type().name();
- EventManager::getInstance().unsubscribe(EventType::getStaticEventType(), handlerName,
- eventId);
+ EventManager::getInstance().unsubscribe(
+ EventType::getStaticEventType(), handlerName, eventId
+ );
}
inline void triggerEvent(const Event & triggeredEvent, int eventId = 0) {
@@ -55,6 +59,7 @@ inline void triggerEvent(const Event & triggeredEvent, int eventId = 0) {
}
inline void queueEvent(std::unique_ptr<Event> && queuedEvent, int eventId = 0) {
- EventManager::getInstance().queueEvent(std::forward<std::unique_ptr<Event>>(queuedEvent),
- eventId);
+ EventManager::getInstance().queueEvent(
+ std::forward<std::unique_ptr<Event>>(queuedEvent), eventId
+ );
}