CLI  2.9
Queue< T > Class Template Reference

Basic queue object. More...

#include <tk_stl.h>

Inheritance diagram for Queue< T >:

Classes

class  Iterator
 Iterator object. More...
 

Public Member Functions

 Queue (const unsigned int UI_MaxCount)
 Main constructor. More...
 
 Queue (const Queue< T > &TK_Queue)
 Copy constructor. More...
 
virtual ~Queue (void)
 Destructor. More...
 
const bool IsEmpty (void) const
 Determines whether the queue is empty. More...
 
const unsigned int GetCount (void) const
 Item count. More...
 
const bool Reset (void)
 Resets the queue. More...
 
Iterator GetIterator (void) const
 Iterator retrieval. More...
 
const bool IsValid (const Iterator &it) const
 Checks the element at the given position is valid. More...
 
const bool MovePrevious (Iterator &it) const
 Iterates backward the iterator. More...
 
const bool MoveNext (Iterator &it) const
 Iterates forward the iterator. More...
 
const T & GetAt (const Iterator &it) const
 Read-only item retrieval. More...
 
T & GetAt (const Iterator &it)
 Modifiable item retrieval. More...
 
const T Remove (Iterator &it)
 Item removal. More...
 
const bool AddHead (const T &T_Element)
 Add a new element at the head of the queue. More...
 
const bool AddTail (const T &T_Element)
 Add a new element at the tail of the queue. More...
 
const T & GetHead (void) const
 First item accessor of the read-only queue. More...
 
T & GetHead (void)
 First item accessor of the modifiable queue. More...
 
const T & GetTail (void) const
 Last item accessor of the read-only queue. More...
 
T & GetTail (void)
 Last item accessor of the modifiable queue. More...
 
const T RemoveHead (void)
 Add a new element at the head of the queue. More...
 
const T RemoveTail (void)
 Add a new element at the tail of the queue. More...
 
const bool Sort (const int(*cmp)(const T &, const T &))
 Sort the list according to the given comparison function. More...
 

Detailed Description

template<class T>
class Queue< T >

Basic queue object.

Definition at line 315 of file tk_stl.h.

Constructor & Destructor Documentation

◆ Queue() [1/2]

template<class T>
Queue< T >::Queue ( const unsigned int  UI_MaxCount)
inlineexplicit

Main constructor.

Parameters
UI_MaxCountMaximum item count.

Definition at line 323 of file tk_stl.h.

References UnusedParameter().

◆ Queue() [2/2]

template<class T>
Queue< T >::Queue ( const Queue< T > &  TK_Queue)
inline

Copy constructor.

Parameters
TK_QueueSource queue object.

Definition at line 332 of file tk_stl.h.

◆ ~Queue()

template<class T>
virtual Queue< T >::~Queue ( void  )
inlinevirtual

Destructor.

Definition at line 340 of file tk_stl.h.

Member Function Documentation

◆ AddHead()

template<class T>
const bool Queue< T >::AddHead ( const T &  T_Element)
inline

Add a new element at the head of the queue.

Returns
true if the element has been added, false otherwise.
Parameters
T_ElementNew element.

Definition at line 467 of file tk_stl.h.

◆ AddTail()

template<class T>
const bool Queue< T >::AddTail ( const T &  T_Element)
inline

Add a new element at the tail of the queue.

Returns
true if the element has been added, false otherwise.
Parameters
T_ElementNew element.

Definition at line 477 of file tk_stl.h.

Referenced by Queue< T >::Sort().

◆ GetAt() [1/2]

template<class T>
const T& Queue< T >::GetAt ( const Iterator it) const
inline

Read-only item retrieval.

Returns
Read-only item retrieved.
Parameters
itCurrent iterator.

Definition at line 436 of file tk_stl.h.

Referenced by Queue< T >::Sort().

◆ GetAt() [2/2]

template<class T>
T& Queue< T >::GetAt ( const Iterator it)
inline

Modifiable item retrieval.

Returns
Modifiable item retrieved.
Parameters
itCurrent iterator.

Definition at line 445 of file tk_stl.h.

◆ GetCount()

template<class T>
const unsigned int Queue< T >::GetCount ( void  ) const
inline

Item count.

Returns
Number of items in the queue.

Definition at line 358 of file tk_stl.h.

Referenced by Queue< T >::Sort().

◆ GetHead() [1/2]

template<class T>
const T& Queue< T >::GetHead ( void  ) const
inline

First item accessor of the read-only queue.

