TrinityCore
|
#include <Queue.h>
Public Member Functions | |
Queue () | |
Queue (const Queue &other) | |
virtual | ~Queue () |
void | pushFront (const T &e) |
void | pushBack (const T &e) |
void | enqueue (const T &e) |
T | popBack () |
T | popFront () |
T | dequeue () |
void | clear (bool freeStorage=true) |
void | fastClear () |
Queue & | operator= (const Queue &other) |
int | size () const |
int | length () const |
T & | operator[] (int n) |
const T & | operator[] (int n) const |
const T & | last () const |
T & | last () |
bool | empty () const |
bool | contains (const T &e) const |
void | deleteAll () |
Private Member Functions | |
void | _copy (const Queue &other) |
int | index (int i) const |
void | repackAndRealloc (int newSize) |
void | reserveSpace () |
Private Attributes | |
T * | data |
int | head |
int | num |
int | numAllocated |
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.
|
inlineprivate |
If a clear was needed, assumes it already occured
|
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. |
|
inline |
Returns true if the given element is in the queue.
|
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.
|
inlineprivate |
Computes a data array index from a queue position. The queue position may be negative.
|
inline |
Returns the back element
|
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).
|
inline |
Remove the next element from the head of the queue. The queue will never shrink in size.
|
inline |
Insert a new element at the end of the queue.
|
inline |
Insert a new element into the front of the queue (a traditional queue only uses pushBack).
|
inlineprivate |
Allocates newSize elements and repacks the array.
|
inlineprivate |
Ensure that there is at least one element between the tail and head, wrapping around in the circular buffer.
|
inline |
Number of elements in the queue.
|
private |
Only num elements are initialized.
|
private |
Index of the next element to be dequeue-d in data.
|
private |
Number of elements (including head) that are visible and initialized.
|
private |
Size of data array in elements.