Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
iqueue< T > Class Template Reference
[queue]
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. | |
iqueue & | operator= (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:
-
T The type of value that the queue holds.
Definition at line 213 of file queue.h.
Member Typedef Documentation
typedef const T* const_pointer |
typedef const T& const_reference |
typedef T& reference |
typedef queue_base::size_type size_type |
The type used for determining the size of the queue.
Reimplemented from queue_base.
typedef T value_type |
Constructor & Destructor Documentation
Member Function Documentation
void add_in | ( | ) | [protected, inherited] |
size_t available | ( | ) | const [inherited] |
reference back | ( | ) |
const_reference back | ( | ) | const |
void clone | ( | const iqueue< T > & | other ) | [protected] |
void del_out | ( | ) | [protected, inherited] |
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:
-
value The value to use to construct the item to push to the queue.
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:
-
value The value to use to construct the item to push to the queue.
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:
-
value The value to use to construct the item to push to the queue.
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:
-
value The value to use to construct the item to push to the queue.
bool empty | ( | ) | const [inherited] |
const_reference front | ( | ) | const |
reference front | ( | ) |
bool full | ( | ) | const [inherited] |
size_type max_size | ( | ) | const [inherited] |
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.
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.
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.
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:
-
value The value to push to the queue.
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.
size_type size | ( | ) | const [inherited] |
Field Documentation
etl::debug_count construct_count [protected, inherited] |
size_type current_size [protected, inherited] |
Generated on Tue Jul 12 2022 14:05:53 by
