Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

intrusive_queue< TValue, TLink > Class Template Reference

intrusive_queue< TValue, TLink > Class Template Reference
[queue]

An intrusive queue. More...

#include <intrusive_queue.h>

Inherits etl::intrusive_queue_base< TLink >.

Public Member Functions

 intrusive_queue ()
 Constructor.
reference front ()
 Gets a 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 front () const
 Gets a const reference to the value at the front of the queue.
const_reference back () const
 Gets a reference to the value at the back of the queue.
void push (link_type &value)
 Adds a value to the queue.
void pop ()
 Removes the oldest item from the queue.
template<typename TContainer >
void pop_into (TContainer &destination)
 Removes the oldest item from the queue and pushes it to the destination.
void clear ()
 Clears the queue to the empty state.
bool empty () const
 Checks if the queue is in the empty state.
size_t size () const
 Returns the number of elements.

Protected Attributes

link_type * p_front
 The current front of the queue.
link_type * p_back
 The current back of the queue.
size_t current_size
 Counts the number of elements in the list.

Detailed Description

template<typename TValue, typename TLink>
class etl::intrusive_queue< TValue, TLink >

An intrusive queue.

Stores elements derived from any type that supports an 'etl_next' pointer member.

Warning:
This queue cannot be used for concurrent access from multiple threads.
Template Parameters:
TValueThe type of value that the queue holds.
TLinkThe link type that the value is derived from.

Definition at line 198 of file intrusive_queue.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 216 of file intrusive_queue.h.


Member Function Documentation

reference back (  )

Gets a reference to the value at the back of the queue.

Undefined behaviour if the queue is empty.

Returns:
A reference to the value at the back of the queue.

Definition at line 236 of file intrusive_queue.h.

const_reference back (  ) const

Gets a reference to the value at the back of the queue.

Undefined behaviour if the queue is empty.

Returns:
A reference to the value at the back of the queue.

Definition at line 256 of file intrusive_queue.h.

void clear (  ) [inherited]

Clears the queue to the empty state.

Definition at line 146 of file intrusive_queue.h.

bool empty (  ) const [inherited]

Checks if the queue is in the empty state.

Definition at line 159 of file intrusive_queue.h.

reference front (  )

Gets a reference to the value at the front of the queue.

Undefined behaviour if the queue is empty.

Returns:
A reference to the value at the front of the queue.

Definition at line 226 of file intrusive_queue.h.

const_reference front (  ) const

Gets a const reference to the value at the front of the queue.

Undefined behaviour if the queue is empty.

Returns:
A const reference to the value at the front of the queue.

Definition at line 246 of file intrusive_queue.h.

void pop (  ) [inherited]

Removes the oldest item from the queue.

Undefined behaviour if the queue is already empty.

Definition at line 112 of file intrusive_queue.h.

void pop_into ( TContainer &  destination ) [inherited]

Removes the oldest item from the queue and pushes it to the destination.

Undefined behaviour if the queue is already empty. NOTE: The destination must be an intrusize container that supports a push(TLink) member function.

Definition at line 136 of file intrusive_queue.h.

void push ( link_type &  value ) [inherited]

Adds a value to the queue.

Parameters:
valueThe value to push to the queue.

Definition at line 90 of file intrusive_queue.h.

size_t size (  ) const [inherited]

Returns the number of elements.

Definition at line 167 of file intrusive_queue.h.


Field Documentation

size_t current_size [protected, inherited]

Counts the number of elements in the list.

Definition at line 187 of file intrusive_queue.h.

link_type* p_back [protected, inherited]

The current back of the queue.

Definition at line 185 of file intrusive_queue.h.

link_type* p_front [protected, inherited]

The current front of the queue.

Definition at line 184 of file intrusive_queue.h.