Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
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. More...
 
 EventAggregator (EventAggregator &&other)=default
 Constructs the EventAggregator using move semantics. More...
 
EventAggregatoroperator= (EventAggregator &&other)=default
 Replaces the EventAggregator contents with the other using move semantics. More...
 
 EventAggregator (const EventAggregator &)=delete
 
EventAggregatoroperator= (const EventAggregator &)=delete
 
virtual ~EventAggregator ()=default
 Destroys a EventAggregator instance. More...
 
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. More...
 
virtual bool unsubscribe (const EventSubscriber &subscriber)=0
 Unsubscribes from an event notification. More...
 
virtual void publish (std::unique_ptr< EventMessage > message)=0
 Publishes a message to all subscribers synchronous. More...
 
virtual void publish_async (std::unique_ptr< EventMessage > message)=0
 Publishes a message to all subscribers asynchronous. More...
 

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)
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)
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: