CrystalSpace

Public API Reference

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

csGrowingArray Class Template Reference

An automatically growing array of objects. More...

#include <garray.h>

List of all members.

Public Methods

 csGrowingArray (int ilimit=0, int ithreshold=0, int ishrinklimit=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...

 ~csGrowingArray ()
 Destroy the container. More...

void SetLimit (int inlimit)
 Set maximum size of array. 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 * GetArray ()
 Get the pointer to the start of the array. More...

const T * GetArray () const
 Get the pointer to the start of the array. More...

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

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

T & operator[] (int n)
 Get a reference. More...

int Push (const T &what)
 Push a element on 'top' of vector. More...

int PushSmart (const T &what)
 Push a element on 'top' of vector if it is not already there. More...

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 Insert (int n, const T &item)
 Insert element 'Item' before element 'n'. More...


Detailed Description

template<class T>
class csGrowingArray< T >

An automatically growing array of objects.

Warning! Do NOT use this for objects that require a constructor. Do not use this for pointers. For normal pointers you should use csPArray and for reference counted pointers you should use csRefArray instead of this class.

Definition at line 35 of file garray.h.


Constructor & Destructor Documentation

template<class T>
csGrowingArray< T >::csGrowingArray int    ilimit = 0,
int    ithreshold = 0,
int    ishrinklimit = 0
[inline]
 

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

Definition at line 48 of file garray.h.

template<class T>
csGrowingArray< T >::~csGrowingArray   [inline]
 

Destroy the container.

Definition at line 78 of file garray.h.


Member Function Documentation

template<class T>
bool csGrowingArray< T >::Delete int    n [inline]
 

Delete element number 'n' from vector.

Definition at line 189 of file garray.h.

template<class T>
void csGrowingArray< T >::DeleteAll   [inline]
 

Clear entire vector.

Definition at line 64 of file garray.h.

Referenced by csGrowingArray< Listener >::~csGrowingArray.

template<class T>
const T& csGrowingArray< T >::Get int    n const [inline]
 

Get a const reference.

Definition at line 137 of file garray.h.

template<class T>
const T* csGrowingArray< T >::GetArray   const [inline]
 

Get the pointer to the start of the array.

Definition at line 131 of file garray.h.

template<class T>
T* csGrowingArray< T >::GetArray   [inline]
 

Get the pointer to the start of the array.

Definition at line 125 of file garray.h.

Referenced by csTriangleMesh::GetTriangles.

template<class T>
bool csGrowingArray< T >::Insert int    n,
const T &    item
[inline]
 

Insert element 'Item' before element 'n'.

Definition at line 207 of file garray.h.

template<class T>
int csGrowingArray< T >::Length   const [inline]
 

Query vector length.

Definition at line 113 of file garray.h.

Referenced by csTriangleMesh::GetTriangleCount.

template<class T>
int csGrowingArray< T >::Limit   const [inline]
 

Query vector limit.

Definition at line 119 of file garray.h.

template<class T>
T& csGrowingArray< T >::operator[] int    n [inline]
 

Get a reference.

Definition at line 151 of file garray.h.

template<class T>
const T& csGrowingArray< T >::operator[] int    n const [inline]
 

Get a const reference.

Definition at line 144 of file garray.h.

template<class T>
T csGrowingArray< T >::Pop   [inline]
 

Pop an element from vector 'top'.

Definition at line 175 of file garray.h.

template<class T>
int csGrowingArray< T >::Push const T &    what [inline]
 

Push a element on 'top' of vector.

Definition at line 160 of file garray.h.

Referenced by csGrowingArray< Listener >::PushSmart.

template<class T>
int csGrowingArray< T >::PushSmart const T &    what [inline]
 

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

Definition at line 168 of file garray.h.

template<class T>
void csGrowingArray< T >::SetLength int    n [inline]
 

Set vector length to n.

Definition at line 104 of file garray.h.

Referenced by csGrowingArray< Listener >::Delete, csGrowingArray< Listener >::Insert, csGrowingArray< Listener >::operator[], csGrowingArray< Listener >::Pop, and csGrowingArray< Listener >::Push.

template<class T>
void csGrowingArray< T >::SetLimit int    inlimit [inline]
 

Set maximum size of array.

Definition at line 94 of file garray.h.

Referenced by csGrowingArray< Listener >::SetLength.

template<class T>
T& csGrowingArray< T >::Top   const [inline]
 

Return the top element but don't remove it.

Definition at line 183 of file garray.h.


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