Public Types | Public Member Functions

Utils::AutoPtr< T > Class Template Reference

std::auto_ptr analogue with ability to delete object by object's method. More...

#include <B2BITS_AutoPtr.h>

List of all members.

Public Types

typedef ConstMethodResolver< T >
::MethodType 
ReleaseMethod
 Declares ReleaseMethod handler.

Public Member Functions

 AutoPtr ()
 Default constructor.
 AutoPtr (T *ptr, ReleaseMethod releaseMethod)
 Constructor.
 AutoPtr (AutoPtr< T > &ptr)
 Copy constructor.
T const * get () const
 Returns a pointer.
T * get ()
 Returns a pointer.
T ** operator& ()
 Overloaded operator&.
T const & operator* () const
 Overloaded operator*.
T & operator* ()
 Overloaded operator*.
T const * operator-> () const
 Overloaded operator->.
T * operator-> ()
 Overloaded operator->.
AutoPtroperator= (AutoPtr< T > &ptr)
 Copy operator.
T * release ()
 Release underlying pointer and return it.
void reset (T *ptr, ReleaseMethod releaseMethod)
 Deletes object by underlying pointer and set it to new value.
 ~AutoPtr ()
 Destructor.

Detailed Description

template<typename T>
class Utils::AutoPtr< T >

std::auto_ptr analogue with ability to delete object by object's method.

Definition at line 73 of file B2BITS_AutoPtr.h.


Member Typedef Documentation

template<typename T>
typedef ConstMethodResolver<T>::MethodType Utils::AutoPtr< T >::ReleaseMethod

Declares ReleaseMethod handler.

Definition at line 77 of file B2BITS_AutoPtr.h.


Constructor & Destructor Documentation

template<typename T>
Utils::AutoPtr< T >::AutoPtr (  ) [inline]

Default constructor.

Definition at line 82 of file B2BITS_AutoPtr.h.

template<typename T>
Utils::AutoPtr< T >::AutoPtr ( T *  ptr,
ReleaseMethod  releaseMethod 
) [inline]

Constructor.

Parameters:
ptrPointer to the object to be owned.
releaseMethodObject's release method.

Definition at line 92 of file B2BITS_AutoPtr.h.

template<typename T>
Utils::AutoPtr< T >::AutoPtr ( AutoPtr< T > &  ptr ) [inline]

Copy constructor.

Definition at line 100 of file B2BITS_AutoPtr.h.

References Utils::AutoPtr< T >::reset().

template<typename T>
Utils::AutoPtr< T >::~AutoPtr (  ) [inline]

Destructor.

Definition at line 126 of file B2BITS_AutoPtr.h.


Member Function Documentation

template<typename T>
T const* Utils::AutoPtr< T >::get (  ) const [inline]

Returns a pointer.

Returns:
Pointer.

Definition at line 164 of file B2BITS_AutoPtr.h.

template<typename T>
T* Utils::AutoPtr< T >::get (  ) [inline]

Returns a pointer.

Returns:
Pointer.

Definition at line 173 of file B2BITS_AutoPtr.h.

template<typename T>
T** Utils::AutoPtr< T >::operator& (  ) [inline]

Overloaded operator&.

Definition at line 197 of file B2BITS_AutoPtr.h.

template<typename T>
T& Utils::AutoPtr< T >::operator* (  ) [inline]

Overloaded operator*.

Definition at line 181 of file B2BITS_AutoPtr.h.

template<typename T>
T const& Utils::AutoPtr< T >::operator* (  ) const [inline]

Overloaded operator*.

Definition at line 189 of file B2BITS_AutoPtr.h.

template<typename T>
T* Utils::AutoPtr< T >::operator-> (  ) [inline]

Overloaded operator->.

Definition at line 205 of file B2BITS_AutoPtr.h.

template<typename T>
T const* Utils::AutoPtr< T >::operator-> (  ) const [inline]

Overloaded operator->.

Definition at line 213 of file B2BITS_AutoPtr.h.

template<typename T>
AutoPtr& Utils::AutoPtr< T >::operator= ( AutoPtr< T > &  ptr ) [inline]

Copy operator.

Definition at line 113 of file B2BITS_AutoPtr.h.

References Utils::AutoPtr< T >::reset().

template<typename T>
T* Utils::AutoPtr< T >::release (  ) [inline]

Release underlying pointer and return it.

Returns:
underlying pointer.

Definition at line 136 of file B2BITS_AutoPtr.h.

template<typename T>
void Utils::AutoPtr< T >::reset ( T *  ptr,
ReleaseMethod  releaseMethod 
) [inline]

Deletes object by underlying pointer and set it to new value.

Parameters:
ptrNew value to set.
releaseMethodObject's release method.

Definition at line 151 of file B2BITS_AutoPtr.h.

Referenced by Utils::AutoPtr< T >::AutoPtr(), and Utils::AutoPtr< T >::operator=().