26 #ifndef __TERRALIB_COMMON_INTERNAL_GENERICQUEUE_H
27 #define __TERRALIB_COMMON_INTERNAL_GENERICQUEUE_H
145 throw Exception(
"Queue remove error: index out of boundaries.");
159 for(
unsigned int i = 0; i < pos - 1; i++)
164 if(aux2->m_next == 0)
174 aux->
m_next = aux2->m_next;
195 void insert(
const T& v,
const unsigned int& pos)
198 throw Exception(
"Queue insert error: index out of boundaries.");
219 for(
unsigned int i = 0; i < pos - 1; i++)
243 throw Exception(
"Queue getValue error: index out of boundaries.");
247 for(
unsigned int i = 0; i < pos; i++)
267 unsigned int count = 0;
279 throw Exception(
"Queue does not contains data.");
This class is designed to declare objects to be thrown as exceptions by TerraLib.
Struct that represents a node in the Queue.
NodeT< T > * m_next
Pointer to the next node.
Struct that implements the generic queue.
T getValue(const unsigned int &pos) const
Returns the value stored at pos position of the queue.
NodeT< T > * m_last
Pointer to the last node.
unsigned int getSize() const
Returns the size of the queue.
void add(const T &v)
Adds an element to the end of the queue.
T remove(const unsigned int &pos)
Removes the element at position pos.
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.
unsigned int m_size
Number of elements contained in the queue.
NodeT< T > * m_first
Pointer to the first node.
An exception class for the XML module.