ITK
4.6.0
Insight Segmentation and Registration Toolkit
|
#include <itkAutoPointer.h>
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 46 of file itkAutoPointer.h.
Public Types | |
typedef TObjectType | ObjectType |
typedef AutoPointer | Self |
Public Member Functions | |
AutoPointer () | |
AutoPointer (ObjectType *p, bool takeOwnership) | |
ObjectType * | GetPointer () const |
bool | IsOwner (void) const |
operator bool () const | |
bool | operator!= (const AutoPointer &r) const |
ObjectType * | operator-> () 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 |
void | TakeOwnership (void) |
~AutoPointer () | |
AutoPointer (AutoPointer &p) | |
void | Reset (void) |
void | TakeOwnership (ObjectType *objectptr) |
void | TakeNoOwnership (ObjectType *objectptr) |
ObjectType * | ReleaseOwnership (void) |
AutoPointer & | operator= (AutoPointer &r) |
Private Member Functions | |
void | Swap (AutoPointer &r) throw ( ) |
Private Attributes | |
bool | m_IsOwner |
ObjectType * | m_Pointer |
typedef TObjectType itk::AutoPointer< TObjectType >::ObjectType |
Extract information from template parameter.
Definition at line 50 of file itkAutoPointer.h.
typedef AutoPointer itk::AutoPointer< TObjectType >::Self |
Definition at line 51 of file itkAutoPointer.h.
|
inline |
Constructor.
Definition at line 54 of file itkAutoPointer.h.
Referenced by itk::AutoPointer< JPEG2000ImageIOInternal >::operator=().
|
inlineexplicit |
Copy constructor.
Definition at line 58 of file itkAutoPointer.h.
|
inlineexplicit |
Constructor to pointer p.
Definition at line 67 of file itkAutoPointer.h.
|
inline |
Destructor.
Definition at line 72 of file itkAutoPointer.h.
|
inline |
Access function to pointer.
Definition at line 146 of file itkAutoPointer.h.
|
inline |
Query for the ownership
Definition at line 123 of file itkAutoPointer.h.
Referenced by itk::AutoPointer< JPEG2000ImageIOInternal >::AutoPointer().
|
inline |
Casting operator to boolean. This is used in conditional statments to check the content of the pointer against null
Definition at line 183 of file itkAutoPointer.h.
|
inline |
Comparison of pointers. NonEqual comparison.
Definition at line 154 of file itkAutoPointer.h.
|
inline |
Overload operator ->.
Definition at line 78 of file itkAutoPointer.h.
|
inline |
Comparison of pointers. Less than comparison.
Definition at line 158 of file itkAutoPointer.h.
|
inline |
Comparison of pointers. Less than or equal to comparison.
Definition at line 166 of file itkAutoPointer.h.
|
inline |
Overload operator assignment.
Definition at line 174 of file itkAutoPointer.h.
|
inline |
Comparison of pointers. Equal comparison.
Definition at line 150 of file itkAutoPointer.h.
|
inline |
Comparison of pointers. Greater than comparison.
Definition at line 162 of file itkAutoPointer.h.
|
inline |
Comparison of pointers. Greater than or equal to comparison.
Definition at line 170 of file itkAutoPointer.h.
|
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 still points to the object after the ReleaseOwnership operation, but it doesn't own the object any more.
Definition at line 138 of file itkAutoPointer.h.
Referenced by itk::AutoPointer< JPEG2000ImageIOInternal >::AutoPointer().
|
inline |
Clear the AutoPointer. If it had a pointer the object is deleted and the pointer is set to null.
Definition at line 83 of file itkAutoPointer.h.
Referenced by itk::AutoPointer< JPEG2000ImageIOInternal >::~AutoPointer().
|
inlineprivate |
Function to print object pointed to. Exchange the content of two AutoPointers
Definition at line 200 of file itkAutoPointer.h.
|
inline |
Explicitly reject ownership
Definition at line 111 of file itkAutoPointer.h.
|
inline |
Explicitly set the ownership
Definition at line 95 of file itkAutoPointer.h.
|
inline |
Explicitly set the ownership
Definition at line 99 of file itkAutoPointer.h.
|
private |
Definition at line 211 of file itkAutoPointer.h.
Referenced by itk::AutoPointer< JPEG2000ImageIOInternal >::AutoPointer(), itk::AutoPointer< JPEG2000ImageIOInternal >::IsOwner(), itk::AutoPointer< JPEG2000ImageIOInternal >::ReleaseOwnership(), itk::AutoPointer< JPEG2000ImageIOInternal >::Reset(), itk::AutoPointer< JPEG2000ImageIOInternal >::TakeNoOwnership(), and itk::AutoPointer< JPEG2000ImageIOInternal >::TakeOwnership().
|
private |
The pointer to the object referred to by this smart pointer.
Definition at line 210 of file itkAutoPointer.h.
Referenced by itk::AutoPointer< JPEG2000ImageIOInternal >::AutoPointer(), itk::AutoPointer< JPEG2000ImageIOInternal >::GetPointer(), itk::AutoPointer< JPEG2000ImageIOInternal >::operator bool(), itk::AutoPointer< JPEG2000ImageIOInternal >::operator!=(), itk::AutoPointer< JPEG2000ImageIOInternal >::operator->(), itk::AutoPointer< JPEG2000ImageIOInternal >::operator<(), itk::AutoPointer< JPEG2000ImageIOInternal >::operator<=(), itk::AutoPointer< JPEG2000ImageIOInternal >::operator==(), itk::AutoPointer< JPEG2000ImageIOInternal >::operator>(), itk::AutoPointer< JPEG2000ImageIOInternal >::operator>=(), itk::AutoPointer< JPEG2000ImageIOInternal >::ReleaseOwnership(), itk::AutoPointer< JPEG2000ImageIOInternal >::Reset(), itk::AutoPointer< JPEG2000ImageIOInternal >::Swap(), itk::AutoPointer< JPEG2000ImageIOInternal >::TakeNoOwnership(), and itk::AutoPointer< JPEG2000ImageIOInternal >::TakeOwnership().