.TH "shevek::crefbase" 3 "Wed Jul 9 2014" "libshevek" \" -*- nroff -*- .ad l .nh .SH NAME shevek::crefbase \- .PP Circular-dependancy-protected reference-counting object base class\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "void \fBinit_done\fP (int code=0)" .br .RI "\fIAfter calling this, the object is destroyed without references\&. \fP" .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static int \fBset_default_tag\fP (int tag)" .br .RI "\fISet the default tag for when init_done is called\&. \fP" .ti -1c .RI "static void \fBcheck\fP (bool fatal=true)" .br .RI "\fICheck if all objects have called init_done\&. \fP" .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "\fBcrefbase\fP ()" .br .RI "\fIConstructor, which is called when an object is created\&. \fP" .ti -1c .RI "virtual \fB~crefbase\fP ()" .br .RI "\fIVirtual destructor, which does nothing except allowing derived class to have a virtual destructor\&. \fP" .in -1c .SS "Friends" .in +1c .ti -1c .RI "template class \fBcrefptr\fP" .br .in -1c .SH "Detailed Description" .PP Circular-dependancy-protected reference-counting object base class\&. Objects which derive from this class are reference-counted in a way that detects dependency loops and destroys the entire loop when it is no longer externally referenced\&. For this, it is important that objects which contain pointers register them appropriately\&. .SH "Member Function Documentation" .PP .SS "static void shevek::crefbase::check (boolfatal = \fCtrue\fP)\fC [inline]\fP, \fC [static]\fP" .PP Check if all objects have called init_done\&. When debugging is enabled, this function checks for all objects if they have called init_done\&. When debugging is not enabled, no list of objects is kept, and this check does nothing\&. .SS "void shevek::crefbase::init_done (intcode = \fC0\fP)\fC [inline]\fP" .PP After calling this, the object is destroyed without references\&. On creation, an object does not have any references\&. To prevent immediate destruction, it is first in an initialisation phase\&. During that phase, it will not be destroyed, even if it has no references\&. This function should be called immeiately after creating the object (normally through \fBcrefptr::init\fP): \fBshevek::crefptr\fP bar = foo::create ()\&.init (); If code is not given or 0, the default tag (set with set_default_tag) will be used\&. .SS "static int shevek::crefbase::set_default_tag (inttag)\fC [inline]\fP, \fC [static]\fP" .PP Set the default tag for when init_done is called\&. If the tag is not set to 1, a message will be printed to standard error on destruction\&. The previous tag is returned\&. If tag is set to 0, the old value is not changed\&. The initial default value is 1\&. .SH "Author" .PP Generated automatically by Doxygen for libshevek from the source code\&.