Public Member Functions | Protected Attributes

zeus::TPtr< T > Class Template Reference

#include <Ptr.hpp>

List of all members.

Public Member Functions

 TPtr ()
 TPtr (const T *pPtr)
 TPtr (const T &rPtr)
 TPtr (const TPtr< T > &rWrapper)
virtual ~TPtr ()
void assignWrapper (const TPtr &rWrapper)
void assign (const T *pInterface)
bool equals (const T *pPtr) const
T * getPointer ()
const T * getConstPointer () const
void release ()
TPtr< T > & operator= (const TPtr< T > &rWrapper)
TPtr< T > & operator= (const T *pPtr)
TPtr< T > & operator= (const T &rPtr)
bool operator== (const TPtr< T > &rWrapper) const
bool operator!= (const TPtr< T > &rWrapper) const
bool operator== (const T *pPtr) const
bool operator== (const T &rPtr) const
bool operator!= (const T *pPtr) const
bool operator!= (const T &rPtr) const
T * operator-> ()
const T * operator-> () const
T & operator* () const
 operator T * () const

Protected Attributes

T * m_pPtr
 Interface pointer.
Int * m_pReferenceCounter
 reference counter

Detailed Description

template<class T>
class zeus::TPtr< 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::TPtr< T >::TPtr (  ) [inline]

Creates a pointer wrapper

template<class T>
zeus::TPtr< T >::TPtr ( const T *  pPtr ) [inline]

Creates a pointer wrapper

Parameters:
pPtr: Pointer
template<class T>
zeus::TPtr< T >::TPtr ( const T &  rPtr ) [inline]

Creates a pointer wrapper

Parameters:
rPtr: Pointer
template<class T>
zeus::TPtr< T >::TPtr ( const TPtr< T > &  rWrapper ) [inline]

Creates a pointer wrapper out of a n other pointer wrapper. This copy constructor is protected.

Parameters:
rWrapper: pointer wrapper
template<class T>
virtual zeus::TPtr< T >::~TPtr (  ) [inline, virtual]

Destroys the pointer


Member Function Documentation

template<class T>
void zeus::TPtr< T >::assign ( const T *  pInterface ) [inline]

assigns a new pointer to the pointer wrapper.

template<class T>
void zeus::TPtr< T >::assignWrapper ( const TPtr< T > &  rWrapper ) [inline]

assigns a new pointer to the pointer wrapper.

template<class T>
bool zeus::TPtr< T >::equals ( const T *  pPtr ) const [inline]

Checks if two pointers are equal

template<class T>
const T* zeus::TPtr< T >::getConstPointer (  ) const [inline]

returns the the const_pointer

template<class T>
T* zeus::TPtr< T >::getPointer (  ) [inline]

returns the the pointer

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

Implicit cast to T*

template<class T>
bool zeus::TPtr< T >::operator!= ( const TPtr< T > &  rWrapper ) const [inline]

Equals operator

Parameters:
rWrapper: Pointer wrapper
template<class T>
bool zeus::TPtr< T >::operator!= ( const T *  pPtr ) const [inline]

Equals operator

Parameters:
pPtr: Interface
template<class T>
bool zeus::TPtr< T >::operator!= ( const T &  rPtr ) const [inline]

Equals operator

Parameters:
rPtr: Interface
template<class T>
T& zeus::TPtr< T >::operator* (  ) const [inline]

Returns the dereferenced pointer of an interface

Returns:
pointer to interface
template<class T>
T* zeus::TPtr< 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::TPtr< 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>
TPtr<T>& zeus::TPtr< T >::operator= ( const T &  rPtr ) [inline]

Assign operator

Parameters:
rPtr: reference
template<class T>
TPtr<T>& zeus::TPtr< T >::operator= ( const T *  pPtr ) [inline]

Assign operator

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

Assign operator

Parameters:
rWrapper: pointer wrapper
template<class T>
bool zeus::TPtr< T >::operator== ( const T &  rPtr ) const [inline]

Equals operator

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

Equals operator

Parameters:
rWrapper: Pointer wrapper
template<class T>
bool zeus::TPtr< T >::operator== ( const T *  pPtr ) const [inline]

Equals operator

Parameters:
pPtr: Interface
template<class T>
void zeus::TPtr< T >::release (  ) [inline]

Removes the pointer from the wrapper


Member Data Documentation

template<class T>
T* zeus::TPtr< T >::m_pPtr [protected]

Interface pointer.

template<class T>
Int* zeus::TPtr< T >::m_pReferenceCounter [protected]

reference counter


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:40