Warning
Do not call on an empty queue.
Returns
Read-only head element.

Definition at line 488 of file tk_stl.h.

Referenced by Queue< T >::GetHead().

◆ GetHead() [2/2]

template<class T>
T& Queue< T >::GetHead ( void  )
inline

First item accessor of the modifiable queue.

Warning
Do not call on an empty queue.
Returns
Modifiable head element.

Definition at line 496 of file tk_stl.h.

References Queue< T >::GetHead().

◆ GetIterator()

template<class T>
Iterator Queue< T >::GetIterator ( void  ) const
inline

Iterator retrieval.

Returns
Iterator instance.

Definition at line 393 of file tk_stl.h.

Referenced by Queue< T >::Sort().

◆ GetTail() [1/2]

template<class T>
const T& Queue< T >::GetTail ( void  ) const
inline

Last item accessor of the read-only queue.

Warning
Do not call on an empty queue.
Returns
Read-only tail element.

Definition at line 506 of file tk_stl.h.

Referenced by Queue< T >::GetTail().

◆ GetTail() [2/2]

template<class T>
T& Queue< T >::GetTail ( void  )
inline

Last item accessor of the modifiable queue.

Warning
Do not call on an empty queue.
Returns
Modifiable tail element.

Definition at line 514 of file tk_stl.h.

References Queue< T >::GetTail().

◆ IsEmpty()

template<class T>
const bool Queue< T >::IsEmpty ( void  ) const
inline

Determines whether the queue is empty.

Returns
true when the queue is empty, false otherwise.

Definition at line 351 of file tk_stl.h.

Referenced by Queue< T >::Sort().

◆ IsValid()

template<class T>
const bool Queue< T >::IsValid ( const Iterator it) const
inline

Checks the element at the given position is valid.

Returns
true if the iterator is at a valid place, false otherwise.
Parameters
itIterator to check.

Definition at line 400 of file tk_stl.h.

Referenced by Queue< T >::MoveNext(), and Queue< T >::Sort().

◆ MoveNext()

template<class T>
const bool Queue< T >::MoveNext ( Iterator it) const
inline

Iterates forward the iterator.

Returns
true if the iterator has moved to a valid place, false otherwise.
Parameters
itIterator to move forward.

Definition at line 426 of file tk_stl.h.

References Queue< T >::IsValid().

Referenced by Queue< T >::Sort().

◆ MovePrevious()

template<class T>
const bool Queue< T >::MovePrevious ( Iterator it) const
inline

Iterates backward the iterator.

Returns
true if the iterator has moved to a valid place, false otherwise.
Parameters
itIterator to move backward.

Definition at line 409 of file tk_stl.h.

◆ Remove()

template<class T>
const T Queue< T >::Remove ( Iterator it)
inline

Item removal.

Parameters
itPosition. Set to next item.
Returns
The removed element.
Parameters
itCurrent iterator.

Definition at line 455 of file tk_stl.h.

◆ RemoveHead()

template<class T>
const T Queue< T >::RemoveHead ( void  )
inline

Add a new element at the head of the queue.

Warning
Do not call on an empty queue.
Returns
Element removed.

Definition at line 524 of file tk_stl.h.

◆ RemoveTail()

template<class T>
const T Queue< T >::RemoveTail ( void  )
inline

Add a new element at the tail of the queue.

Warning
Do not call on an empty queue.
Returns
Element removed.

Definition at line 534 of file tk_stl.h.

Referenced by Queue< T >::Sort().

◆ Reset()

template<class T>
const bool Queue< T >::Reset ( void  )
inline

Resets the queue.

Returns
true when success, false otherwise.
Author
[contrib: Oleg Smolsky, 2010, based on CLI 2.5]

Definition at line 367 of file tk_stl.h.

◆ Sort()

template<class T>
const bool Queue< T >::Sort ( const int(*)(const T &, const T &)  cmp)
inline

Sort the list according to the given comparison function.

Returns
true when success, false otherwise.
Parameters
cmpComparison function. Return positive value when then second argument should follow first one.

Definition at line 544 of file tk_stl.h.

References Queue< T >::AddTail(), Queue< T >::GetAt(), Queue< T >::GetCount(), Queue< T >::GetIterator(), Queue< T >::IsEmpty(), Queue< T >::IsValid(), Queue< T >::MoveNext(), Queue< T >::RemoveTail(), and Queue< T >::Sort().

Referenced by Queue< T >::Sort().


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