Public Member Functions | Protected Member Functions | Protected Attributes

zeus::TArrayPtr< T > Class Template Reference

#include <ArrayPtr.hpp>

List of all members.

Public Member Functions

 TArrayPtr ()
 TArrayPtr (Int iSize)
 TArrayPtr (const T *pPtr, Int iSize=-1)
 TArrayPtr (const TArrayPtr< T > &rWrapper)
virtual ~TArrayPtr ()
void assignWrapper (const TArrayPtr &rWrapper)
void assign (const T *pInterface, Int iSize=-1)
void clean ()
void memset (Int iValue)
bool equals (const T *pPtr) const
T * getPointer ()
const T * getConstPointer () const
Int getSize () const
void release ()
T * detach ()
TArrayPtr< T > & operator= (const TArrayPtr< T > &rWrapper)
TArrayPtr< T > & operator= (const T *pPtr)
bool operator== (const TArrayPtr< T > &rWrapper) const
bool operator!= (const TArrayPtr< T > &rWrapper) const
bool operator== (const T *pPtr) const
bool operator!= (const T *pPtr) const
 operator T * () const
T & operator[] (Int iIndex)
const T & operator[] (Int iIndex) const
T & getItem (Int iIndex)
const T & getItemConst (Int iIndex) const

Protected Member Functions

void release_internal (bool bDeletePointer)

Protected Attributes

T * m_paPtr
 Pointer to an array allocated with new[].
Int * m_pReferenceCounter
 reference counter
Int m_iSize
 Size.

Detailed Description

template<class T>
class zeus::TArrayPtr< T >

The array auto pointer class helps to manage array objects. It uses new[] and delete[] operator to allocate (free) the memory


Constructor & Destructor Documentation

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

Creates a pointer wrapper

template<class T>
zeus::TArrayPtr< T >::TArrayPtr ( Int  iSize ) [inline]

Creates an array pointer wrapper and allocates an array of size iSize

Parameters:
iSize: Size of the array
template<class T>
zeus::TArrayPtr< T >::TArrayPtr ( const T *  pPtr,
Int  iSize = -1 
) [inline]

Creates a pointer wrapper

Parameters:
pPtr: Pointer
iSize: size of the array
template<class T>
zeus::TArrayPtr< T >::TArrayPtr ( const TArrayPtr< 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::TArrayPtr< T >::~TArrayPtr (  ) [inline, virtual]

Destroys the pointer


Member Function Documentation

template<class T>
void zeus::TArrayPtr< T >::assign ( const T *  pInterface,
Int  iSize = -1 
) [inline]

assigns a new pointer to the pointer wrapper.

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

assigns a new pointer to the pointer wrapper.

template<class T>
void zeus::TArrayPtr< T >::clean (  ) [inline]

Cleans the content of the array

template<class T>
T* zeus::TArrayPtr< T >::detach (  ) [inline]

detaches the pointer from the wrapper. The pointer is not deleted but returned

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

Checks if two pointers are equal

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

returns the the const_pointer

template<class T>
T& zeus::TArrayPtr< T >::getItem ( Int  iIndex ) [inline]

Returns an indexed item of the array

template<class T>
const T& zeus::TArrayPtr< T >::getItemConst ( Int  iIndex ) const [inline]

Returns an indexed and const item of the array

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

returns the the pointer

template<class T>
Int zeus::TArrayPtr< T >::getSize (  ) const [inline]

Returns the size of the array

template<class T>
void zeus::TArrayPtr< T >::memset ( Int  iValue ) [inline]

sets the array to a different value

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

Implicit cast to T*

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

Equals operator

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

Equals operator

Parameters:
rWrapper: Pointer wrapper
template<class T>
TArrayPtr<T>& zeus::TArrayPtr< T >::operator= ( const TArrayPtr< T > &  rWrapper ) [inline]

Assign operator

Parameters:
rWrapper: pointer wrapper
template<class T>
TArrayPtr<T>& zeus::TArrayPtr< T >::operator= ( const T *  pPtr ) [inline]

Assign operator

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

Equals operator

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

Equals operator

Parameters:
pPtr: Interface
template<class T>
T& zeus::TArrayPtr< T >::operator[] ( Int  iIndex ) [inline]

Returns an indexed item of the array

template<class T>
const T& zeus::TArrayPtr< T >::operator[] ( Int  iIndex ) const [inline]

Returns an indexed and const item of the array

template<class T>
void zeus::TArrayPtr< T >::release (  ) [inline]

Removes the pointer from the wrapper

template<class T>
void zeus::TArrayPtr< T >::release_internal ( bool  bDeletePointer ) [inline, protected]

releases the internal pointers


Member Data Documentation

template<class T>
Int zeus::TArrayPtr< T >::m_iSize [protected]

Size.

template<class T>
T* zeus::TArrayPtr< T >::m_paPtr [protected]

Pointer to an array allocated with new[].

template<class T>
Int* zeus::TArrayPtr< 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:32