Berserk
Macros
EventDispatcher.cpp File Reference
#include <core/EventDispatcher.hpp>
#include <core/io/Logger.hpp>
#include <algorithm>
#include <cassert>
Include dependency graph for EventDispatcher.cpp:

Macros

#define BRK_EVENT_DISPATCHER_FIND_LISTENER(handle)
 

Macro Definition Documentation

◆ BRK_EVENT_DISPATCHER_FIND_LISTENER

#define BRK_EVENT_DISPATCHER_FIND_LISTENER (   handle)
Value:
auto query = mListenersTypes.find(handle); \
\
if (query == mListenersTypes.end()) { \
BRK_ERROR("No such listener with handle=" << (handle)); \
continue; \
} \
\
const auto &eventType = query->second; \
auto &listeners = mListeners[eventType]; \
auto listener = std::find_if(listeners.begin(), listeners.end(), [=](const Listener &l) { return l.handle == (handle); }); \
\
if (listener == listeners.end()) { \
BRK_ERROR("No such listener with handle=" << (handle)); \
continue; \
}