Embedded Template Library 1.0
Loading...
Searching...
No Matches
queue

Classes

class  etl::intrusive_queue_base< TLink >
 
class  etl::intrusive_queue< TValue, TLink >
 
class  etl::priority_queue_exception
 
class  etl::priority_queue_full
 
class  etl::priority_queue_iterator
 
class  etl::ipriority_queue< T, TContainer, TCompare >
 This is the base for all priority queues that contain a particular type. More...
 
class  etl::queue_exception
 
class  etl::queue_full
 
class  etl::queue_empty
 
class  etl::queue_base< MEMORY_MODEL >
 
class  etl::iqueue< T, MEMORY_MODEL >
 This is the base for all queues that contain a particular type. More...
 
class  etl::queue< T, SIZE, MEMORY_MODEL >
 

Detailed Description

A priority queue with the capacity defined at compile time, written in the STL style.

A First-in / first-out queue with the capacity defined at compile time, written in the STL style.


Class Documentation

◆ etl::intrusive_queue_base

class etl::intrusive_queue_base
template<typename TLink>
class etl::intrusive_queue_base< TLink >

Base for intrusive queue. Stores elements derived any ETL type that supports an 'etl_next' pointer member.

Template Parameters
TLinkThe link type that the value is derived from.

Public Types

typedef TLink link_type
 

Public Member Functions

void push (link_type &value)
 
void pop ()
 
template<typename TContainer >
void pop_into (TContainer &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 Member Functions

 intrusive_queue_base ()
 Constructor.
 
 ~intrusive_queue_base ()
 Destructor.
 

Protected Attributes

link_type * p_back
 Pointer to the current back of the queue.
 
link_type terminator
 This link terminates the queue and points to the front of the queue.
 
size_t current_size
 Counts the number of elements in the list.
 

Member Function Documentation

◆ pop()

template<typename TLink >
void etl::intrusive_queue_base< TLink >::pop ( )
inline

Removes the oldest item from the queue. Undefined behaviour if the queue is already empty.

◆ pop_into()

template<typename TLink >
template<typename TContainer >
void etl::intrusive_queue_base< TLink >::pop_into ( TContainer destination)
inline

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 intrusive container that supports a push(TLink) member function.

◆ push()

template<typename TLink >
void etl::intrusive_queue_base< TLink >::push ( link_type &  value)
inline

Adds a value to the queue.

Parameters
valueThe value to push to the queue.

◆ etl::intrusive_queue

class etl::intrusive_queue
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.

Public Types

typedef etl::intrusive_queue_base< TLinklink_type
 
typedef TValue value_type
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef size_t size_type
 
- Public Types inherited from etl::intrusive_queue_base< TLink >
typedef TLink link_type
 

Public Member Functions

 intrusive_queue ()
 Constructor.
 
reference front ()
 
reference back ()
 
const_reference front () const
 
const_reference back () const
 
- Public Member Functions inherited from etl::intrusive_queue_base< TLink >
void push (link_type &value)
 
void pop ()
 
template<typename TContainer >
void pop_into (TContainer &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.
 

Additional Inherited Members

- Protected Member Functions inherited from etl::intrusive_queue_base< TLink >
 intrusive_queue_base ()
 Constructor.
 
 ~intrusive_queue_base ()
 Destructor.
 
- Protected Attributes inherited from etl::intrusive_queue_base< TLink >
link_type * p_back
 Pointer to the current back of the queue.
 
link_type terminator
 This link terminates the queue and points to the front of the queue.
 
size_t current_size
 Counts the number of elements in the list.
 

Member Function Documentation

◆ back() [1/2]

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.

◆ back() [2/2]

template<typename TValue , typename TLink >
const_reference etl::intrusive_queue< TValue, TLink >::back ( ) const
inline

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.

◆ front() [1/2]

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.

◆ front() [2/2]

template<typename TValue , typename TLink >
const_reference etl::intrusive_queue< TValue, TLink >::front ( ) const
inline

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.

◆ etl::priority_queue_exception

class etl::priority_queue_exception

The base class for priority_queue exceptions.

Public Member Functions

 priority_queue_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
 
- Public Member Functions inherited from etl::exception
ETL_CONSTEXPR exception (string_type reason_, string_type, numeric_type line_)
 Constructor.
 
ETL_CONSTEXPR string_type what () const
 
ETL_CONSTEXPR string_type file_name () const
 
ETL_CONSTEXPR numeric_type line_number () const
 

Additional Inherited Members

- Public Types inherited from etl::exception
typedef const charstring_type
 
typedef int numeric_type
 

◆ etl::priority_queue_full

class etl::priority_queue_full

The exception thrown when the queue is full.

Public Member Functions

 priority_queue_full (string_type file_name_, numeric_type line_number_)
 
- Public Member Functions inherited from etl::priority_queue_exception
 priority_queue_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
 
- Public Member Functions inherited from etl::exception
ETL_CONSTEXPR exception (string_type reason_, string_type, numeric_type line_)
 Constructor.
 
ETL_CONSTEXPR string_type what () const
 
ETL_CONSTEXPR string_type file_name () const
 
ETL_CONSTEXPR numeric_type line_number () const
 

Additional Inherited Members

- Public Types inherited from etl::exception
typedef const charstring_type
 
typedef int numeric_type
 

◆ etl::priority_queue_iterator

class etl::priority_queue_iterator

The priority queue iterator exception on reversed iterators

Public Member Functions

 priority_queue_iterator (string_type file_name_, numeric_type line_number_)
 
- Public Member Functions inherited from etl::priority_queue_exception
 priority_queue_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
 
- Public Member Functions inherited from etl::exception
ETL_CONSTEXPR exception (string_type reason_, string_type, numeric_type line_)
 Constructor.
 
ETL_CONSTEXPR string_type what () const
 
ETL_CONSTEXPR string_type file_name () const
 
ETL_CONSTEXPR numeric_type line_number () const
 

Additional Inherited Members

- Public Types inherited from etl::exception
typedef const charstring_type
 
typedef int numeric_type
 

◆ etl::ipriority_queue

class etl::ipriority_queue
template<typename T, typename TContainer, typename TCompare = etl::less<T>>
class etl::ipriority_queue< T, TContainer, TCompare >

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

Normally a reference to this type will be taken from a derived queue. The TContainer specified must provide the front, push_back, pop_back, and assign methods to work correctly with priority_queue.

pair holds two objects of arbitrary type
Definition utility.h:164
Warning
This priority queue cannot be used for concurrent access from multiple threads.
Template Parameters
TThe type of value that the queue holds.
TContainerto hold the T queue values
TCompareto use in comparing T values

Public Types

typedef T value_type
 The type stored in the queue.
 
typedef TContainer container_type
 The container type used for priority queue.
 
typedef TCompare compare_type
 The comparison type.
 
typedef Treference
 A reference to the type used in the queue.
 
typedef const Tconst_reference
 A const reference to the type used in the queue.
 
typedef TContainer::size_type size_type
 The type used for determining the size of the queue.
 
typedef etl::iterator_traits< typenameTContainer::iterator >::difference_type difference_type
 

Public Member Functions

reference top ()
 
const_reference top () const
 
void push (const_reference value)
 
void emplace ()
 
template<typename T1 >
void emplace (const T1 &value1)
 
template<typename T1 , typename T2 >
void emplace (const T1 &value1, const T2 &value2)
 
template<typename T1 , typename T2 , typename T3 >
void emplace (const T1 &value1, const T2 &value2, const T3 &value3)
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
void emplace (const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
 
template<typename TIterator >
void assign (TIterator first, TIterator last)
 
void pop ()
 
void pop_into (reference destination)
 
size_type size () const
 Returns the current number of items in the priority queue.
 
size_type max_size () const
 Returns the maximum number of items that can be queued.
 
bool empty () const
 
bool full () const
 
size_type available () const
 
void clear ()
 Clears the queue to the empty state.
 
ipriority_queueoperator= (const ipriority_queue &rhs)
 Assignment operator.
 

Protected Member Functions

void clone (const ipriority_queue &other)
 Make this a clone of the supplied priority queue.
 
 ipriority_queue ()
 The constructor that is called from derived classes.
 

Member Function Documentation

◆ assign()

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
template<typename TIterator >
void etl::ipriority_queue< T, TContainer, TCompare >::assign ( TIterator  first,
TIterator  last 
)
inline

Assigns values to the priority queue. If asserts or exceptions are enabled, emits priority_queue_full if priority queue does not have enough free space. If asserts or exceptions are enabled, emits priority_iterator if the iterators are reversed.

Parameters
firstThe iterator to the first element.
lastThe iterator to the last element + 1.

◆ available()

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
size_type etl::ipriority_queue< T, TContainer, TCompare >::available ( ) const
inline

Returns the remaining capacity.

Returns
The remaining capacity.

◆ emplace() [1/5]

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
void etl::ipriority_queue< T, TContainer, TCompare >::emplace ( )
inline

Emplaces a value to the queue. If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters
valueThe value to push to the queue.

◆ emplace() [2/5]

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
template<typename T1 >
void etl::ipriority_queue< T, TContainer, TCompare >::emplace ( const T1 value1)
inline

Emplaces a value to the queue. If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters
valueThe value to push to the queue.

◆ emplace() [3/5]

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
template<typename T1 , typename T2 >
void etl::ipriority_queue< T, TContainer, TCompare >::emplace ( const T1 value1,
const T2 value2 
)
inline

Emplaces a value to the queue. If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters
valueThe value to push to the queue.

◆ emplace() [4/5]

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
template<typename T1 , typename T2 , typename T3 >
void etl::ipriority_queue< T, TContainer, TCompare >::emplace ( const T1 value1,
const T2 value2,
const T3 value3 
)
inline

Emplaces a value to the queue. If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters
valueThe value to push to the queue.

◆ emplace() [5/5]

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
void etl::ipriority_queue< T, TContainer, TCompare >::emplace ( const T1 value1,
const T2 value2,
const T3 value3,
const T4 value4 
)
inline

Emplaces a value to the queue. If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters
valueThe value to push to the queue.

◆ empty()

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
bool etl::ipriority_queue< T, TContainer, TCompare >::empty ( ) const
inline

Checks to see if the priority queue is empty.

Returns
true if the queue is empty, otherwise false

◆ full()

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
bool etl::ipriority_queue< T, TContainer, TCompare >::full ( ) const
inline

Checks to see if the priority queue is full.

Returns
true if the priority queue is full, otherwise false

◆ pop()

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
void etl::ipriority_queue< T, TContainer, TCompare >::pop ( )
inline

Removes the oldest value from the back of the priority queue. Does nothing if the priority queue is already empty.

◆ pop_into()

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
void etl::ipriority_queue< T, TContainer, TCompare >::pop_into ( reference  destination)
inline

Gets the highest priority value in the priority queue and assigns it to destination and removes it from the queue.

◆ push()

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
void etl::ipriority_queue< T, TContainer, TCompare >::push ( const_reference  value)
inline

Adds a value to the queue. If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters
valueThe value to push to the queue.

◆ top() [1/2]

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
reference etl::ipriority_queue< T, TContainer, TCompare >::top ( )
inline

Gets a reference to the highest priority value in the priority queue.

Returns
A reference to the highest priority value in the priority queue.

◆ top() [2/2]

template<typename T , typename TContainer , typename TCompare = etl::less<T>>
const_reference etl::ipriority_queue< T, TContainer, TCompare >::top ( ) const
inline

Gets a const reference to the highest priority value in the priority queue.

Returns
A const reference to the highest priority value in the priority queue.

◆ etl::queue_exception

class etl::queue_exception

The base class for queue exceptions.

Public Member Functions

 queue_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
 
- Public Member Functions inherited from etl::exception
ETL_CONSTEXPR exception (string_type reason_, string_type, numeric_type line_)
 Constructor.
 
ETL_CONSTEXPR string_type what () const
 
ETL_CONSTEXPR string_type file_name () const
 
ETL_CONSTEXPR numeric_type line_number () const
 

Additional Inherited Members

- Public Types inherited from etl::exception
typedef const charstring_type
 
typedef int numeric_type
 

◆ etl::queue_full

class etl::queue_full

The exception thrown when the queue is full.

Public Member Functions

 queue_full (string_type file_name_, numeric_type line_number_)
 
- Public Member Functions inherited from etl::queue_exception
 queue_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
 
- Public Member Functions inherited from etl::exception
ETL_CONSTEXPR exception (string_type reason_, string_type, numeric_type line_)
 Constructor.
 
ETL_CONSTEXPR string_type what () const
 
ETL_CONSTEXPR string_type file_name () const
 
ETL_CONSTEXPR numeric_type line_number () const
 

Additional Inherited Members

- Public Types inherited from etl::exception
typedef const charstring_type
 
typedef int numeric_type
 

◆ etl::queue_empty

class etl::queue_empty

The exception thrown when the queue is empty.

Public Member Functions

 queue_empty (string_type file_name_, numeric_type line_number_)
 
- Public Member Functions inherited from etl::queue_exception
 queue_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
 
- Public Member Functions inherited from etl::exception
ETL_CONSTEXPR exception (string_type reason_, string_type, numeric_type line_)
 Constructor.
 
ETL_CONSTEXPR string_type what () const
 
ETL_CONSTEXPR string_type file_name () const
 
ETL_CONSTEXPR numeric_type line_number () const
 

Additional Inherited Members

- Public Types inherited from etl::exception
typedef const charstring_type
 
typedef int numeric_type
 

◆ etl::queue_base

class etl::queue_base
template<size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
class etl::queue_base< MEMORY_MODEL >

The base class for all queues.

Public Types

typedef etl::size_type_lookup< MEMORY_MODEL >::type size_type
 The type used for determining the size of queue.
 

Public Member Functions

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.
 
size_type capacity () const
 Returns the maximum number of items that can be queued.
 
bool empty () const
 
bool full () const
 
size_type available () const
 

Protected Member Functions

 queue_base (size_type max_size_)
 The constructor that is called from derived classes.
 
 ~queue_base ()
 Destructor.
 
void add_in ()
 Increments (and wraps) the 'in' index value to record a queue addition.
 
void del_out ()
 Increments (and wraps) the 'out' index value to record a queue deletion.
 
void index_clear ()
 Clears the indexes.
 

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_DECLARE_DEBUG_COUNT
 For internal debugging purposes.
 

Member Function Documentation

◆ available()

template<size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
size_type etl::queue_base< MEMORY_MODEL >::available ( ) const
inline

Returns the remaining capacity.

Returns
The remaining capacity.

◆ empty()

template<size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
bool etl::queue_base< MEMORY_MODEL >::empty ( ) const
inline

Checks to see if the queue is empty.

Returns
true if the queue is empty, otherwise false

◆ full()

template<size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
bool etl::queue_base< MEMORY_MODEL >::full ( ) const
inline

Checks to see if the queue is full.

Returns
true if the queue is full, otherwise false

◆ etl::iqueue

class etl::iqueue
template<typename T, const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
class etl::iqueue< T, MEMORY_MODEL >

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.

Warning
This queue cannot be used for concurrent access from multiple threads.
Template Parameters
TThe type of value that the queue holds.

Public Types

typedef T value_type
 The type stored in the queue.
 
typedef Treference
 A reference to the type used in the queue.
 
typedef const Tconst_reference
 A const reference to the type used in the queue.
 
typedef Tpointer
 A pointer to the type used in the queue.
 
typedef const Tconst_pointer
 A const pointer to the type used in the queue.
 
typedef base_t::size_type size_type
 The type used for determining the size of the queue.
 
- Public Types inherited from etl::queue_base< MEMORY_MODEL >
typedef etl::size_type_lookup< MEMORY_MODEL >::type size_type
 The type used for determining the size of queue.
 

Public Member Functions

reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
void push (const_reference value)
 
reference emplace ()
 
template<typename T1 >
reference emplace (const T1 &value1)
 
template<typename T1 , typename T2 >
reference emplace (const T1 &value1, const T2 &value2)
 
template<typename T1 , typename T2 , typename T3 >
reference emplace (const T1 &value1, const T2 &value2, const T3 &value3)
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
reference emplace (const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
 
void clear ()
 Clears the queue to the empty state.
 
void pop ()
 
void pop_into (reference destination)
 
template<typename TContainer >
void pop_into (TContainer &destination)
 
iqueueoperator= (const iqueue &rhs)
 Assignment operator.
 
- Public Member Functions inherited from etl::queue_base< MEMORY_MODEL >
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.
 
size_type capacity () const
 Returns the maximum number of items that can be queued.
 
bool empty () const
 
bool full () const
 
size_type available () const
 

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.
 
 ~iqueue ()
 Destructor.
 
- Protected Member Functions inherited from etl::queue_base< MEMORY_MODEL >
 queue_base (size_type max_size_)
 The constructor that is called from derived classes.
 
 ~queue_base ()
 Destructor.
 
void add_in ()
 Increments (and wraps) the 'in' index value to record a queue addition.
 
void del_out ()
 Increments (and wraps) the 'out' index value to record a queue deletion.
 
void index_clear ()
 Clears the indexes.
 

Additional Inherited Members

- Protected Attributes inherited from etl::queue_base< MEMORY_MODEL >
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_DECLARE_DEBUG_COUNT
 For internal debugging purposes.
 

Member Function Documentation

◆ back() [1/2]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
reference etl::iqueue< T, MEMORY_MODEL >::back ( )
inline

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

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

◆ back() [2/2]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
const_reference etl::iqueue< T, MEMORY_MODEL >::back ( ) const
inline

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.

◆ emplace() [1/5]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
reference etl::iqueue< T, MEMORY_MODEL >::emplace ( )
inline

Constructs a default constructed value in the queue 'in place'. If asserts or exceptions are enabled, throws an etl::queue_full if the queue if already full.

◆ emplace() [2/5]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
template<typename T1 >
reference etl::iqueue< T, MEMORY_MODEL >::emplace ( const T1 value1)
inline

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
value1The argument to use to construct the item to push to the queue.

◆ emplace() [3/5]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
template<typename T1 , typename T2 >
reference etl::iqueue< T, MEMORY_MODEL >::emplace ( const T1 value1,
const T2 value2 
)
inline

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
value1The first argument to use to construct the item to push to the queue.
value2The second argument to use to construct the item to push to the queue.

◆ emplace() [4/5]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
template<typename T1 , typename T2 , typename T3 >
reference etl::iqueue< T, MEMORY_MODEL >::emplace ( const T1 value1,
const T2 value2,
const T3 value3 
)
inline

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
value1The first argument to use to construct the item to push to the queue.
value2The second argument to use to construct the item to push to the queue.
value3The third argument to use to construct the item to push to the queue.

◆ emplace() [5/5]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
reference etl::iqueue< T, MEMORY_MODEL >::emplace ( const T1 value1,
const T2 value2,
const T3 value3,
const T4 value4 
)
inline

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
value1The first argument to use to construct the item to push to the queue.
value2The second argument to use to construct the item to push to the queue.
value3The third argument to use to construct the item to push to the queue.
value4The fourth argument to use to construct the item to push to the queue.

◆ front() [1/2]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
reference etl::iqueue< T, MEMORY_MODEL >::front ( )
inline

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

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

◆ front() [2/2]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
const_reference etl::iqueue< T, MEMORY_MODEL >::front ( ) const
inline

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.

◆ pop()

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
void etl::iqueue< T, MEMORY_MODEL >::pop ( )
inline

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.

◆ pop_into() [1/2]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
void etl::iqueue< T, MEMORY_MODEL >::pop_into ( reference  destination)
inline

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.

◆ pop_into() [2/2]

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
template<typename TContainer >
void etl::iqueue< T, MEMORY_MODEL >::pop_into ( TContainer destination)
inline

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.

◆ push()

template<typename T , const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
void etl::iqueue< T, MEMORY_MODEL >::push ( const_reference  value)
inline

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.

◆ etl::queue

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

A fixed capacity queue. This queue does not support concurrent access by different threads.

Template Parameters
TThe type this queue should support.
SIZEThe maximum capacity of the queue.
MEMORY_MODELThe memory model for the queue. Determines the type of the internal counter variables.

Public Types

typedef base_t::size_type size_type
 
typedef etl::aligned_storage< sizeof(T), etl::alignment_of< T >::value >::type container_type
 
- Public Types inherited from etl::iqueue< T, MEMORY_MODEL >
typedef T value_type
 The type stored in the queue.
 
typedef Treference
 A reference to the type used in the queue.
 
typedef const Tconst_reference
 A const reference to the type used in the queue.
 
typedef Tpointer
 A pointer to the type used in the queue.
 
typedef const Tconst_pointer
 A const pointer to the type used in the queue.
 
typedef base_t::size_type size_type
 The type used for determining the size of the queue.
 
- Public Types inherited from etl::queue_base< MEMORY_MODEL >
typedef etl::size_type_lookup< MEMORY_MODEL >::type size_type
 The type used for determining the size of queue.
 

Public Member Functions

 ETL_STATIC_ASSERT ((SIZE<=etl::integral_limits< size_type >::max), "Size too large for memory model")
 
 queue ()
 Default constructor.
 
 queue (const queue &rhs)
 Copy constructor.
 
 ~queue ()
 Destructor.
 
queueoperator= (const queue &rhs)
 Assignment operator.
 
- Public Member Functions inherited from etl::iqueue< T, MEMORY_MODEL >
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
void push (const_reference value)
 
reference emplace ()
 
template<typename T1 >
reference emplace (const T1 &value1)
 
template<typename T1 , typename T2 >
reference emplace (const T1 &value1, const T2 &value2)
 
template<typename T1 , typename T2 , typename T3 >
reference emplace (const T1 &value1, const T2 &value2, const T3 &value3)
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
reference emplace (const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
 
void clear ()
 Clears the queue to the empty state.
 
void pop ()
 
void pop_into (reference destination)
 
template<typename TContainer >
void pop_into (TContainer &destination)
 
iqueueoperator= (const iqueue &rhs)
 Assignment operator.
 
- Public Member Functions inherited from etl::queue_base< MEMORY_MODEL >
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.
 
size_type capacity () const
 Returns the maximum number of items that can be queued.
 
bool empty () const
 
bool full () const
 
size_type available () const
 

Static Public Attributes

static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE)
 

Additional Inherited Members

- Protected Member Functions inherited from etl::iqueue< T, MEMORY_MODEL >
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.
 
 ~iqueue ()
 Destructor.
 
- Protected Member Functions inherited from etl::queue_base< MEMORY_MODEL >
 queue_base (size_type max_size_)
 The constructor that is called from derived classes.
 
 ~queue_base ()
 Destructor.
 
void add_in ()
 Increments (and wraps) the 'in' index value to record a queue addition.
 
void del_out ()
 Increments (and wraps) the 'out' index value to record a queue deletion.
 
void index_clear ()
 Clears the indexes.
 
- Protected Attributes inherited from etl::queue_base< MEMORY_MODEL >
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_DECLARE_DEBUG_COUNT
 For internal debugging purposes.