PixelLightAPI
.
|
Queue (FIFO -> First In First Out) template. More...
#include <Queue.h>
Public Member Functions | |
Queue () | |
Constructor. | |
Queue (const Queue< ValueType > &cSource) | |
Copy constructor. | |
~Queue () | |
Destructor. | |
bool | Push (const ValueType &Element) |
Push an element onto the queue (enqueue) | |
bool | Pop (ValueType *pElement=nullptr) |
Pops the bottom element from the queue (dequeue) | |
ValueType | Top () const |
Returns the top element without removing it. | |
ValueType | Bottom () const |
Returns the bottom element without removing it. | |
uint32 | GetNumOfElements () const |
Returns the number of elements on the queue. | |
Queue< ValueType > & | operator= (const Queue< ValueType > &cSource) |
Copies the data from another queue. | |
void | Clear () |
Clears the whole queue. | |
virtual Iterator< ValueType > | GetIterator (uint32 nIndex=0) const override |
Returns an iterator operating on the derived data structure. | |
virtual ConstIterator< ValueType > | GetConstIterator (uint32 nIndex=0) const override |
Returns a constant iterator operating on the derived data structure. | |
virtual Iterator< ValueType > | GetEndIterator () const override |
Returns an iterator operating on the derived data structure and starting at the end. | |
virtual ConstIterator< ValueType > | GetConstEndIterator () const override |
Returns a constant iterator operating on the derived data structure and starting at the end. |
Queue (FIFO -> First In First Out) template.
* Simple extendable queue using a linked list. * The queue will hold copies of the type used in the queue, * so note that your classes should supply a copy (=) operator! * * Usage example: * Queue<MyClass> cQueue; // Create queue * MyClass T, T1, T2, T3; // Test class instances * cQueue.Push(T1); // Push a copy of T1 onto the queue * cQueue.Push(T2); // Push a copy of T2 onto the queue * cQueue.Push(T3); // Push a copy of T3 onto the queue * cQueue.Pop(&T); // Pop last element (T1) * cQueue.Pop(&T); // Pop last element (T2) * cQueue.Pop(&T); // Pop last element (T3) *
PLCore::Queue< ValueType >::Queue | ( | ) |
PLCore::Queue< ValueType >::Queue | ( | const Queue< ValueType > & | cSource | ) |
Copy constructor.
[in] | cSource | Source queue to copy from |
PLCore::Queue< ValueType >::~Queue | ( | ) |
Destructor.
bool PLCore::Queue< ValueType >::Push | ( | const ValueType & | Element | ) |
Push an element onto the queue (enqueue)
Push an element onto the queue.
[in] | Element | New queue element |
bool PLCore::Queue< ValueType >::Pop | ( | ValueType * | pElement = nullptr | ) |
Pops the bottom element from the queue (dequeue)
Pops the bottom element from the queue.
[out] | pElement | If not a null pointer, this will receive the popped element |
ValueType PLCore::Queue< ValueType >::Top | ( | ) | const |
Returns the top element without removing it.
Get the top element without removing it.
ValueType PLCore::Queue< ValueType >::Bottom | ( | ) | const |
Returns the bottom element without removing it.
Get the bottom element without removing it.
uint32 PLCore::Queue< ValueType >::GetNumOfElements | ( | ) | const |
Returns the number of elements on the queue.
Returns the number of element on the queue.
Queue< ValueType > & PLCore::Queue< ValueType >::operator= | ( | const Queue< ValueType > & | cSource | ) |
Copies the data from another queue.
[in] | cSource | Queue to copy from |
void PLCore::Queue< ValueType >::Clear | ( | ) |
Clears the whole queue.
Iterator< ValueType > PLCore::Queue< ValueType >::GetIterator | ( | uint32 | nIndex = 0 | ) | const [override, virtual] |
Returns an iterator operating on the derived data structure.
[in] | nIndex | Start index, if >= 'total number of elements' the index is set to the last valid index |
Implements PLCore::Iterable< ValueType >.
ConstIterator< ValueType > PLCore::Queue< ValueType >::GetConstIterator | ( | uint32 | nIndex = 0 | ) | const [override, virtual] |
Returns a constant iterator operating on the derived data structure.
[in] | nIndex | Start index, if >= 'total number of elements' the index is set to the last valid index |
Implements PLCore::Iterable< ValueType >.
Iterator< ValueType > PLCore::Queue< ValueType >::GetEndIterator | ( | ) | const [override, virtual] |
Returns an iterator operating on the derived data structure and starting at the end.
Implements PLCore::Iterable< ValueType >.
ConstIterator< ValueType > PLCore::Queue< ValueType >::GetConstEndIterator | ( | ) | const [override, virtual] |
Returns a constant iterator operating on the derived data structure and starting at the end.
Implements PLCore::Iterable< ValueType >.
|