« Back to documentation index
queue< T, SIZE > Class Template Reference
A fixed capacity queue.
More...
#include <queue.h >
Inherits etl::iqueue< T > .
Public Types
typedef T value_type
The type stored in the queue.
typedef T & reference
A reference to the type used in the queue.
typedef const T & const_reference
A const reference to the type used in the queue.
typedef T * pointer
A pointer to the type used in the queue.
typedef const T * const_pointer
A const pointer to the type used in the queue.
typedef queue_base::size_type size_type
The type used for determining the size of the queue.
Public Member Functions
queue ()
Default constructor.
queue (const queue &rhs)
Copy constructor.
~queue ()
Destructor.
queue & operator= (const queue &rhs)
Assignment operator.
reference front ()
Gets a reference to the value at the front of the queue.
const_reference front () const
Gets a const reference to the value at the front of the queue.
reference back ()
Gets a reference to the value at the back of the queue.
const_reference back () const
Gets a const reference to the value at the back of the queue.
void push (parameter_t value)
Adds a value to the queue.
reference push ()
Allows a possibly more efficient 'push' by moving to the next input value and returning a reference to it.
template<typename T1 >
void emplace (const T1 &value1)
Constructs a value in the queue 'in place'.
template<typename T1 , typename T2 >
void emplace (const T1 &value1, const T2 &value2)
Constructs a value in the queue 'in place'.
template<typename T1 , typename T2 , typename T3 >
void emplace (const T1 &value1, const T2 &value2, const T3 &value3)
Constructs a value in the queue 'in place'.
template<typename T1 , typename T2 , typename T3 , typename T4 >
void emplace (const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
Constructs a value in the queue 'in place'.
void clear ()
Clears the queue to the empty state.
void pop ()
Removes the oldest value from the back of the queue.
void pop_into (reference destination)
Gets the oldest value and removes it from the front of the queue.
template<typename TContainer >
void pop_into (TContainer &destination)
Gets the oldest value and removes it from the front of the queue and pushes it to the destination container.
size_type size () const
Returns the current number of items in the queue.
size_type max_size () const
Returns the maximum number of items that can be queued.
bool empty () const
Checks to see if the queue is empty.
bool full () const
Checks to see if the queue is full.
size_t available () const
Returns the remaining capacity.
Protected Member Functions
void clone (const iqueue &other)
Make this a clone of the supplied queue.
void add_in ()
Increments (and wraps) the 'in' index value to record a queue addition.
void del_out ()
Decrements (and wraps) the 'out' index value to record a queue deletion.
Protected Attributes
size_type in
Where to input new data.
size_type out
Where to get the oldest data.
size_type current_size
The number of items in the queue.
const size_type CAPACITY
The maximum number of items in the queue.
etl::debug_count construct_count
For internal debugging purposes.
Detailed Description
template<typename T, const size_t SIZE>
class etl::queue< T, SIZE >
A fixed capacity queue.
This queue does not support concurrent access by different threads.
Template Parameters:
T The type this queue should support.
SIZE The maximum capacity of the queue.
Definition at line 469 of file queue.h .
Member Typedef Documentation
A const pointer to the type used in the queue.
Definition at line 221 of file queue.h .
A const reference to the type used in the queue.
Definition at line 219 of file queue.h .
A pointer to the type used in the queue.
Definition at line 220 of file queue.h .
A reference to the type used in the queue.
Definition at line 218 of file queue.h .
The type used for determining the size of the queue.
Reimplemented from queue_base .
Definition at line 222 of file queue.h .
The type stored in the queue.
Definition at line 217 of file queue.h .
Constructor & Destructor Documentation
Default constructor.
Definition at line 478 of file queue.h .
Copy constructor.
Definition at line 486 of file queue.h .
Destructor.
Definition at line 495 of file queue.h .
Member Function Documentation
void add_in
(
)
[protected, inherited]
Increments (and wraps) the 'in' index value to record a queue addition.
Definition at line 170 of file queue.h .
size_t available
(
)
const [inherited]
Returns the remaining capacity.
Returns: The remaining capacity.
Definition at line 149 of file queue.h .
Gets a reference to the value at the back of the queue.
Returns: A reference to the value at the back of the queue.
Definition at line 253 of file queue.h .
Gets a const reference to the value at the back of the queue.
Returns: A const reference to the value at the back of the queue.
Definition at line 262 of file queue.h .
void clear
(
)
[inherited]
Clears the queue to the empty state.
Definition at line 363 of file queue.h .
void clone
(
const iqueue < T > &
other )
[protected, inherited]
Make this a clone of the supplied queue.
Definition at line 431 of file queue.h .
void del_out
(
)
[protected, inherited]
Decrements (and wraps) the 'out' index value to record a queue deletion.
Definition at line 184 of file queue.h .
void emplace
(
const T1 &
value1 )
[inherited]
Constructs a value in the queue 'in place'.
If asserts or exceptions are enabled, throws an etl::queue_full if the queue if already full.
Parameters:
value The value to use to construct the item to push to the queue.
Definition at line 306 of file queue.h .
void emplace
(
const T1 &
value1 ,
const T2 &
value2
)
[inherited]
Constructs a value in the queue 'in place'.
If asserts or exceptions are enabled, throws an etl::queue_full if the queue if already full.
Parameters:
value The value to use to construct the item to push to the queue.
Definition at line 321 of file queue.h .
void emplace
(
const T1 &
value1 ,
const T2 &
value2 ,
const T3 &
value3
)
[inherited]
Constructs a value in the queue 'in place'.
If asserts or exceptions are enabled, throws an etl::queue_full if the queue if already full.
Parameters:
value The value to use to construct the item to push to the queue.
Definition at line 336 of file queue.h .
void emplace
(
const T1 &
value1 ,
const T2 &
value2 ,
const T3 &
value3 ,
const T4 &
value4
)
[inherited]
Constructs a value in the queue 'in place'.
If asserts or exceptions are enabled, throws an etl::queue_full if the queue if already full.
Parameters:
value The value to use to construct the item to push to the queue.
Definition at line 351 of file queue.h .
bool empty
(
)
const [inherited]
Checks to see if the queue is empty.
Returns: true if the queue is empty, otherwise false
Definition at line 131 of file queue.h .
Gets a reference to the value at the front of the queue.
Returns: A reference to the value at the front of the queue.
Definition at line 235 of file queue.h .
Gets a const reference to the value at the front of the queue.
Returns: A const reference to the value at the front of the queue.
Definition at line 244 of file queue.h .
bool full
(
)
const [inherited]
Checks to see if the queue is full.
Returns: true if the queue is full, otherwise false
Definition at line 140 of file queue.h .
Returns the maximum number of items that can be queued.
Definition at line 122 of file queue.h .
Assignment operator.
Definition at line 503 of file queue.h .
Removes the oldest value from the back of the queue.
Does nothing if the queue is already empty. If asserts or exceptions are enabled, throws an etl::queue_empty if the queue is empty.
Definition at line 380 of file queue.h .
void pop_into
(
TContainer &
destination )
[inherited]
Gets the oldest value and removes it from the front of the queue and pushes it to the destination container.
If asserts or exceptions are enabled, throws an etl::queue_empty if the queue is empty. NOTE: The destination must support a push(T) member function.
Definition at line 406 of file queue.h .
void pop_into
(
reference
destination )
[inherited]
Gets the oldest value and removes it from the front of the queue.
If asserts or exceptions are enabled, throws an etl::queue_empty if the queue is empty.
Definition at line 393 of file queue.h .
void push
(
parameter_t
value )
[inherited]
Adds a value to the queue.
If asserts or exceptions are enabled, throws an etl::queue_full if the queue if already full.
Parameters:
value The value to push to the queue.
Definition at line 272 of file queue.h .
Allows a possibly more efficient 'push' by moving to the next input value and returning a reference to it.
This may eliminate a copy by allowing direct construction in-place.
If asserts or exceptions are enabled, throws an etl::queue_full is the queue is already full.
Returns: A reference to the position to 'push' to.
Definition at line 288 of file queue.h .
Returns the current number of items in the queue.
Definition at line 114 of file queue.h .
Field Documentation
The maximum number of items in the queue.
Definition at line 197 of file queue.h .
For internal debugging purposes.
Definition at line 198 of file queue.h .
The number of items in the queue.
Definition at line 196 of file queue.h .
Where to input new data.
Definition at line 194 of file queue.h .
Where to get the oldest data.
Definition at line 195 of file queue.h .