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]

#include <itkAutoPointer.h>

Collaboration diagram for itk::AutoPointer< TObjectType >:

Collaboration graph
[legend]
List of all members.

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. An AutoPointer can release ownership of the object it holds.

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

Definition at line 45 of file itkAutoPointer.h.

Public Types

typedef TObjectType ObjectType
typedef AutoPointer Self

Public Member Functions

 AutoPointer (ObjectType *p, bool takeOwnership)
Copy constructor * AutoPointer (AutoPointer &p)
 AutoPointer ()
ObjectTypeGetPointer () const
bool IsOwner (void) const
Overload operator assignment.*/AutoPointer &operator= (AutoPointer &r) const
 operator bool () const
bool operator!= (const AutoPointer &r) const
ObjectTypeoperator-> () 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
Function to print object pointed
to *ObjectType
Print (std::ostream &os) const
**Note that the AutoPointer
still points to the object
after the *ReleaseOwnership
but it doesn t own the object
any *more *ObjectType
ReleaseOwnership (void)
Clear the AutoPointer If it
had a pointer the object is
deleted and the pointer is
set to null *void 
Reset (void)
Explicitly reject ownership
*void 
TakeNoOwnership (ObjectType *objectptr)
Explicitly set the ownership
*void 
TakeOwnership (ObjectType *objectptr)
void TakeOwnership (void)
Destructor * ~AutoPointer ()

Public Attributes

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
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
*AutoPointer< Cow > 
onecow = new Cow
*AutoPointer< Mammal > onemammal = onecow.ReleaseOwnership()
**Note that the AutoPointer
still points to the object
after the *ReleaseOwnership 
operation


Member Typedef Documentation

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

Extract information from template parameter.

Definition at line 49 of file itkAutoPointer.h.

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

Definition at line 50 of file itkAutoPointer.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 53 of file itkAutoPointer.h.

template<class TObjectType>
Copy constructor* itk::AutoPointer< TObjectType >::AutoPointer AutoPointer< TObjectType > &  p  )  [inline, explicit]
 

Definition at line 57 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 66 of file itkAutoPointer.h.

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

Definition at line 71 of file itkAutoPointer.h.


Member Function Documentation

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

Access function to pointer.

Definition at line 152 of file itkAutoPointer.h.

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

Query for the ownership

Definition at line 129 of file itkAutoPointer.h.

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

template<class TObjectType>
Overload itk::AutoPointer< TObjectType >::operator assignment.*/AutoPointer &operator= AutoPointer< TObjectType > &  r  )  const [inline]
 

Definition at line 180 of file itkAutoPointer.h.

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 189 of file itkAutoPointer.h.

References NULL.

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

Comparison of pointers. NonEqual comparison.

Definition at line 160 of file itkAutoPointer.h.

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

Overload operator ->.

Definition at line 83 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 164 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 172 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 156 of file itkAutoPointer.h.

References itk::AutoPointer< TObjectType >::m_Pointer.

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

Comparison of pointers. Greater than comparison.

Definition at line 168 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 176 of file itkAutoPointer.h.

template<class TObjectType>
Function to print object pointed to* ObjectType* itk::AutoPointer< TObjectType >::Print std::ostream &  os  )  const [inline]
 

Definition at line 193 of file itkAutoPointer.h.

template<class TObjectType>
* * Note that the AutoPointer still points to the object after the* ReleaseOwnership but it doesn t own the object any* more* ObjectType* itk::AutoPointer< TObjectType >::ReleaseOwnership void   )  [inline]
 

Definition at line 144 of file itkAutoPointer.h.

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

template<class TObjectType>
Clear the AutoPointer If it had a pointer the object is deleted and the pointer is set to null* void itk::AutoPointer< TObjectType >::Reset void   )  [inline]
 

Definition at line 88 of file itkAutoPointer.h.

template<class TObjectType>
Explicitly reject ownership* void itk::AutoPointer< TObjectType >::TakeNoOwnership ObjectType objectptr  )  [inline]
 

Definition at line 117 of file itkAutoPointer.h.

template<class TObjectType>
Explicitly set the ownership* void itk::AutoPointer< TObjectType >::TakeOwnership ObjectType objectptr  )  [inline]
 

Definition at line 105 of file itkAutoPointer.h.

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

Explicitly set the ownership

Definition at line 101 of file itkAutoPointer.h.


Member Data Documentation

template<class TObjectType>
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* * itk::AutoPointer< TObjectType >::Example
 

Definition at line 137 of file itkAutoPointer.h.

template<class TObjectType>
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 * AutoPointer<Cow> itk::AutoPointer< TObjectType >::onecow = new Cow
 

Definition at line 138 of file itkAutoPointer.h.

template<class TObjectType>
* AutoPointer<Mammal> itk::AutoPointer< TObjectType >::onemammal = onecow.ReleaseOwnership()
 

Definition at line 139 of file itkAutoPointer.h.

template<class TObjectType>
* * Note that the AutoPointer still points to the object after the* ReleaseOwnership itk::AutoPointer< TObjectType >::operation
 

Definition at line 142 of file itkAutoPointer.h.


The documentation for this class was generated from the following file:
Generated at Sun Jul 9 18:52:50 2006 for ITK by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2000