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

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

List of all members.

Public Member Functions

 queue ()
 queue (const queue &lvalue)
 ~queue ()
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::queue< T, maxSize >

The queue 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 queue 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 queue is implemented using a simple ringbuffer. Therefore the operations manipulating the back and the front are very efficient.

If an illegal operation is attempted, an assertion is raised.

Definition at line 66 of file queue.h.


Constructor & Destructor Documentation

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

constructors, destructors Constructs a new queue object.

Definition at line 154 of file queue.h.

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

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

Parameters:
lvalue queue used to generate a new object.

Definition at line 159 of file queue.h.

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

Destroys the object and releases all the associated resources.

Definition at line 168 of file queue.h.


Member Function Documentation

template<class T , int maxSize>
T & ApparatusFramework::queue< 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 182 of file queue.h.

template<class T , int maxSize>
T & ApparatusFramework::queue< 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 200 of file queue.h.

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

Clears the whole content of the queue.

Definition at line 232 of file queue.h.

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

queries True if the container is empty, false otherwise.

Returns:
bool result of the query.

Definition at line 246 of file queue.h.

template<class T , int maxSize>
T & ApparatusFramework::queue< 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 193 of file queue.h.

template<class T , int maxSize>
T & ApparatusFramework::queue< 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 172 of file queue.h.

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

Removes the item at the front of the container. If the queue is empty, an assertion is raised.

Definition at line 220 of file queue.h.

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

Pushes the given item at the back of the container. If the queue is full, an assertion is raised.

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

Definition at line 207 of file queue.h.

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

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

Returns:
int size of the containter.

Definition at line 240 of file queue.h.

© 2004-2010 bbv Software Services AG / Apparatus Services