Provides a reference counting base class. More...
#include <ObjectCounter.h>
Public Member Functions | |
ObjectCounter () | |
ObjectCounter * | alias () |
void | free () |
virtual | ~ObjectCounter () |
Provides a reference counting base class.
The class counts the number of references to itself and destroys itself when the count goes to zero. Subclasses should be manipulated as follows: class CountedClass : public ObjectCounter { ... } CountedClass *x = new CountedClass(...); CountedClass *y = (CountedClass *) x->alias(); x->free(); y->free(); To avoid forcing the case on alias(), define an alias() in the subclass which does the cast for you.
ObjectCounter::ObjectCounter | ( | ) | [inline] |
virtual ObjectCounter::~ObjectCounter | ( | ) | [inline, virtual] |
ObjectCounter* ObjectCounter::alias | ( | ) | [inline] |
Reimplemented in BBoxList, GridBoxList, GridUnitList, and GridDataBucketVoid.
Referenced by GridDataBucketVoid::alias().
void ObjectCounter::free | ( | ) | [inline] |
Referenced by GridTableGhostRcv::rcv_update(), GridTableDataRcv::rcv_update(), and GridTable::send().