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. | |
| unsigned int | getSize () const |
| Returns the size of the queue. | |
| T | getValue (const unsigned int &pos) const |
| Returns the value stored at pos position of the queue. | |
| void | insert (const T &v, const unsigned int &pos) |
| Inserts a data at a specific position. | |
| unsigned int | position (const T &v) const |
| Return the position of a value in the queue. | |
| QueueT () | |
| Constructor. | |
| T | remove (const unsigned int &pos) |
| Removes the element at position pos. | |
| ~QueueT () | |
| Destructor. | |
Public Attributes | |
| NodeT< T > * | m_first |
| Pointer to the first node. | |
| NodeT< T > * | m_last |
| Pointer to the last node. | |
| unsigned int | m_size |
| Number of elements contained in the queue. | |
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, te::common::QueueT< T >::m_last, and te::common::QueueT< T >::m_size.
|
inline |
Destructor.
Definition at line 104 of file GenericQueue.h.
References te::common::QueueT< T >::m_size, and te::common::QueueT< T >::remove().
|
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, te::common::QueueT< T >::m_last, and te::common::QueueT< T >::m_size.
|
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, te::common::QueueT< T >::m_size, 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, te::common::QueueT< T >::m_last, te::common::NodeT< T >::m_next, and te::common::QueueT< T >::m_size.
|
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, te::common::QueueT< T >::m_size, 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::QueueT< T >::m_last, te::common::NodeT< T >::m_next, te::common::QueueT< T >::m_size, and te::common::NodeT< T >::m_value.
Referenced by te::common::QueueT< T >::~QueueT().
| 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.
Referenced by te::common::QueueT< T >::add(), te::common::QueueT< T >::insert(), te::common::QueueT< T >::QueueT(), and te::common::QueueT< T >::remove().
| 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 >::add(), te::common::QueueT< T >::getSize(), te::common::QueueT< T >::getValue(), te::common::QueueT< T >::insert(), te::common::QueueT< T >::position(), te::common::QueueT< T >::QueueT(), te::common::QueueT< T >::remove(), and te::common::QueueT< T >::~QueueT().