casa
$Rev:20696$
|
Internal representation for CountedPtr
More...
#include <CountedPtr.h>
Protected Member Functions | |
PtrRep (t *v) | |
This constructor sets up the reference count to one and initializes the pointer to the real data. | |
PtrRep (t *v, Bool delit) | |
void | freeVal () |
This deletes the real data if indeed it can be deleted. | |
~PtrRep () | |
This destructor uses the deletable flag to indicate if the real data should be freed or not. | |
Private Attributes | |
t * | val |
unsigned int | count |
Bool | deletable |
Friends | |
class | SimpleCountedPtr< t > |
class | SimpleCountedConstPtr< t > |
class | CountedPtr< t > |
class | CountedConstPtr< t > |
Internal representation for CountedPtr
Internal
This class is a utility class for CountedConstPtr and CountedPtr . It stores the reference count and the pointer to the real data.
Tip: It is currently a template and is used such that t
is the true type of the stored pointer; This means, however, that when it is used, a template instantiation must be done for each type which t
assumes; This makes debugging easier, but in the future all of these pointers could be declared with void
type to avoid template instantiations;
This class isolates all of the low level management of the reference.
Definition at line 108 of file CountedPtr.h.
casa::PtrRep< t >::PtrRep | ( | t * | v | ) | [inline, protected] |
This constructor sets up the reference count to one and initializes the pointer to the real data.
The delit
flag can be passed in to indicate whether the real data should be freed or not when the reference count reaches zero.
Definition at line 126 of file CountedPtr.h.
casa::PtrRep< t >::PtrRep | ( | t * | v, |
Bool | delit | ||
) | [inline, protected] |
Definition at line 127 of file CountedPtr.h.
casa::PtrRep< t >::~PtrRep | ( | ) | [inline, protected] |
This destructor uses the deletable
flag to indicate if the real data should be freed or not.
Definition at line 136 of file CountedPtr.h.
void casa::PtrRep< t >::freeVal | ( | ) | [protected] |
This deletes the real data if indeed it can be deleted.
Referenced by casa::PtrRep< Block< AutoDiffA< T > > >::~PtrRep().
friend class CountedConstPtr< t > [friend] |
Definition at line 116 of file CountedPtr.h.
friend class CountedPtr< t > [friend] |
Definition at line 115 of file CountedPtr.h.
friend class SimpleCountedConstPtr< t > [friend] |
Definition at line 114 of file CountedPtr.h.
friend class SimpleCountedPtr< t > [friend] |
Definition at line 113 of file CountedPtr.h.
unsigned int casa::PtrRep< t >::count [private] |
Definition at line 143 of file CountedPtr.h.
Bool casa::PtrRep< t >::deletable [private] |
Definition at line 144 of file CountedPtr.h.
t* casa::PtrRep< t >::val [private] |
Definition at line 142 of file CountedPtr.h.