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

intrusive_queue


An intrusive queue.
STL equivalent: None

etl::intrusive_queue<typename TValue, typename TLink>

TValue is the type that contains the actual values. It is derived from TLink.
TLink is the link type for this list. It must contain an etl_next pointer member.
See Intrusive links.

____________________________________________________________________________________________________

Member types


link_type       TLink
value_type      TValue
size_type       std::size_t
pointer         value_type*
const_pointer   const value_type*
reference       value_type&
const_reference const value_type&

____________________________________________________________________________________________________

Constructor


etl::intrusive_queue<typename TValue, typename TLink>();

____________________________________________________________________________________________________

Element access


T& front()
const T& front() const

Returns a reference or const reference to the first element.
Undefined behaviour if the queue is empty.
____________________________________________________________________________________________________

T& back()
const T& back() const

Returns a reference or const reference to the last element.
Undefined behaviour if the queue is empty.

____________________________________________________________________________________________________

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(link_type& value);

Pushes a value to the back of the queue.
____________________________________________________________________________________________________

void pop();

Pop a value from the front of the queue.
Emits an etl::intrusive_queue_empty if the queue is empty and ETL_CHECK_PUSH_POP is defined.
If asserts or exceptions are not enabled then undefined behaviour occurs.
____________________________________________________________________________________________________

template <typename TContainer>
void pop_into(TContainer& destination);

Pop a value from the front of the queue and push to the destination intrusive container.
The destination container type must support a push(TLink) member function.
Emits an etl::intrusive_queue_empty if the queue is empty and ETL_CHECK_PUSH_POP is defined.
If asserts or exceptions are not enabled then undefined behaviour occurs.
____________________________________________________________________________________________________

void clear();

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