template <class T> class dynamic_ref_counter dynamic reference counter.
| | class_type Parent class type |
| | counter_type Static reference counter |
| | getCount () const Get the reference count |
| | getParent () const Get the parent class |
| | setParent (T* parent, bool array = false) Set the parent class |
| | dynamic_ref_counter (T* parent = 0, bool array = false) Constructor |
| | ~dynamic_ref_counter () Destructor |
| | dynamic_ref_counter (const dynamic_ref_counter& dref) Copy constructor |
| | dynamic_ref_counter (counter_type* sref) Copy constructor (from a static reference counter) |
| | operator= (const dynamic_ref_counter& dref) Assignment operator |
| | operator= (counter_type* sref) Assignment operator (from a static reference counter) |
| | operator* () const dereference operator (returns parent) |
| | operator-> () const member access operator (returns parent) |
A templated reference counter. This counter maintains a pointer to a static reference counter. The counter value is initialized with one and is increased everytime the counter is copied and decreased everytime the counter is destroyed.Example:
// class which manages a shared floating point array class container { float* fData; // must be before reference counter! dynamic_ref_counter<float> fRef; public: container (int size) : fData (new float[size]), fRef (fData, true) {} ... }; // This is all what is needed to implement reference counting on // the data array. The user does not have to implement a // destructor, a copy costructor nor assignment operator. // Because of the reference counter, the above example class // implements a "shared" copy paradigm and destroyes the // data automatically when no longer needed.
typedef static_ref_counter <T> counter_type
int getCount() const
T* getParent() const
void setParent(T* parent, bool array = false)
explicit dynamic_ref_counter(T* parent = 0, bool array = false)
~dynamic_ref_counter()
dynamic_ref_counter(const dynamic_ref_counter& dref)
dynamic_ref_counter(counter_type* sref)
dynamic_ref_counter& operator= (const dynamic_ref_counter& dref)
dynamic_ref_counter& operator= (counter_type* sref)
T& operator*() const
T* operator->() const
alphabetic index hierarchy of classes
Please send questions and comments to zweizig_j@ligo.caltech.edu
generated by doc++