Base class for all reference counted objects with built-in support for intrusive reference counting. More...
Public Member Functions | |
void | addRef () const |
Increments the reference count for this object. More... | |
void | release () const |
Decrements the reference count for this object. More... | |
int | refCount () const |
Returns the reference count for this object. More... | |
void | setRefCountZero () const |
Sets the ref count to zero, but DOES NOT delete the object. More... | |
Base class for all reference counted objects with built-in support for intrusive reference counting.
See Smart pointers for more information.
void cee::RefCountedObject::addRef | ( | ) | const |
Increments the reference count for this object.
Objects use a reference counting mechanism to ensure that the lifetime of the object includes the lifetime of references to it. You use addRef() to stabilize a copy of an interface pointer. It can also be called when the life of a cloned pointer must extend beyond the lifetime of the original pointer. The cloned pointer must be released by calling release().
int cee::RefCountedObject::refCount | ( | ) | const |
Returns the reference count for this object.
void cee::RefCountedObject::release | ( | ) | const |
Decrements the reference count for this object.
Call this method when you no longer need to use an interface pointer.
void cee::RefCountedObject::setRefCountZero | ( | ) | const |
Sets the ref count to zero, but DOES NOT delete the object.
After this call, the refCount would be zero and the object is in a similar state with regards to refCount as it was when it was created with the new operator.