B2BITS FIX Antenna C++  2.27.0
Public Types | Public Member Functions | List of all members
Utils::AutoPtr< T > Class Template Reference

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

#include <B2BITS_AutoPtr.h>

Public Types

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

Public Member Functions

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

Detailed Description

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

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

Deprecated:
This class is not safe. Please use Utils::AutoPtr2 instead.

Member Typedef Documentation

◆ ReleaseMethod

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

Declares ReleaseMethod handler.

Constructor & Destructor Documentation

◆ AutoPtr() [1/3]

template<typename T>
Utils::AutoPtr< T >::AutoPtr ( )
throw (
)
inline

Default constructor.

◆ AutoPtr() [2/3]

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

Constructor.

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

◆ AutoPtr() [3/3]

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

Copy constructor.

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

◆ ~AutoPtr()

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

Destructor.

Member Function Documentation

◆ get() [1/2]

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

Returns a pointer.

Returns
Pointer.

◆ get() [2/2]

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

Returns a pointer.

Returns
Pointer.

◆ operator &()

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

Overloaded operator&.

◆ operator*() [1/2]

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

Overloaded operator*.

◆ operator*() [2/2]

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

Overloaded operator*.

◆ operator->() [1/2]

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

Overloaded operator->.

◆ operator->() [2/2]

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

Overloaded operator->.

◆ operator=()

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

Copy operator.

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

◆ release()

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

Release underlying pointer and return it.

Returns
underlying pointer.

◆ reset()

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

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

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

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