Falcon
Public Member Functions | List of all members
fmemory::PoolAllocator Class Reference

#include <PoolAllocator.hpp>

Public Member Functions

 PoolAllocator ()
 
 PoolAllocator (const std::size_t size_in_bytes, const std::size_t num_of_elements, const std::size_t alignment)
 
void CreatePool (const std::size_t size_in_bytes, const std::size_t num_of_elements, const std::size_t alignment)
 
void * GetBlocKFromPool ()
 
void Release (void *mem_ref)
 
void * GetPoolMemLocation ()
 
 PoolAllocator (PoolAllocator &poolRef)=delete
 
PoolAllocatoroperator= (const PoolAllocator &poolRef)=default
 
 PoolAllocator (PoolAllocator &&refToPool)=delete
 
PoolAllocatoroperator= (const PoolAllocator &&refToPool)=delete
 
 ~PoolAllocator ()
 

Constructor & Destructor Documentation

◆ PoolAllocator() [1/4]

fmemory::PoolAllocator::PoolAllocator ( )

Default constructor

◆ PoolAllocator() [2/4]

fmemory::PoolAllocator::PoolAllocator ( const std::size_t  element_size_in_bytes,
const std::size_t  num_of_elements,
const std::size_t  alignment 
)

Parameterized constructor

Parameters
size_telement size in bytes sizeof(T)
size_tnumber of elements
size_talignment required

◆ PoolAllocator() [3/4]

fmemory::PoolAllocator::PoolAllocator ( PoolAllocator poolRef)
delete

◆ PoolAllocator() [4/4]

fmemory::PoolAllocator::PoolAllocator ( PoolAllocator &&  refToPool)
delete

◆ ~PoolAllocator()

fmemory::PoolAllocator::~PoolAllocator ( )

Destructor. Deallocates all the memory and frees everything.

Member Function Documentation

◆ CreatePool()

void fmemory::PoolAllocator::CreatePool ( const std::size_t  element_size_in_bytes,
const std::size_t  num_of_elements,
const std::size_t  alignment 
)

Creats pool of memory for requested number of elements.

Parameters
size_telement size in bytes sizeof(T)
size_tnumber of elements
size_talignment required

◆ GetBlocKFromPool()

void * fmemory::PoolAllocator::GetBlocKFromPool ( )

Returns next free block from pool.

Returns
void* returns pointer if block available else nullptr

◆ GetPoolMemLocation()

void * fmemory::PoolAllocator::GetPoolMemLocation ( )

Returns base pointer to the pool.

Returns
void* return pointer to the pool

◆ operator=() [1/2]

PoolAllocator& fmemory::PoolAllocator::operator= ( const PoolAllocator &&  refToPool)
delete

◆ operator=() [2/2]

PoolAllocator& fmemory::PoolAllocator::operator= ( const PoolAllocator poolRef)
default

◆ Release()

void fmemory::PoolAllocator::Release ( void *  memory_block)

Releases the referenced block and adds back to free list.

Parameters
void*pointer to memory_block

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