26 #ifndef __TERRALIB_COMMON_INTERNAL_GENERICQUEUE_H
27 #define __TERRALIB_COMMON_INTERNAL_GENERICQUEUE_H
142 T
remove(
const unsigned int& pos)
145 throw Exception(
"Queue remove error: index out of boundaries.");
152 m_first = m_first->
m_next;
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.");
210 else if(pos == m_size)
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.");
295 #endif // __TERRALIB_COMMON_INTERNAL_GENERICQUEUE_H
unsigned int m_size
Number of elements contained in the queue.
unsigned int getSize() const
Returns the size of the queue.
unsigned int position(const T &v) const
Return the position of a value in the queue.
Struct that implements the generic queue.
T getValue(const unsigned int &pos) const
Returns the value stored at pos position of the queue.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
void insert(const T &v, const unsigned int &pos)
Inserts a data at a specific position.
void add(const T &v)
Adds an element to the end of the queue.
Struct that represents a node in the Queue.
NodeT< T > * m_first
Pointer to the first node.
NodeT< T > * m_next
Pointer to the next node.
NodeT< T > * m_last
Pointer to the last node.