casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
casa::CountedPtr< t > Class Template Reference

Regular referenced counted pointer for non-constant data. More...

#include <CountedPtr.h>

Inheritance diagram for casa::CountedPtr< t >:
casa::SimpleCountedPtr< t > casa::CountedConstPtr< t > casa::SimpleCountedConstPtr< t > casa::SimpleCountedConstPtr< t >

List of all members.

Public Member Functions

 CountedPtr ()
 This constructor allows for the creation of a null CountedPtr.
 CountedPtr (t *val, Bool delit=True)
 This constructor sets up a reference count for the val pointer.
 CountedPtr (const CountedPtr< t > &val)
 This copy constructor allows CountedPtrs to be initialized from other CountedPtrs.
CountedPtr< t > & operator= (const CountedPtr< t > &val)
 This assignment operator allows CountedPtrs to be freely assigned to each other.
CountedPtr< t > & operator= (t *v)
 This assignment operator allows the object to which the current CountedPtr points to be changed.
t * operator-> () const
 This dereferencing operator behaves as expected; it returns the pointer to the value being protected, and then its dereferencing operator will be invoked as appropriate.
t * operator-> ()

Detailed Description

template<class t>
class casa::CountedPtr< t >

Regular referenced counted pointer for non-constant data.

Intended use:

Public interface

Review Status

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

Prerequisite

Synopsis

This class completes the lattice. It inherits much of the members which deal with non-constant data from SimpleCountedPtr , and it inherits the const operator->() from CountedConstPtr . What this class adds is the operator->() which returns a modifiable pointer.

Definition at line 513 of file CountedPtr.h.


Constructor & Destructor Documentation

template<class t>
casa::CountedPtr< t >::CountedPtr ( )

This constructor allows for the creation of a null CountedPtr.

The assignment operator can be used to assign a null CountedPtr from another pointer.

template<class t>
casa::CountedPtr< t >::CountedPtr ( t *  val,
Bool  delit = True 
)

This constructor sets up a reference count for the val pointer.

By default, the data pointed to by val will be deleted when it is no longer referenced. Passing in False for delit will prevent the data from being deleted when the reference count reaches zero.


Warning: After the counted pointer is initialized the value should no longer be manipulated by the raw pointer of type t*;

template<class t>
casa::CountedPtr< t >::CountedPtr ( const CountedPtr< t > &  val)

This copy constructor allows CountedPtrs to be initialized from other CountedPtrs.


Member Function Documentation

template<class t>
t* casa::CountedPtr< t >::operator-> ( ) const [inline]

This dereferencing operator behaves as expected; it returns the pointer to the value being protected, and then its dereferencing operator will be invoked as appropriate.

If the pointer is un-initialized (null), an exception will be thrown. The member function null () can be used to catch such a condition in time.

Thrown Exceptions

  • ExcpError

Reimplemented from casa::CountedConstPtr< t >.

Definition at line 572 of file CountedPtr.h.

template<class t>
t* casa::CountedPtr< t >::operator-> ( ) [inline]

Definition at line 576 of file CountedPtr.h.

template<class t>
CountedPtr<t>& casa::CountedPtr< t >::operator= ( const CountedPtr< t > &  val) [inline]

This assignment operator allows CountedPtrs to be freely assigned to each other.

Definition at line 546 of file CountedPtr.h.

Referenced by casa::CountedPtr< Block< AutoDiffA< T > > >::operator=().

template<class t>
CountedPtr<t>& casa::CountedPtr< t >::operator= ( t *  v) [inline]

This assignment operator allows the object to which the current CountedPtr points to be changed.

Reimplemented from casa::CountedConstPtr< t >.

Definition at line 554 of file CountedPtr.h.


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