Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::Queue< T > Class Template Reference

Dynamic queue that uses a circular buffer for performance. More...

#include <Queue.h>

List of all members.

Public Member Functions

void clear (bool freeStorage=true)
bool contains (const T &e) const
void deleteAll ()
dequeue ()
void enqueue (const T &e)
void fastClear ()
int length () const
Queueoperator= (const Queue &other)
const T & operator[] (int n) const
T & operator[] (int n)
popBack ()
popFront ()
void pushBack (const T &e)
void pushFront (const T &e)
 Queue (const Queue &other)
 Queue ()
int size () const
virtual ~Queue ()


Detailed Description

template<class T>
class G3D::Queue< T >

Dynamic queue that uses a circular buffer for performance.

Faster than std::deque for objects with constructors.


Constructor & Destructor Documentation

template<class T>
G3D::Queue< T >::Queue (  )  [inline]

template<class T>
G3D::Queue< T >::Queue ( const Queue< T > &  other  )  [inline]

Copy constructor.

template<class T>
virtual G3D::Queue< T >::~Queue (  )  [inline, virtual]

Destructor does not delete() the objects if T is a pointer type (e.g.

T = int*) instead, it deletes the pointers themselves and leaves the objects. Call deleteAll if you want to dealocate the objects referenced.


Member Function Documentation

template<class T>
void G3D::Queue< T >::clear ( bool  freeStorage = true  )  [inline]

Removes all elements (invoking their destructors).

Parameters:
freeStorage If false, the underlying array is not deallocated (allowing fast push in the future), however, the size of the Queue is reported as zero.

template<class T>
bool G3D::Queue< T >::contains ( const T &  e  )  const [inline]

Returns true if the given element is in the queue.

template<class T>
void G3D::Queue< T >::deleteAll (  )  [inline]

Calls delete on all objects[0.

..size-1] and sets the queue size to zero.

template<class T>
T G3D::Queue< T >::dequeue (  )  [inline]

popFront

template<class T>
void G3D::Queue< T >::enqueue ( const T &  e  )  [inline]

pushBack

template<class T>
void G3D::Queue< T >::fastClear (  )  [inline]

Clear without freeing the underlying array.

template<class T>
int G3D::Queue< T >::length (  )  const [inline]

Number of elements in the queue.

template<class T>
Queue& G3D::Queue< T >::operator= ( const Queue< T > &  other  )  [inline]

Assignment operator.

template<class T>
const T& G3D::Queue< T >::operator[] ( int  n  )  const [inline]

Performs bounds checks in debug mode.

template<class T>
T& G3D::Queue< T >::operator[] ( int  n  )  [inline]

Performs bounds checks in debug mode.

template<class T>
T G3D::Queue< T >::popBack (  )  [inline]

Remove the last element from the queue.

The queue will never shrink in size. (A typical queue only uses popFront).

template<class T>
T G3D::Queue< T >::popFront (  )  [inline]

Remove the next element from the head of the queue.

The queue will never shrink in size.

template<class T>
void G3D::Queue< T >::pushBack ( const T &  e  )  [inline]

Insert a new element at the end of the queue.

template<class T>
void G3D::Queue< T >::pushFront ( const T &  e  )  [inline]

Insert a new element into the front of the queue (a traditional queue only uses pushBack).

template<class T>
int G3D::Queue< T >::size (  )  const [inline]

Number of elements in the queue.


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:47 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo