A C++ template library for embedded applications
MIT licensed
Designed and
maintained by
John Wellbelove

queue


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

etl::queue<typename T,
           const size_t SIZE,
           const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>

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

The memory model determines the type used internally for indexes and size, to allow for the most efficient
implementation for the application.

Maximum queue sizes:
MEMORY_MODEL_SMALL   255
MEMORY_MODEL_MEDIUM  65535
MEMORY_MODEL_LARGE   2147483647
MEMORY_MODEL_HUGE    9223372036854775807

See memory_model.h

____________________________________________________________________________________________________

Member types


value_type      T
size_type        <based on memory model>
pointer          value_type*
const_pointer    const value_type*
reference        value_type&
const_reference  const value_type&
rvalue_reference 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_type size() const

Returns the size of the queue.
____________________________________________________________________________________________________

size_type available() const

Returns the remaining available capacity in the queue.
____________________________________________________________________________________________________

ETL_CONSTEXPR size_type max_size() const

Returns the maximum possible size of the queue.
____________________________________________________________________________________________________

ETL_CONSTEXPR size_type capacity() const

Returns the maximum possible size of the queue.

____________________________________________________________________________________________________

Modifiers


void push(const_reference value);
void push(rvalue_reference value);

Pushes a value to the back of the queue.
Emits an etl::queue_full if the queue is full and ETL_CHECK_PUSH_POP is defined. If asserts or exceptions are not
enabled then undefined behaviour occurs.
____________________________________________________________________________________________________

C++03

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);

C++11

void emplace(Args&&… args);

Constructs an item in the the queue 'in place'.
C++03: Supports up to four constructor parameters.
Emits an etl::queue_full if the queue is full and ETL_CHECK_PUSH_POP is defined. If asserts or exceptions are not
enabled then undefined behaviour occurs.
____________________________________________________________________________________________________

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. Undefined behaviour if the
queue is empty.
____________________________________________________________________________________________________

void pop_into(TContainer& destination);

Pop a value from the front of the list and places it in destination.
Emits an etl::queue_empty if the queue is empty and ETL_CHECK_PUSH_POP is defined. Undefined behaviour if the
queue is empty.
____________________________________________________________________________________________________

void clear();

Clears the queue to a size of zero.
queue.h