EventQueue Class
Abstract base class defining an interface for an EventQueue. More...
Declaration
Derived Classes
| class | DequeEventQueue |
|
Concrete implementation of an EventQueue that uses a Deque as its underlying queue strategy. Adding and removing events follows a FIFO strategy. More... | |
Public Destructor Index
| ~EventQueue ()=default | |
Public Member Functions Index
| EventQueue & | add (std::unique_ptr< const Event > event)=0 |
|
Adds a new event to the queue. The queue will take ownership of the provided event. The concrete position in the queue for the event will depend on the concrete implementation. More... | |
| EventQueue & | addOrReplace (std::unique_ptr< const Event > event, const std::function< bool(const std::unique_ptr< const Event > &evt, const std::unique_ptr< const Event > &e)> &cmpFunc)=0 |
|
Adds a new Event to the queue or replaces an existing one. More... | |
| bool | empty () const noexcept=0 |
|
Returns true if the queue is empty, otherwise false. More... | |
| std::unique_ptr< const Event > | next ()=0 |
|
Retrieves and removes the "next" event in the queue. Implementing classes are responsible for defining the meaning of "next", i.e., FIFO, LIFO, ordered after a particular criteria etc. More... | |
Description
Abstract base class defining an interface for an EventQueue.
The `EventQueue` provides mechanism to buffer and retrieve events in a structured manner. Implementing classes must define how events are stored and processed.
All events managed by this queue must derive from `Event`
Definition at line 25 of file EventQueue.ixx.
Public Destructor
~EventQueue()
| virtual default |
Definition at line 29 of file EventQueue.ixx.
Public Member Functions
add()
|
Adds a new event to the queue. The queue will take ownership of the provided event. The concrete position in the queue for the event will depend on the concrete implementation.
- Parameters
-
event A unique_ptr to the event this queue should buffer.
- Returns
Definition at line 42 of file EventQueue.ixx.
addOrReplace()
|
Adds a new Event to the queue or replaces an existing one.
This method allows for event management of events that should only be buffered once, but are added to the queue from different sources in the application, such that controlling the addition of events is not possible.
Implementing classes ar responsible for treating the specified cmpFunc, provided by the caller.
- Parameters
-
event A unique_ptr to a new or existing event that should be replaced.
cmpFunc A compare function that provides the logic for looking up the event that should be replaced with the specified event. The compFunc must accept two event arguments, whereas the first argument is the Event to add, and the second event is an existing event of the queue.
- Returns
Definition at line 64 of file EventQueue.ixx.
empty()
| nodiscard noexcept |
Returns true if the queue is empty, otherwise false.
- Returns
True if the queue is empty, otherwise false.
Definition at line 74 of file EventQueue.ixx.
next()
|
Retrieves and removes the "next" event in the queue. Implementing classes are responsible for defining the meaning of "next", i.e., FIFO, LIFO, ordered after a particular criteria etc.
The ownership of the event is transferred to the caller.
- Returns
a unique_ptr to the next event.
Definition at line 86 of file EventQueue.ixx.
Reference next.
Referenced by next.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.