20 #ifndef ANTKEEPER_EVENT_QUEUE_HPP
21 #define ANTKEEPER_EVENT_QUEUE_HPP
49 this->dispatch<T>(message);
59 while (!messages.empty())
77 [[nodiscard]]
inline bool empty() const noexcept
79 return messages.empty();
83 std::list<std::function<void()>> messages;
Forwards messages from publishers to subscribers.
Collects messages from publishers to be dispatched to subscribers when desired.
bool empty() const noexcept
Returns true if there are no messages in the queue, false otherwise.
void flush()
Dispatches queued messages, in FIFO order, to subscribers.
void enqueue(const T &message)
Adds a message to the queue, to be distributed later.
void clear()
Removes all messages from the queue.
Publish-subscribe messaging.