aimstil
5.0.5
|
Base class for all classes needing reference counting based garbage collection. More...
#include <til/SmartObject.h>
Public Member Functions | |
SmartObject (void) | |
Default constructor. More... | |
virtual | ~SmartObject () |
Destructor Do nothing special. More... | |
void | subscribe (void) |
Register to this object. More... | |
void | unsubscribe (void) |
Unregister to this object. More... | |
int | getReferenceCount (void) |
Get the number of pointers that have registered to this object. More... | |
void | lock () |
Disable garbage collection. More... | |
void | unlock () |
Re-enable garbage collection. More... | |
Base class for all classes needing reference counting based garbage collection.
Use in conjunction with Ptr and ConstPtr.
Definition at line 25 of file SmartObject.h.
|
inline |
Default constructor.
By default, reference count is zero and lock is off
Definition at line 32 of file SmartObject.h.
|
inlinevirtual |
|
inline |
Get the number of pointers that have registered to this object.
Definition at line 75 of file SmartObject.h.
|
inline |
Disable garbage collection.
Prevents the object from being automatically deleted. Reference counting is still active though, in case one will unlock the object
Definition at line 83 of file SmartObject.h.
|
inline |
Register to this object.
(unfortunately, register is a reserved word :( Basically increase the reference count
Definition at line 55 of file SmartObject.h.
|
inline |
Re-enable garbage collection.
Note that if the reference count is null when re-enabling garbage collection, the object is immediately destroyed
Definition at line 88 of file SmartObject.h.
|
inline |
Unregister to this object.
Decrease the reference count, and delete this object if it falls to zero and if the lock is off
Definition at line 66 of file SmartObject.h.