Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
Allocators::Pool< T, Storage > Class Template Reference

allocator design parameters: More...

#include <pool.h>

Public Member Functions

 Pool (size_t maxObjects)
 
size_t RemainingObjects ()
 
TAllocate ()
 
void Deallocate (T *p)
 
void DeallocateAll ()
 
bool Contains (uintptr_t address) const
 

Static Public Attributes

static const size_t objectSize = ROUND_UP(sizeof(T), sizeof(intptr_t))
 

Private Member Functions

 NONCOPYABLE (Pool)
 

Private Attributes

Storage storage
 
size_t end
 
void * freelist
 

Detailed Description

template<typename T, class Storage = Storage_Fixed<>>
class Allocators::Pool< T, Storage >

allocator design parameters:

  • O(1) allocation and deallocation;
  • fixed-size objects;
  • support for deallocating all objects;
  • consecutive allocations are back-to-back;
  • objects are aligned to the pointer size.

Constructor & Destructor Documentation

◆ Pool()

template<typename T , class Storage = Storage_Fixed<>>
Allocators::Pool< T, Storage >::Pool ( size_t  maxObjects)
inline

Member Function Documentation

◆ Allocate()

template<typename T , class Storage = Storage_Fixed<>>
T * Allocators::Pool< T, Storage >::Allocate ( )
inline

◆ Contains()

template<typename T , class Storage = Storage_Fixed<>>
bool Allocators::Pool< T, Storage >::Contains ( uintptr_t  address) const
inline

◆ Deallocate()

template<typename T , class Storage = Storage_Fixed<>>
void Allocators::Pool< T, Storage >::Deallocate ( T p)
inline

◆ DeallocateAll()

template<typename T , class Storage = Storage_Fixed<>>
void Allocators::Pool< T, Storage >::DeallocateAll ( )
inline

◆ NONCOPYABLE()

template<typename T , class Storage = Storage_Fixed<>>
Allocators::Pool< T, Storage >::NONCOPYABLE ( Pool< T, Storage )
private

◆ RemainingObjects()

template<typename T , class Storage = Storage_Fixed<>>
size_t Allocators::Pool< T, Storage >::RemainingObjects ( )
inline

Member Data Documentation

◆ end

template<typename T , class Storage = Storage_Fixed<>>
size_t Allocators::Pool< T, Storage >::end
private

◆ freelist

template<typename T , class Storage = Storage_Fixed<>>
void* Allocators::Pool< T, Storage >::freelist
private

◆ objectSize

template<typename T , class Storage = Storage_Fixed<>>
const size_t Allocators::Pool< T, Storage >::objectSize = ROUND_UP(sizeof(T), sizeof(intptr_t))
static

◆ storage

template<typename T , class Storage = Storage_Fixed<>>
Storage Allocators::Pool< T, Storage >::storage
private

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