Dali 3D User Interface Engine
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Dali::Internal::MemoryPoolObjectAllocator< T > Class Template Reference

Helper for allocating/deallocating objects using a memory pool. More...

#include <memory-pool-object-allocator.h>

Inheritance diagram for Dali::Internal::MemoryPoolObjectAllocator< T >:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::MemoryPoolObjectAllocator< T >:
Collaboration graph
[legend]

Public Member Functions

 MemoryPoolObjectAllocator ()
 Constructor. More...
 
 ~MemoryPoolObjectAllocator ()
 Destructor. More...
 
T * Allocate ()
 Allocate from the memory pool. More...
 
T * AllocateThreadSafe ()
 Thread-safe version of Allocate() More...
 
void * AllocateRaw ()
 Allocate a block of memory from the memory pool of the appropriate size to store an object of type T. More...
 
void * AllocateRawThreadSafe ()
 Thread-safe version of AllocateRaw() More...
 
void Free (T *object)
 Return the object to the memory pool. More...
 
void FreeThreadSafe (T *object)
 Thread-safe version of Free() More...
 
void ResetMemoryPool ()
 Reset the memory pool, unloading all block memory previously allocated. More...
 

Private Member Functions

 MemoryPoolObjectAllocator (const MemoryPoolObjectAllocator &memoryPoolObjectAllocator)
 
MemoryPoolObjectAllocatoroperator= (const MemoryPoolObjectAllocator &memoryPoolObjectAllocator)
 

Private Attributes

FixedSizeMemoryPoolmPool
 Memory pool from which allocations are made. More...
 

Detailed Description

template<typename T>
class Dali::Internal::MemoryPoolObjectAllocator< T >

Helper for allocating/deallocating objects using a memory pool.

This is a helper class for creating and destroying objects of a single given type. The type may be a class or POD.

Definition at line 38 of file memory-pool-object-allocator.h.

Constructor & Destructor Documentation

Constructor.

Definition at line 45 of file memory-pool-object-allocator.h.

Destructor.

Definition at line 54 of file memory-pool-object-allocator.h.

template<typename T>
Dali::Internal::MemoryPoolObjectAllocator< T >::MemoryPoolObjectAllocator ( const MemoryPoolObjectAllocator< T > &  memoryPoolObjectAllocator)
private

Member Function Documentation

template<typename T>
T* Dali::Internal::MemoryPoolObjectAllocator< T >::Allocate ( )
inline

Allocate from the memory pool.

Returns
Return the allocated object

Definition at line 64 of file memory-pool-object-allocator.h.

template<typename T>
void* Dali::Internal::MemoryPoolObjectAllocator< T >::AllocateRaw ( )
inline

Allocate a block of memory from the memory pool of the appropriate size to store an object of type T.

This is usually so the memory can be used in a placement new for an object of type T with a constructor that takes multiple parameters.

Returns
Return the allocated memory block

Definition at line 87 of file memory-pool-object-allocator.h.

template<typename T>
void* Dali::Internal::MemoryPoolObjectAllocator< T >::AllocateRawThreadSafe ( )
inline

Thread-safe version of AllocateRaw()

Returns
Return the allocated memory block

Definition at line 97 of file memory-pool-object-allocator.h.

template<typename T>
T* Dali::Internal::MemoryPoolObjectAllocator< T >::AllocateThreadSafe ( )
inline

Thread-safe version of Allocate()

Returns
Return the allocated object

Definition at line 74 of file memory-pool-object-allocator.h.

template<typename T>
void Dali::Internal::MemoryPoolObjectAllocator< T >::Free ( T *  object)
inline

Return the object to the memory pool.

Parameters
objectPointer to the object to delete

Definition at line 107 of file memory-pool-object-allocator.h.

template<typename T>
void Dali::Internal::MemoryPoolObjectAllocator< T >::FreeThreadSafe ( T *  object)
inline

Thread-safe version of Free()

Parameters
objectPointer to the object to delete

Definition at line 119 of file memory-pool-object-allocator.h.

template<typename T>
MemoryPoolObjectAllocator& Dali::Internal::MemoryPoolObjectAllocator< T >::operator= ( const MemoryPoolObjectAllocator< T > &  memoryPoolObjectAllocator)
private
template<typename T>
void Dali::Internal::MemoryPoolObjectAllocator< T >::ResetMemoryPool ( )
inline

Reset the memory pool, unloading all block memory previously allocated.

Definition at line 129 of file memory-pool-object-allocator.h.

Referenced by Dali::Internal::MemoryPoolObjectAllocator< Dali::Internal::MemoryPoolRelayoutContainer::RelayoutInfo >::MemoryPoolObjectAllocator().

Here is the caller graph for this function:

Member Data Documentation

template<typename T>
FixedSizeMemoryPool* Dali::Internal::MemoryPoolObjectAllocator< T >::mPool
private

The documentation for this class was generated from the following file:
Dali Docs Home
Read more about Dali