#include <DynObj.h>
Public Member Functions | |
virtual DynObjType *docall | doGetType (const DynI **pself=0) const |
virtual int docall | doAddRef ()=0 |
virtual int docall | doRelease ()=0 |
virtual int docall | IncRef () |
virtual int docall | DecRef () |
It adds ref counting methods to the object: doAddRef, doRelease. On object creation, it is assumed that the internal ref counter is set to 1 (NOTE: not 0).
DynSharedI derives from DynObj (more fundamental) since a ref-counted object depends on a mechanism to delete itself (which DynObj provides).
The DynSharedC is a default implementation that implements the ref counting methods.
There are some other helpful classes:
virtual DynObjType* docall DynSharedI::doGetType | ( | const DynI ** | pself = 0 |
) | const [virtual] |
Returns type of this object. Each type that wants to make itself known should override this method. DynI knows its own type so we get the type without any lookup. It is faster and works without registration.
pself | allows fetching the actual 'this' used inside doGetType (from a side base, this will be different to the 'this' of the caller). |
Reimplemented from DynObj.
virtual int docall DynSharedI::doAddRef | ( | ) | [pure virtual] |
Increases the reference count of the object
virtual int docall DynSharedI::doRelease | ( | ) | [pure virtual] |
Decreares the reference count of the object and destroy if zero.
virtual int docall DynSharedI::IncRef | ( | ) | [inline, virtual] |