Lugdunum  0.1.0
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset > Class Template Reference

#include <Chunk.hpp>

Collaboration diagram for lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >:
[legend]

Public Member Functions

 Chunk (lug::System::Memory::Area::IArea *area)
 
 Chunk (const Chunk &)=delete
 
 Chunk (Chunk &&)=default
 
Chunkoperator= (const Chunk &)=delete
 
Chunkoperator= (Chunk &&)=default
 
 ~Chunk ()=default
 
void * allocate (size_t size, size_t alignment, size_t offset)
 
void free (void *ptr)
 
void reset ()
 
size_t getSize (void *ptr) const
 

Private Attributes

lug::System::Memory::Area::IArea *const _area
 
FreeList _freeList {ChunkSize}
 
lug::System::Memory::Area::Page_currentPage {nullptr}
 
lug::System::Memory::Area::Page_firstPage {nullptr}
 

Static Private Attributes

static constexpr size_t ChunkSize = (MaxAlignment <= 1 ? MaxSize : priv::ceil(static_cast<float>(MaxSize) / MaxAlignment) * MaxAlignment)
 

Detailed Description

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
class lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >

Definition at line 34 of file Chunk.hpp.

Constructor & Destructor Documentation

◆ Chunk() [1/3]

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
Chunk::Chunk ( lug::System::Memory::Area::IArea area)

Definition at line 2 of file Chunk.inl.

◆ Chunk() [2/3]

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >::Chunk ( const Chunk< MaxSize, MaxAlignment, Offset > &  )
delete

◆ Chunk() [3/3]

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >::Chunk ( Chunk< MaxSize, MaxAlignment, Offset > &&  )
default

◆ ~Chunk()

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >::~Chunk ( )
default

Member Function Documentation

◆ operator=() [1/2]

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
Chunk& lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >::operator= ( const Chunk< MaxSize, MaxAlignment, Offset > &  )
delete

◆ operator=() [2/2]

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
Chunk& lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >::operator= ( Chunk< MaxSize, MaxAlignment, Offset > &&  )
default

◆ allocate()

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
void * Chunk::allocate ( size_t  size,
size_t  alignment,
size_t  offset 
)

Definition at line 5 of file Chunk.inl.

◆ free()

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
void Chunk::free ( void *  ptr)

Definition at line 25 of file Chunk.inl.

◆ reset()

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
void Chunk::reset ( )

Definition at line 30 of file Chunk.inl.

◆ getSize()

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
size_t Chunk::getSize ( void *  ptr) const

Definition at line 36 of file Chunk.inl.

Member Data Documentation

◆ ChunkSize

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
constexpr size_t lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >::ChunkSize = (MaxAlignment <= 1 ? MaxSize : priv::ceil(static_cast<float>(MaxSize) / MaxAlignment) * MaxAlignment)
staticprivate

Definition at line 52 of file Chunk.hpp.

◆ _area

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
lug::System::Memory::Area::IArea* const lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >::_area
private

Definition at line 54 of file Chunk.hpp.

◆ _freeList

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
FreeList lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >::_freeList {ChunkSize}
private

Definition at line 55 of file Chunk.hpp.

◆ _currentPage

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
lug::System::Memory::Area::Page* lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >::_currentPage {nullptr}
private

Definition at line 57 of file Chunk.hpp.

◆ _firstPage

template<size_t MaxSize, size_t MaxAlignment = MaxSize, size_t Offset = 0>
lug::System::Memory::Area::Page* lug::System::Memory::Allocator::Chunk< MaxSize, MaxAlignment, Offset >::_firstPage {nullptr}
private

Definition at line 58 of file Chunk.hpp.


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