CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

csRefArray Class Template Reference

An array of smart pointers. More...

#include <refarr.h>

Inheritance diagram for csRefArray:

csRefArrayObject List of all members.

Public Methods

 csRefArray (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 TransferTo (csRefArray< T > &destination)
 Transfer the entire contents of one array to the other. More...

void DeleteAll ()
 Clear entire vector. More...

 ~csRefArray ()
 Destroy the container and release all contained references. 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...

const csRef< T > & Get (int n) const
 Get a const reference. More...

const csRef< T > & operator[] (int n) const
 Get a const reference. More...

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

csPtr< 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, ArrayCompareKeyFunction *comparekey) const
 Find an element based on some key. More...

int InsertSorted (T *item, ArrayCompareFunction *compare)
 Insert an element at a sorted position. More...

void QuickSort (ArrayCompareFunction *compare)
 Same but for all elements. More...

void QuickSort (int Left, int Right, ArrayCompareFunction *compare)
 Partially sort the array. More...


Detailed Description

template<class T>
class csRefArray< T >

An array of smart pointers.

Definition at line 29 of file refarr.h.


Constructor & Destructor Documentation

template<class T>
csRefArray< T >::csRefArray (  int    ilimit = 0,
int    ithreshold = 0
)  [inline]
 

Initialize object to hold initially 'ilimit' elements, and increase storage by 'ithreshold' each time the upper bound is exceeded.

Definition at line 43 of file refarr.h.

template<class T>
csRefArray< T >::~csRefArray (    )  [inline]
 

Destroy the container and release all contained references.

Definition at line 90 of file refarr.h.


Member Function Documentation

template<class T>
bool csRefArray< T >::Delete (  T *    item )  [inline]
 

Delete the given element from vector.

Definition at line 223 of file refarr.h.

template<class T>
bool csRefArray< T >::Delete (  int    n )  [inline]
 

Delete element number 'n' from vector.

Definition at line 200 of file refarr.h.

Referenced by csRefArray< iCameraPosition >::Delete, csObjectWatcher::RemoveListener, and csObjectModel::RemoveListener.

template<class T>
void csRefArray< T >::DeleteAll (    )  [inline]
 

Clear entire vector.

Definition at line 74 of file refarr.h.

Referenced by csShadowBlock::DeleteShadows, csRefArray< iCameraPosition >::SetLength, csRefArray< iCameraPosition >::TransferTo, and csRefArray< iCameraPosition >::~csRefArray.

template<class T>
int csRefArray< T >::Find (  T *    which )  const [inline]
 

Find a element in array and return its index (or -1 if not found).

Definition at line 161 of file refarr.h.

Referenced by csRefArray< iCameraPosition >::Delete, csRefArray< iCameraPosition >::PushSmart, and csObjectModel::RemoveListener.

template<class T>
int csRefArray< T >::FindSortedKey (  void *    key,
ArrayCompareKeyFunction *    comparekey
)  const [inline]
 

Find an element based on some key.

Definition at line 257 of file refarr.h.

template<class T>
const csRef<T>& csRefArray< T >::Get (  int    n )  const [inline]
 

Get a const reference.

Definition at line 138 of file refarr.h.

Referenced by csSectorList::Get, csMeshFactoryList::Get, csMeshList::Get, and csLightList::Get.

template<class T>
bool csRefArray< T >::Insert (  int    n,
T *    item
)  [inline]
 

Insert element 'Item' before element 'n'.

Definition at line 231 of file refarr.h.

Referenced by csRefArray< iCameraPosition >::InsertSorted.

template<class T>
int csRefArray< T >::InsertSorted (  T *    item,
ArrayCompareFunction *    compare
)  [inline]
 

Insert an element at a sorted position.

Assumes array is already sorted.

Definition at line 279 of file refarr.h.

template<class T>
int csRefArray< T >::Length (    )  const [inline]
 

Query vector length.

Definition at line 126 of file refarr.h.

Referenced by csRefArray< iCameraPosition >::Find, csRefArray< iCameraPosition >::FindSortedKey, csObjectModel::FireListeners, csSectorList::GetCount, csMeshFactoryList::GetCount, csMeshList::GetCount, csLightList::GetCount, csCollection::GetObjectCount, csShadowBlock::GetShadow, csShadowBlock::GetShadowCount, csRefArray< iCameraPosition >::InsertSorted, and csShadowBlock::Transform.

template<class T>
int csRefArray< T >::Limit (    )  const [inline]
 

Query vector limit.

Definition at line 132 of file refarr.h.

template<class T>
csRef<T>& csRefArray< T >::operator[] (  int    n )  [inline]
 

Get a reference.

Definition at line 152 of file refarr.h.

template<class T>
const csRef<T>& csRefArray< T >::operator[] (  int    n )  const [inline]
 

Get a const reference.

Definition at line 145 of file refarr.h.

template<class T>
csPtr<T> csRefArray< T >::Pop (    )  [inline]
 

Pop an element from vector 'top'.

Definition at line 186 of file refarr.h.

template<class T>
int csRefArray< T >::Push (  T *    what )  [inline]
 

Push a element on 'top' of vector.

Definition at line 171 of file refarr.h.

Referenced by csObjectWatcher::AddListener, csObjectModel::AddListener, csCollection::AddObject, csRefArray< iCameraPosition >::PushSmart, and csMeshWrapper::SetDrawCallback.

template<class T>
int csRefArray< T >::PushSmart (  T *    what )  [inline]
 

Push a element on 'top' of vector if it is not already there.

Definition at line 179 of file refarr.h.

template<class T>
void csRefArray< T >::QuickSort (  int    Left,
int    Right,
ArrayCompareFunction *    compare
)  [inline]
 

Partially sort the array.

Definition at line 311 of file refarr.h.

template<class T>
void csRefArray< T >::QuickSort (  ArrayCompareFunction *    compare )  [inline]
 

Same but for all elements.

Definition at line 304 of file refarr.h.

Referenced by csRefArray< iCameraPosition >::QuickSort.

template<class T>
void csRefArray< T >::SetLength (  int    n )  [inline]
 

Set vector length to n.

Definition at line 96 of file refarr.h.

Referenced by csRefArray< iCameraPosition >::Delete, csRefArray< iCameraPosition >::Insert, csRefArray< iCameraPosition >::operator[], csRefArray< iCameraPosition >::Pop, and csRefArray< iCameraPosition >::Push.

template<class T>
T* csRefArray< T >::Top (    )  const [inline]
 

Return the top element but don't remove it.

Definition at line 194 of file refarr.h.

template<class T>
void csRefArray< T >::TransferTo (  csRefArray< T > &    destination )  [inline]
 

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.

Definition at line 60 of file refarr.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14