![]() |
Murl Engine API
Version 2018.3
|
A generic queue template class for non-moveable objects eg. NonCopyable classes. More...
#include <murl_object_queue.h>
A generic queue template class for non-moveable objects eg. NonCopyable classes.
The object queue class uses a queue of pointers to the objects, this ensures that the object's memory location is unchanged when modifying the queue.
This class is based on the NTL BiArray container, see http://www.ultimatepp.org
DataType | The value's data type of the queue. |
Classes | |
class | ConstIterator |
Definition of the const iterator. More... | |
class | Iterator |
Definition of the iterator. More... | |
Public Types | |
typedef DataType | ValueType |
The template parameter value type. More... | |
Public Member Functions | |
ObjectQueue () | |
Construct an empty queue. | |
ObjectQueue (const ObjectQueue &other) | |
Construct a queue from an already existing one, performing a deep copy. More... | |
~ObjectQueue () | |
Destroy the queue and all of its contents. | |
void | operator= (const ObjectQueue &other) |
Assign the content of another queue to this one, performing a deep copy. More... | |
SInt32 | GetCount () const |
Get the number of items in the queue. More... | |
Bool | IsEmpty () const |
Check if the queue is empty. More... | |
void | Clear () |
Clear the queue and remove the underlying storage. | |
void | Empty () |
Empty the queue, but keep the underlying storage. | |
DataType & | AddHead () |
Add a new item at the head of the queue. More... | |
DataType & | AddTail () |
Add a new item at the tail of the queue. More... | |
DataType & | AddHead (const DataType &item) |
Add a given item at the head of the queue. More... | |
DataType & | AddTail (const DataType &item) |
Add a given item at the tail of the queue. More... | |
DataType & | AddHead (DataType *item) |
Add a new allocated item at the head of the queue. More... | |
DataType & | AddTail (DataType *item) |
Add a new allocated item at the tail of the queue. More... | |
DataType & | Head () |
Get the item at the head of the queue. More... | |
DataType & | Tail () |
Get the item at the tail of the queue. More... | |
const DataType & | Head () const |
Get the item at the head of the queue. More... | |
const DataType & | Tail () const |
Get the item at the tail of the queue. More... | |
DataType | DropGetHead () |
Drop the item from the head of the queue and get a copy of the item. More... | |
DataType | DropGetTail () |
Drop the item from the tail of the queue and get a copy of the item. More... | |
void | DropHead () |
Drop the item from the head of the queue. | |
void | DropTail () |
Drop the item from the tail of the queue. | |
void | DropHead (SInt32 n) |
Drop a specified number of items from the head of the queue. More... | |
void | DropTail (SInt32 n) |
Drop a specified number of items from the tail of the queue. More... | |
DataType * | DetachHead () |
Removes the item from the head and giving up ownership. More... | |
DataType * | DetachTail () |
Removes the item from the tail and giving up ownership. More... | |
const DataType & | operator[] (SInt32 index) const |
Retrieve the item at a given position from the queue. More... | |
DataType & | operator[] (SInt32 index) |
Retrieve the item at a given position from the queue. More... | |
DataType & | Get (SInt32 index) |
Get the item at a given position from the queue. More... | |
const DataType & | Get (SInt32 index) const |
Get the item at a given position from the queue. More... | |
void | Shrink () |
Shrink the queue so that the underlying storage is only as large as necessary. | |
void | Reserve (SInt32 n) |
Reserve storage space. More... | |
SInt32 | GetAlloc () const |
Get the number of actually allocated items. More... | |
Bool | IsEqual (const ObjectQueue &other) const |
Compare the queue to another one. More... | |
bool | operator== (const ObjectQueue &rhs) const |
The "equal to" comparison operator, calls IsEqual(). More... | |
bool | operator!= (const ObjectQueue &rhs) const |
The "not equal to" comparison operator, calls IsEqual(). More... | |
void | Swap (ObjectQueue &other) |
Exchange the content of the queue with a given second one. More... | |
ConstIterator | Begin () const |
Get the const iterator to the first item. More... | |
ConstIterator | End () const |
Get the const iterator next to the last item. More... | |
ConstIterator | GetIter (SInt32 index) const |
Get the const iterator of a specified index. More... | |
Iterator | Begin () |
Get the iterator to the first item. More... | |
Iterator | End () |
Get the iterator next to the last item. More... | |
Iterator | GetIter (SInt32 index) |
Get the iterator of a specified index. More... | |
typedef DataType Murl::ObjectQueue< DataType >::ValueType |
The template parameter value type.
|
inline |
Construct a queue from an already existing one, performing a deep copy.
other | The queue to copy. |
|
inline |
Assign the content of another queue to this one, performing a deep copy.
other | The source queue. |
|
inline |
Get the number of items in the queue.
|
inline |
Check if the queue is empty.
|
inline |
Add a new item at the head of the queue.
The new item entry is initialized using the value type's default constructor. The new item will be at position 0.
|
inline |
Add a new item at the tail of the queue.
The new item entry is initialized using the value type's default constructor. The new item will be at position GetCount() - 1.
|
inline |
Add a given item at the head of the queue.
The new item entry is initialized using the given item's copy constructor. The new item will be at position 0.
item | The given item to be inserted at the head of the queue. |
|
inline |
Add a given item at the tail of the queue.
The new item entry is initialized using the given item's copy constructor. The new item will be at position GetCount() - 1.
item | The given item to be inserted at the tail of the queue. |
|
inline |
Add a new allocated item at the head of the queue.
The queue takes the ownership of the item. The new item will be at position 0.
item | The given item to be inserted at the head of the queue. |
|
inline |
Add a new allocated item at the tail of the queue.
The queue takes the ownership of the item. The new item will be at position GetCount() - 1.
item | The given item to be inserted at the tail of the queue. |
|
inline |
Get the item at the head of the queue.
|
inline |
Get the item at the tail of the queue.
|
inline |
Get the item at the head of the queue.
|
inline |
Get the item at the tail of the queue.
|
inline |
Drop the item from the head of the queue and get a copy of the item.
|
inline |
Drop the item from the tail of the queue and get a copy of the item.
|
inline |
Drop a specified number of items from the head of the queue.
n | The number of items to remove from the head. |
|
inline |
Drop a specified number of items from the tail of the queue.
n | The number of items to remove from the tail. |
|
inline |
Removes the item from the head and giving up ownership.
(!) The client is responsible for deletion of the returned item.
|
inline |
Removes the item from the tail and giving up ownership.
(!) The client is responsible for deletion of the returned item.
|
inline |
Retrieve the item at a given position from the queue.
index | The zero-based index of the item to retrieve. |
|
inline |
Retrieve the item at a given position from the queue.
index | The zero-based index of the item to retrieve. |
|
inline |
Get the item at a given position from the queue.
index | The zero-based index of the item to retrieve. |
|
inline |
Get the item at a given position from the queue.
index | The zero-based index of the item to retrieve. |
|
inline |
Reserve storage space.
If the given size is less than the actual size, nothing is done.
n | The number of items the underlying storage should hold. |
|
inline |
Get the number of actually allocated items.
|
inline |
Compare the queue to another one.
other | The queue to compare. |
|
inline |
The "equal to" comparison operator, calls IsEqual().
rhs | The right hand side queue to compare. |
|
inline |
The "not equal to" comparison operator, calls IsEqual().
rhs | The right hand side queue to compare. |
|
inline |
Exchange the content of the queue with a given second one.
other | The second queue. |
|
inline |
Get the const iterator to the first item.
|
inline |
Get the const iterator next to the last item.
|
inline |
Get the const iterator of a specified index.
index | The index for the iterator. |
|
inline |
Get the iterator to the first item.
|
inline |
Get the iterator next to the last item.
|
inline |
Get the iterator of a specified index.
index | The index for the iterator. |