[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
csObject
The csObject
class can be used to build object hierarchies. It supports
building a simple tree structure. To use this functionality, you should derive
your classes from csObject
. csObject
implements the
iObject
interface and can store any number of iObject
children.
Furthermore, every csObject
has a name.
All child objects are IncRef
'ed when added and DecRef
'ed when
removed. An object also stores a pointer to its parent (which is not
reference-counted to avoid circular references). Note that this pointer will
always point to the last parent if the object is added to more than one
parent. When the object is removed from a parent, the pointer is set to
NULL
, even if the object is still a child of another parent!
Although the children of an object are only available as iObject
's,
you can use SCF_QUERY_INTERFACE
to query other interfaces from them.
Some convenience macros are also available:
CS_GET_CHILD_OBJECT(object,Interface)
CS_GET_NAMED_CHILD_OBJECT(object,Interface,name)
CS_GET_FIRST_NAMED_CHILD_OBJECT(object,Interface,name)
NULL
is
returned). This is slightly faster.
SCF_DECLARE_FAST_INTERFACE
before using them. Note that all these
macros increase the reference count of the returned object by 1.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |