[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Crystal Space currently has several styles of typed Arrays. These arrays grow as needed to accommodate additions and insertions.
csArray<T>
: This is a generic, all-purpose dynamic array class. It is
suitable for any C++ type, including basic types (such as `int') and
user-defined types (such as objects). This class guarantees proper
construction and destruction of objects as they are added to, and removed from
the array. Include file is `csutil/array.h'.
csDirtyAccessArray<T>
: Similar to csArray<T>
, this array type can
be used to store arbitrary objects, with the exception that it does not
invoke constructors and destructors of contained objects. Use this class at
your own peril; csArray<T>
is almost always a better choice. The only
conceivable instance in which use of this class might be warranted is when
micro-optimization is required; when you need to avoid the overhead of object
construction, but this is highly dangerous and should be avoided in almost all
cases. This class is mainly useful in cases where you have simple objects
(structures) and efficiency is of utmost importance. Also, this array provides
read access to the actual memory vector, which can be useful if you need to
communicate with some external API. Include file is
`csutil/garray.h'.
csRefArray<T>
: This is the preferred way to store an array of pointers
to reference-counted objects. This array type automatically invokes each
object's IncRef()
method at insertion time, and DecRef()
at
removal time. All SCF objects (see section 6.3 Shared Class Facility (SCF)) support these methods, as do
objects derived from csRefCount
. Since csRefArray<T>
is a
templated class, it will also work with any other object which provides
IncRef()
and DecRef()
methods. Include file is
`csutil/refarr.h'.
csRefArrayObject<T>
: This is a variant of csRefArray<T>
which can
hold objects that have a method QueryObject()
which returns something
from which you can call GetName()
. In practice it means this is useful
for all Crystal Space objects that implement iObject
. In addition to
the features of csRefArray<T>
this class adds the ability to find
elements by name. Include file is `csutil/nobjvec.h'.
csPDelArray<T>
: This is an array class for
pointers only. It will invoke `delete' for elements removed from the
array. Include file is
`csutil/parray.h'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |