[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Typed Vectors
Typed vectors are the type-safe equivalent to the csVector
class. They
work similar to templates, but use #define
's instead. Using one of
these macros, you can create a vector class for a specific type of objects.
There are several different macros which produce slightly different
behaviour:
CS_DECLARE_TYPED_VECTOR
csVector
. Objects which are removed with the DeleteIt
parameter
set to true
, or objects left in the vector at destruction are deleted
with the delete
operator.
CS_DECLARE_TYPED_VECTOR_NODELETE
CS_DECLARE_TYPED_VECTOR_DECREF
iBase
and
DecRef()
is called.
CS_DECLARE_TYPED_RESTRICTED_ACCESS_VECTOR
operator[]
), but only by real methods.
For every added object, PrepareItem()
is called; for every removed
object, FreeItem()
is called. This time it really applies to
every object, since there is no DeleteIt
parameter for methods
that can remove elements.
CS_DECLARE_TYPED_IBASE_VECTOR
In addition, so-called object vectors are provided. They are specially
suited to contain objects of type csObject
and add special methods,
for example to find an object by name. These macros are:
CS_DECLARE_OBJECT_VECTOR_NOREF(NAME,TYPE)
CS_DECLARE_TYPED_VECTOR_NODELETE
.
CS_DECLARE_RESTRICTED_ACCESS_OBJECT_VECTOR(NAME,TYPE)
CS_DECLARE_TYPED_RESTRICTED_ACCESS_VECTOR
.
CS_DECLARE_OBJECT_VECTOR(NAME,TYPE)
CS_DECLARE_TYPED_IBASE_VECTOR
.