StringMatcherQueue Class Reference

Just a reference-countable list of references to StringMatcher objects. More...

#include <PathMatcher.h>

Inheritance diagram for StringMatcherQueue:

Inheritance graph
[legend]
List of all members.

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

 StringMatcherQueue (uint32 initialSize=SMALL_QUEUE_SIZE)
 Constructor.
bool operator== (const Queue &rhs) const
 Equality operator.
bool operator!= (const Queue &rhs) const
 Returns the negation of the equality operator.
status_t CopyFrom (const Queue< ItemType > &rhs)
 Similar to the assignment operator, except this method returns a status code.
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.
ItemType & Head ()
 Returns a writable reference the head item in the queue.
const ItemType & Tail () const
 Returns a read-only reference the tail 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.
void IncrementRefCount () const
 Increments the counter and returns true iff the new value is zero.
bool DecrementRefCount () const
 Decrements the counter and returns true iff the new value is zero.
void SetManager (AbstractObjectManager *manager)
 Sets the recycle-pointer for this object.
AbstractObjectManagerGetManager () const
 Returns this object's current recyler pointer.
uint32 GetRefCount () const
 Returns this object's current reference count.

Detailed Description

Just a reference-countable list of references to StringMatcher objects.

Definition at line 17 of file PathMatcher.h.


Member Typedef Documentation

template<class ItemType>
typedef int(*) Queue< ItemType >::ItemCompareFunc(const ItemType &item1, const ItemType &item2, void *cookie) [inherited]

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.

Parameters:
item1 The first item
item2 The second item
cookie A user-defined value that was passed in to the Sort() method.
Returns:
A value indicating which item is "larger", as defined above.

Definition at line 305 of file Queue.h.


Constructor & Destructor Documentation

StringMatcherQueue::StringMatcherQueue ( uint32  initialSize = SMALL_QUEUE_SIZE  )  [inline]

Constructor.

Parameters:
initialSize passed on to the Queue constructor.

Definition at line 23 of file PathMatcher.h.


Member Function Documentation

template<class ItemType>
bool Queue< ItemType >::operator== ( const Queue< ItemType > &  rhs  )  const [inherited]

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 431 of file Queue.h.

References Queue< ItemType >::GetNumItems().

template<class ItemType>
status_t Queue< ItemType >::CopyFrom ( const Queue< ItemType > &  rhs  )  [inherited]

Similar to the assignment operator, except this method returns a status code.

Parameters:
rhs This Queue's contents will become a copy of (rhs)'s items.
Returns:
B_NO_ERROR on success, or B_ERROR on failure (out of memory?).

Definition at line 455 of file Queue.h.

References Queue< ItemType >::EnsureSize(), and Queue< ItemType >::GetNumItems().

template<class ItemType>
status_t Queue< ItemType >::AddTail ( const ItemType &  item = ItemType()  )  [inherited]

Appends (item) to the end of the queue.

Queue size grows by one.

Parameters:
item The item to append.
Returns:
B_NO_ERROR on success, B_ERROR on failure (out of memory)

Definition at line 500 of file Queue.h.

References Queue< ItemType >::EnsureSize().

Referenced by Queue< ItemType >::InsertItemAt(), Queue< ItemType >::InsertItemsAt(), QueueGatewayMessageReceiver::MessageReceivedFromGateway(), and Queue< ItemType >::SwapContents().

template<class ItemType>
status_t Queue< ItemType >::AddTail ( const Queue< ItemType > &  queue,
uint32  startIndex = 0,
uint32  numItems = MUSCLE_NO_LIMIT 
) [inherited]

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

Parameters:
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.
Returns:
B_NO_ERROR on success, B_ERROR on failure (out of memory)

Definition at line 513 of file Queue.h.

References Queue< ItemType >::EnsureSize(), and Queue< ItemType >::GetNumItems().

template<class ItemType>
status_t Queue< ItemType >::AddTail ( const ItemType *  items,
uint32  numItems 
) [inherited]

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).

Parameters:
items Pointer to an array of items to add to the Queue.
numItems Number of items in the array
Returns:
B_NO_ERROR on success, or B_ERROR on failure (out of memory)

Definition at line 529 of file Queue.h.

References Queue< ItemType >::EnsureSize(), and Queue< ItemType >::GetNumItems().

template<class ItemType>
status_t Queue< ItemType >::AddHead ( const ItemType &  item = ItemType()  )  [inherited]

Prepends (item) to the head of the queue.

Queue size grows by one.

Parameters:
item The item to prepend.
Returns:
B_NO_ERROR on success, B_ERROR on failure (out of memory)

Definition at line 543 of file Queue.h.

References Queue< ItemType >::EnsureSize().

Referenced by Queue< ItemType >::AddHead(), Queue< ItemType >::InsertItemAt(), and Queue< ItemType >::InsertItemsAt().

template<class ItemType>
status_t Queue< ItemType >::AddHead ( const Queue< ItemType > &  queue,
uint32  startIndex = 0,
uint32  numItems = MUSCLE_NO_LIMIT 
) [inherited]

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

Parameters:
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.
Returns:
B_NO_ERROR on success, B_ERROR on failure (out of memory)

Definition at line 556 of file Queue.h.

References Queue< ItemType >::AddHead(), Queue< ItemType >::EnsureSize(), and Queue< ItemType >::GetNumItems().

template<class ItemType>
status_t Queue< ItemType >::AddHead ( const ItemType *  items,
uint32  numItems 
) [inherited]

Concatenates the given array of items to the head of the Queue.

The semantics are the same as for AddHead(const Queue<ItemType> &).

Parameters:
items Pointer to an array of items to add to the Queue.
numItems Number of items in the array
Returns:
B_NO_ERROR on success, or B_ERROR on failure (out of memory)

Definition at line 569 of file Queue.h.

References Queue< ItemType >::AddHead(), and Queue< ItemType >::EnsureSize().

template<class ItemType>
status_t Queue< ItemType >::RemoveHead (  )  [inherited]

Removes the item at the head of the queue.

Returns:
B_NO_ERROR on success, B_ERROR if the queue was empty.

Definition at line 589 of file Queue.h.

Referenced by Queue< ItemType >::RemoveHead().

template<class ItemType>
status_t Queue< ItemType >::RemoveHead ( ItemType &  returnItem  )  [inherited]

Removes the item at the head of the queue and places it into (returnItem).

Parameters:
returnItem On success, the removed item is copied into this object.
Returns:
B_NO_ERROR on success, B_ERROR if the queue was empty

Definition at line 579 of file Queue.h.

References Queue< ItemType >::RemoveHead().

template<class ItemType>
status_t Queue< ItemType >::RemoveTail (  )  [inherited]

Removes the item at the tail of the queue.

Returns:
B_NO_ERROR on success, B_ERROR if the queue was empty.

Definition at line 612 of file Queue.h.

Referenced by Queue< ItemType >::Clear(), Queue< ItemType >::EnsureSize(), Queue< ItemType >::RemoveAllInstancesOf(), and Queue< ItemType >::RemoveTail().

template<class ItemType>
status_t Queue< ItemType >::RemoveTail ( ItemType &  returnItem  )  [inherited]

Removes the item at the tail of the queue and places it into (returnItem).

Parameters:
returnItem On success, the removed item is copied into this object.
Returns:
B_NO_ERROR on success, B_ERROR if the queue was empty

Definition at line 602 of file Queue.h.

References Queue< ItemType >::RemoveTail().

template<class ItemType>
status_t Queue< ItemType >::RemoveItemAt ( uint32  index  )  [inherited]

Removes the item at the (index)'th position in the queue.

Parameters:
index Which item to remove--can range from zero (head of the queue) to GetNumItems()-1 (tail of the queue).
Returns:
B_NO_ERROR on success, B_ERROR on failure (i.e. bad index) Note that this method is somewhat inefficient for indices that aren't at the head or tail of the queue (i.e. O(n) time)

Definition at line 645 of file Queue.h.

Referenced by Queue< ItemType >::RemoveFirstInstanceOf(), Queue< ItemType >::RemoveItemAt(), and Queue< ItemType >::RemoveLastInstanceOf().

template<class ItemType>
status_t Queue< ItemType >::RemoveItemAt ( uint32  index,
ItemType &  returnItem 
) [inherited]

Removes the item at the (index)'th position in the queue, and copies it into (returnItem).

Parameters:
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.
Returns:
B_NO_ERROR on success, B_ERROR on failure (i.e. bad index)

Definition at line 635 of file Queue.h.

References Queue< ItemType >::RemoveItemAt().

template<class ItemType>
status_t Queue< ItemType >::GetItemAt ( uint32  index,
ItemType &  returnItem 
) const [inherited]

Copies the (index)'th item into (returnItem).

Parameters:
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.
Returns:
B_NO_ERROR on success, B_ERROR on failure (e.g. bad index)

Definition at line 625 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().

template<class ItemType>
ItemType * Queue< ItemType >::GetItemAt ( uint32  index  )  const [inherited]

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!

Parameters:
index Index of the item to return a pointer to.
Returns:
a pointer to the internally held item, or NULL if (index) was invalid.

Definition at line 486 of file Queue.h.

template<class ItemType>
status_t Queue< ItemType >::ReplaceItemAt ( uint32  index,
const ItemType &  newItem = ItemType() 
) [inherited]

Replaces the (index)'th item in the queue with (newItem).

Parameters:
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.
Returns:
B_NO_ERROR on success, B_ERROR on failure (e.g. bad index)

Definition at line 685 of file Queue.h.

Referenced by Queue< ItemType >::InsertItemAt(), and Queue< ItemType >::Swap().

template<class ItemType>
status_t Queue< ItemType >::InsertItemAt ( uint32  index,
const ItemType &  newItem = ItemType() 
) [inherited]

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.

Parameters:
index The position at which to insert the new item.
newItem The item to insert into the queue.
Returns:
B_NO_ERROR on success, B_ERROR on failure (i.e. bad index).

Definition at line 695 of file Queue.h.

References Queue< ItemType >::AddHead(), Queue< ItemType >::AddTail(), Queue< ItemType >::GetItemAt(), and Queue< ItemType >::ReplaceItemAt().

template<class ItemType>
status_t Queue< ItemType >::InsertItemsAt ( uint32  index,
const Queue< ItemType > &  queue,
uint32  startIndex = 0,
uint32  numNewItems = MUSCLE_NO_LIMIT 
) [inherited]

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

Parameters:
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.
Returns:
B_NO_ERROR on success, B_ERROR on failure (out of memory)

Definition at line 721 of file Queue.h.

References Queue< ItemType >::AddHead(), Queue< ItemType >::AddTail(), Queue< ItemType >::EnsureSize(), Queue< ItemType >::GetNumItems(), and Queue< ItemType >::Head().

template<class ItemType>
status_t Queue< ItemType >::InsertItemsAt ( uint32  index,
const ItemType *  items,
uint32  numNewItems 
) [inherited]

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

Parameters:
items Pointer to the items to insert into this queue.
numNewItems Number of items to insert.
Returns:
B_NO_ERROR on success, B_ERROR on failure (out of memory)

Definition at line 745 of file Queue.h.

References Queue< ItemType >::AddHead(), Queue< ItemType >::AddTail(), Queue< ItemType >::EnsureSize(), and Queue< ItemType >::GetNumItems().

template<class ItemType>
void Queue< ItemType >::Clear ( bool  releaseCachedBuffers = false  )  [inherited]

Removes all items from the queue.

Parameters:
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 768 of file Queue.h.

References Queue< ItemType >::RemoveTail().

template<class ItemType>
uint32 Queue< ItemType >::GetNumItems (  )  const [inline, inherited]

Returns the number of items in the queue.

(This number does not include pre-allocated space)

Definition at line 210 of file Queue.h.

Referenced by Queue< ItemType >::AddHead(), Queue< ItemType >::AddTail(), Queue< ItemType >::CopyFrom(), 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().

template<class ItemType>
uint32 Queue< ItemType >::GetNumAllocatedItemSlots (  )  const [inline, inherited]

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.

Definition at line 216 of file Queue.h.

template<class ItemType>
const ItemType& Queue< ItemType >::Head (  )  const [inline, inherited]

Returns a read-only reference the head item in the queue.

You must not call this when the queue is empty!

Definition at line 225 of file Queue.h.

Referenced by Queue< ItemType >::InsertItemsAt(), and Queue< Refef< AbstractReflectSession > >::StartsWith().

template<class ItemType>
ItemType& Queue< ItemType >::Head (  )  [inline, inherited]

Returns a writable reference the head item in the queue.

You must not call this when the queue is empty!

Definition at line 231 of file Queue.h.

template<class ItemType>
const ItemType& Queue< ItemType >::Tail (  )  const [inline, inherited]

Returns a read-only reference the tail item in the queue.

You must not call this when the queue is empty!

Definition at line 228 of file Queue.h.

Referenced by Queue< Refef< AbstractReflectSession > >::EndsWith().

template<class ItemType>
ItemType& Queue< ItemType >::Tail (  )  [inline, inherited]

Returns a writable reference the tail item in the queue.

You must not call this when the queue is empty!

Definition at line 234 of file Queue.h.

template<class ItemType>
ItemType* Queue< ItemType >::GetItemPointer ( uint32  index  )  const [inline, inherited]

Deprecated synonym for GetItemAt().

Don't call this method in new code, call GetItemAt() instead!

Deprecated:

Definition at line 251 of file Queue.h.

template<class ItemType>
status_t Queue< ItemType >::EnsureSize ( uint32  numSlots,
bool  setNumItems = false,
uint32  extraReallocItems = 0 
) [inherited]

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).

Parameters:
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.
Returns:
B_NO_ERROR on success, or B_ERROR on failure (out of memory)

Definition at line 783 of file Queue.h.

References Queue< ItemType >::GetItemAt(), and Queue< ItemType >::RemoveTail().

Referenced by Queue< ItemType >::AddHead(), Queue< ItemType >::AddTail(), Queue< ItemType >::CopyFrom(), Queue< ItemType >::InsertItemsAt(), and Queue< ItemType >::operator=().

template<class ItemType>
int32 Queue< ItemType >::IndexOf ( const ItemType &  item  )  const [inherited]

Returns the last index of the given (item), or -1 if (item) is not found in the list.

O(n) search time.

Parameters:
item The item to look for.
Returns:
The index of (item), or -1 if no such item is present.

Definition at line 829 of file Queue.h.

References Queue< ItemType >::GetItemAt(), and Queue< ItemType >::GetNumItems().

template<class ItemType>
void Queue< ItemType >::Swap ( uint32  fromIndex,
uint32  toIndex 
) [inherited]

Swaps the values of the two items at the given indices.

This operation will involve three copies of the held items.

Parameters:
fromIndex First index to swap.
toIndex Second index to swap.

Definition at line 839 of file Queue.h.

References Queue< ItemType >::GetItemAt(), and Queue< ItemType >::ReplaceItemAt().

Referenced by Queue< ItemType >::ReverseItemOrdering(), and Queue< ItemType >::Sort().

template<class ItemType>
void Queue< ItemType >::ReverseItemOrdering ( uint32  from = 0,
uint32  to = MUSCLE_NO_LIMIT 
) [inherited]

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)

Parameters:
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 885 of file Queue.h.

References Queue< ItemType >::GetNumItems(), and Queue< ItemType >::Swap().

template<class ItemType>
void Queue< ItemType >::Sort ( ItemCompareFunc  compareFunc,
uint32  from = 0,
uint32  to = MUSCLE_NO_LIMIT,
void *  optCookie = NULL 
) [inherited]

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).

Parameters:
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 849 of file Queue.h.

References Queue< ItemType >::GetItemAt(), Queue< ItemType >::GetNumItems(), and Queue< ItemType >::Swap().

template<class ItemType>
void Queue< ItemType >::SwapContents ( Queue< ItemType > &  that  )  [inherited]

Swaps our contents with the contents of (that), in an efficient manner.

Parameters:
that The queue whose contents are to be swapped with our own.

Definition at line 1085 of file Queue.h.

References Queue< ItemType >::_queue, Queue< ItemType >::_smallQueue, Queue< ItemType >::AddTail(), and Queue< ItemType >::GetNumItems().

template<class ItemType>
uint32 Queue< ItemType >::RemoveAllInstancesOf ( const ItemType &  val  )  [inherited]

Goes through the array and removes every item that is equal to (val).

Parameters:
val the item to look for and remove
Returns:
The number of instances of (val) that were found and removed during this operation.

Definition at line 918 of file Queue.h.

References Queue< ItemType >::GetNumItems(), and Queue< ItemType >::RemoveTail().

template<class ItemType>
status_t Queue< ItemType >::RemoveFirstInstanceOf ( const ItemType &  val  )  [inherited]

Goes through the array and removes the first item that is equal to (val).

Parameters:
val the item to look for and remove
Returns:
B_NO_ERROR if a matching item was found and removed, or B_ERROR if it wasn't found.

Definition at line 899 of file Queue.h.

References Queue< ItemType >::GetNumItems(), and Queue< ItemType >::RemoveItemAt().

template<class ItemType>
status_t Queue< ItemType >::RemoveLastInstanceOf ( const ItemType &  val  )  [inherited]

Goes through the array and removes the last item that is equal to (val).

Parameters:
val the item to look for and remove
Returns:
B_NO_ERROR if a matching item was found and removed, or B_ERROR if it wasn't found.

Definition at line 909 of file Queue.h.

References Queue< ItemType >::GetNumItems(), and Queue< ItemType >::RemoveItemAt().

template<class ItemType>
ItemType* Queue< ItemType >::GetArrayPointer ( uint32  whichArray,
uint32 &  retLength 
) [inline, inherited]

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.

Parameters:
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.
Returns:
Pointer to the first item in the sub-array on success, or NULL on failure. Note that this array is only guaranteed valid as long as no items are added or removed from the Queue.

Definition at line 371 of file Queue.h.

template<class ItemType>
void Queue< ItemType >::Normalize (  )  [inherited]

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)

Definition at line 1170 of file Queue.h.

void RefCountable::IncrementRefCount (  )  const [inline, inherited]

Increments the counter and returns true iff the new value is zero.

Thread safe.

Definition at line 32 of file RefCount.h.

References AtomicCounter::AtomicIncrement().

bool RefCountable::DecrementRefCount (  )  const [inline, inherited]

Decrements the counter and returns true iff the new value is zero.

Thread safe.

Definition at line 35 of file RefCount.h.

References AtomicCounter::AtomicDecrement().

void RefCountable::SetManager ( AbstractObjectManager manager  )  [inline, inherited]

Sets the recycle-pointer for this object.

If set to non-NULL, this pointer is used by the ObjectPool class to recycle this object when it is no longer in use, so as to avoid the overhead of having to delete it and re-create it later on. The RefCountable class itself does nothing with this pointer. Default value is NULL.

Parameters:
manager Pointer to the new manager object to use, or NULL to use no manager.

Definition at line 44 of file RefCount.h.

uint32 RefCountable::GetRefCount (  )  const [inline, inherited]

Returns this object's current reference count.

Note that the value returned by this method is volatile in multithreaded environments, so it may already be wrong by the time it is returned. Be careful!

Definition at line 54 of file RefCount.h.

References AtomicCounter::GetCount().


The documentation for this class was generated from the following file:
Generated on Thu Jun 5 17:48:40 2008 for MUSCLE by  doxygen 1.5.1