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

#include <allocator_resources.hpp>

Public Member Functions

 FrameAllocatorResource (size_t capacity=16 *1024 *1024)
 Constructs resource with a frame allocator.
 
 FrameAllocatorResource (const FrameAllocatorResource &)=delete
 
 FrameAllocatorResource (FrameAllocatorResource &&) noexcept=default
 
 ~FrameAllocatorResource () noexcept=default
 
FrameAllocatorResourceoperator= (const FrameAllocatorResource &)=delete
 
FrameAllocatorResourceoperator= (FrameAllocatorResource &&) noexcept=default
 
void Reset () noexcept
 Resets the frame allocator, freeing all allocations.
 
bool Empty () const noexcept
 Checks if the frame allocator is empty.
 
memory::FrameAllocatorGet () noexcept
 Gets reference to the frame allocator.
 
const memory::FrameAllocatorGet () const noexcept
 Gets const reference to the frame allocator.
 
memory::AllocatorStats Stats () const noexcept
 Gets frame allocator statistics.
 
size_t Capacity () const noexcept
 Gets the capacity of the frame allocator.
 

Static Public Member Functions

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

Detailed Description

Definition at line 39 of file allocator_resources.hpp.

Constructor & Destructor Documentation

◆ FrameAllocatorResource() [1/3]

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

Constructs resource with a frame allocator.

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

Definition at line 45 of file allocator_resources.hpp.

45: allocator_(capacity) {}

◆ FrameAllocatorResource() [2/3]

helios::app::FrameAllocatorResource::FrameAllocatorResource ( const FrameAllocatorResource )
delete

◆ FrameAllocatorResource() [3/3]

helios::app::FrameAllocatorResource::FrameAllocatorResource ( FrameAllocatorResource &&  )
defaultnoexcept

◆ ~FrameAllocatorResource()

helios::app::FrameAllocatorResource::~FrameAllocatorResource ( )
defaultnoexcept

Member Function Documentation

◆ Capacity()

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

Gets the capacity of the frame allocator.

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

Definition at line 87 of file allocator_resources.hpp.

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

◆ Empty()

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

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

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

◆ Get() [1/2]

const memory::FrameAllocator & helios::app::FrameAllocatorResource::Get ( ) const
inlinenoexcept

Gets const reference to the frame allocator.

Returns
Const reference to FrameAllocator

Definition at line 75 of file allocator_resources.hpp.

75{ return allocator_; }

◆ Get() [2/2]

memory::FrameAllocator & helios::app::FrameAllocatorResource::Get ( )
inlinenoexcept

Gets reference to the frame allocator.

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

Definition at line 69 of file allocator_resources.hpp.

69{ return allocator_; }

◆ Name()

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

93{ return "FrameAllocatorResource"; }

◆ operator=() [1/2]

◆ operator=() [2/2]

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

◆ Reset()

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

Resets the frame allocator, freeing all allocations.

Should be called at frame boundaries.

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

Definition at line 57 of file allocator_resources.hpp.

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

◆ Stats()

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

Gets frame 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 81 of file allocator_resources.hpp.

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