Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
CoreArrayPool< T > Class Template Reference

Memory manager allowing to create and delete arrays of objects in a memory efficient way. More...

Public Member Functions

 CoreArrayPool (const unsigned int &array_size, const unsigned int &chunk_size=128)
 Constructor.
 
void init (const unsigned int &array_size, const unsigned int &chunk_size=128)
 Init the pool and clear any allocated memory.
 
T * alloc_array ()
 Gets the pointer of an available array. Do not call objects constructor.
 
void free_array (T *array)
 Frees the array with specified pointer. Do not call objects destructor.
 
T * new_array ()
 Gets the pointer of an available array. Call objects constructor.
 
void delete_array (T *array)
 Frees the array with specified pointer. Call objects destructor.
 
unsigned int get_array_size () const
 
unsigned int get_allocated_array_count () const
 
unsigned int get_used_array_count () const
 
size_t get_memory_size () const
 

Detailed Description

template<class T>
class CoreArrayPool< T >

Memory manager allowing to create and delete arrays of objects in a memory efficient way.

Constructor & Destructor Documentation

template<class T >
CoreArrayPool< T >::CoreArrayPool ( const unsigned int &  array_size,
const unsigned int &  chunk_size = 128 
)

Constructor.

Parameters
[in]array_sizesize of arrays to allocate
[in]chunk_sizenumber of arrays allocated at once

Member Function Documentation

template<class T >
void CoreArrayPool< T >::init ( const unsigned int &  array_size,
const unsigned int &  chunk_size = 128 
)

Init the pool and clear any allocated memory.

Parameters
[in]array_sizenumber of objects per allocated array
[in]chunk_sizenumber of arrays allocated at once