A FIFO queue with limited length (cyclic). More...
#include <Robots/SeaBeeIII/IMUDataServer/xsens_fifoqueue.h>
Public Types | |
typedef T | value_type |
The type of the value stored in this queue. | |
typedef size_t | size_type |
The type of a 'size' value. | |
Public Member Functions | |
FifoQueue (size_type size=16, bool delOnOverwrite=true) | |
Create an empty queue with capacity size. | |
template<bool E2> | |
FifoQueue (const FifoQueue< T, E2 > &q) | |
The copy constructor. | |
void | eraseAndClear (void) |
~FifoQueue () | |
The destructor. | |
template<bool E2> | |
FifoQueue< T, E > & | operator= (const FifoQueue< T, E2 > &q) |
The assignment operator. | |
void | resize (const size_t size) |
Resize the queue, note that this function clears the queue. | |
bool | empty () const |
Return true if the queue is empty. | |
size_type | size () const |
Return the maximum number of elements in the queue. | |
size_type | length () const |
Return the number of elements currnetly in the queue. | |
value_type & | front () |
Return the oldest element in the queue. | |
const value_type & | front () const |
Return the oldest element in the queue. | |
value_type & | back () |
Return the newest element in the queue. | |
const value_type & | back () const |
Return the newest element in the queue. | |
void | push (const value_type &x) |
Insert x at the back of the queue. | |
void | pop (void) |
Remove the element at the front of the queue. | |
void | popBack (void) |
Remove the element at the back of the queue. | |
const value_type & | operator[] (size_t index) const |
Return the index'th oldest item from the queue. | |
value_type & | operator[] (size_t index) |
Return the index'th oldest item from the queue. | |
void | clear (void) |
void | remove (size_t index) |
Protected Attributes | |
size_t | m_maxCount |
size_t | m_currentCount |
size_t | m_first |
bool | m_deleteOnOverwrite |
T * | m_list |
A FIFO queue with limited length (cyclic).
The class is based on the STL queue class, but has a limited size. If more items are inserted than would fit, the oldest item is overwritten. The class can only handle pointer types.
Definition at line 41 of file xsens_fifoqueue.h.
typedef size_t xsens::FifoQueue< T, E >::size_type |
The type of a 'size' value.
Definition at line 51 of file xsens_fifoqueue.h.
typedef T xsens::FifoQueue< T, E >::value_type |
The type of the value stored in this queue.
Definition at line 50 of file xsens_fifoqueue.h.
xsens::FifoQueue< T, E >::FifoQueue | ( | size_type | size = 16 , |
|
bool | delOnOverwrite = true | |||
) | [inline] |
Create an empty queue with capacity size.
Definition at line 54 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::size().
xsens::FifoQueue< T, E >::FifoQueue | ( | const FifoQueue< T, E2 > & | q | ) | [inline] |
The copy constructor.
Definition at line 68 of file xsens_fifoqueue.h.
xsens::FifoQueue< T, E >::~FifoQueue | ( | ) | [inline] |
The destructor.
Definition at line 88 of file xsens_fifoqueue.h.
const value_type& xsens::FifoQueue< T, E >::back | ( | ) | const [inline] |
Return the newest element in the queue.
Definition at line 166 of file xsens_fifoqueue.h.
value_type& xsens::FifoQueue< T, E >::back | ( | ) | [inline] |
Return the newest element in the queue.
Definition at line 160 of file xsens_fifoqueue.h.
bool xsens::FifoQueue< T, E >::empty | ( | ) | const [inline] |
Return true if the queue is empty.
Definition at line 130 of file xsens_fifoqueue.h.
const value_type& xsens::FifoQueue< T, E >::front | ( | ) | const [inline] |
Return the oldest element in the queue.
Definition at line 154 of file xsens_fifoqueue.h.
value_type& xsens::FifoQueue< T, E >::front | ( | ) | [inline] |
Return the oldest element in the queue.
Definition at line 148 of file xsens_fifoqueue.h.
size_type xsens::FifoQueue< T, E >::length | ( | ) | const [inline] |
Return the number of elements currnetly in the queue.
Definition at line 142 of file xsens_fifoqueue.h.
FifoQueue<T,E>& xsens::FifoQueue< T, E >::operator= | ( | const FifoQueue< T, E2 > & | q | ) | [inline] |
The assignment operator.
Definition at line 98 of file xsens_fifoqueue.h.
value_type& xsens::FifoQueue< T, E >::operator[] | ( | size_t | index | ) | [inline] |
Return the index'th oldest item from the queue.
Definition at line 211 of file xsens_fifoqueue.h.
const value_type& xsens::FifoQueue< T, E >::operator[] | ( | size_t | index | ) | const [inline] |
Return the index'th oldest item from the queue.
Definition at line 202 of file xsens_fifoqueue.h.
void xsens::FifoQueue< T, E >::pop | ( | void | ) | [inline] |
Remove the element at the front of the queue.
Definition at line 189 of file xsens_fifoqueue.h.
void xsens::FifoQueue< T, E >::popBack | ( | void | ) | [inline] |
Remove the element at the back of the queue.
Definition at line 196 of file xsens_fifoqueue.h.
void xsens::FifoQueue< T, E >::push | ( | const value_type & | x | ) | [inline] |
Insert x at the back of the queue.
Definition at line 172 of file xsens_fifoqueue.h.
void xsens::FifoQueue< T, E >::resize | ( | const size_t | size | ) | [inline] |
Resize the queue, note that this function clears the queue.
Definition at line 115 of file xsens_fifoqueue.h.
size_type xsens::FifoQueue< T, E >::size | ( | ) | const [inline] |
Return the maximum number of elements in the queue.
Definition at line 136 of file xsens_fifoqueue.h.
Referenced by xsens::FifoQueue< T, E >::FifoQueue().