OpenCurves
0.9
|
A base class for adding reference counting to a class. More...
#include <refcountobject.h>
Public Member Functions | |
RefCountObject () | |
Constructor, setting a zero reference count. | |
RefCountObject (int initialCount) | |
Constructor, setting the given initial reference count. More... | |
int | referenceCount () const |
Access the current reference count. More... | |
int | addReference () |
Increment and return the reference count. More... | |
int | decReference () |
Decrement the reference count. More... | |
A base class for adding reference counting to a class.
Usage: derive this class, using the derived class as the template type. For example:
Call addReference()
and decReference()
to adjust the reference count. A call to decReference()
may immediately delete the object when the decremented reference count is zero or less.
|
inline |
Constructor, setting the given initial reference count.
initialCount | The initial reference count. |
|
inline |
Increment and return the reference count.
int plotutil::RefCountObject< T >::decReference | ( | ) |
Decrement the reference count.
The object is deleted if this results in a zero or negative reference count.
|
inline |
Access the current reference count.