#include <Queue.h>
Inheritance diagram for Queue< ItemType >:

Public Types | |
| typedef int(*) | ItemCompareFunc (const ItemType &item1, const ItemType &item2, void *cookie) |
| This is the signature of the type of callback function that you must pass into the Sort() method. | |
Public Member Functions | |
| Queue () | |
| Default constructor. | |
| Queue (uint32 initialSlots) | |
| Constructor. | |
| Queue (const Queue ©Me) | |
| Copy constructor. | |
| virtual | ~Queue () |
| Destructor. | |
| Queue & | operator= (const Queue &from) |
| Assigment operator. | |
| bool | operator== (const Queue &rhs) const |
| Equality operator. | |
| bool | operator!= (const Queue &rhs) const |
| Returns the negation of the equality operator. | |
| status_t | AddTail (const ItemType &item=ItemType()) |
| Appends (item) to the end of the queue. | |
| status_t | AddTail (const Queue< ItemType > &queue, uint32 startIndex=0, uint32 numItems=MUSCLE_NO_LIMIT) |
| Appends some or all items in (queue) to the end of our queue. | |
| status_t | AddTail (const ItemType *items, uint32 numItems) |
| Adds the given array of items to the tail of the Queue. | |
| status_t | AddHead (const ItemType &item=ItemType()) |
| Prepends (item) to the head of the queue. | |
| status_t | AddHead (const Queue< ItemType > &queue, uint32 startIndex=0, uint32 numItems=MUSCLE_NO_LIMIT) |
| Concatenates (queue) to the head of our queue. | |
| status_t | AddHead (const ItemType *items, uint32 numItems) |
| Concatenates the given array of items to the head of the Queue. | |
| status_t | RemoveHead () |
| Removes the item at the head of the queue. | |
| status_t | RemoveHead (ItemType &returnItem) |
| Removes the item at the head of the queue and places it into (returnItem). | |
| status_t | RemoveTail () |
| Removes the item at the tail of the queue. | |
| status_t | RemoveTail (ItemType &returnItem) |
| Removes the item at the tail of the queue and places it into (returnItem). | |
| status_t | RemoveItemAt (uint32 index) |
| Removes the item at the (index)'th position in the queue. | |
| status_t | RemoveItemAt (uint32 index, ItemType &returnItem) |
| Removes the item at the (index)'th position in the queue, and copies it into (returnItem). | |
| status_t | GetItemAt (uint32 index, ItemType &returnItem) const |
| Copies the (index)'th item into (returnItem). | |
| ItemType * | GetItemAt (uint32 index) const |
| Returns a pointer to an item in the array (i.e. | |
| status_t | ReplaceItemAt (uint32 index, const ItemType &newItem=ItemType()) |
| Replaces the (index)'th item in the queue with (newItem). | |
| status_t | InsertItemAt (uint32 index, const ItemType &newItem=ItemType()) |
| Inserts (item) into the (nth) slot in the array. | |
| status_t | InsertItemsAt (uint32 index, const Queue< ItemType > &queue, uint32 startIndex=0, uint32 numNewItems=MUSCLE_NO_LIMIT) |
| Inserts some or all of the items in (queue) at the specified position in our queue. | |
| status_t | InsertItemsAt (uint32 index, const ItemType *items, uint32 numNewItems) |
| Inserts the items pointed at by (items) at the specified position in our queue. | |
| void | Clear (bool releaseCachedBuffers=false) |
| Removes all items from the queue. | |
| uint32 | GetNumItems () const |
| Returns the number of items in the queue. | |
| uint32 | GetNumAllocatedItemSlots () const |
| Returns the number of item-slots we have allocated space for. | |
| bool | IsEmpty () const |
| Convenience method: Returns true iff there are no items in the queue. | |
| bool | HasItems () const |
| Convenience method: Returns true iff there is at least one item in the queue. | |
| const ItemType & | Head () const |
| Returns a read-only reference the head item in the queue. | |
| const ItemType & | Tail () const |
| Returns a read-only reference the tail item in the queue. | |
| ItemType & | Head () |
| Returns a writable reference the head item in the queue. | |
| ItemType & | Tail () |
| Returns a writable reference the tail item in the queue. | |
| ItemType * | HeadPointer () const |
| Returns a pointer to the first item in the queue, or NULL if the queue is empty. | |
| ItemType * | TailPointer () const |
| Returns a pointer to the last item in the queue, or NULL if the queue is empty. | |
| const ItemType & | operator[] (uint32 Index) const |
| Convenient read-only array-style operator (be sure to only use valid indices!). | |
| ItemType & | operator[] (uint32 Index) |
| Convenient read-write array-style operator (be sure to only use valid indices!). | |
| ItemType * | GetItemPointer (uint32 index) const |
| Deprecated synonym for GetItemAt(). | |
| status_t | EnsureSize (uint32 numSlots, bool setNumItems=false, uint32 extraReallocItems=0) |
| Makes sure there is enough space allocated for at least (numSlots) items. | |
| int32 | IndexOf (const ItemType &item) const |
| Returns the last index of the given (item), or -1 if (item) is not found in the list. | |
| void | Swap (uint32 fromIndex, uint32 toIndex) |
| Swaps the values of the two items at the given indices. | |
| void | ReverseItemOrdering (uint32 from=0, uint32 to=MUSCLE_NO_LIMIT) |
| Reverses the ordering of the items in the given subrange. | |
| void | Sort (ItemCompareFunc compareFunc, uint32 from=0, uint32 to=MUSCLE_NO_LIMIT, void *optCookie=NULL) |
| Does an in-place, stable sort on a subrange of the contents of this Queue. | |
| void | SwapContents (Queue< ItemType > &that) |
| Swaps our contents with the contents of (that), in an efficient manner. | |
| uint32 | RemoveAllInstancesOf (const ItemType &val) |
| Goes through the array and removes every item that is equal to (val). | |
| status_t | RemoveFirstInstanceOf (const ItemType &val) |
| Goes through the array and removes the first item that is equal to (val). | |
| status_t | RemoveLastInstanceOf (const ItemType &val) |
| Goes through the array and removes the last item that is equal to (val). | |
| bool | StartsWith (const ItemType &prefix) const |
| Returns true iff the first item in our queue is equal to (prefix). | |
| bool | StartsWith (const Queue< ItemType > &prefixQueue) const |
| Returns true iff the (prefixQueue) is a prefix of this queue. | |
| bool | EndsWith (const ItemType &suffix) const |
| Returns true iff the last item in our queue is equal to (suffix). | |
| bool | EndsWith (const Queue< ItemType > &suffixQueue) const |
| Returns true iff the (suffixQueue) is a suffix of this queue. | |
| ItemType * | GetArrayPointer (uint32 whichArray, uint32 &retLength) |
| Returns a pointer to the nth internally-held contiguous-Item-sub-array, to allow efficient array-style access to groups of items in this Queue. | |
| const ItemType * | GetArrayPointer (uint32 whichArray, uint32 &retLength) const |
| Read-only version of the above. | |
| void | Normalize () |
| Normalizes the layout of the items held in this Queue so that they are guaranteed to be contiguous in memory. | |
Adding or removing items from the head or tail of a Queue is (on average) an O(1) operation. A Queue also makes for a nice Vector, if that's all you need.
Definition at line 18 of file Queue.h.
| typedef int(*) Queue< ItemType >::ItemCompareFunc(const ItemType &item1, const ItemType &item2, void *cookie) |
This is the signature of the type of callback function that you must pass into the Sort() method.
This function should work like strcmp(), returning a negative value if (item1) is less than item2, or zero if the items are equal, or a positive value if (item1) is greater than item2.
| item1 | The first item | |
| item2 | The second item | |
| cookie | A user-defined value that was passed in to the Sort() method. |
Equality operator.
Queues are equal if they are the same length, and every nth item in this queue is == to the corresponding item in (rhs).
Definition at line 425 of file Queue.h.
References Queue< ItemType >::GetNumItems().
| status_t Queue< ItemType >::AddTail | ( | const ItemType & | item = ItemType() |
) |
Appends (item) to the end of the queue.
Queue size grows by one.
| item | The item to append. |
Definition at line 480 of file Queue.h.
References Queue< ItemType >::EnsureSize().
Referenced by Queue< ItemType >::InsertItemAt(), Queue< ItemType >::InsertItemsAt(), QueueGatewayMessageReceiver::MessageReceivedFromGateway(), and Queue< ItemType >::SwapContents().
| status_t Queue< ItemType >::AddTail | ( | const Queue< ItemType > & | queue, | |
| uint32 | startIndex = 0, |
|||
| uint32 | numItems = MUSCLE_NO_LIMIT | |||
| ) |
Appends some or all items in (queue) to the end of our queue.
Queue size grows by at most (queue.GetNumItems()). For example: Queue<int> a; // contains 1, 2, 3, 4 Queue<int> b; // contains 5, 6, 7, 8 a.AddTail(b); // a now contains 1, 2, 3, 4, 5, 6, 7, 8
| queue | The queue to append to our queue. | |
| startIndex | Index in (queue) to start adding at. Default to zero. | |
| numItems | Number of items to add. If this number is too large, it will be capped appropriately. Default is to add all items. |
Definition at line 493 of file Queue.h.
References Queue< ItemType >::EnsureSize(), and Queue< ItemType >::GetNumItems().
| status_t Queue< ItemType >::AddTail | ( | const ItemType * | items, | |
| uint32 | numItems | |||
| ) |
Adds the given array of items to the tail of the Queue.
Equivalent to adding them to the tail of the Queue one at a time, but somewhat more efficient. On success, the queue size grows by (numItems).
| items | Pointer to an array of items to add to the Queue. | |
| numItems | Number of items in the array |
Definition at line 509 of file Queue.h.
References Queue< ItemType >::EnsureSize(), and Queue< ItemType >::GetNumItems().
| status_t Queue< ItemType >::AddHead | ( | const ItemType & | item = ItemType() |
) |
Prepends (item) to the head of the queue.
Queue size grows by one.
| item | The item to prepend. |
Definition at line 523 of file Queue.h.
References Queue< ItemType >::EnsureSize().
Referenced by Queue< ItemType >::AddHead(), Queue< ItemType >::InsertItemAt(), and Queue< ItemType >::InsertItemsAt().
| status_t Queue< ItemType >::AddHead | ( | const Queue< ItemType > & | queue, | |
| uint32 | startIndex = 0, |
|||
| uint32 | numItems = MUSCLE_NO_LIMIT | |||
| ) |
Concatenates (queue) to the head of our queue.
Our queue size grows by at most (queue.GetNumItems()). For example: Queue<int> a; // contains 1, 2, 3, 4 Queue<int> b; // contains 5, 6, 7, 8 a.AddHead(b); // a now contains 5, 6, 7, 8, 1, 2, 3, 4
| queue | The queue to prepend to our queue. | |
| startIndex | Index in (queue) to start adding at. Default to zero. | |
| numItems | Number of items to add. If this number is too large, it will be capped appropriately. Default is to add all items. |
Definition at line 536 of file Queue.h.
References Queue< ItemType >::AddHead(), Queue< ItemType >::EnsureSize(), and Queue< ItemType >::GetNumItems().
| status_t Queue< ItemType >::AddHead | ( | const ItemType * | items, | |
| uint32 | numItems | |||
| ) |
Concatenates the given array of items to the head of the Queue.
The semantics are the same as for AddHead(const Queue<ItemType> &).
| items | Pointer to an array of items to add to the Queue. | |
| numItems | Number of items in the array |
Definition at line 549 of file Queue.h.
References Queue< ItemType >::AddHead(), and Queue< ItemType >::EnsureSize().
| status_t Queue< ItemType >::RemoveHead | ( | ) |
Removes the item at the head of the queue.
Definition at line 569 of file Queue.h.
Referenced by Queue< ItemType >::RemoveHead().
| status_t Queue< ItemType >::RemoveHead | ( | ItemType & | returnItem | ) |
Removes the item at the head of the queue and places it into (returnItem).
| returnItem | On success, the removed item is copied into this object. |
Definition at line 559 of file Queue.h.
References Queue< ItemType >::RemoveHead().
| status_t Queue< ItemType >::RemoveTail | ( | ) |
Removes the item at the tail of the queue.
Definition at line 592 of file Queue.h.
Referenced by Queue< ItemType >::Clear(), Queue< ItemType >::EnsureSize(), Queue< ItemType >::RemoveAllInstancesOf(), and Queue< ItemType >::RemoveTail().
| status_t Queue< ItemType >::RemoveTail | ( | ItemType & | returnItem | ) |
Removes the item at the tail of the queue and places it into (returnItem).
| returnItem | On success, the removed item is copied into this object. |
Definition at line 582 of file Queue.h.
References Queue< ItemType >::RemoveTail().
| status_t Queue< ItemType >::RemoveItemAt | ( | uint32 | index | ) |
Removes the item at the (index)'th position in the queue.
| index | Which item to remove--can range from zero (head of the queue) to GetNumItems()-1 (tail of the queue). |
Definition at line 625 of file Queue.h.
Referenced by Queue< ItemType >::RemoveFirstInstanceOf(), Queue< ItemType >::RemoveItemAt(), and Queue< ItemType >::RemoveLastInstanceOf().
| status_t Queue< ItemType >::RemoveItemAt | ( | uint32 | index, | |
| ItemType & | returnItem | |||
| ) |
Removes the item at the (index)'th position in the queue, and copies it into (returnItem).
| index | Which item to remove--can range from zero (head of the queue) to (GetNumItems()-1) (tail of the queue). | |
| returnItem | On success, the removed item is copied into this object. |
Definition at line 615 of file Queue.h.
References Queue< ItemType >::RemoveItemAt().
| status_t Queue< ItemType >::GetItemAt | ( | uint32 | index, | |
| ItemType & | returnItem | |||
| ) | const |
Copies the (index)'th item into (returnItem).
| index | Which item to get--can range from zero (head of the queue) to (GetNumItems()-1) (tail of the queue). | |
| returnItem | On success, the retrieved item is copied into this object. |
Definition at line 605 of file Queue.h.
Referenced by Queue< ItemType >::EnsureSize(), Queue< Refef< AbstractReflectSession > >::GetItemPointer(), Queue< Refef< AbstractReflectSession > >::Head(), Queue< Refef< AbstractReflectSession > >::HeadPointer(), Queue< ItemType >::IndexOf(), Queue< ItemType >::InsertItemAt(), Queue< ItemType >::Sort(), Queue< ItemType >::Swap(), Queue< Refef< AbstractReflectSession > >::Tail(), and Queue< Refef< AbstractReflectSession > >::TailPointer().
| ItemType * Queue< ItemType >::GetItemAt | ( | uint32 | index | ) | const |
Returns a pointer to an item in the array (i.e.
no copying of the item is done). Included for efficiency; be careful with this: modifying the queue can invalidate the returned pointer!
| index | Index of the item to return a pointer to. |
| status_t Queue< ItemType >::ReplaceItemAt | ( | uint32 | index, | |
| const ItemType & | newItem = ItemType() | |||
| ) |
Replaces the (index)'th item in the queue with (newItem).
| index | Which item to replace--can range from zero (head of the queue) to (GetNumItems()-1) (tail of the queue). | |
| newItem | The item to place into the queue at the (index)'th position. |
Definition at line 665 of file Queue.h.
Referenced by Queue< ItemType >::InsertItemAt(), and Queue< ItemType >::Swap().
| status_t Queue< ItemType >::InsertItemAt | ( | uint32 | index, | |
| const ItemType & | newItem = ItemType() | |||
| ) |
Inserts (item) into the (nth) slot in the array.
InsertItemAt(0) is the same as AddHead(item), InsertItemAt(GetNumItems()) is the same as AddTail(item). Other positions will involve an O(n) shifting of contents.
| index | The position at which to insert the new item. | |
| newItem | The item to insert into the queue. |
Definition at line 675 of file Queue.h.
References Queue< ItemType >::AddHead(), Queue< ItemType >::AddTail(), Queue< ItemType >::GetItemAt(), and Queue< ItemType >::ReplaceItemAt().
| status_t Queue< ItemType >::InsertItemsAt | ( | uint32 | index, | |
| const Queue< ItemType > & | queue, | |||
| uint32 | startIndex = 0, |
|||
| uint32 | numNewItems = MUSCLE_NO_LIMIT | |||
| ) |
Inserts some or all of the items in (queue) at the specified position in our queue.
Queue size grows by at most (queue.GetNumItems()). For example: Queue<int> a; // contains 1, 2, 3, 4 Queue<int> b; // contains 5, 6, 7, 8 a.InsertItemsAt(2, b); // a now contains 1, 2, 5, 6, 7, 8, 3, 4
| queue | The queue whose items are to be inserted into this queue. | |
| startIndex | Index in (queue) to start reading items from. Defaults to zero. | |
| numNewItems | Number of items to insert. If this number is too large, it will be capped appropriately. Default is to add all items. |
Definition at line 701 of file Queue.h.
References Queue< ItemType >::AddHead(), Queue< ItemType >::AddTail(), Queue< ItemType >::EnsureSize(), Queue< ItemType >::GetNumItems(), and Queue< ItemType >::Head().
| status_t Queue< ItemType >::InsertItemsAt | ( | uint32 | index, | |
| const ItemType * | items, | |||
| uint32 | numNewItems | |||
| ) |
Inserts the items pointed at by (items) at the specified position in our queue.
Queue size grows (numNewItems). For example: Queue<int> a; // contains 1, 2, 3, 4 const int b[] = {5, 6, 7}; a.InsertItemsAt(2, b, ARRAYITEMS(b)); // a now contains 1, 2, 5, 6, 7, 3, 4
| items | Pointer to the items to insert into this queue. | |
| numNewItems | Number of items to insert. |
Definition at line 725 of file Queue.h.
References Queue< ItemType >::AddHead(), Queue< ItemType >::AddTail(), Queue< ItemType >::EnsureSize(), and Queue< ItemType >::GetNumItems().
| void Queue< ItemType >::Clear | ( | bool | releaseCachedBuffers = false |
) |
Removes all items from the queue.
| releaseCachedBuffers | If true, we will immediately free any buffers that we may be holding. Otherwise we will keep them around so that they can be re-used in the future. |
Definition at line 748 of file Queue.h.
References Queue< ItemType >::RemoveTail().
| uint32 Queue< ItemType >::GetNumItems | ( | ) | const [inline] |
Returns the number of items in the queue.
(This number does not include pre-allocated space)
Definition at line 204 of file Queue.h.
Referenced by Queue< ItemType >::AddHead(), Queue< ItemType >::AddTail(), Queue< ItemType >::EndsWith(), Queue< ItemType >::IndexOf(), Queue< ItemType >::InsertItemsAt(), Queue< ItemType >::operator=(), Queue< ItemType >::operator==(), Queue< ItemType >::RemoveAllInstancesOf(), Queue< ItemType >::RemoveFirstInstanceOf(), Queue< ItemType >::RemoveLastInstanceOf(), Queue< ItemType >::ReverseItemOrdering(), Queue< ItemType >::Sort(), Queue< ItemType >::StartsWith(), and Queue< ItemType >::SwapContents().
| uint32 Queue< ItemType >::GetNumAllocatedItemSlots | ( | ) | const [inline] |
Returns the number of item-slots we have allocated space for.
Note that this is NOT the same as the value returned by GetNumItems() -- it is generally larger, since we pre-allocate additional slots in advance to cut down on the number of re-allocations we need to do.
| const ItemType& Queue< ItemType >::Head | ( | ) | const [inline] |
Returns a read-only reference the head item in the queue.
You must not call this when the queue is empty!
Definition at line 219 of file Queue.h.
Referenced by Queue< ItemType >::InsertItemsAt(), and Queue< Refef< AbstractReflectSession > >::StartsWith().
| const ItemType& Queue< ItemType >::Tail | ( | ) | const [inline] |
Returns a read-only reference the tail item in the queue.
You must not call this when the queue is empty!
Definition at line 222 of file Queue.h.
Referenced by Queue< Refef< AbstractReflectSession > >::EndsWith().
| ItemType& Queue< ItemType >::Head | ( | ) | [inline] |
| ItemType& Queue< ItemType >::Tail | ( | ) | [inline] |
| ItemType* Queue< ItemType >::GetItemPointer | ( | uint32 | index | ) | const [inline] |
Deprecated synonym for GetItemAt().
Don't call this method in new code, call GetItemAt() instead!
| status_t Queue< ItemType >::EnsureSize | ( | uint32 | numSlots, | |
| bool | setNumItems = false, |
|||
| uint32 | extraReallocItems = 0 | |||
| ) |
Makes sure there is enough space allocated for at least (numSlots) items.
You only need to call this if you wish to minimize the number of data re-allocations done, or wish to add or remove a large number of default items at once (by specifying setNumItems=true).
| numSlots | the minimum amount of items to pre-allocate space for in the Queue. | |
| setNumItems | If true, the length of the Queue will be altered by adding or removing items to (from) the tail of the Queue until the Queue is the specified size. If false (the default), more slots may be pre-allocated, but the number of items officially in the Queue remains the same as before. | |
| extraReallocItems | If we have to do an array reallocation, this many extra slots will be added to the newly allocated array, above and beyond what is strictly necessary. That way the likelihood of another reallocation being necessary in the near future is reduced. Default value is zero, indicating that no extra slots will be allocated. This argument is ignored if (setNumItems) is true. |
Definition at line 763 of file Queue.h.
References Queue< ItemType >::GetItemAt(), and Queue< ItemType >::RemoveTail().
Referenced by Queue< ItemType >::AddHead(), Queue< ItemType >::AddTail(), Queue< ItemType >::InsertItemsAt(), and Queue< ItemType >::operator=().
| int32 Queue< ItemType >::IndexOf | ( | const ItemType & | item | ) | const |
Returns the last index of the given (item), or -1 if (item) is not found in the list.
O(n) search time.
| item | The item to look for. |
Definition at line 809 of file Queue.h.
References Queue< ItemType >::GetItemAt(), and Queue< ItemType >::GetNumItems().
| void Queue< ItemType >::Swap | ( | uint32 | fromIndex, | |
| uint32 | toIndex | |||
| ) |
Swaps the values of the two items at the given indices.
This operation will involve three copies of the held items.
| fromIndex | First index to swap. | |
| toIndex | Second index to swap. |
Definition at line 819 of file Queue.h.
References Queue< ItemType >::GetItemAt(), and Queue< ItemType >::ReplaceItemAt().
Referenced by Queue< ItemType >::ReverseItemOrdering(), and Queue< ItemType >::Sort().
| void Queue< ItemType >::ReverseItemOrdering | ( | uint32 | from = 0, |
|
| uint32 | to = MUSCLE_NO_LIMIT | |||
| ) |
Reverses the ordering of the items in the given subrange.
(e.g. if the items were A,B,C,D,E, this would change them to E,D,C,B,A)
| from | Index of the start of the subrange. Defaults to zero. | |
| to | Index of the next item after the end of the subrange. If greater than the number of items currently in the queue, this value will be clipped to be equal to that number. Defaults to the largest possible uint32. |
Definition at line 865 of file Queue.h.
References Queue< ItemType >::GetNumItems(), and Queue< ItemType >::Swap().
| void Queue< ItemType >::Sort | ( | ItemCompareFunc | compareFunc, | |
| uint32 | from = 0, |
|||
| uint32 | to = MUSCLE_NO_LIMIT, |
|||
| void * | optCookie = NULL | |||
| ) |
Does an in-place, stable sort on a subrange of the contents of this Queue.
(The sort algorithm is a smart, in-place merge sort).
| compareFunc | A function that compares two items in this queue and returns a value indicating which is "larger". (negative indicates that the second parameter is larger, positive indicate that the first is larger, and zero indicates that the two parameters are equal) | |
| from | Index of the start of the subrange. Defaults to zero. | |
| to | Index of the next item after the end of the subrange. If greater than the number of items currently in the queue, the subrange will extend to the last item. Defaults to the largest possible uint32. | |
| optCookie | A user-defined value that will be passed to the (compareFunc). |
Definition at line 829 of file Queue.h.
References Queue< ItemType >::GetItemAt(), Queue< ItemType >::GetNumItems(), and Queue< ItemType >::Swap().
Swaps our contents with the contents of (that), in an efficient manner.
| that | The queue whose contents are to be swapped with our own. |
Definition at line 1065 of file Queue.h.
References Queue< ItemType >::_queue, Queue< ItemType >::_smallQueue, Queue< ItemType >::AddTail(), and Queue< ItemType >::GetNumItems().
| uint32 Queue< ItemType >::RemoveAllInstancesOf | ( | const ItemType & | val | ) |
Goes through the array and removes every item that is equal to (val).
| val | the item to look for and remove |
Definition at line 898 of file Queue.h.
References Queue< ItemType >::GetNumItems(), and Queue< ItemType >::RemoveTail().
| status_t Queue< ItemType >::RemoveFirstInstanceOf | ( | const ItemType & | val | ) |
Goes through the array and removes the first item that is equal to (val).
| val | the item to look for and remove |
Definition at line 879 of file Queue.h.
References Queue< ItemType >::GetNumItems(), and Queue< ItemType >::RemoveItemAt().
| status_t Queue< ItemType >::RemoveLastInstanceOf | ( | const ItemType & | val | ) |
Goes through the array and removes the last item that is equal to (val).
| val | the item to look for and remove |
Definition at line 889 of file Queue.h.
References Queue< ItemType >::GetNumItems(), and Queue< ItemType >::RemoveItemAt().
| ItemType* Queue< ItemType >::GetArrayPointer | ( | uint32 | whichArray, | |
| uint32 & | retLength | |||
| ) | [inline] |
Returns a pointer to the nth internally-held contiguous-Item-sub-array, to allow efficient array-style access to groups of items in this Queue.
In the current implementation there may be as many as two such sub-arrays present, depending on the internal state of the Queue.
| whichArray | Index of the internal array to return a pointer to. Typically zero or one. | |
| retLength | On success, the number of items in the returned sub-array will be written here. |
| void Queue< ItemType >::Normalize | ( | ) |
Normalizes the layout of the items held in this Queue so that they are guaranteed to be contiguous in memory.
This is useful if you want to pass pointers to items in this array in to functions that expect C arrays. Note that the normalization only lasts until the Queue is next modified, and that normalization is an O(N) procedure if the array needs normalizing. (It's a no-op if the array is already normalized, of course)
1.5.1