Type indexed publish and subscribe event bus.
More...
#include <events/busEvents.hpp>
|
| template<typename E > |
| void | subscribe (std::function< void(const E &event)> func) |
| | Registers a handler for one event type.
|
| |
| template<typename E > |
| void | publish (const E &event) |
| | Calls every handler registered for the event type.
|
| |
Type indexed publish and subscribe event bus.
Handlers run synchronously on the thread that publishes the event.
◆ subscribe()
template<typename E >
| void busEvent::subscribe |
( |
std::function< void(const E &event)> | func | ) |
|
|
inline |
Registers a handler for one event type.
- Template Parameters
-
- Parameters
-
| func | Function called with every published event of type E. |
◆ publish()
template<typename E >
| void busEvent::publish |
( |
const E & | event | ) |
|
|
inline |
Calls every handler registered for the event type.
- Template Parameters
-
- Parameters
-
| event | Event passed to the handlers. |