1 #ifndef TIL_SMARTOBJECT_H 2 #define TIL_SMARTOBJECT_H 35 std::cout <<
"SmartObj constr" << std::endl;
46 std::cout <<
"SmartObj destr" << std::endl;
59 std::cout <<
"Increase to " << m_refCount << std::endl;
69 std::cout <<
"Decrease to " << m_refCount - 1 << std::endl;
71 if ((--m_refCount == 0) && (!m_lock))
delete this;
83 void lock() { m_lock =
true; }
91 if (m_refCount==0)
delete this;
int getReferenceCount(void)
Get the number of pointers that have registered to this object.
void lock()
Disable garbage collection.
void unsubscribe(void)
Unregister to this object.
Belongs to package Box Do not include directly, include til/Box.h instead.
General macros, definitions and functions.
void unlock()
Re-enable garbage collection.
void subscribe(void)
Register to this object.
Base class for all classes needing reference counting based garbage collection.
virtual ~SmartObject()
Destructor Do nothing special.
SmartObject(void)
Default constructor.