PixelLightAPI  .
Public Member Functions
PLCore::Queue< ValueType > Class Template Reference

Queue (FIFO -> First In First Out) template. More...

#include <Queue.h>

List of all members.

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 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.

Detailed Description

template<class ValueType>
class PLCore::Queue< ValueType >

Queue (FIFO -> First In First Out) template.

Remarks:
*    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)
*  

Constructor & Destructor Documentation

template<class ValueType >
PLCore::Queue< ValueType >::Queue ( )
template<class ValueType>
PLCore::Queue< ValueType >::Queue ( const Queue< ValueType > &  cSource)

Copy constructor.

Parameters:
[in]cSourceSource queue to copy from
template<class ValueType >
PLCore::Queue< ValueType >::~Queue ( )

Destructor.


Member Function Documentation

template<class ValueType>
bool PLCore::Queue< ValueType >::Push ( const ValueType &  Element)

Push an element onto the queue (enqueue)

Push an element onto the queue.

Parameters:
[in]ElementNew queue element
Returns:
'true' if all went fine, else 'false'
template<class ValueType>
bool PLCore::Queue< ValueType >::Pop ( ValueType *  pElement = nullptr)

Pops the bottom element from the queue (dequeue)

Pops the bottom element from the queue.

Parameters:
[out]pElementIf not a null pointer, this will receive the popped element
Returns:
'true' if all went fine, else 'false'
Note:
  • On error, pElement is NOT touched, so ensure that you take this case into account!
template<class ValueType >
ValueType PLCore::Queue< ValueType >::Bottom ( ) const

Returns the bottom element without removing it.

Get the bottom element without removing it.

Returns:
Bottom queue element
template<class ValueType >
uint32 PLCore::Queue< ValueType >::GetNumOfElements ( ) const

Returns the number of elements on the queue.

Returns the number of element on the queue.

Returns:
Number of queue elements
template<class ValueType>
Queue< ValueType > & PLCore::Queue< ValueType >::operator= ( const Queue< ValueType > &  cSource)

Copies the data from another queue.

Parameters:
[in]cSourceQueue to copy from
Returns:
Reference to this instance
template<class ValueType >
void PLCore::Queue< ValueType >::Clear ( )

Clears the whole queue.


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


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:14
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported