te::common::QueueT< T > Struct Template Reference

Struct that implements the generic queue. More...

#include <GenericQueue.h>

Public Member Functions

void add (const T &v)
 Adds an element to the end of the queue. More...
 
unsigned int getSize () const
 Returns the size of the queue. More...
 
getValue (const unsigned int &pos) const
 Returns the value stored at pos position of the queue. More...
 
void insert (const T &v, const unsigned int &pos)
 Inserts a data at a specific position. More...
 
unsigned int position (const T &v) const
 Return the position of a value in the queue. More...
 
 QueueT ()
 Constructor. More...
 
remove (const unsigned int &pos)
 Removes the element at position pos. More...
 
 ~QueueT ()
 Destructor. More...
 

Public Attributes

NodeT< T > * m_first
 Pointer to the first node. More...
 
NodeT< T > * m_last
 Pointer to the last node. More...
 
unsigned int m_size
 Number of elements contained in the queue. More...
 

Detailed Description

template<typename T>
struct te::common::QueueT< T >

Struct that implements the generic queue.

Queues have well known behavior: first in, first out.

Template Parameters
TType of the data to be stored.
Note
The queue DOES NOT takes the ownership of the pointers stored in it.

Definition at line 85 of file GenericQueue.h.

Constructor & Destructor Documentation

template<typename T >
te::common::QueueT< T >::QueueT ( )
inline

Constructor.

Definition at line 94 of file GenericQueue.h.

References te::common::QueueT< T >::m_first.

template<typename T >
te::common::QueueT< T >::~QueueT ( )
inline

Destructor.

Definition at line 104 of file GenericQueue.h.

Member Function Documentation

template<typename T >
void te::common::QueueT< T >::add ( const T &  v)
inline

Adds an element to the end of the queue.

Parameters
vElement to be stored.

Definition at line 115 of file GenericQueue.h.

References te::common::QueueT< T >::m_first, and te::common::NodeT< T >::m_next.

template<typename T >
unsigned int te::common::QueueT< T >::getSize ( ) const
inline

Returns the size of the queue.

Returns
The number of items stored at the queue.

Definition at line 287 of file GenericQueue.h.

References te::common::QueueT< T >::m_size.

template<typename T >
T te::common::QueueT< T >::getValue ( const unsigned int &  pos) const
inline

Returns the value stored at pos position of the queue.

Parameters
posThe required position.
Returns
The value stored at required position.
Exceptions
Ifpos were greater or equal than queue size a te::common::Exception will be raised.

Definition at line 240 of file GenericQueue.h.

References te::common::QueueT< T >::m_first, te::common::NodeT< T >::m_next, and te::common::NodeT< T >::m_value.

template<typename T >
void te::common::QueueT< T >::insert ( const T &  v,
const unsigned int &  pos 
)
inline

Inserts a data at a specific position.

Parameters
vValue to be stored.
posPosition where to put it.
Exceptions
Ifpos were greater than the queue size a te::common::Exception will be raised.

Definition at line 195 of file GenericQueue.h.

References te::common::QueueT< T >::m_first, and te::common::NodeT< T >::m_next.

template<typename T >
unsigned int te::common::QueueT< T >::position ( const T &  v) const
inline

Return the position of a value in the queue.

Parameters
vThe value we are searching for.
Returns
The position of the value in the queue.
Exceptions
Ifqueue were empty or does not contains the v, a te::common::Exception will be raised.

Definition at line 262 of file GenericQueue.h.

References te::common::QueueT< T >::m_first, te::common::NodeT< T >::m_next, and te::common::NodeT< T >::m_value.

template<typename T >
T te::common::QueueT< T >::remove ( const unsigned int &  pos)
inline

Removes the element at position pos.

Parameters
posThe position of the element in the queue.
Returns
The elemen stored at position pos.
Exceptions
Ifpos is greater or equals than the queue size, a te::common::Exception will be raised.

Definition at line 142 of file GenericQueue.h.

References te::common::QueueT< T >::m_first, te::common::NodeT< T >::m_next, and te::common::NodeT< T >::m_value.

Member Data Documentation

template<typename T >
NodeT<T>* te::common::QueueT< T >::m_last

Pointer to the last node.

Definition at line 88 of file GenericQueue.h.

template<typename T >
unsigned int te::common::QueueT< T >::m_size

Number of elements contained in the queue.

Definition at line 89 of file GenericQueue.h.

Referenced by te::common::QueueT< T >::getSize().


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