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 non-pointer types.
Definition at line 282 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 | |
FifoQueueBasic (size_type size=16) | |
Create an empty queue with capacity size. More... | |
FifoQueueBasic (const FifoQueueBasic< T > &q) | |
The copy constructor. More... | |
void | eraseAndClear (void) |
~FifoQueueBasic () | |
The destructor. More... | |
FifoQueueBasic< T > & | operator= (const FifoQueueBasic< T > &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 | push_front (const value_type &x) |
Insert x at the front of the queue (LIFO operation). 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 |
T * | m_list |
typedef size_t xsens::FifoQueueBasic< T >::size_type |
The type of a 'size' value.
Definition at line 316 of file xsens_fifoqueue.h.
typedef T xsens::FifoQueueBasic< T >::value_type |
The type of the value stored in this queue.
Definition at line 314 of file xsens_fifoqueue.h.
|
inline |
Create an empty queue with capacity size.
Definition at line 319 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, xsens::FifoQueueBasic< T >::m_maxCount, QUEUELOG, and xsens::FifoQueueBasic< T >::size().
|
inline |
The copy constructor.
Definition at line 334 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, xsens::FifoQueueBasic< T >::m_maxCount, and QUEUELOG.
|
inline |
The destructor.
Definition at line 359 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_list, xsens::FifoQueueBasic< T >::m_maxCount, and QUEUELOG.
|
inline |
Return the newest element in the queue.
Definition at line 417 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, and xsens::FifoQueueBasic< T >::m_maxCount.
|
inline |
Return the newest element in the queue.
Definition at line 423 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, and xsens::FifoQueueBasic< T >::m_maxCount.
|
inline |
Definition at line 497 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_maxCount, and QUEUELOG.
|
inline |
Return true if the queue is empty.
Definition at line 407 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount.
|
inline |
Definition at line 347 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, xsens::FifoQueueBasic< T >::m_maxCount, and QUEUELOG.
|
inline |
Return the oldest element in the queue.
Definition at line 413 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_first, and xsens::FifoQueueBasic< T >::m_list.
|
inline |
Return the oldest element in the queue.
Definition at line 415 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_first, and xsens::FifoQueueBasic< T >::m_list.
|
inline |
Return the number of elements currnetly in the queue.
Definition at line 411 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount.
|
inline |
The assignment operator.
Definition at line 369 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, xsens::FifoQueueBasic< T >::m_maxCount, and QUEUELOG.
|
inline |
Return the index'th oldest item from the queue.
Definition at line 489 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, and xsens::FifoQueueBasic< T >::m_maxCount.
|
inline |
Return the index'th oldest item from the queue.
Definition at line 480 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, and xsens::FifoQueueBasic< T >::m_maxCount.
|
inline |
Remove the element at the front of the queue.
Definition at line 458 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_maxCount, and QUEUELOG.
Referenced by xsens::FifoQueueBasic< T >::remove().
|
inline |
Remove the element at the back of the queue.
Definition at line 471 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_maxCount, and QUEUELOG.
|
inline |
Insert x at the back of the queue.
Definition at line 429 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, xsens::FifoQueueBasic< T >::m_maxCount, and QUEUELOG.
|
inline |
Insert x at the front of the queue (LIFO operation).
Definition at line 446 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, xsens::FifoQueueBasic< T >::m_maxCount, and QUEUELOG.
|
inline |
Definition at line 506 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, xsens::FifoQueueBasic< T >::m_maxCount, xsens::FifoQueueBasic< T >::pop(), and QUEUELOG.
|
inline |
Resize the queue, note that this function clears the queue.
Definition at line 391 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_currentCount, xsens::FifoQueueBasic< T >::m_first, xsens::FifoQueueBasic< T >::m_list, xsens::FifoQueueBasic< T >::m_maxCount, QUEUELOG, and xsens::FifoQueueBasic< T >::size().
|
inline |
Return the maximum number of elements in the queue.
Definition at line 409 of file xsens_fifoqueue.h.
References xsens::FifoQueueBasic< T >::m_maxCount.
Referenced by xsens::FifoQueueBasic< T >::FifoQueueBasic(), and xsens::FifoQueueBasic< T >::resize().
|
protected |
Definition at line 307 of file xsens_fifoqueue.h.
Referenced by xsens::FifoQueueBasic< T >::back(), xsens::FifoQueueBasic< T >::clear(), xsens::FifoQueueBasic< T >::empty(), xsens::FifoQueueBasic< T >::eraseAndClear(), xsens::FifoQueueBasic< T >::FifoQueueBasic(), xsens::FifoQueueBasic< T >::length(), xsens::FifoQueueBasic< T >::operator=(), xsens::FifoQueueBasic< T >::operator[](), xsens::FifoQueueBasic< T >::pop(), xsens::FifoQueueBasic< T >::popBack(), xsens::FifoQueueBasic< T >::push(), xsens::FifoQueueBasic< T >::push_front(), xsens::FifoQueueBasic< T >::remove(), xsens::FifoQueueBasic< T >::resize(), and xsens::FifoQueueBasic< T >::~FifoQueueBasic().
|
protected |
Definition at line 308 of file xsens_fifoqueue.h.
Referenced by xsens::FifoQueueBasic< T >::back(), xsens::FifoQueueBasic< T >::clear(), xsens::FifoQueueBasic< T >::eraseAndClear(), xsens::FifoQueueBasic< T >::FifoQueueBasic(), xsens::FifoQueueBasic< T >::front(), xsens::FifoQueueBasic< T >::operator=(), xsens::FifoQueueBasic< T >::operator[](), xsens::FifoQueueBasic< T >::pop(), xsens::FifoQueueBasic< T >::push(), xsens::FifoQueueBasic< T >::push_front(), xsens::FifoQueueBasic< T >::remove(), and xsens::FifoQueueBasic< T >::resize().
|
protected |
Definition at line 310 of file xsens_fifoqueue.h.
Referenced by xsens::FifoQueueBasic< T >::back(), xsens::FifoQueueBasic< T >::eraseAndClear(), xsens::FifoQueueBasic< T >::FifoQueueBasic(), xsens::FifoQueueBasic< T >::front(), xsens::FifoQueueBasic< T >::operator=(), xsens::FifoQueueBasic< T >::operator[](), xsens::FifoQueueBasic< T >::push(), xsens::FifoQueueBasic< T >::push_front(), xsens::FifoQueueBasic< T >::remove(), xsens::FifoQueueBasic< T >::resize(), and xsens::FifoQueueBasic< T >::~FifoQueueBasic().
|
protected |
Definition at line 306 of file xsens_fifoqueue.h.
Referenced by xsens::FifoQueueBasic< T >::back(), xsens::FifoQueueBasic< T >::clear(), xsens::FifoQueueBasic< T >::eraseAndClear(), xsens::FifoQueueBasic< T >::FifoQueueBasic(), xsens::FifoQueueBasic< T >::operator=(), xsens::FifoQueueBasic< T >::operator[](), xsens::FifoQueueBasic< T >::pop(), xsens::FifoQueueBasic< T >::popBack(), xsens::FifoQueueBasic< T >::push(), xsens::FifoQueueBasic< T >::push_front(), xsens::FifoQueueBasic< T >::remove(), xsens::FifoQueueBasic< T >::resize(), xsens::FifoQueueBasic< T >::size(), and xsens::FifoQueueBasic< T >::~FifoQueueBasic().
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST |