Health-GPS
1.2.2.0
Global Health Policy Simulation model (Health-GPS)
|
Implements the default memory-based simulation event bus type. More...
#include <event_bus.h>
Public Member Functions | |
std::unique_ptr< EventSubscriber > | subscribe (EventType event_id, std::function< void(std::shared_ptr< EventMessage > message)> &&function) override |
Subscribes a handler function to an event type identifier. More... | |
void | publish (std::unique_ptr< EventMessage > message) override |
Publishes a message to all subscribers synchronous. More... | |
void | publish_async (std::unique_ptr< EventMessage > message) override |
Publishes a message to all subscribers asynchronous. More... | |
bool | unsubscribe (const EventSubscriber &subscriber) override |
Unsubscribes from an event notification. More... | |
std::size_t | count () |
Gets the number of registered subscribers. More... | |
void | clear () noexcept |
Clear all registered subscribers. More... | |
![]() | |
EventAggregator ()=default | |
Initialises a new instance of the EventAggregator class. More... | |
EventAggregator (EventAggregator &&other)=default | |
Constructs the EventAggregator using move semantics. More... | |
EventAggregator & | operator= (EventAggregator &&other)=default |
Replaces the EventAggregator contents with the other using move semantics. More... | |
EventAggregator (const EventAggregator &)=delete | |
EventAggregator & | operator= (const EventAggregator &)=delete |
virtual | ~EventAggregator ()=default |
Destroys a EventAggregator instance. More... | |
Implements the default memory-based simulation event bus type.
|
noexcept |
Clear all registered subscribers.
std::size_t hgps::DefaultEventBus::count | ( | ) |
Gets the number of registered subscribers.
|
overridevirtual |
Publishes a message to all subscribers synchronous.
message | The new message instance |
Implements hgps::EventAggregator.
|
overridevirtual |
Publishes a message to all subscribers asynchronous.
message | The new message instance |
Implements hgps::EventAggregator.
|
overridevirtual |
Subscribes a handler function to an event type identifier.
event_id | The event type to subscribe |
handler | The event handler function to register |
Implements hgps::EventAggregator.
|
overridevirtual |
Unsubscribes from an event notification.
subscriber | The event subscriber instance |
Implements hgps::EventAggregator.