#include <xrb_circularqueue.hpp>
Public Member Functions | |
CircularQueue () | |
Default constructor. | |
~CircularQueue () | |
Destructor. | |
T const & | Entry (Uint32 const index) const |
Returns the entry in the relative position given by index . | |
Uint32 | EntryCount () const |
Returns the number of entries in this queue. | |
bool | IsEmpty () const |
Returns true iff the queue is empty. | |
bool | IsFull () const |
Returns true iff the queue is at maximum capacity. | |
void | Enqueue (T const &entry) |
Enqueues the given entry at the end of the queue. | |
T | Dequeue () |
Dequeue the head entry, returning it by value. | |
void | Clear () |
Clear all entries in the queue, leaving an empty queue. |
Template arguments are the type of queue data and queue length. Adding items happens strictly by enqueueing them at the end, while removing items happens be dequeueing them from the beggining. Random, read-only access (index-based) is also available.
The template argument for entry type ( T
) must be assignable. Dequeue and Clear don't actually change the entries at all, so the entries will not be destructed in any reliable way. T
should not count on being destructed.
Definition at line 32 of file xrb_circularqueue.hpp.
Xrb::CircularQueue< T, queue_size >::CircularQueue | ( | ) | [inline] |
Default constructor.
Initializes an empty queue.
Definition at line 95 of file xrb_circularqueue.hpp.
T const & Xrb::CircularQueue< T, queue_size >::Entry | ( | Uint32 const | index | ) | const [inline] |
Returns the entry in the relative position given by index
.
The head of the queue always has index 0.
Definition at line 112 of file xrb_circularqueue.hpp.
References Xrb::CircularQueue< T, queue_size >::EntryCount().
Referenced by Xrb::FramerateCalculator::Framerate().
Uint32 Xrb::CircularQueue< T, queue_size >::EntryCount | ( | ) | const [inline] |
Returns the number of entries in this queue.
The size of the queue will always be <= queue_size
.
Definition at line 51 of file xrb_circularqueue.hpp.
Referenced by Xrb::CircularQueue< T, queue_size >::Entry(), and Xrb::FramerateCalculator::Framerate().
void Xrb::CircularQueue< T, queue_size >::Enqueue | ( | T const & | entry | ) | [inline] |
Enqueues the given entry at the end of the queue.
Will assert if the queue is currently full.
Definition at line 119 of file xrb_circularqueue.hpp.
References Xrb::CircularQueue< T, queue_size >::IsFull().
Referenced by Xrb::FramerateCalculator::AddFrameTime().
T Xrb::CircularQueue< T, queue_size >::Dequeue | ( | ) | [inline] |
Dequeue the head entry, returning it by value.
Doesn't actually change the contents of the queue (which is important if T
relies on being destructed).
Will assert if the queue is currently empty.
Definition at line 132 of file xrb_circularqueue.hpp.
References Xrb::CircularQueue< T, queue_size >::IsEmpty().
Referenced by Xrb::FramerateCalculator::AddFrameTime(), and Xrb::KeyRepeater::DequeueEvent().
void Xrb::CircularQueue< T, queue_size >::Clear | ( | ) | [inline] |
Clear all entries in the queue, leaving an empty queue.
Doesn't actually change the contents of the queue (which is important if T
relies on being destructed).
Definition at line 148 of file xrb_circularqueue.hpp.