Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::app::FreeListAllocatorResource Class Reference

#include <allocator_resources.hpp>

Public Member Functions

 FreeListAllocatorResource (size_t capacity=64 *1024 *1024)
 Constructs resource with a free list allocator.
 
 FreeListAllocatorResource (const FreeListAllocatorResource &)=delete
 
 FreeListAllocatorResource (FreeListAllocatorResource &&) noexcept=default
 
 ~FreeListAllocatorResource () noexcept=default
 
FreeListAllocatorResourceoperator= (const FreeListAllocatorResource &)=delete
 
FreeListAllocatorResourceoperator= (FreeListAllocatorResource &&) noexcept=default
 
memory::FreeListAllocatorGet () noexcept
 Gets reference to the free list allocator.
 
const memory::FreeListAllocatorGet () const noexcept
 Gets const reference to the free list allocator.
 
void Reset () noexcept
 Resets the allocator, freeing all allocations.
 
bool Empty () const noexcept
 Checks if the allocator is empty.
 
memory::AllocatorStats Stats () const noexcept
 Gets allocator statistics.
 
size_t Capacity () const noexcept
 Gets the capacity of the allocator.
 

Static Public Member Functions

static constexpr std::string_view Name () noexcept
 Gets the resource name for registration.
 

Detailed Description

Definition at line 118 of file allocator_resources.hpp.

Constructor & Destructor Documentation

◆ FreeListAllocatorResource() [1/3]

helios::app::FreeListAllocatorResource::FreeListAllocatorResource ( size_t  capacity = 64 * 1024 * 1024)
inlineexplicit

Constructs resource with a free list allocator.

Parameters
capacitySize of the allocator buffer in bytes (default: 64MB)

Definition at line 124 of file allocator_resources.hpp.

124: allocator_(capacity) {}

◆ FreeListAllocatorResource() [2/3]

helios::app::FreeListAllocatorResource::FreeListAllocatorResource ( const FreeListAllocatorResource )
delete

◆ FreeListAllocatorResource() [3/3]

helios::app::FreeListAllocatorResource::FreeListAllocatorResource ( FreeListAllocatorResource &&  )
defaultnoexcept

◆ ~FreeListAllocatorResource()

helios::app::FreeListAllocatorResource::~FreeListAllocatorResource ( )
defaultnoexcept

Member Function Documentation

◆ Capacity()

size_t helios::app::FreeListAllocatorResource::Capacity ( ) const
inlinenoexcept

Gets the capacity of the allocator.

Returns
Capacity in bytes
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/memory/allocator_resources.hpp.

Definition at line 165 of file allocator_resources.hpp.

165{ return allocator_.Capacity(); }
size_t Capacity() const noexcept
Gets the total capacity of the allocator.

◆ Empty()

bool helios::app::FreeListAllocatorResource::Empty ( ) const
inlinenoexcept

Checks if the allocator is empty.

Returns
True if no allocations exist
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/memory/allocator_resources.hpp.

Definition at line 153 of file allocator_resources.hpp.

153{ return allocator_.Empty(); }
bool Empty() const noexcept
Checks if the allocator is empty (all memory free).

◆ Get() [1/2]

const memory::FreeListAllocator & helios::app::FreeListAllocatorResource::Get ( ) const
inlinenoexcept

Gets const reference to the free list allocator.

Returns
Const reference to FreeListAllocator

Definition at line 142 of file allocator_resources.hpp.

142{ return allocator_; }

◆ Get() [2/2]

memory::FreeListAllocator & helios::app::FreeListAllocatorResource::Get ( )
inlinenoexcept

Gets reference to the free list allocator.

Returns
Reference to FreeListAllocator
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/memory/allocator_resources.hpp.

Definition at line 136 of file allocator_resources.hpp.

136{ return allocator_; }

◆ Name()

static constexpr std::string_view helios::app::FreeListAllocatorResource::Name ( )
inlinestaticconstexprnoexcept

Gets the resource name for registration.

Returns
Resource name
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/memory/allocator_resources.hpp.

Definition at line 171 of file allocator_resources.hpp.

171{ return "FreeListAllocatorResource"; }

◆ operator=() [1/2]

◆ operator=() [2/2]

FreeListAllocatorResource & helios::app::FreeListAllocatorResource::operator= ( FreeListAllocatorResource &&  )
defaultnoexcept

◆ Reset()

void helios::app::FreeListAllocatorResource::Reset ( )
inlinenoexcept

Resets the allocator, freeing all allocations.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/memory/allocator_resources.hpp.

Definition at line 147 of file allocator_resources.hpp.

147{ allocator_.Reset(); }
void Reset() noexcept
Resets the allocator, freeing all allocations.

◆ Stats()

memory::AllocatorStats helios::app::FreeListAllocatorResource::Stats ( ) const
inlinenoexcept

Gets allocator statistics.

Returns
AllocatorStats with current usage
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/memory/allocator_resources.hpp.

Definition at line 159 of file allocator_resources.hpp.

159{ return allocator_.Stats(); }
AllocatorStats Stats() const noexcept
Gets current allocator statistics.