Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

iqueue< T > Class Template Reference

This is the base for all queues that contain a particular type. More...

#include <queue.h>

Inherits etl::queue_base.

Inherited by queue< T, SIZE >.

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

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.
iqueueoperator= (const iqueue &rhs)
 Assignment operator.
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.
 iqueue (T *p_buffer_, size_type max_size_)
 The constructor that is called from derived classes.
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>
class etl::iqueue< T >

This is the base for all queues that contain a particular type.

Normally a reference to this type will be taken from a derived queue.

      etl::queue<int, 10> myQueue;
      etl::iqueue<int>& iQueue = myQueue;
Warning:
This queue cannot be used for concurrent access from multiple threads.
Template Parameters:
TThe type of value that the queue holds.

Definition at line 213 of file queue.h.


Member Typedef Documentation

typedef const T* const_pointer

A const pointer to the type used in the queue.

Definition at line 221 of file queue.h.

typedef const T& const_reference

A const reference to the type used in the queue.

Definition at line 219 of file queue.h.

typedef T* pointer

A pointer to the type used in the queue.

Definition at line 220 of file queue.h.

typedef T& reference

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.

typedef T value_type

The type stored in the queue.

Definition at line 217 of file queue.h.


Constructor & Destructor Documentation

iqueue ( T *  p_buffer_,
size_type  max_size_ 
) [protected]

The constructor that is called from derived classes.

Definition at line 447 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.

reference back (  )

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.

const_reference back (  ) const

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

Clears the queue to the empty state.

Definition at line 363 of file queue.h.

void clone ( const iqueue< T > &  other ) [protected]

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,
const T2 &  value2 
)

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:
valueThe 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 
)

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:
valueThe 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 
)

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:
valueThe value to use to construct the item to push to the queue.

Definition at line 351 of file queue.h.

void emplace ( const T1 &  value1 )

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:
valueThe value to use to construct the item to push to the queue.

Definition at line 306 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.

const_reference front (  ) const

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.

reference front (  )

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.

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.

size_type max_size (  ) const [inherited]

Returns the maximum number of items that can be queued.

Definition at line 122 of file queue.h.

iqueue& operator= ( const iqueue< T > &  rhs )

Assignment operator.

Definition at line 415 of file queue.h.

void pop (  )

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 ( reference  destination )

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 pop_into ( TContainer &  destination )

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 push ( parameter_t  value )

Adds a value to the queue.

If asserts or exceptions are enabled, throws an etl::queue_full if the queue if already full.

Parameters:
valueThe value to push to the queue.

Definition at line 272 of file queue.h.

reference push (  )

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.

size_type size (  ) const [inherited]

Returns the current number of items in the queue.

Definition at line 114 of file queue.h.


Field Documentation

const size_type CAPACITY [protected, inherited]

The maximum number of items in the queue.

Definition at line 197 of file queue.h.

etl::debug_count construct_count [protected, inherited]

For internal debugging purposes.

Definition at line 198 of file queue.h.

size_type current_size [protected, inherited]

The number of items in the queue.

Definition at line 196 of file queue.h.

size_type in [protected, inherited]

Where to input new data.

Definition at line 194 of file queue.h.

size_type out [protected, inherited]

Where to get the oldest data.

Definition at line 195 of file queue.h.