Support Forum G3D Web Page |
Dynamic queue that uses a circular buffer for performance.
More...
Public Member Functions | |
Queue () | |
Queue (const Queue &other) | |
Copy constructor More... | |
virtual | ~Queue () |
Destructor does not delete() the objects if T is a pointer type (e.g. More... | |
void | clear (bool freeStorage=true) |
Removes all elements (invoking their destructors). More... | |
bool | contains (const T &e) const |
Returns true if the given element is in the queue. More... | |
void | copyInto (T *array) const |
Copies the elements of the queue into the array, which must be large enough to hold all elements. More... | |
void | deleteAll () |
Calls delete on all objects[0...size-1] and sets the queue size to zero. More... | |
T | dequeue () |
popFront More... | |
bool | empty () const |
void | enqueue (const T &e) |
pushBack More... | |
void | fastClear () |
Clear without freeing the underlying array. More... | |
const T & | last () const |
Returns the back element. More... | |
T & | last () |
int | length () const |
Number of elements in the queue. More... | |
Queue & | operator= (const Queue &other) |
Assignment operator. More... | |
T & | operator[] (int n) |
Performs bounds checks in debug mode More... | |
const T & | operator[] (int n) const |
Performs bounds checks in debug mode More... | |
T | popBack () |
Remove the last element from the queue. More... | |
T | popFront () |
Remove the next element from the head of the queue. More... | |
void | pushBack (const T &e) |
Insert a new element at the end of the queue. More... | |
void | pushFront (const T &e) |
Insert a new element into the front of the queue (a traditional queue only uses pushBack). More... | |
int | size () const |
Number of elements in the queue. More... | |
Dynamic queue that uses a circular buffer for performance.
Faster than std::deque for objects with constructors.
|
inline |
|
inline |
Copy constructor
|
inlinevirtual |
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.
|
inline |
Removes all elements (invoking their destructors).
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. |
Referenced by G3D::ThreadsafeQueue< G3D::_internal::NetworkCallbackInfo >::clear(), G3D::TimeQueue< T >::clear(), G3D::Queue< G3D::_internal::NetworkCallbackInfo >::deleteAll(), G3D::Queue< G3D::_internal::NetworkCallbackInfo >::fastClear(), G3D::Queue< G3D::_internal::NetworkCallbackInfo >::operator=(), and G3D::Queue< G3D::_internal::NetworkCallbackInfo >::~Queue().
|
inline |
Returns true if the given element is in the queue.
|
inline |
Copies the elements of the queue into the array, which must be large enough to hold all elements.
|
inline |
Calls delete on all objects[0...size-1] and sets the queue size to zero.
|
inline |
popFront
|
inline |
|
inline |
pushBack
|
inline |
Clear without freeing the underlying array.
|
inline |
Returns the back element.
Referenced by G3D::TimeQueue< T >::getPopBack().
|
inline |
|
inline |
Number of elements in the queue.
|
inline |
Assignment operator.
|
inline |
Performs bounds checks in debug mode
|
inline |
Performs bounds checks in debug mode
|
inline |
Remove the last element from the queue.
The queue will never shrink in size. (A typical queue only uses popFront).
Referenced by G3D::TimeQueue< T >::getPopBack(), and G3D::ThreadsafeQueue< G3D::_internal::NetworkCallbackInfo >::popBack().
|
inline |
Remove the next element from the head of the queue.
The queue will never shrink in size.
Referenced by G3D::Queue< G3D::_internal::NetworkCallbackInfo >::dequeue(), G3D::TimeQueue< T >::getPopFront(), and G3D::ThreadsafeQueue< G3D::_internal::NetworkCallbackInfo >::popFront().
|
inline |
Insert a new element at the end of the queue.
Referenced by G3D::TimeQueue< T >::enqueue(), G3D::Queue< G3D::_internal::NetworkCallbackInfo >::enqueue(), G3D::ThreadsafeQueue< G3D::_internal::NetworkCallbackInfo >::pushBack(), and G3D::TimeQueue< T >::pushBack().
|
inline |
Insert a new element into the front of the queue (a traditional queue only uses pushBack).
Referenced by G3D::ThreadsafeQueue< G3D::_internal::NetworkCallbackInfo >::pushFront(), and G3D::TimeQueue< T >::pushFront().
|
inline |
Number of elements in the queue.
Referenced by G3D::Queue< G3D::_internal::NetworkCallbackInfo >::contains(), G3D::Queue< G3D::_internal::NetworkCallbackInfo >::empty(), G3D::TimeQueue< T >::getPopBack(), G3D::TimeQueue< T >::getPopFront(), G3D::Queue< G3D::_internal::NetworkCallbackInfo >::last(), G3D::Queue< G3D::_internal::NetworkCallbackInfo >::length(), G3D::TimeQueue< T >::operator[](), G3D::ThreadsafeQueue< G3D::_internal::NetworkCallbackInfo >::popBack(), G3D::ThreadsafeQueue< G3D::_internal::NetworkCallbackInfo >::popFront(), G3D::ThreadsafeQueue< G3D::_internal::NetworkCallbackInfo >::size(), and G3D::TimeQueue< T >::size().