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 31 of file xsens_fifoqueue.h.
#include <xSens_MT3/xsens_fifoqueue.h>
Public Types | |
typedef T | value_type |
The type of the value stored in this queue. More... | |
typedef size_t | size_type |
The type of a 'size' value. More... | |
Public Member Functions | |
FifoQueue (size_type size=16, bool delOnOverwrite=true) | |
Create an empty queue with capacity size. More... | |
template<bool E2> | |
FifoQueue (const FifoQueue< T, E2 > &q) | |
The copy constructor. More... | |
void | eraseAndClear (void) |
~FifoQueue () | |
The destructor. More... | |
template<bool E2> | |
FifoQueue< T, E > & | operator= (const FifoQueue< T, E2 > &q) |
The assignment operator. More... | |
void | resize (const size_t size) |
Resize the queue, note that this function clears the queue. More... | |
bool | empty () const |
Return true if the queue is empty. More... | |
size_type | size () const |
Return the maximum number of elements in the queue. More... | |
size_type | length () const |
Return the number of elements currnetly in the queue. More... | |
value_type & | front () |
Return the oldest element in the queue. More... | |
const value_type & | front () const |
Return the oldest element in the queue. More... | |
value_type & | back () |
Return the newest element in the queue. More... | |
const value_type & | back () const |
Return the newest element in the queue. More... | |
void | push (const value_type &x) |
Insert x at the back of the queue. More... | |
void | pop (void) |
Remove the element at the front of the queue. More... | |
void | popBack (void) |
Remove the element at the back of the queue. More... | |
const value_type & | operator[] (size_t index) const |
Return the index'th oldest item from the queue. More... | |
value_type & | operator[] (size_t index) |
Return the index'th oldest item from the queue. More... | |
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 |
typedef size_t xsens::FifoQueue< T, E >::size_type |
The type of a 'size' value.
Definition at line 62 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 61 of file xsens_fifoqueue.h.
|
inline |
Create an empty queue with capacity size.
Definition at line 65 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_deleteOnOverwrite, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, xsens::FifoQueue< T, E >::m_maxCount, QUEUELOG, and xsens::FifoQueue< T, E >::size().
|
inline |
The copy constructor.
Definition at line 81 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_deleteOnOverwrite, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, xsens::FifoQueue< T, E >::m_maxCount, and QUEUELOG.
|
inline |
The destructor.
Definition at line 103 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::eraseAndClear(), xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_list, xsens::FifoQueue< T, E >::m_maxCount, and QUEUELOG.
|
inline |
Return the newest element in the queue.
Definition at line 178 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, and xsens::FifoQueue< T, E >::m_maxCount.
|
inline |
Return the newest element in the queue.
Definition at line 184 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, and xsens::FifoQueue< T, E >::m_maxCount.
|
inline |
Definition at line 240 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_maxCount, and QUEUELOG.
|
inline |
Return true if the queue is empty.
Definition at line 148 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount.
|
inline |
Definition at line 93 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, xsens::FifoQueue< T, E >::m_maxCount, and QUEUELOG.
Referenced by xsens::FifoQueue< T, E >::resize(), and xsens::FifoQueue< T, E >::~FifoQueue().
|
inline |
Return the oldest element in the queue.
Definition at line 166 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_first, and xsens::FifoQueue< T, E >::m_list.
|
inline |
Return the oldest element in the queue.
Definition at line 172 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_first, and xsens::FifoQueue< T, E >::m_list.
|
inline |
Return the number of elements currnetly in the queue.
Definition at line 160 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount.
|
inline |
The assignment operator.
Definition at line 114 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, xsens::FifoQueue< T, E >::m_maxCount, and QUEUELOG.
|
inline |
Return the index'th oldest item from the queue.
Definition at line 223 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, and xsens::FifoQueue< T, E >::m_maxCount.
|
inline |
Return the index'th oldest item from the queue.
Definition at line 232 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, and xsens::FifoQueue< T, E >::m_maxCount.
|
inline |
Remove the element at the front of the queue.
Definition at line 208 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_maxCount, and QUEUELOG.
Referenced by xsens::FifoQueue< T, E >::remove().
|
inline |
Remove the element at the back of the queue.
Definition at line 216 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_maxCount, and QUEUELOG.
|
inline |
Insert x at the back of the queue.
Definition at line 190 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_deleteOnOverwrite, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, xsens::FifoQueue< T, E >::m_maxCount, and QUEUELOG.
|
inline |
Definition at line 247 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, xsens::FifoQueue< T, E >::m_maxCount, xsens::FifoQueue< T, E >::pop(), and QUEUELOG.
|
inline |
Resize the queue, note that this function clears the queue.
Definition at line 132 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::eraseAndClear(), xsens::FifoQueue< T, E >::m_currentCount, xsens::FifoQueue< T, E >::m_first, xsens::FifoQueue< T, E >::m_list, xsens::FifoQueue< T, E >::m_maxCount, QUEUELOG, and xsens::FifoQueue< T, E >::size().
|
inline |
Return the maximum number of elements in the queue.
Definition at line 154 of file xsens_fifoqueue.h.
References xsens::FifoQueue< T, E >::m_maxCount.
Referenced by xsens::FifoQueue< T, E >::FifoQueue(), and xsens::FifoQueue< T, E >::resize().
|
protected |
Definition at line 55 of file xsens_fifoqueue.h.
Referenced by xsens::FifoQueue< T, E >::back(), xsens::FifoQueue< T, E >::clear(), xsens::FifoQueue< T, E >::empty(), xsens::FifoQueue< T, E >::eraseAndClear(), xsens::FifoQueue< T, E >::FifoQueue(), xsens::FifoQueue< T, E >::length(), xsens::FifoQueue< T, E >::operator=(), xsens::FifoQueue< T, E >::operator[](), xsens::FifoQueue< T, E >::pop(), xsens::FifoQueue< T, E >::popBack(), xsens::FifoQueue< T, E >::push(), xsens::FifoQueue< T, E >::remove(), xsens::FifoQueue< T, E >::resize(), and xsens::FifoQueue< T, E >::~FifoQueue().
|
protected |
Definition at line 57 of file xsens_fifoqueue.h.
Referenced by xsens::FifoQueue< T, E >::FifoQueue(), and xsens::FifoQueue< T, E >::push().
|
protected |
Definition at line 56 of file xsens_fifoqueue.h.
Referenced by xsens::FifoQueue< T, E >::back(), xsens::FifoQueue< T, E >::clear(), xsens::FifoQueue< T, E >::eraseAndClear(), xsens::FifoQueue< T, E >::FifoQueue(), xsens::FifoQueue< T, E >::front(), xsens::FifoQueue< T, E >::operator=(), xsens::FifoQueue< T, E >::operator[](), xsens::FifoQueue< T, E >::pop(), xsens::FifoQueue< T, E >::push(), xsens::FifoQueue< T, E >::remove(), and xsens::FifoQueue< T, E >::resize().
|
protected |
Definition at line 59 of file xsens_fifoqueue.h.
Referenced by xsens::FifoQueue< T, E >::back(), xsens::FifoQueue< T, E >::eraseAndClear(), xsens::FifoQueue< T, E >::FifoQueue(), xsens::FifoQueue< T, E >::front(), xsens::FifoQueue< T, E >::operator=(), xsens::FifoQueue< T, E >::operator[](), xsens::FifoQueue< T, E >::push(), xsens::FifoQueue< T, E >::remove(), xsens::FifoQueue< T, E >::resize(), and xsens::FifoQueue< T, E >::~FifoQueue().
|
protected |
Definition at line 54 of file xsens_fifoqueue.h.
Referenced by xsens::FifoQueue< T, E >::back(), xsens::FifoQueue< T, E >::clear(), xsens::FifoQueue< T, E >::eraseAndClear(), xsens::FifoQueue< T, E >::FifoQueue(), xsens::FifoQueue< T, E >::operator=(), xsens::FifoQueue< T, E >::operator[](), xsens::FifoQueue< T, E >::pop(), xsens::FifoQueue< T, E >::popBack(), xsens::FifoQueue< T, E >::push(), xsens::FifoQueue< T, E >::remove(), xsens::FifoQueue< T, E >::resize(), xsens::FifoQueue< T, E >::size(), and xsens::FifoQueue< T, E >::~FifoQueue().
Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019 |