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

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

Inheritance diagram for CorePool< T >:
CorePoolBase< T, InPlaceChunkItem< T > >

Public Types

typedef CorePoolBase< T,
InPlaceChunkItem< T > > 
BaseType
 

Public Member Functions

 CorePool (const unsigned int &chunk_size=128)
 Constructor.
 
T * alloc_object ()
 Gets the pointer of an available object. Do not call the object constructor.
 
void free_object (T *obj)
 Frees the object with specified pointer. Do not call the object destructor.
 
T * new_object ()
 Gets the pointer of an available object. Call the object constructor.
 
void delete_object (T *obj)
 Frees the object with specified pointer. Call the object destructor.
 
- Public Member Functions inherited from CorePoolBase< T, InPlaceChunkItem< T > >
 CorePoolBase (const unsigned int &chunk_size=128)
 
unsigned int get_allocated_object_count () const
 
unsigned int get_used_object_count () const
 
virtual size_t get_memory_size () const
 

Protected Member Functions

T * get_unused_object ()
 
- Protected Member Functions inherited from CorePoolBase< T, InPlaceChunkItem< T > >
void set_unused_object (T *object)
 

Additional Inherited Members

- Protected Attributes inherited from CorePoolBase< T, InPlaceChunkItem< T > >
InPlaceChunkItem< T > ** m_chunk_array
 
InPlaceChunkItem< T > * m_first_free
 
unsigned int m_chunk_size
 
unsigned int m_chunk_array_size
 
unsigned int m_chunk_count
 
unsigned int m_object_count
 

Detailed Description

template<class T>
class CorePool< T >

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

Constructors are called only once for the first use of objects. Destructors are called only for used objects during the pool destruction.

Constructor & Destructor Documentation

template<class T>
CorePool< T >::CorePool ( const unsigned int &  chunk_size = 128)
inline

Constructor.

Parameters
[in]chunk_sizenumber of objects allocated at once