|
Nebula
|
#include <queue.h>
Nebula's queue class (a FIFO container).
Faster queue class that apart from Enqueue has constant time operations.
Assumes that items can be trivially moved by using memmove.
Public Member Functions | |
| Queue () | |
| constructor | |
| ~Queue () | |
| destructor | |
| Queue (const Queue< TYPE > &rhs) | |
| copy constructor | |
| Queue (Queue< TYPE > &&rhs) | |
| move constructor | |
| void | operator= (const Queue< TYPE > &rhs) |
| assignment operator | |
| void | operator= (Queue< TYPE > &&rhs) |
| move assignment operator | |
| TYPE & | operator[] (IndexT index) const |
| access element by index, 0 is the frontmost element (next to be dequeued) | |
| bool | operator== (const Queue< TYPE > &rhs) const |
| equality operator | |
| bool | operator!= (const Queue< TYPE > &rhs) const |
| inequality operator | |
| void | Reserve (SizeT num) |
| increase capacity to fit N more elements into the Dequeue (slow) | |
| void | Grow () |
| grow Dequeue by internal growing rules (slow) | |
| SizeT | Size () const |
| returns number of elements in the Dequeue | |
| SizeT | Capacity () const |
| returns allocation of elements in the Dequeue | |
| bool | IsEmpty () const |
| return true if Dequeue is empty | |
| void | Clear () |
| remove all elements from the Dequeue | |
| bool | Contains (const TYPE &e) const |
| return true if Dequeue contains element | |
| void | EraseIndex (const IndexT i) |
| erase element at index (slow!!) | |
| void | Enqueue (const TYPE &e) |
| add element to the back of the Dequeue, can trigger grow | |
| void | Enqueue (TYPE &&e) |
| TYPE | Dequeue () |
| remove the element from the front of the Dequeue | |
| TYPE & | Peek () const |
| access to element at front of Dequeue without removing it | |
Protected Member Functions | |
| template<typename X> | |
| __forceinline std::enable_if< std::is_trivially_destructible< X >::value==false >::type | DestroyElement (IndexT idx) |
| template<typename X> | |
| __forceinline std::enable_if< std::is_trivially_destructible< X >::value==true >::type | DestroyElement (IndexT idx) |
| template<typename X> | |
| __forceinline std::enable_if< std::is_trivially_destructible< X >::value==false >::type | ClearAll () |
| template<typename X> | |
| __forceinline std::enable_if< std::is_trivially_destructible< X >::value==true >::type | ClearAll () |
| IndexT | MapIndex (IndexT index) const |
| maps index to actual item position using wrapping | |
Protected Attributes | |
| TYPE * | data |
| SizeT | grow |
| SizeT | start |
| SizeT | size |
| SizeT | capacity |
Static Protected Attributes | |
| static const SizeT | MinGrowSize = 16 |
| static const SizeT | MaxGrowSize = 65536 |
| Util::Queue< TYPE >::Queue | ( | ) |
constructor
| Util::Queue< TYPE >::~Queue | ( | ) |
destructor
| Util::Queue< TYPE >::Queue | ( | const Queue< TYPE > & | rhs | ) |
copy constructor
| Util::Queue< TYPE >::Queue | ( | Queue< TYPE > && | rhs | ) |
move constructor
| __forceinline SizeT Util::Queue< TYPE >::Capacity | ( | ) | const |
returns allocation of elements in the Dequeue
| void Util::Queue< TYPE >::Clear | ( | ) |
remove all elements from the Dequeue
|
inlineprotected |
|
inlineprotected |
| bool Util::Queue< TYPE >::Contains | ( | const TYPE & | e | ) | const |
return true if Dequeue contains element
| __forceinline TYPE Util::Queue< TYPE >::Dequeue | ( | ) |
remove the element from the front of the Dequeue
|
inlineprotected |
|
inlineprotected |
| __forceinline void Util::Queue< TYPE >::Enqueue | ( | const TYPE & | e | ) |
add element to the back of the Dequeue, can trigger grow
| __forceinline void Util::Queue< TYPE >::Enqueue | ( | TYPE && | e | ) |
| void Util::Queue< TYPE >::EraseIndex | ( | const IndexT | i | ) |
erase element at index (slow!!)
| void Util::Queue< TYPE >::Grow | ( | ) |
grow Dequeue by internal growing rules (slow)
| __forceinline bool Util::Queue< TYPE >::IsEmpty | ( | ) | const |
return true if Dequeue is empty
|
protected |
maps index to actual item position using wrapping
Maps an index onto the actual array index by wrapping around.
can deal with negative indices as well
| bool Util::Queue< TYPE >::operator!= | ( | const Queue< TYPE > & | rhs | ) | const |
inequality operator
| void Util::Queue< TYPE >::operator= | ( | const Queue< TYPE > & | rhs | ) |
assignment operator
| void Util::Queue< TYPE >::operator= | ( | Queue< TYPE > && | rhs | ) |
move assignment operator
| bool Util::Queue< TYPE >::operator== | ( | const Queue< TYPE > & | rhs | ) | const |
equality operator
| __forceinline TYPE & Util::Queue< TYPE >::operator[] | ( | IndexT | index | ) | const |
access element by index, 0 is the frontmost element (next to be dequeued)
| __forceinline TYPE & Util::Queue< TYPE >::Peek | ( | ) | const |
access to element at front of Dequeue without removing it
| void Util::Queue< TYPE >::Reserve | ( | SizeT | num | ) |
increase capacity to fit N more elements into the Dequeue (slow)
| __forceinline SizeT Util::Queue< TYPE >::Size | ( | ) | const |
returns number of elements in the Dequeue
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |