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... | |
T | 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... | |
T | 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... | |
Struct that implements the generic queue.
Queues have well known behavior: first in, first out.
T | Type of the data to be stored. |
Definition at line 85 of file GenericQueue.h.
|
inline |
Constructor.
Definition at line 94 of file GenericQueue.h.
References te::common::QueueT< T >::m_first.
|
inline |
Destructor.
Definition at line 104 of file GenericQueue.h.
|
inline |
Adds an element to the end of the queue.
v | Element 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.
|
inline |
Returns the size of the queue.
Definition at line 287 of file GenericQueue.h.
References te::common::QueueT< T >::m_size.
|
inline |
Returns the value stored at pos position of the queue.
pos | The required position. |
If | pos 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.
|
inline |
Inserts a data at a specific position.
v | Value to be stored. |
pos | Position where to put it. |
If | pos 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.
|
inline |
Return the position of a value in the queue.
v | The value we are searching for. |
If | queue 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.
|
inline |
Removes the element at position pos.
pos | The position of the element in the queue. |
If | pos 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.
NodeT<T>* te::common::QueueT< T >::m_first |
Pointer to the first node.
Definition at line 87 of file GenericQueue.h.
Referenced by te::common::QueueT< T >::add(), te::common::QueueT< T >::getValue(), te::common::QueueT< T >::insert(), te::common::QueueT< T >::position(), te::common::QueueT< T >::QueueT(), and te::common::QueueT< T >::remove().
NodeT<T>* te::common::QueueT< T >::m_last |
Pointer to the last node.
Definition at line 88 of file GenericQueue.h.
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().