qb
2.0.0.0
C++17 Actor Framework
|
Single-Event Multiple-Handler router (generic version) More...
#include <router.h>
Public Member Functions | |
template<bool _CleanEvent = true> | |
void | route (_RawEvent &event) noexcept |
Routes an event to the appropriate handler. | |
void | subscribe (_Handler &handler) noexcept |
Subscribe a handler to receive events. | |
void | unsubscribe (_HandlerId const &id) noexcept |
Unsubscribe a handler by ID. |
Additional Inherited Members | |
Protected Member Functions inherited from qb::router::internal::EventPolicy | |
template<typename _Handler, typename _Event> | |
void | invoke (_Handler &handler, _Event &event) const |
Invoke a handler with an event. | |
template<typename _Event> | |
void | dispose (_Event &event) const noexcept |
Dispose of an event if necessary. |
Single-Event Multiple-Handler router (generic version)
Routes a specific event type to multiple handlers based on destination IDs.
_RawEvent | The event type |
_Handler | The handler type (void for heterogeneous handlers) |
|
inlinenoexcept |
Routes an event to the appropriate handler.
If the event has a broadcast destination, it's sent to all handlers. Otherwise, it's sent to the handler that matches the destination ID.
_CleanEvent | Whether to clean up the event after routing |
event | The event to route |
|
inlinenoexcept |
Subscribe a handler to receive events.
handler | The handler to subscribe |
|
inlinenoexcept |
Unsubscribe a handler by ID.
id | The ID of the handler to unsubscribe |