|
Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
|
Type-erased event bus. More...
#include <event_bus.hpp>
Public Member Functions | |
| EventBus () | |
| ~EventBus () | |
| EventBus (const EventBus &)=delete | |
| EventBus & | operator= (const EventBus &)=delete |
| EventBus (EventBus &&)=delete | |
| EventBus & | operator= (EventBus &&)=delete |
| template<typename T> | |
| void | publish (const T &event) |
| template<typename T> | |
| ::aria::Subscription | subscribe (std::function< void(const T &)> handler) |
| template<typename T> | |
| ::aria::Subscription | subscribe_on (IDispatcher &dispatcher, std::function< void(const T &)> handler) |
| Subscribe with a dispatcher — incoming events are marshalled to the dispatcher's thread (e.g. | |
| void | clear () |
Static Public Member Functions | |
| static EventBus & | global () noexcept |
| Process-wide global event bus. | |
Type-erased event bus.
Subscribe to any type T, publish any T. Singleton accessor returns the same instance process-wide because the definition lives in the runtime shared library.
| aria::runtime::EventBus::EventBus | ( | ) |
| aria::runtime::EventBus::~EventBus | ( | ) |
|
delete |
|
delete |
|
staticnoexcept |
Process-wide global event bus.
|
inline |
|
inlinenodiscard |
|
inlinenodiscard |
Subscribe with a dispatcher — incoming events are marshalled to the dispatcher's thread (e.g.
the UI thread) before the handler fires. Use this if your handler touches UI and publishers may call you from a worker thread. The dispatcher is borrowed and must outlive the subscription and any publish call already in progress. Releasing the subscription suppresses queued handlers that have not started.
| void aria::runtime::EventBus::clear | ( | ) |