Version: 5.1.6

MEDMEM.PointerOf< T > Class Template Reference

#include <MEDMEM_PointerOf.hxx>

Inheritance diagram for MEDMEM.PointerOf< T >:
Inheritance graph

Public Member Functions

 PointerOf ()
 ~PointerOf ()
 PointerOf (const int &size)
 PointerOf (const T *pointer)
 PointerOf (const int &size, const T *pointer)
 PointerOf (const PointerOf< T > &pointerOf)
 operator T * ()
 PointerOf( const int &size, const PointerOf<T> & pointerOf ) ;.
 operator const T * () const
void set (const int &size)
void set (const T *pointer)
void set (const int &size, const T *pointer)
void setShallowAndOwnership (const T *pointer)
PointerOf< T > & operator= (const PointerOf< T > &pointer)

Data Fields

T * _pointer
bool _done

template<typename T>
class MEDMEM::PointerOf< T >


Constructor & Destructor Documentation

template<typename T >
MEDMEM.PointerOf< T >::PointerOf (  ) 

Creates a null T* pointer and sets the boolean (for desallocation) to false.

template<typename T >
MEDMEM.PointerOf< T >::~PointerOf (  ) 

The destuctor desallocates memory if necessary (that is if the attribute _done equals true).
The attribute _pointer is nullified

References MEDMEM.PointerOf< T >._done, MEDMEM.PointerOf< T >._pointer, and MESSAGE_MED.

template<typename T >
MEDMEM.PointerOf< T >::PointerOf ( const int size  ) 

Duplicate array of size size pointed in pointerOf.

If size < 0, creates a null "T*" pointer
Else allocates memory and sets desallocation boolean to true.
Memory will be desallocated when erasing this PointerOf

References MEDMEM.PointerOf< T >._done, MEDMEM.PointerOf< T >._pointer, and NULL.

template<typename T>
MEDMEM.PointerOf< T >::PointerOf ( const T *  pointer  ) 

Creates a standard pointer to the memory zone pointed by T*.
T* owner is in charged of memory desallocation.
Memory will not be released when erasing this PointerOf

template<typename T>
MEDMEM.PointerOf< T >::PointerOf ( const int size,
const T *  pointer 
)

If size < 0, return an exception
Else duplicate array and sets desallocation boolean to true.
Memory will be desallocated when erasing this PointerOf

References MEDMEM.PointerOf< T >._done, and MEDMEM.PointerOf< T >._pointer.

template<typename T>
MEDMEM.PointerOf< T >::PointerOf ( const PointerOf< T > &  pointerOf  ) 

Creates a standard T* pointer to the pointed memory.
The boolean for desallocation is setted to false.
Be aware :

  • The "old" PointerOf always has propriety of the pointed memory.
  • If the "old" PointerOf is detroyed, the "new" PointerOf points a desallocated memory zone.

References BEGIN_OF_MED, END_OF_MED, and MESSAGE_MED.


Member Function Documentation

template<typename T >
MEDMEM.PointerOf< T >::operator T * (  ) 

PointerOf( const int &size, const PointerOf<T> & pointerOf ) ;.

Returns _pointer.

References MEDMEM.PointerOf< T >._pointer.

template<typename T >
MEDMEM.PointerOf< T >::operator const T * (  )  const

Returns _pointer.

References MEDMEM.PointerOf< T >._pointer.

template<typename T >
void MEDMEM.PointerOf< T >::set ( const int size  ) 

If necessary, released memory holded by PointerOf
. Else allocates memory and sets desallocation boolean to true.
Can be used in order to "nullify" an existing PointerOf
Memory will be desallocated when erasing this PointerOf

References MEDMEM.PointerOf< T >._done, MEDMEM.PointerOf< T >._pointer, and NULL.

template<typename T>
void MEDMEM.PointerOf< T >::set ( const T *  pointer  ) 

If necessary, released memory holded by PointerOf
. Then, sets _pointer to the memory zone pointed by T*.
T* owner is in charged of memory desallocation.
memory will not be released when erasing this PointerOf

References MEDMEM.PointerOf< T >._done, MEDMEM.PointerOf< T >._pointer, MESSAGE_MED, and SCRUTE_MED.

template<typename T>
void MEDMEM.PointerOf< T >::set ( const int size,
const T *  pointer 
)

If necessary, released memory holded by PointerOf
. If size < 0, return an exception
. Else allocates memory and sets desallocation boolean to true.
Can be used in order to "nullify" an existing PointerOf
Memory will be desallocated when erasing this PointerOf

References MEDMEM.PointerOf< T >._done, MEDMEM.PointerOf< T >._pointer, and NULL.

template<typename T>
void MEDMEM.PointerOf< T >::setShallowAndOwnership ( const T *  pointer  ) 
template<typename T>
PointerOf< T > & MEDMEM.PointerOf< T >::operator= ( const PointerOf< T > &  pointer  ) 

Creates a standard pointer (T*) to the pointed memory.
The boolean for desallocation is setted to false.
Be aware :

References MEDMEM.PointerOf< T >._pointer, BEGIN_OF_MED, and END_OF_MED.


Field Documentation

template<typename T>
T* MEDMEM.PointerOf< T >._pointer

pointer to the pointed memory

template<typename T>
bool MEDMEM.PointerOf< T >._done

boolean setted to true if memory has to be desallocated