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

Collects messages from publishers to be dispatched to subscribers when desired. More...

#include <queue.hpp>

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

Public Member Functions

template<class T >
void enqueue (const T &message)
 Adds a message to the queue, to be distributed later. More...
 
void flush ()
 Dispatches queued messages, in FIFO order, to subscribers. More...
 
void clear ()
 Removes all messages from the queue. More...
 
bool empty () const noexcept
 Returns true if there are no messages in the queue, false otherwise. More...
 
- Public Member Functions inherited from event::dispatcher
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

Collects messages from publishers to be dispatched to subscribers when desired.

Definition at line 32 of file queue.hpp.

Member Function Documentation

◆ clear()

void event::queue::clear ( )
inline

Removes all messages from the queue.

Definition at line 69 of file queue.hpp.

◆ empty()

bool event::queue::empty ( ) const
inlinenoexcept

Returns true if there are no messages in the queue, false otherwise.

Definition at line 77 of file queue.hpp.

◆ enqueue()

template<class T >
void event::queue::enqueue ( const T &  message)
inline

Adds a message to the queue, to be distributed later.

Template Parameters
TMessage type.
Parameters
messageMessage to enqueue.

Definition at line 43 of file queue.hpp.

◆ flush()

void event::queue::flush ( )
inline

Dispatches queued messages, in FIFO order, to subscribers.

Definition at line 57 of file queue.hpp.


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