xsens_imu
Public Types | Public Member Functions | Protected Attributes | List of all members
xsens::FifoQueueBasic< T > Class Template Reference

A FIFO queue with limited length (cyclic). More...

#include <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 currently in the queue. More...
 
value_typefront ()
 Return the oldest element in the queue. More...
 
const value_typefront () const
 Return the oldest element in the queue. More...
 
value_typeback ()
 Return the newest element in the queue. More...
 
const value_typeback () 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_typeoperator[] (size_t index) const
 Return the index'th oldest item from the queue. More...
 
value_typeoperator[] (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
 

Detailed Description

template<class T>
class xsens::FifoQueueBasic< T >

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.

Member Typedef Documentation

◆ size_type

template<class T>
typedef size_t xsens::FifoQueueBasic< T >::size_type

The type of a 'size' value.

◆ value_type

template<class T>
typedef T xsens::FifoQueueBasic< T >::value_type

The type of the value stored in this queue.

Constructor & Destructor Documentation

◆ FifoQueueBasic() [1/2]

template<class T>
xsens::FifoQueueBasic< T >::FifoQueueBasic ( size_type  size = 16)
inline

Create an empty queue with capacity 'size'.

◆ FifoQueueBasic() [2/2]

template<class T>
xsens::FifoQueueBasic< T >::FifoQueueBasic ( const FifoQueueBasic< T > &  q)
inline

The copy constructor.

◆ ~FifoQueueBasic()

template<class T>
xsens::FifoQueueBasic< T >::~FifoQueueBasic ( )
inline

The destructor.

Member Function Documentation

◆ back() [1/2]

template<class T>
value_type& xsens::FifoQueueBasic< T >::back ( )
inline

Return the newest element in the queue.

◆ back() [2/2]

template<class T>
const value_type& xsens::FifoQueueBasic< T >::back ( ) const
inline

Return the newest element in the queue.

◆ clear()

template<class T>
void xsens::FifoQueueBasic< T >::clear ( void  )
inline

◆ empty()

template<class T>
bool xsens::FifoQueueBasic< T >::empty ( ) const
inline

Return true if the queue is empty.

◆ eraseAndClear()

template<class T>
void xsens::FifoQueueBasic< T >::eraseAndClear ( void  )
inline

◆ front() [1/2]

template<class T>
value_type& xsens::FifoQueueBasic< T >::front ( )
inline

Return the oldest element in the queue.

◆ front() [2/2]

template<class T>
const value_type& xsens::FifoQueueBasic< T >::front ( ) const
inline

Return the oldest element in the queue.

◆ length()

template<class T>
size_type xsens::FifoQueueBasic< T >::length ( ) const
inline

Return the number of elements currently in the queue.

◆ operator=()

template<class T>
FifoQueueBasic<T>& xsens::FifoQueueBasic< T >::operator= ( const FifoQueueBasic< T > &  q)
inline

The assignment operator.

◆ operator[]() [1/2]

template<class T>
const value_type& xsens::FifoQueueBasic< T >::operator[] ( size_t  index) const
inline

Return the index'th oldest item from the queue.

◆ operator[]() [2/2]

template<class T>
value_type& xsens::FifoQueueBasic< T >::operator[] ( size_t  index)
inline

Return the index'th oldest item from the queue.

◆ pop()

template<class T>
void xsens::FifoQueueBasic< T >::pop ( void  )
inline

Remove the element at the front of the queue.

◆ popBack()

template<class T>
void xsens::FifoQueueBasic< T >::popBack ( void  )
inline

Remove the element at the back of the queue.

◆ push()

template<class T>
void xsens::FifoQueueBasic< T >::push ( const value_type x)
inline

Insert x at the back of the queue.

◆ push_front()

template<class T>
void xsens::FifoQueueBasic< T >::push_front ( const value_type x)
inline

Insert x at the front of the queue (LIFO operation).

◆ remove()

template<class T>
void xsens::FifoQueueBasic< T >::remove ( size_t  index)
inline

◆ resize()

template<class T>
void xsens::FifoQueueBasic< T >::resize ( const size_t  size)
inline

Resize the queue, note that this function clears the queue.

◆ size()

template<class T>
size_type xsens::FifoQueueBasic< T >::size ( ) const
inline

Return the maximum number of elements in the queue.

Member Data Documentation

◆ m_currentCount

template<class T>
size_t xsens::FifoQueueBasic< T >::m_currentCount
protected

◆ m_first

template<class T>
size_t xsens::FifoQueueBasic< T >::m_first
protected

◆ m_list

template<class T>
T* xsens::FifoQueueBasic< T >::m_list
protected

◆ m_maxCount

template<class T>
size_t xsens::FifoQueueBasic< T >::m_maxCount
protected

The documentation for this class was generated from the following file: