An event handler. More...
#include <eventHandler.hpp>
Public Member Functions | |
| EventHandler (const std::function< void(Derived &, const anch::events::Event< T > &)> &callbackFunction, bool useEventBus=false) | |
| EventHandler (const std::function< void(Derived &, const anch::events::Event< T > &)> &callbackFunction, anch::events::EventBus< T > &eventBus) | |
| virtual | ~EventHandler () |
| virtual void | handle (const anch::events::Event< T > &event) noexcept |
An event handler.
It provides a simple way to inherits several times from Observer and cutomize event receiving method name.
| anch::events::EventHandler< T, Derived >::EventHandler | ( | const std::function< void(Derived &, const anch::events::Event< T > &)> & | callbackFunction, |
| bool | useEventBus = false ) |
EventHandler constructor.
Register callback method.
Register itself in global EventBus if set.
| callbackFunction | the callback method to use on notify |
| useEventBus | if true register itself in global EventBus, false otherwise (default) |
| anch::events::EventHandler< T, Derived >::EventHandler | ( | const std::function< void(Derived &, const anch::events::Event< T > &)> & | callbackFunction, |
| anch::events::EventBus< T > & | eventBus ) |
EventHandler constructor.
Registers callback method.
Register itself in EventBus.
| callbackFunction | the callback method to use on notify |
| eventBus | the EventBus to register itself |
|
virtual |
EventHandler destructor.
Unregister EventHandler from EventBus if needed.
|
virtualnoexcept |
Invokes callback method on receiving event.
| event | the event which has been fired |
Implements anch::events::Observer< T >.