![]() |
Public API Reference |
#include <parray.h>
Public Methods | |
csPDelArray (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... | |
~csPDelArray () | |
Destroy the container. More... | |
void | TransferTo (csPDelArray< 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... | |
T * | operator[] (int n) const |
Get a pointer. More... | |
void | Put (int n, T *ptr) |
Put a pointer. 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... | |
T * | GetAndClear (int n) |
Get and clear the element 'n' from vector. More... | |
T * | Extract (int n) |
Extract element number 'n' from vector. 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. This array will delete elements (using 'delete') as needed. This array properly initializes new elements in the array to NULL.
Definition at line 292 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 503 of file parray.h. Referenced by csPDelArray< csPluginOption >::Delete. |
|
Clear entire vector.
Definition at line 317 of file parray.h. Referenced by csPDelArray< csPluginOption >::SetLength, csPDelArray< csPluginOption >::TransferTo, and csPDelArray< csPluginOption >::~csPDelArray. |
|
Extract element number 'n' from vector. The element is deleted from the array and returned. You are responsible for deleting the pointer later. Definition at line 484 of file parray.h. Referenced by csPDelArray< csPluginOption >::Delete. |
|
Find a element in array and return its index (or -1 if not found).
Definition at line 424 of file parray.h. Referenced by csPDelArray< csPluginOption >::Delete, and csPDelArray< csPluginOption >::PushSmart. |
|
Find an element based on some key.
|
|
Get a pointer.
Definition at line 400 of file parray.h. Referenced by csAnimationTemplate::GetFrame. |
|
Get and clear the element 'n' from vector. This spot in the array will be set to NULL. You are responsible for deleting the returned pointer later. |
|
Insert element 'Item' before element 'n'.
Definition at line 526 of file parray.h. Referenced by csPDelArray< csPluginOption >::InsertSorted. |
|
Insert an element at a sorted position. Assumes array is already sorted. |
|
Query vector length.
Definition at line 388 of file parray.h. Referenced by csObjectPool::Alloc, csPDelArray< csPluginOption >::Find, csPDelArray< csPluginOption >::FindSortedKey, csAnimationTemplate::GetFrameCount, and csPDelArray< csPluginOption >::InsertSorted. |
|
Query vector limit.
|
|
Get a pointer.
|
|
Pop an element from vector 'top'. You are responsible for deleting the object later. Definition at line 452 of file parray.h. Referenced by csObjectPool::Alloc. |
|
Push a element on 'top' of vector.
Definition at line 434 of file parray.h. Referenced by csAnimationTemplate::AddFrame, csObjectPool::Free, and csPDelArray< csPluginOption >::PushSmart. |
|
Push a element on 'top' of vector if it is not already there.
|
|
Put a pointer.
|
|
Set vector length to n.
Definition at line 356 of file parray.h. Referenced by csPDelArray< csPluginOption >::Extract, csPDelArray< csPluginOption >::Insert, csPDelArray< csPluginOption >::Pop, csPDelArray< csPluginOption >::Push, and csPDelArray< csPluginOption >::Put. |
|
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. |