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

#include <allocator_resources.hpp>

Public Member Functions

 StackAllocatorResource (size_t capacity=16 *1024 *1024)
 Constructs resource with a stack allocator.
 
 StackAllocatorResource (const StackAllocatorResource &)=delete
 
 StackAllocatorResource (StackAllocatorResource &&) noexcept=default
 
 ~StackAllocatorResource () noexcept=default
 
StackAllocatorResourceoperator= (const StackAllocatorResource &)=delete
 
StackAllocatorResourceoperator= (StackAllocatorResource &&) noexcept=default
 
memory::StackAllocatorGet () noexcept
 Gets reference to the stack allocator.
 
const memory::StackAllocatorGet () const noexcept
 Gets const reference to the stack allocator.
 
void Reset () noexcept
 Resets the stack allocator, freeing all allocations.
 
bool Empty () const noexcept
 Checks if the stack allocator is empty.
 
bool Full () const noexcept
 Checks if the stack allocator is full.
 
memory::AllocatorStats Stats () const noexcept
 Gets stack 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 302 of file allocator_resources.hpp.

Constructor & Destructor Documentation

◆ StackAllocatorResource() [1/3]

helios::app::StackAllocatorResource::StackAllocatorResource ( size_t  capacity = 16 * 1024 * 1024)
inlineexplicit

Constructs resource with a stack allocator.

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

Definition at line 308 of file allocator_resources.hpp.

308: allocator_(capacity) {}

◆ StackAllocatorResource() [2/3]

helios::app::StackAllocatorResource::StackAllocatorResource ( const StackAllocatorResource )
delete

◆ StackAllocatorResource() [3/3]

helios::app::StackAllocatorResource::StackAllocatorResource ( StackAllocatorResource &&  )
defaultnoexcept

◆ ~StackAllocatorResource()

helios::app::StackAllocatorResource::~StackAllocatorResource ( )
defaultnoexcept

Member Function Documentation

◆ Capacity()

size_t helios::app::StackAllocatorResource::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 355 of file allocator_resources.hpp.

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

◆ Empty()

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

Checks if the stack 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 337 of file allocator_resources.hpp.

337{ return allocator_.Empty(); }
bool Empty() const noexcept
Checks if the allocator is empty.

◆ Full()

bool helios::app::StackAllocatorResource::Full ( ) const
inlinenoexcept

Checks if the stack allocator is full.

Returns
True if no more allocations can be made without reset
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/memory/allocator_resources.hpp.

Definition at line 343 of file allocator_resources.hpp.

343{ return allocator_.Full(); }
bool Full() const noexcept
Checks if the allocator is full.

◆ Get() [1/2]

const memory::StackAllocator & helios::app::StackAllocatorResource::Get ( ) const
inlinenoexcept

Gets const reference to the stack allocator.

Returns
Const reference to StackAllocator

Definition at line 326 of file allocator_resources.hpp.

326{ return allocator_; }

◆ Get() [2/2]

memory::StackAllocator & helios::app::StackAllocatorResource::Get ( )
inlinenoexcept

Gets reference to the stack allocator.

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

Definition at line 320 of file allocator_resources.hpp.

320{ return allocator_; }

◆ Name()

static constexpr std::string_view helios::app::StackAllocatorResource::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 361 of file allocator_resources.hpp.

361{ return "StackAllocatorResource"; }

◆ operator=() [1/2]

◆ operator=() [2/2]

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

◆ Reset()

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

Resets the stack allocator, freeing all allocations.

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

Definition at line 331 of file allocator_resources.hpp.

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

◆ Stats()

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

Gets stack 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 349 of file allocator_resources.hpp.

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