# TMCSMPArray< T > Class Template Reference
[MCCore]

Inheritance diagram for TMCSMPArray< T >:

List of all members.

## Public Member Functions
| TMCSMPArray ()
virtual | ~TMCSMPArray ()
void | SetStackDepth (int32 depth)
void | SetAverageElemSpace (int32 elemSpace)
TMCArray< T > & | GetArray (TMCSMPArrayRequest< T > &request)
## Protected Member Functions
void | PopArray ()
## Static Protected Member Functions
static void | FreeArray (void **privData)
## Protected Attributes
int32 | fStackDepth
int32 | fAverageElemSpace
TMCLocalStorage * | fTLSArray
TMCLocalStorage * | fStackIndex
## Friends
class | TMCSMPArrayRequest< T >

## Detailed Description

### template<class T>
class TMCSMPArray< T >

TMCSMPArray is a way to get TMCArray in a SMP context wihtout allocating memory each time.

It behaves like a stack. So a function that uses an SMPArray can be recursively called.

Usage:
TMCSMPArrayRequest< _TYPE_ > request;
TMCArray< _TYPE_ >& myArray = fArrayVolumeRec.GetArray( request );

Prelated class: TMCArray

## Constructor & Destructor Documentation

template<class T >

TMCSMPArray< T >::TMCSMPArray | ( |  | ) | `[inline]`

Construt a dynamic array (TMCArray) SMP-friendly. That is to say, the array will not be allocated on the stack. But all the Threads will have their own.

template<class T >

virtual TMCSMPArray< T >::~TMCSMPArray | ( |  | ) | `[inline, virtual]`

Destructor. Remove the TLS. Note: the memory used by the arrays is freed when the thread dies.

## Member Function Documentation

template<class T >

void TMCSMPArray< T >::FreeArray | ( | void ** | privData | ) | `[inline, static, protected]`

This is to remove the all allocated memory when the thread die

template<class T >

TMCArray< T > & TMCSMPArray< T >::GetArray | ( | TMCSMPArrayRequest< T > & | request | ) | `[inline]`

This is the way to get a reference to an TMCArray

Parameters:

  | request | is a class instanciated on the stack to help for asking and destructing the array. Just create it like that : TMCSMPArrayRequest request; or TMCSMPArrayRequest request(size_of_the_wanted_array);

template<class T >

void TMCSMPArray< T >::PopArray | ( |  | ) | `[inline, protected]`

Pop the last gotten array

template<class T >

void TMCSMPArray< T >::SetAverageElemSpace | ( | int32 | elemSpace | ) | `[inline]`

[Optional] Can be used to optimize memory allocation by setting directly the the size of the array.

Note:
  Call it before asking the first Array.

template<class T >

void TMCSMPArray< T >::SetStackDepth | ( | int32 | depth | ) | `[inline]`

[Optional] Can be used to optimize memory allocation by setting directly the number of wanted recursion.

Note:
  Call it before asking the first Array.

## Friends And Related Function Documentation

template<class T >

friend class TMCSMPArrayRequest< T >`[friend]`

## Member Data Documentation

template<class T >

int32 TMCSMPArray< T >::fAverageElemSpace`[protected]`

template<class T >

int32 TMCSMPArray< T >::fStackDepth`[protected]`

template<class T >

TMCLocalStorage* TMCSMPArray< T >::fStackIndex`[protected]`

template<class T >

TMCLocalStorage* TMCSMPArray< T >::fTLSArray`[protected]`

The documentation for this class was generated from the following file:

- MCSMPArray.h