46 template <
typename EventType>
70 template <
typename U,
typename args,
class ListenerClass>
71 void addListener(U* owner,
void (ListenerClass::*listenerMethod)(args)) {
72 callbacks_.insert(std::pair<void*, EventCallBack>(
73 static_cast<void*>(owner),
74 std::bind(listenerMethod, owner, std::placeholders::_1)));
85 template <
typename U,
typename args,
class ListenerClass>
EventGenerator()
Default constructor.
Definition: xmmEvents.hpp:54
std::function< void(EventType &)> EventCallBack
Definition: xmmEvents.hpp:49
void notifyListeners(EventType &e) const
Propagates the event to all listeners.
Definition: xmmEvents.hpp:99
virtual ~EventGenerator()
Destructor.
Definition: xmmEvents.hpp:60
void removeListeners()
Removes all listeners.
Definition: xmmEvents.hpp:93
void removeListener(U *owner, void(ListenerClass::*listenerMethod)(args))
Removes a listener object.
Definition: xmmEvents.hpp:86
Generator class for a specific type of events.
Definition: xmmEvents.hpp:47
Definition: xmmAttribute.hpp:42
void addListener(U *owner, void(ListenerClass::*listenerMethod)(args))
Adds a listener object to be notified when events are sent.
Definition: xmmEvents.hpp:71
std::map< void *, EventCallBack > callbacks_
Set of listener objects.
Definition: xmmEvents.hpp:109