#include <CNCL/Ref.h>
None
CNRefObj, CNRefNamed
CNPtr
This class is the base class for classes with reference counting.
Note: CNRef
is outside of CNCL's inheritance tree and is always
used as a further base class of its children, which are also derived
from CNObject
.
With the help of reference counting you can track all references to
instances of CNObject
.
See see section CNPtr -- Intelligent pointer to CNRefObjs and the file tRef.c
in directory
CNCL/lib/misc/test
for examples.
Constructors:
CNRef();
CNRef
provides:
void ref();
static void ref(CNRef* aRef);
ref()
. Calls aRef->ref()
, if
aRef
is non-NIL
.
void deref();
delete this;
! In this case you cannot
access this object any longer.
static void deref(CNRef* aRef);
deref()
. Calls aRef->deref()
, if
aRef
is non-NIL
.
unsigned long get_count() const;
static void set_debug(bool r, bool = FALSE);
r
is set to TRUE
, all calls to ref()
and
deref()
are logged and a respective message is output to
cerr
. The second parameter has no funcionality, yet.
static void decrease(CNRef* aRef);
aRef
is
non-NIL
, and does not delete aRef
, if the reference
counter equals to zero.
static void del(CNRef* aRef);
aRef
is non-NIL
and the reference counter greater than zero, and which
deletes aRef
, if the reference counter equals to 0.
Go to the first, previous, next, last section, table of contents.