Dequeue, Queue able to pop/push elements either from front or back.
More...
#include <Imt.Base.Core.Util/Dequeue.h>
template<typename T>
class imt::base::core::util::Dequeue< T >
Dequeue, Queue able to pop/push elements either from front or back.
- Parameters
-
T | The type of the elements in the queue. The type T must define the = operator! E.g., If a uint8_t array should be used, then put this array into a struct, to implicitly define the = operator. |
- Note
- Check that the used compile does not reorder the operations in the memory. Otherwise this will fail.
◆ Dequeue()
Constructor.
- Parameters
-
mem | The memory to use for the queue. |
queueSize | Size of memory assigned to queue. |
- Note
- The queue can only contain up to size-1 elements (full will return true when size returns size-1). This is due to fact, that is not possible to decide if the queue is empty or full in case of head == tail.
◆ ~Dequeue()
◆ back() [1/2]
Returns the back element of the queue.
- Parameters
-
Reference | to the back element of the queue. |
- Note
- Calling this function on an empty container causes undefined behavior. There is no check if the value is valid. To check this use empty.
◆ back() [2/2]
Returns the back element of the queue.
- Parameters
-
Reference | to the back element of the queue. |
- Note
- Calling this function on an empty container causes undefined behavior. There is no check if the value is valid. To check this use empty.
◆ empty()
Returns if the queue is empty.
- Returns
- True if the queue is empty and false otherwise.
◆ front() [1/2]
Returns the front element of the queue.
- Returns
- Reference to the front element of the queue.
- Note
- Calling this function on an empty container causes undefined behavior. There is no check if the value is valid. To check this use empty.
◆ front() [2/2]
Returns the front element of the queue.
- Returns
- Reference to the front element of the queue.
- Note
- Calling this function on an empty container causes undefined behavior. There is no check if the value is valid. To check this use empty.
◆ full()
Returns if the queue is full.
- Returns
- True if the queue is full and false otherwise.
◆ pop_back()
Removes the last element of the queue.
In case of an empty queue nothing happens (element is not removed).
◆ pop_front()
Removes the front element of the queue.
In case of an empty queue nothing happens (element is not removed).
◆ push_back()
Adds a new element to the back of the queue.
In case of a full queue nothing happens (element is not added).
- Parameters
-
e | The new element to copy to the queue. |
◆ push_front()
Adds a new element to the front of the queue.
In case of a full queue nothing happens (element is not added).
- Parameters
-
e | The new element to copy to the queue. |
◆ size()
Returns the current number of elements in the queue.
- Returns
- Number of elements in the queue.
The documentation for this class was generated from the following file:
- D:/_Work/10/s/Imt.Base/Imt.Base.Core.Util/Dequeue.h