Antkeeper  0.0.1
Public Types | Public Member Functions | Friends | List of all members
event::channel< T > Class Template Reference

Channel through which messages are published. More...

#include <channel.hpp>

Public Types

typedef T message_type
 Message type. More...
 
typedef subscriber< message_typesubscriber_type
 Subscriber function object type. More...
 

Public Member Functions

std::shared_ptr< subscriptionsubscribe (subscriber_type &&subscriber)
 Subscribes a function object to messages published through this channel. More...
 
std::shared_ptr< subscriptionsubscribe (event::dispatcher &dispatcher)
 Subscribes a message dispatcher to messages published through this channel. More...
 
std::shared_ptr< subscriptionsubscribe (event::queue &queue)
 Subscribes a message queue to messages published through this channel. More...
 

Friends

class publisher< T >
 

Detailed Description

template<class T>
class event::channel< T >

Channel through which messages are published.

Template Parameters
TMessage type.

Definition at line 43 of file channel.hpp.

Member Typedef Documentation

◆ message_type

template<class T >
typedef T event::channel< T >::message_type

Message type.

Definition at line 47 of file channel.hpp.

◆ subscriber_type

template<class T >
typedef subscriber<message_type> event::channel< T >::subscriber_type

Subscriber function object type.

Definition at line 50 of file channel.hpp.

Member Function Documentation

◆ subscribe() [1/3]

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

Subscribes a message dispatcher to messages published through this channel.

Parameters
dispatcherMessage dispatcher which will received published messages.
Returns
Shared subscription object which will unsubscribe the queue on destruction.

Definition at line 85 of file channel.hpp.

◆ subscribe() [2/3]

template<class T >
std::shared_ptr<subscription> event::channel< T >::subscribe ( event::queue queue)
inline

Subscribes a message queue to messages published through this channel.

Parameters
queueMessage queue which will received published messages.
Returns
Shared subscription object which will unsubscribe the queue on destruction.

Definition at line 103 of file channel.hpp.

◆ subscribe() [3/3]

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

Subscribes a function object to messages published through this channel.

Parameters
subscriberSubscriber function object which will received published messages.
Returns
Shared subscription object which will unsubscribe the subscriber on destruction.

Definition at line 59 of file channel.hpp.

Friends And Related Function Documentation

◆ publisher< T >

template<class T >
friend class publisher< T >
friend

Definition at line 103 of file channel.hpp.


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