Antkeeper  0.0.1
Public Member Functions | List of all members
event::dispatcher Class Reference

Forwards messages from publishers to subscribers. More...

#include <dispatcher.hpp>

Inheritance diagram for event::dispatcher:
event::queue

Public Member Functions

template<class T >
std::shared_ptr< subscriptionsubscribe (subscriber< T > &&subscriber)
 Subscribes a function object to messages dispatched by this dispatcher. More...
 
template<class T >
void dispatch (const T &message) const
 Dispatches a message to subscribers of the message type. More...
 

Detailed Description

Forwards messages from publishers to subscribers.

Definition at line 36 of file dispatcher.hpp.

Member Function Documentation

◆ dispatch()

template<class T >
void event::dispatcher::dispatch ( const T &  message) const
inline

Dispatches a message to subscribers of the message type.

Template Parameters
TMessage type.
Parameters
messageMessage to dispatch.

Definition at line 77 of file dispatcher.hpp.

◆ subscribe()

template<class T >
std::shared_ptr<subscription> event::dispatcher::subscribe ( subscriber< T > &&  subscriber)
inline

Subscribes a function object to messages dispatched by this dispatcher.

Template Parameters
TMessage type.
Parameters
subscriberFunction object to subscribe.
Returns
Shared subscription object which will unsubscribe the subscriber on destruction.

Definition at line 50 of file dispatcher.hpp.


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