A C++ template library for embedded applications
Designed and maintained by
Aster Consulting Ltd

queue

A fixed capacity queue.
STL equivalent: std::queue

etl::queue<typename T, const size_t SIZE>

Inherits from etl::iqueue<T>
etl::iqueue may be used as a size independent pointer or reference type for any etl::queue instance.

Member types

value_type T
size_type  std::size_t
pointer         value_type*
const_pointer   const value_type*
reference       value_type&
const_reference const value_type&

Constructor

etl::queue<typename T, const size_t SIZE>();

Element access

T& front()
const T& front() const
Returns a reference or const reference to the first element.

T& back()
const T& back() const
Returns a reference or const reference to the last element.

Capacity

bool empty() const
Returns true if the size of the queue is zero, otherwise false.

bool full() const
Returns true if the size of the queue is SIZE, otherwise false.

size_t size() const
Returns the size of the queue.

size_t available() const
Returns the remaining available capacity in the queue.

size_t max_size() const
Returns the maximum possible size of the queue.

size_t capacity() const
Returns the maximum possible size of the queue.

Modifiers

void push(parameter_t value);
T& push();
Pushes a value to the back of the queue.
The first pushes a value.
The second allocates the new element but does not initialise it and returns a reference to it..

Emits an etl::queue_full if the queue is full and ETL_CHECK_PUSH_POP is defined.

void emplace(const T1& value1);
void emplace(const T1& value1, const T2& value2);
void emplace(const T1& value1, const T2& value2, const T3& value3);
void emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4);
Constructs an item in the the queue 'in place'.
Supports up to four constructor parameters.

void pop();
Pop a value from the front of the list.
Emits an etl::queue_empty if the queue is empty and ETL_CHECK_PUSH_POP is defined.

void clear();
Clears the queue to a size of zero.
queue.h