|
stdex
Additional custom or not Standard C++ covered algorithms
|
Helper class to allow limited size FIFO queues implemented as vector of elements. More...
#include <stdex/vector_queue.h>
Public Member Functions | |
| vector_queue (size_type size_max) | |
| Construct queue of fixed size. More... | |
| vector_queue (const vector_queue< value_type > &other) | |
| Copies existing queue. More... | |
| virtual | ~vector_queue () |
| Destroys the queue. | |
| vector_queue (vector_queue< value_type > &&other) | |
| Moves existing queue. More... | |
| vector_queue< value_type > & | operator= (const vector_queue< value_type > &other) |
| Copies existing queue. More... | |
| vector_queue< value_type > & | operator= (vector_queue< value_type > &&other) |
| Moves existing queue. More... | |
| size_type | size () const |
| Returns the number of elements in the vector. | |
| size_type | capacity () const |
| Returns the number of elements that the queue can contain before overwriting head ones. | |
| void | clear () |
| Erases the elements of the queue. | |
| bool | empty () const |
| Tests if the queue is empty. | |
| reference | at (size_type pos) |
| Returns a reference to the element at a specified location in the queue. More... | |
| reference | operator[] (size_type pos) |
| Returns a reference to the element at a specified location in the queue. More... | |
| const_reference | at (size_type pos) const |
| Returns a constant reference to the element at a specified location in the queue. More... | |
| const_reference | operator[] (size_type pos) const |
| Returns a constant reference to the element at a specified location in the queue. More... | |
| reference | at_abs (size_type pos) |
| Returns a reference to the element at the absolute location in the queue. More... | |
| const_reference | at_abs (size_type pos) const |
| Returns a constant reference to the element at the absolute location in the queue: measured from the beginning of the storage. More... | |
| size_type | push_back (const value_type &v) |
| Copies an existing element to the end of the queue, overriding the first one when queue is out of space. More... | |
| size_type | push_back (value_type &&v) |
| Moves the element to the end of the queue, overriding the first one when queue is out of space. More... | |
| void | pop_back () |
| Removes (dequeues) the last element of the queue. | |
| size_type | push_front (const value_type &v) |
| Copies an existing element to the head of the queue, overriding the last one when queue is out of space and moving all others one place right. More... | |
| size_type | push_front (value_type &&v) |
| Moves the element to the head of the queue, overriding the last one when queue is out of space and moving all others one place right. More... | |
| void | pop_front () |
| Removes (dequeues) the head element of the queue. | |
| reference | front () |
| Returns a reference to the head element in the queue. | |
| const_reference | front () const |
| Returns a constant reference to the head element in the queue. | |
| reference | back () |
| Returns a reference to the last element in the queue. | |
| const_reference | back () const |
| Returns a constant reference to the last element in the queue. | |
| size_type | head () const |
| Returns absolute subscript or position number of the head element in the queue. The element does not need to exist. | |
| size_type | tail () const |
| Returns absolute subscript or position number of the last element in the queue. The element must exist. | |
| size_type | abs (size_type pos) const |
| Returns absolute subscript or position number of the given element in the queue. | |
Protected Attributes | |
| value_type * | m_data |
| Underlying data container. | |
| size_type | m_head |
| Index of the first element. | |
| size_type | m_count |
| Number of elements. | |
| size_type | m_size_max |
| Maximum size. | |
Helper class to allow limited size FIFO queues implemented as vector of elements.
|
inline |
Construct queue of fixed size.
| [in] | size_max | Maximum number of elements. Please note this cannot be changed later. |
|
inline |
Copies existing queue.
| [in] | other | Queue to copy from |
|
inline |
Moves existing queue.
| [in,out] | other | Queue to move |
|
inline |
Returns a reference to the element at a specified location in the queue.
| [in] | pos | The subscript or position number of the element to reference in the queue. |
|
inline |
Returns a constant reference to the element at a specified location in the queue.
| [in] | pos | The subscript or position number of the element to reference in the queue. |
|
inline |
Returns a reference to the element at the absolute location in the queue.
| [in] | pos | The absolute subscript or position number of the element to reference in the queue. |
|
inline |
Returns a constant reference to the element at the absolute location in the queue: measured from the beginning of the storage.
| [in] | pos | The absolute subscript or position number of the element to reference in the queue. |
|
inline |
Copies existing queue.
| [in] | other | Queue to copy from |
|
inline |
Moves existing queue.
| [in,out] | other | Queue to move |
|
inline |
Returns a reference to the element at a specified location in the queue.
| [in] | pos | The subscript or position number of the element to reference in the queue. |
|
inline |
Returns a constant reference to the element at a specified location in the queue.
| [in] | pos | The subscript or position number of the element to reference in the queue. |
|
inline |
Copies an existing element to the end of the queue, overriding the first one when queue is out of space.
| [in] | v | Element to copy to the end of the queue. |
|
inline |
Moves the element to the end of the queue, overriding the first one when queue is out of space.
| [in] | v | Element to move to the end of the queue. |
|
inline |
Copies an existing element to the head of the queue, overriding the last one when queue is out of space and moving all others one place right.
| [in] | v | Element to copy to the head of the queue. |
|
inline |
Moves the element to the head of the queue, overriding the last one when queue is out of space and moving all others one place right.
| [in] | v | Element to move to the head of the queue. |