Back to Site
Loading...
Searching...
No Matches
librats::EventBus Class Reference

#include <event_bus.h>

Public Member Functions

template<class E >
void on (std::function< void(const E &)> handler)
 Register a handler for events of type E.
 
template<class E >
void emit (const E &event)
 Publish an event to every handler registered for its type.
 

Detailed Description

Definition at line 40 of file event_bus.h.

Member Function Documentation

◆ emit()

template<class E >
void librats::EventBus::emit ( const E &  event)
inline

Publish an event to every handler registered for its type.

Definition at line 53 of file event_bus.h.

◆ on()

template<class E >
void librats::EventBus::on ( std::function< void(const E &)>  handler)
inline

Register a handler for events of type E.

Additive: multiple handlers may coexist and all fire (in registration order) for each emitted event.

Definition at line 45 of file event_bus.h.


The documentation for this class was generated from the following file: