![]() |
Public API Reference |
#include <parray.h>
Public Methods | |
csPArray (int ilimit=0, int ithreshold=0) | |
Initialize object to hold initially 'ilimit' elements, and increase storage by 'ithreshold' each time the upper bound is exceeded. More... | |
void | DeleteAll () |
Clear entire vector. More... | |
~csPArray () | |
Destroy the container. More... | |
void | TransferTo (csPArray< T > &destination) |
Transfer the entire contents of one array to the other. More... | |
void | SetLength (int n) |
Set vector length to n. More... | |
int | Length () const |
Query vector length. More... | |
int | Limit () const |
Query vector limit. More... | |
T * | Get (int n) const |
Get a pointer. More... | |
const T *& | operator[] (int n) const |
Get a const reference. More... | |
T *& | operator[] (int n) |
Get a reference. More... | |
int | Find (T *which) const |
Find a element in array and return its index (or -1 if not found). More... | |
int | Push (T *what) |
Push a element on 'top' of vector. More... | |
int | PushSmart (T *what) |
Push a element on 'top' of vector if it is not already there. More... | |
T * | Pop () |
Pop an element from vector 'top'. More... | |
T * | Top () const |
Return the top element but don't remove it. More... | |
bool | Delete (int n) |
Delete element number 'n' from vector. More... | |
bool | Delete (T *item) |
Delete the given element from vector. More... | |
bool | Insert (int n, T *item) |
Insert element 'Item' before element 'n'. More... | |
int | FindSortedKey (void *key, csArrayCompareKeyFunction *comparekey) const |
Find an element based on some key. More... | |
int | InsertSorted (T *item, csArrayCompareFunction *compare) |
Insert an element at a sorted position. More... |
No ref counting is done on the elements in this array. Use csRefArray if you want ref counting to happen. Note that in many cases you probably want to use csRefArray instead of csPArray. If you want elements to be deleted (with 'delete') you can use csPDelArray instead of this one. Warning! This array doesn't initializate the pointer to NULL for new elements in the array. You have to do that on your own.
Definition at line 38 of file parray.h.
|
Initialize object to hold initially 'ilimit' elements, and increase storage by 'ithreshold' each time the upper bound is exceeded.
|
|
Destroy the container.
|
|
Delete the given element from vector.
|
|
Delete element number 'n' from vector.
Definition at line 191 of file parray.h. Referenced by csPArray< iMovable >::Delete. |
|
Clear entire vector.
Definition at line 63 of file parray.h. Referenced by csPArray< iMovable >::SetLength, csPArray< iMovable >::TransferTo, and csPArray< iMovable >::~csPArray. |
|
Find a element in array and return its index (or -1 if not found).
Definition at line 152 of file parray.h. Referenced by csPArray< iMovable >::Delete, and csPArray< iMovable >::PushSmart. |
|
Find an element based on some key.
|
|
Get a pointer.
|
|
Insert element 'Item' before element 'n'.
Definition at line 217 of file parray.h. Referenced by csPArray< iMovable >::InsertSorted. |
|
Insert an element at a sorted position. Assumes array is already sorted. |
|
Query vector length.
Definition at line 117 of file parray.h. Referenced by csPArray< iMovable >::Find, csPArray< iMovable >::FindSortedKey, csObjectWatcher::GetWatchedLightCount, csObjectWatcher::GetWatchedMovableCount, and csPArray< iMovable >::InsertSorted. |
|
Query vector limit.
|
|
Get a reference.
|
|
Get a const reference.
|
|
Pop an element from vector 'top'.
|
|
Push a element on 'top' of vector.
Definition at line 162 of file parray.h. Referenced by csPArray< iMovable >::PushSmart. |
|
Push a element on 'top' of vector if it is not already there.
|
|
Set vector length to n.
Definition at line 99 of file parray.h. Referenced by csPArray< iMovable >::Delete, csPArray< iMovable >::Insert, csPArray< iMovable >::operator[], csPArray< iMovable >::Pop, and csPArray< iMovable >::Push. |
|
Return the top element but don't remove it.
|
|
Transfer the entire contents of one array to the other. The end result will be that this array will be completely empty and the other array will have all items that originally were in this array. This operation is very efficient. |