Menu

object::RawStorageAllocator< tag, mem_size > Class Template Reference

Allocator allocating from RawStorage. More...

#include <Allocator.h>

Public Types

typedef ThisType::SizeT SizeT
 Type to use for sizes.

Static Public Member Functions

static uint8_t * alloc (SizeT bytes)
 Allocate raw memory (no constructor call).
static void free (uint8_t *p)
 Free memory previously allocated by alloc().
template<typename T >
static T * alloc_array (SizeT num)
 Allocate array (no constructor call).
template<typename T >
static void free_array (T *p)
 Free array previously allocated by alloc_array().
template<typename T >
static void destroy (T *p)
 Destruct and free object previously allocated by allocator new.

Static Protected Member Functions

static ThisTypeinstance ()
 Singleton instance of RawStorage.

Detailed Description

template<class tag, uint64_t mem_size>
class object::RawStorageAllocator< tag, mem_size >

Allocator allocating from RawStorage.

Template Parameters:
tag Type not used for internal purposes but to allow multiple seperated RawStorage pools to be used for allocation. Allocators with the same tag share one RawStorage object (implemented as singleton).
mem_size Size of RawStorage memory pool
See also:
object/Allocator.h

Member Typedef Documentation

template<class tag, uint64_t mem_size>
typedef ThisType::SizeT object::RawStorageAllocator< tag, mem_size >::SizeT

Type to use for sizes.


Member Function Documentation

template<class tag, uint64_t mem_size>
static uint8_t* object::RawStorageAllocator< tag, mem_size >::alloc ( SizeT  bytes  )  [inline, static]

Allocate raw memory (no constructor call).

Parameters:
bytes Number of bytes to allocate
Returns:
Pointer to uninitialized allocated memory or NULL on error.

References object::RawStorage< size >::alloc(), and object::RawStorageAllocator< tag, mem_size >::instance().

Referenced by object::RawStorageAllocator< tag, mem_size >::alloc_array().

template<class tag, uint64_t mem_size>
template<typename T >
static T* object::RawStorageAllocator< tag, mem_size >::alloc_array ( SizeT  num  )  [inline, static]

Allocate array (no constructor call).

Template Parameters:
T Array element type
Parameters:
num Number of T items to allocate
Returns:
Pointer to uninitialized allocated memory or NULL on error.

References object::RawStorageAllocator< tag, mem_size >::alloc().

template<class tag, uint64_t mem_size>
template<typename T >
static void object::RawStorageAllocator< tag, mem_size >::destroy ( T *  p  )  [inline, static]

Destruct and free object previously allocated by allocator new.

Parameters:
p Pointer to object to free

References object::RawStorageAllocator< tag, mem_size >::free().

template<class tag, uint64_t mem_size>
static void object::RawStorageAllocator< tag, mem_size >::free ( uint8_t *  p  )  [inline, static]
template<class tag, uint64_t mem_size>
template<typename T >
static void object::RawStorageAllocator< tag, mem_size >::free_array ( T *  p  )  [inline, static]

Free array previously allocated by alloc_array().

Parameters:
p Pointer to memory to free
Note:
Does not call destuctors!

References object::RawStorageAllocator< tag, mem_size >::free().

template<class tag, uint64_t mem_size>
static ThisType& object::RawStorageAllocator< tag, mem_size >::instance (  )  [inline, static, protected]

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