aimstil  5.0.5
til::SmartObject Class Reference

Base class for all classes needing reference counting based garbage collection. More...

#include <til/SmartObject.h>

Inheritance diagram for til::SmartObject:

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SmartObject()

til::SmartObject::SmartObject ( void  )
inline

Default constructor.

By default, reference count is zero and lock is off

Definition at line 32 of file SmartObject.h.

◆ ~SmartObject()

virtual til::SmartObject::~SmartObject ( )
inlinevirtual

Destructor Do nothing special.

I mean, nothing at all.

Definition at line 43 of file SmartObject.h.

Member Function Documentation

◆ getReferenceCount()

int til::SmartObject::getReferenceCount ( void  )
inline

Get the number of pointers that have registered to this object.

Definition at line 75 of file SmartObject.h.

◆ lock()

void til::SmartObject::lock ( )
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.

◆ subscribe()

void til::SmartObject::subscribe ( void  )
inline

Register to this object.

(unfortunately, register is a reserved word :( Basically increase the reference count

Definition at line 55 of file SmartObject.h.

◆ unlock()

void til::SmartObject::unlock ( )
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.

◆ unsubscribe()

void til::SmartObject::unsubscribe ( void  )
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.


The documentation for this class was generated from the following file: