Public Member Functions

zeus::TAutoPtr< T > Class Template Reference

#include <AutoPtr.hpp>

Inheritance diagram for zeus::TAutoPtr< T >:
zeus::TAutoPtrBase< T >

List of all members.

Public Member Functions

 TAutoPtr ()
 TAutoPtr (const T *pIface, bool bAllocPointer=false)
 TAutoPtr (const T &rIface, bool bAllocPointer=false)
 TAutoPtr (const TAutoPtr< T > &rWrapper)
virtual ~TAutoPtr ()
TAutoPtr< T > & operator= (const T *pIface)
TAutoPtr< T > & operator= (const T &rIface)
TAutoPtr< T > & operator= (const TAutoPtr< T > &rWrapper)
bool operator== (const TAutoPtr< T > &rWrapper) const
bool operator!= (const TAutoPtr< T > &rWrapper) const
bool operator== (const T *pIface) const
bool operator== (const T &rIface) const
bool operator!= (const T *pIface) const
bool operator!= (const T &rIface) const
bool operator< (const TAutoPtr< T > &ptr) const
T * operator-> ()
const T * operator-> () const
T & operator* () const
 operator T * () const
 operator T *& ()

Detailed Description

template<class T>
class zeus::TAutoPtr< T >

The auto pointer class helps to manage objects from heap classes. Normally its used if a heap class is created locally. If there are exceptions we will get memory leaks. Therfore we use the auto pointer to manage the objects inside a scope. Leaving the scope will also release the memory allocated with new.


Constructor & Destructor Documentation

template<class T>
zeus::TAutoPtr< T >::TAutoPtr (  ) [inline]

Creates an auto pointer

template<class T>
zeus::TAutoPtr< T >::TAutoPtr ( const T *  pIface,
bool  bAllocPointer = false 
) [inline]

Creates an auto pointer

Parameters:
pIface: Interface
bAllocPointer: If this flag is true the pointer will be allocated with addRef()
template<class T>
zeus::TAutoPtr< T >::TAutoPtr ( const T &  rIface,
bool  bAllocPointer = false 
) [inline]

Creates an auto pointer

Parameters:
rIface: Interface
bAllocPointer: If this flag is true the pointer will be allocated with addRef()
template<class T>
zeus::TAutoPtr< T >::TAutoPtr ( const TAutoPtr< T > &  rWrapper ) [inline]

Copy constructor of auto pointer

Parameters:
rWrapper: auto pointer to copy
template<class T>
virtual zeus::TAutoPtr< T >::~TAutoPtr (  ) [inline, virtual]

Destroys the auto pointer


Member Function Documentation

template<class T>
zeus::TAutoPtr< T >::operator T * (  ) const [inline]

Implicit cast to T*

template<class T>
zeus::TAutoPtr< T >::operator T *& (  ) [inline]

Implicit cast to T*&

template<class T>
bool zeus::TAutoPtr< T >::operator!= ( const T *  pIface ) const [inline]

Equals operator

Parameters:
pIface: Interface
template<class T>
bool zeus::TAutoPtr< T >::operator!= ( const T &  rIface ) const [inline]

Equals operator

Parameters:
rIface: Interface
template<class T>
bool zeus::TAutoPtr< T >::operator!= ( const TAutoPtr< T > &  rWrapper ) const [inline]

Equals operator

Parameters:
rWrapper: Interface wrapper
template<class T>
T& zeus::TAutoPtr< T >::operator* (  ) const [inline]

Returns the dereferenced pointer of an interface

Returns:
pointer to interface
template<class T>
T* zeus::TAutoPtr< T >::operator-> (  ) [inline]

Operator is used to return the interface pointer and to access to all methods of this interface

Returns:
pointer to interface
template<class T>
const T* zeus::TAutoPtr< T >::operator-> (  ) const [inline]

Operator is used to return the interface pointer and to access to all methods of this interface

Returns:
pointer to interface
template<class T>
bool zeus::TAutoPtr< T >::operator< ( const TAutoPtr< T > &  ptr ) const [inline]

Less than operator.

Needed to resolve ambiguities in STL when using TAutoPtr as key of a set or map (ambiguity between operator T*() and operator T*&().).

Parameters:
ptr[IN]: Auto pointer to be compared to this.
template<class T>
TAutoPtr<T>& zeus::TAutoPtr< T >::operator= ( const T *  pIface ) [inline]

Assign operator

Parameters:
pIface: Interface
template<class T>
TAutoPtr<T>& zeus::TAutoPtr< T >::operator= ( const T &  rIface ) [inline]

Assign operator

Parameters:
rIface: Interface
template<class T>
TAutoPtr<T>& zeus::TAutoPtr< T >::operator= ( const TAutoPtr< T > &  rWrapper ) [inline]

Assign operator

Parameters:
rWrapper: Interfacewrapper
template<class T>
bool zeus::TAutoPtr< T >::operator== ( const TAutoPtr< T > &  rWrapper ) const [inline]

Equals operator

Parameters:
rWrapper: Interface wrapper
template<class T>
bool zeus::TAutoPtr< T >::operator== ( const T *  pIface ) const [inline]

Equals operator

Parameters:
pIface: Interface
template<class T>
bool zeus::TAutoPtr< T >::operator== ( const T &  rIface ) const [inline]

Equals operator

Parameters:
rIface: Interface

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:32