casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Protected Member Functions | Private Attributes | Friends
casa::PtrRep< t > Class Template Reference

Internal representation for CountedPtr More...

#include <CountedPtr.h>

List of all members.

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 >

Detailed Description

template<class t>
class casa::PtrRep< t >

Internal representation for CountedPtr

Intended use:

Internal

Review Status

Reviewed By:
Friso Olnon
Date Reviewed:
1995/03/15
Test programs:
tCountedPtr

Prerequisite

Synopsis

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;

Motivation

This class isolates all of the low level management of the reference.

Definition at line 108 of file CountedPtr.h.


Constructor & Destructor Documentation

template<class t>
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.

template<class t>
casa::PtrRep< t >::PtrRep ( t *  v,
Bool  delit 
) [inline, protected]

Definition at line 127 of file CountedPtr.h.

template<class t>
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.


Member Function Documentation

template<class t>
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().


Friends And Related Function Documentation

template<class t>
friend class CountedConstPtr< t > [friend]

Definition at line 116 of file CountedPtr.h.

template<class t>
friend class CountedPtr< t > [friend]

Definition at line 115 of file CountedPtr.h.

template<class t>
friend class SimpleCountedConstPtr< t > [friend]

Definition at line 114 of file CountedPtr.h.

template<class t>
friend class SimpleCountedPtr< t > [friend]

Definition at line 113 of file CountedPtr.h.


Member Data Documentation

template<class t>
unsigned int casa::PtrRep< t >::count [private]

Definition at line 143 of file CountedPtr.h.

template<class t>
Bool casa::PtrRep< t >::deletable [private]

Definition at line 144 of file CountedPtr.h.

template<class t>
t* casa::PtrRep< t >::val [private]

Definition at line 142 of file CountedPtr.h.


The documentation for this class was generated from the following file: