Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
hgps::EventAggregator Class Referenceabstract

Defines the event aggregator interface type. More...

#include <event_aggregator.h>

Inheritance diagram for hgps::EventAggregator:
[legend]

Public Member Functions

 EventAggregator ()=default
 Initialises a new instance of the EventAggregator class.
 
 EventAggregator (EventAggregator &&other)=default
 Constructs the EventAggregator using move semantics.
 
EventAggregatoroperator= (EventAggregator &&other)=default
 Replaces the EventAggregator contents with the other using move semantics.
 
 EventAggregator (const EventAggregator &)=delete
 
EventAggregatoroperator= (const EventAggregator &)=delete
 
virtual ~EventAggregator ()=default
 Destroys a EventAggregator instance.
 
virtual std::unique_ptr< EventSubscribersubscribe (EventType event_id, std::function< void(std::shared_ptr< EventMessage > message)> handler)=0
 Subscribes a handler function to an event type identifier.
 
virtual bool unsubscribe (const EventSubscriber &subscriber)=0
 Unsubscribes from an event notification.
 
virtual void publish (std::unique_ptr< EventMessage > message) const =0
 Publishes a message to all subscribers synchronous.
 
virtual void publish_async (std::unique_ptr< EventMessage > message) const =0
 Publishes a message to all subscribers asynchronous.
 

Detailed Description

Defines the event aggregator interface type.

Constructor & Destructor Documentation

◆ EventAggregator() [1/3]

hgps::EventAggregator::EventAggregator ( )
default

Initialises a new instance of the EventAggregator class.

◆ EventAggregator() [2/3]

hgps::EventAggregator::EventAggregator ( EventAggregator &&  other)
default

Constructs the EventAggregator using move semantics.

Parameters
otherThe other EventAggregator instance to move

◆ EventAggregator() [3/3]

hgps::EventAggregator::EventAggregator ( const EventAggregator )
delete

◆ ~EventAggregator()

virtual hgps::EventAggregator::~EventAggregator ( )
virtualdefault

Destroys a EventAggregator instance.

Member Function Documentation

◆ operator=() [1/2]

EventAggregator & hgps::EventAggregator::operator= ( const EventAggregator )
delete

◆ operator=() [2/2]

EventAggregator & hgps::EventAggregator::operator= ( EventAggregator &&  other)
default

Replaces the EventAggregator contents with the other using move semantics.

Parameters
otherThe other EventAggregator instance to move
Returns
This instance

◆ publish()

virtual void hgps::EventAggregator::publish ( std::unique_ptr< EventMessage message) const
pure virtual

Publishes a message to all subscribers synchronous.

Parameters
messageThe new message instance

Implemented in hgps::DefaultEventBus.

◆ publish_async()

virtual void hgps::EventAggregator::publish_async ( std::unique_ptr< EventMessage message) const
pure virtual

Publishes a message to all subscribers asynchronous.

Parameters
messageThe new message instance

Implemented in hgps::DefaultEventBus.

◆ subscribe()

virtual std::unique_ptr< EventSubscriber > hgps::EventAggregator::subscribe ( EventType  event_id,
std::function< void(std::shared_ptr< EventMessage > message)>  handler 
)
pure virtual

Subscribes a handler function to an event type identifier.

Parameters
event_idThe event type to subscribe
handlerThe event handler function to register
Returns
The event subscriber instance

Implemented in hgps::DefaultEventBus.

Here is the caller graph for this function:

◆ unsubscribe()

virtual bool hgps::EventAggregator::unsubscribe ( const EventSubscriber subscriber)
pure virtual

Unsubscribes from an event notification.

Parameters
subscriberThe event subscriber instance
Returns
true if the operation succeeded; otherwise, false

Implemented in hgps::DefaultEventBus.

Here is the caller graph for this function:

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