Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itk::AutoPointer< TObjectType > Class Template Reference
[ITK System ObjectsData Access Objects]

Implements an Automatic Pointer to an object. More...

#include <itkAutoPointer.h>

Collaboration diagram for itk::AutoPointer< TObjectType >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TObjectType ObjectType
typedef AutoPointer Self

Public Methods

 AutoPointer ()
 AutoPointer (ObjectType *p, bool takeOwnership)
ObjectTypeoperator-> () const
void TakeOwnership (void)
bool IsOwner (void) const
ObjectTypeReleaseOwnership (void)
ObjectTypeGetPointer () const
bool operator== (const AutoPointer &r) const
bool operator!= (const AutoPointer &r) const
bool operator< (const AutoPointer &r) const
bool operator> (const AutoPointer &r) const
bool operator<= (const AutoPointer &r) const
bool operator>= (const AutoPointer &r) const
 operator bool () const
 AutoPointer (AutoPointer &p)
 ~AutoPointer ()
void Reset (void)
void TakeOwnership (ObjectType *objectptr)
void TakeNoOwnership (ObjectType *objectptr)
AutoPointer & operator= (AutoPointer &r) const
ObjectTypePrint (std::ostream &os) const

Detailed Description

template<class TObjectType>
class itk::AutoPointer< TObjectType >

Implements an Automatic Pointer to an object.

AutoPointer is intended to facilitate the construction of objects on-the-fly for those objects that are not to be shared. An AutopOinter destroys its object when it goes out of scope. Ownership of the object is transferred from one AutoPointer to another AutoPointer when the assignement operator is used. AutoPointers can release the ownership of the object they hold

This class follows the design of the std::auto_ptr class, the main reason for not using the std version is to avoid the use of templated methods which greately difficult wrapping for Tcl, Python and Java.

Definition at line 46 of file itkAutoPointer.h.


Member Typedef Documentation

template<class TObjectType>
typedef TObjectType itk::AutoPointer< TObjectType >::ObjectType
 

Extract information from template parameter.

Definition at line 50 of file itkAutoPointer.h.

template<class TObjectType>
typedef AutoPointer itk::AutoPointer< TObjectType >::Self
 

Definition at line 51 of file itkAutoPointer.h.


Constructor & Destructor Documentation

template<class TObjectType>
itk::AutoPointer< TObjectType >::AutoPointer   [inline]
 

Constructor.

Definition at line 54 of file itkAutoPointer.h.

template<class TObjectType>
itk::AutoPointer< TObjectType >::AutoPointer AutoPointer< TObjectType > &    p [inline, explicit]
 

Copy constructor.

Definition at line 60 of file itkAutoPointer.h.

References itk::AutoPointer< TObjectType >::IsOwner(), and itk::AutoPointer< TObjectType >::ReleaseOwnership().

template<class TObjectType>
itk::AutoPointer< TObjectType >::AutoPointer ObjectType   p,
bool    takeOwnership
[inline, explicit]
 

Constructor to pointer p.

Definition at line 69 of file itkAutoPointer.h.

template<class TObjectType>
itk::AutoPointer< TObjectType >::~AutoPointer   [inline]
 

Destructor.

Definition at line 76 of file itkAutoPointer.h.


Member Function Documentation

template<class TObjectType>
ObjectType* itk::AutoPointer< TObjectType >::GetPointer   const [inline]
 

Access function to pointer.

Definition at line 158 of file itkAutoPointer.h.

template<class TObjectType>
bool itk::AutoPointer< TObjectType >::IsOwner void    const [inline]
 

Query for the ownership

Definition at line 134 of file itkAutoPointer.h.

Referenced by itk::AutoPointer< TObjectType >::AutoPointer().

template<class TObjectType>
itk::AutoPointer< TObjectType >::operator bool   const [inline]
 

Casting operator to boolean. This is used in conditional statments to check the content of the pointer against null

Definition at line 195 of file itkAutoPointer.h.

template<class TObjectType>
bool itk::AutoPointer< TObjectType >::operator!= const AutoPointer< TObjectType > &    r const [inline]
 

Comparison of pointers. NonEqual comparison.

Definition at line 166 of file itkAutoPointer.h.

template<class TObjectType>
ObjectType* itk::AutoPointer< TObjectType >::operator->   const [inline]
 

Overload operator->.

Definition at line 88 of file itkAutoPointer.h.

template<class TObjectType>
bool itk::AutoPointer< TObjectType >::operator< const AutoPointer< TObjectType > &    r const [inline]
 

Comparison of pointers. Less than comparison.

Definition at line 170 of file itkAutoPointer.h.

template<class TObjectType>
bool itk::AutoPointer< TObjectType >::operator<= const AutoPointer< TObjectType > &    r const [inline]
 

Comparison of pointers. Less than or equal to comparison.

Definition at line 178 of file itkAutoPointer.h.

template<class TObjectType>
AutoPointer& itk::AutoPointer< TObjectType >::operator= AutoPointer< TObjectType > &    r const [inline]
 

Overload operator assignment.

Definition at line 186 of file itkAutoPointer.h.

template<class TObjectType>
bool itk::AutoPointer< TObjectType >::operator== const AutoPointer< TObjectType > &    r const [inline]
 

Comparison of pointers. Equal comparison.

Definition at line 162 of file itkAutoPointer.h.

template<class TObjectType>
bool itk::AutoPointer< TObjectType >::operator> const AutoPointer< TObjectType > &    r const [inline]
 

Comparison of pointers. Greater than comparison.

Definition at line 174 of file itkAutoPointer.h.

template<class TObjectType>
bool itk::AutoPointer< TObjectType >::operator>= const AutoPointer< TObjectType > &    r const [inline]
 

Comparison of pointers. Greater than or equal to comparison.

Definition at line 182 of file itkAutoPointer.h.

template<class TObjectType>
ObjectType* itk::AutoPointer< TObjectType >::Print std::ostream &    os const [inline]
 

Function to print object pointed to.

Definition at line 199 of file itkAutoPointer.h.

template<class TObjectType>
ObjectType* itk::AutoPointer< TObjectType >::ReleaseOwnership void    [inline]
 

Release the pointer hold by the current AutoPointer and return the raw pointer so it can be hold by another AutoPointer. This operation is intended to be used for facilitating polymorphism.

Example: if class Cow derives from Mammal, AutoPointer<Cow> onecow = new Cow; AutoPointer<Mammal> onemammal = onecow.ReleaseOwnership();

Note that the AutoPointer is still pointing to the object after the ReleaseOwnership operation but it doesn't owns the object anymore.

Definition at line 151 of file itkAutoPointer.h.

Referenced by itk::AutoPointer< TObjectType >::AutoPointer().

template<class TObjectType>
void itk::AutoPointer< TObjectType >::Reset void    [inline]
 

Clear the AutoPointer. If it had a pointer the object is deleted and the pointer is set to null.

Definition at line 93 of file itkAutoPointer.h.

template<class TObjectType>
void itk::AutoPointer< TObjectType >::TakeNoOwnership ObjectType   objectptr [inline]
 

Reject explicitly the Ownership

Definition at line 122 of file itkAutoPointer.h.

template<class TObjectType>
void itk::AutoPointer< TObjectType >::TakeOwnership ObjectType   objectptr [inline]
 

Set explicitly the Ownership

Definition at line 110 of file itkAutoPointer.h.

template<class TObjectType>
void itk::AutoPointer< TObjectType >::TakeOwnership void    [inline]
 

Set explicitly the Ownership

Definition at line 106 of file itkAutoPointer.h.


The documentation for this class was generated from the following file:
Generated at Wed Mar 12 01:13:57 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000