ApparatusFramework::overWriteQueue< T, maxSize > Class Template Reference
[RT-STL]

#include <RT_STL/current/include/ovrQueue.h>

List of all members.

Public Member Functions

 overWriteQueue ()
 overWriteQueue (const overWriteQueue &lvalue)
 ~overWriteQueue ()
T & operator[] (int n)
T & at (int n)
T & front ()
T & back ()
void push (const T &val)
void pop ()
void clear ()
bool empty () const
int size () const

Detailed Description

template<class T, int maxSize>
class ApparatusFramework::overWriteQueue< T, maxSize >

The overWriteQueue class implements the equivalent of the queue class defined in the standard template library. But our class does not use any dynamic memory allocation scheme. Therefore the additional template parameter maxSize defines the maximum number of elements the overWriteQueue can ever contain.

We support the same interface as the STL class. This feature allows an easy switch between the dynamic and the static bound queue class.

Our overWriteQueue is implemented using a simple ringbuffer. Therefore the operations manipulating the back and the front are very efficient.

This implementation differs in its exception behaviour from the default queue. If a push into a full queue is done, the oldest entry is overwritten. If a pop from an empty queue is done, nothing happens (no assertion raised).

Definition at line 68 of file ovrQueue.h.


Constructor & Destructor Documentation

template<class T , int maxSize>
ApparatusFramework::overWriteQueue< T, maxSize >::overWriteQueue (  )  [inline]

constructors, destructors Constructs a new overWriteQueue object.

Definition at line 158 of file ovrQueue.h.

template<class T , int maxSize>
ApparatusFramework::overWriteQueue< T, maxSize >::overWriteQueue ( const overWriteQueue< T, maxSize > &  lvalue  )  [inline]

The copy constructor constructs a new overWriteQueue object from an existing one.

Parameters:
lvalue overWriteQueue used to generate a new object.

Definition at line 163 of file ovrQueue.h.

template<class T , int maxSize>
ApparatusFramework::overWriteQueue< T, maxSize >::~overWriteQueue (  )  [inline]

Destroys the object and releases all the associated resources.

Definition at line 172 of file ovrQueue.h.


Member Function Documentation

template<class T , int maxSize>
T & ApparatusFramework::overWriteQueue< T, maxSize >::at ( int  n  )  [inline]

Returns the item at the given position. A sanity check is performed.

Parameters:
n index of the requested item. The index starts at 0.
Returns:
T& reference to the item at the given position.

Definition at line 187 of file ovrQueue.h.

template<class T , int maxSize>
T & ApparatusFramework::overWriteQueue< T, maxSize >::back (  )  [inline]

Returns the object stored at the back of the queue. If the queue is empty, an assertion is raised.

Returns:
T& reference to the item at the given position.

Definition at line 205 of file ovrQueue.h.

template<class T , int maxSize>
void ApparatusFramework::overWriteQueue< T, maxSize >::clear (  )  [inline]

Clears the whole content of the queue.

Definition at line 247 of file ovrQueue.h.

template<class T , int maxSize>
bool ApparatusFramework::overWriteQueue< T, maxSize >::empty (  )  const [inline]

queries True if the container is empty, false otherwise.

Returns:
bool result of the query.

Definition at line 261 of file ovrQueue.h.

template<class T , int maxSize>
T & ApparatusFramework::overWriteQueue< T, maxSize >::front (  )  [inline]

Returns the object stored at the front of the queue. If the queue is empty, an assertion is raised.

Returns:
T& reference to the item at the given position.

Definition at line 198 of file ovrQueue.h.

template<class T , int maxSize>
T & ApparatusFramework::overWriteQueue< T, maxSize >::operator[] ( int  n  )  [inline]

modifiers Returns the item at the given position. No sanity checks are performed.

Parameters:
n index of the requested item. The index starts at 0.
Returns:
T& reference to the item at the given position.

Definition at line 177 of file ovrQueue.h.

template<class T , int maxSize>
void ApparatusFramework::overWriteQueue< T, maxSize >::pop (  )  [inline]

Removes the item at the front of the container. If the queue is empty, nothing happens.

Definition at line 234 of file ovrQueue.h.

template<class T, int maxSize>
void ApparatusFramework::overWriteQueue< T, maxSize >::push ( const T &  val  )  [inline]

Pushes the given item at the back of the container. If the queue is full, the the oldest entry is overwritten.

Parameters:
val item to be inserted at the back of the container.

Definition at line 212 of file ovrQueue.h.

template<class T , int maxSize>
int ApparatusFramework::overWriteQueue< T, maxSize >::size (  )  const [inline]

Returns the size of the container (number of items contained).

Returns:
int size of the container.

Definition at line 255 of file ovrQueue.h.

© 2004-2010 bbv Software Services AG / Apparatus Services