namespace Akenti template This class implements a simple reference counting scheme that simplifies memory management
| | ref_ptr (T *pointee = NULL) Constructs a reference-count pointer |
| | ref_ptr (const ref_ptr& rhs) Constructs a shallow copy of this object |
| | operator= (const ref_ptr& rhs) Assignment operator |
| | ~ref_ptr () Destructor |
| | operator-> () const Accesses the wrapped pointer |
| | operator void* () const Overloads the void * pointer for conditional testsing |
| | get () const Returns the wrapped pointer |
This class implements a simple reference counting scheme
that simplifies memory management. The ref_ptr object contains
a reference to another object, (the wraped pointer) and a count of
how many places this ref_ptr is stored. One should avoid using
the wrapped pointer directly. More important, one should
never, and I mean never, hold a live reference to wrapped
pointer since that will invalidate the reference count in the ref pointer.
We do allow null pointers to be wrapped. But the
accesor methods throw exceptions when this pointer is null.
ref_ptr is defined using class templates, so that you can create a ref_ptr
to any class.
Most of the Akenti classes that represent data objects are implented as
a set of classes. There is a class that should be used for external
manipulation of the object and is implemented as a ref_ptr. There is a
class that holds the data members implements the methods.By convention
the implementation class names end in Impl.
Usage:
class AImpl{
f();
g();
}
ref_ptr aptr( new AImpl);
aptr->f();
aptr->g();
ref_ptr(const ref_ptr& rhs)
ref_ptr
~ref_ptr()
T* operator->() const
operator void*() const
T* get() const
alphabetic index hierarchy of classes
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de