DCMTK  Version 3.6.1 20170228
OFFIS DICOM Toolkit
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Attributes | List of all members
OFauto_ptr< T > Class Template Reference

a simple class which makes sure a pointer is deleted once it goes out of scope. More...

Public Member Functions

 OFauto_ptr (T *p=NULL)
 constructs a OFauto_ptr from the given pointer. More...
 
 OFauto_ptr (OFauto_ptr< T > &other)
 constructs a OFauto_ptr from another OFauto_ptr. More...
 
 OFauto_ptr (OFauto_ptr_ref< T > other)
 constructs a OFauto_ptr from an OFauto_ptr_ref. More...
 
 ~OFauto_ptr ()
 destructor. More...
 
void reset (T *p=NULL)
 assign another pointer to this OFauto_ptr, possibly deleting our current pointer More...
 
T * get () const
 get the pointer that is managed by this class More...
 
T * operator-> () const
 get the pointer that is managed by this class More...
 
T & operator* () const
 dereference the pointer that is managed by this class More...
 
 operator OFauto_ptr_ref< T > ()
 this is used automatically by the compiler, don't call directly More...
 
OFauto_ptroperator= (OFauto_ptr< T > &other)
 assigns the other pointer to this OFauto_ptr More...
 
OFauto_ptroperator= (OFauto_ptr_ref< T > other)
 assigns the other pointer to this OFauto_ptr More...
 
T * release ()
 release the pointer that is managed by this class. More...
 

Protected Attributes

T * ptr
 the pointer that it's all about
 

Detailed Description

template<class T>
class OFauto_ptr< T >

a simple class which makes sure a pointer is deleted once it goes out of scope.

This class does NOT do reference counting! This is a reimplementation of std::auto_ptr.

Constructor & Destructor Documentation

template<class T>
OFauto_ptr< T >::OFauto_ptr ( T *  p = NULL)
inlineexplicit

constructs a OFauto_ptr from the given pointer.

You must not call delete on a pointer that is managed by OFauto_ptr!

Parameters
pthe pointer
template<class T>
OFauto_ptr< T >::OFauto_ptr ( OFauto_ptr< T > &  other)
inline

constructs a OFauto_ptr from another OFauto_ptr.

The other OFauto_ptr will be invalidated. This means he will point to NULL from now on!

Parameters
otherthe OFauto_ptr to get the pointer from.
template<class T>
OFauto_ptr< T >::OFauto_ptr ( OFauto_ptr_ref< T >  other)
inline

constructs a OFauto_ptr from an OFauto_ptr_ref.

Parameters
otherthe OFauto_ptr_ref to get the pointer from.
template<class T>
OFauto_ptr< T >::~OFauto_ptr ( )
inline

destructor.

Destroys the pointer that is managed by this instance, if there is any.

Member Function Documentation

template<class T>
T* OFauto_ptr< T >::get ( ) const
inline

get the pointer that is managed by this class

Returns
the pointer

Referenced by dcmtk::log4cplus::spi::FactoryRegistry< T >::put().

template<class T>
OFauto_ptr< T >::operator OFauto_ptr_ref< T > ( )
inline

this is used automatically by the compiler, don't call directly

Returns
an OFauto_ptr_ref that stores this object's pointer

References OFauto_ptr< T >::release().

template<class T>
T& OFauto_ptr< T >::operator* ( ) const
inline

dereference the pointer that is managed by this class

Returns
the reference
template<class T>
T* OFauto_ptr< T >::operator-> ( ) const
inline

get the pointer that is managed by this class

Returns
the pointer
template<class T>
OFauto_ptr& OFauto_ptr< T >::operator= ( OFauto_ptr< T > &  other)
inline

assigns the other pointer to this OFauto_ptr

Parameters
otherother OFauto_ptr which will be invalidated
Returns
reference to this object
template<class T>
OFauto_ptr& OFauto_ptr< T >::operator= ( OFauto_ptr_ref< T >  other)
inline

assigns the other pointer to this OFauto_ptr

Parameters
otherother OFauto_ptr_ref
Returns
reference to this object
template<class T>
T* OFauto_ptr< T >::release ( )
inline

release the pointer that is managed by this class.

You are now responsible for destroying that pointer yourself!

Returns
the pointer

Referenced by OFauto_ptr< T >::operator OFauto_ptr_ref< T >(), and OFauto_ptr< DecoderStrategy >::operator=().

template<class T>
void OFauto_ptr< T >::reset ( T *  p = NULL)
inline

assign another pointer to this OFauto_ptr, possibly deleting our current pointer

Parameters
pthe new pointer

Referenced by OFauto_ptr< DecoderStrategy >::operator=(), and OFauto_ptr< DecoderStrategy >::~OFauto_ptr().


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


Generated on Tue Feb 28 2017 for DCMTK Version 3.6.1 20170228 by Doxygen 1.8.8