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

Per-system execution context with validated access. More...

#include <system_context.hpp>

Public Types

using QueryAllocator = memory::STLGrowableAllocator< ecs::ComponentTypeId, memory::FrameAllocator >
 Allocator type for component type IDs in queries.
 
using CommandAllocator = memory::STLGrowableAllocator< std::unique_ptr< ecs::Command >, memory::FrameAllocator >
 Allocator type for command pointers in command buffers.
 

Public Member Functions

 SystemContext (ecs::World &world, const details::SystemInfo &system_info, async::Executor &executor, ecs::details::SystemLocalStorage &local_storage) noexcept
 Constructs a system context with Executor for main schedule systems.
 
 SystemContext (ecs::World &world, const details::SystemInfo &system_info, async::SubTaskGraph &sub_graph, ecs::details::SystemLocalStorage &local_storage) noexcept
 Constructs a system context with SubTaskGraph for parallel schedule systems.
 
 SystemContext (const SystemContext &)=delete
 
 SystemContext (SystemContext &&)=delete
 
 ~SystemContext () noexcept=default
 
SystemContextoperator= (const SystemContext &)=delete
 
SystemContextoperator= (SystemContext &&)=delete
 
auto Query () noexcept -> ecs::QueryBuilder< QueryAllocator >
 
auto ReadOnlyQuery () const noexcept -> ecs::ReadOnlyQueryBuilder< QueryAllocator >
 
auto Commands () noexcept -> ecs::WorldCmdBuffer< CommandAllocator >
 Creates a command buffer for deferred world operations.
 
auto EntityCommands (ecs::Entity entity) -> ecs::EntityCmdBuffer< CommandAllocator >
 Creates an entity command buffer for a specific entity.
 
ecs::Entity ReserveEntity ()
 Reserves an entity ID for deferred creation.
 
template<ecs::ResourceTrait T>
T & WriteResource ()
 Gets mutable reference to a resource.
 
template<ecs::ResourceTrait T>
const T & ReadResource () const
 Gets const reference to a resource.
 
template<ecs::ResourceTrait T>
T * TryWriteResource ()
 Tries to get mutable pointer to a resource.
 
template<ecs::ResourceTrait T>
const T * TryReadResource () const
 Tries to get const pointer to a resource.
 
template<ecs::EventTrait T>
void EmitEvent (const T &event)
 Emits an event to the local event queue.
 
template<std::ranges::sized_range R>
requires ecs::EventTrait<std::ranges::range_value_t<R>>
void EmitEventBulk (const R &events)
 Emits multiple events in bulk.
 
template<ecs::EventTrait T>
auto ReadEvents () const noexcept -> ecs::EventReader< T >
 Gets an event reader for type T.
 
bool EntityExists (ecs::Entity entity) const
 Checks if entity exists in the world.
 
template<ecs::ComponentTrait T>
bool HasComponent (ecs::Entity entity) const
 Checks if entity has component.
 
template<ecs::ComponentTrait... Ts>
requires utils::UniqueTypes<Ts...>
auto HasComponents (ecs::Entity entity) const -> std::array< bool, sizeof...(Ts)>
 Checks if entity has components.
 
template<ecs::ResourceTrait T>
bool HasResource () const
 Checks if a resource exists.
 
bool HasSubTaskGraph () const noexcept
 Checks if SubTaskGraph is available in this context.
 
bool HasExecutor () const noexcept
 Checks if Executor is available in this context.
 
size_t EntityCount () const noexcept
 Gets the number of entities in the world.
 
memory::AllocatorStats FrameAllocatorStats () const noexcept
 Gets frame allocator statistics.
 
ecs::details::SystemLocalStorage::FrameAllocatorTypeFrameAllocator () noexcept
 Gets reference to the per-system frame allocator.
 
const ecs::details::SystemLocalStorage::FrameAllocatorTypeFrameAllocator () const noexcept
 Gets const reference to the per-system frame allocator.
 
template<typename T >
auto MakeFrameAllocator () noexcept -> memory::STLGrowableAllocator< T, memory::FrameAllocator >
 
async::SubTaskGraphSubTaskGraph () noexcept
 Gets reference to the sub task graph for parallel work.
 
async::ExecutorExecutor () noexcept
 Gets reference to the executor for async work.
 
const details::SystemInfoGetSystemInfo () const noexcept
 Gets the system information.
 
std::string_view GetSystemName () const noexcept
 Gets the system name.
 

Detailed Description

Per-system execution context with validated access.

SystemContext wraps ecs::World to provide:

  • Validated access to components and resources based on AccessPolicy
  • Thread-safe query creation
  • Local command buffer access for deferred operations
  • Event emission capabilities
  • Async execution support (Executor or SubTaskGraph)
  • Frame allocator access for temporary allocations

SystemContext is created once per system per update and holds only references. All access is validated against the system's declared AccessPolicy.

Query and command buffer methods use the frame allocator by default for efficient temporary storage within systems.

Note
Pratially thread-safe.
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/system.hpp.

Definition at line 53 of file system_context.hpp.

Member Typedef Documentation

◆ CommandAllocator

◆ QueryAllocator

Constructor & Destructor Documentation

◆ SystemContext() [1/4]

helios::app::SystemContext::SystemContext ( ecs::World world,
const details::SystemInfo system_info,
async::Executor executor,
ecs::details::SystemLocalStorage local_storage 
)
inlinenoexcept

Constructs a system context with Executor for main schedule systems.

Parameters
worldReference to the ECS world
system_infoReference to system information
executorReference to async executor
local_storageReference to system local storage

Definition at line 68 of file system_context.hpp.

70 : world_(world), system_info_(system_info), async_context_(std::ref(executor)), local_storage_(local_storage) {}
auto Query() noexcept -> ecs::QueryBuilder< QueryAllocator >

◆ SystemContext() [2/4]

helios::app::SystemContext::SystemContext ( ecs::World world,
const details::SystemInfo system_info,
async::SubTaskGraph sub_graph,
ecs::details::SystemLocalStorage local_storage 
)
inlinenoexcept

Constructs a system context with SubTaskGraph for parallel schedule systems.

Parameters
worldReference to the ECS world
system_infoReference to system information
sub_graphReference to async sub task graph
local_storageReference to system local storage

Definition at line 79 of file system_context.hpp.

81 : world_(world), system_info_(system_info), async_context_(std::ref(sub_graph)), local_storage_(local_storage) {}

◆ SystemContext() [3/4]

helios::app::SystemContext::SystemContext ( const SystemContext )
delete

◆ SystemContext() [4/4]

helios::app::SystemContext::SystemContext ( SystemContext &&  )
delete

◆ ~SystemContext()

helios::app::SystemContext::~SystemContext ( )
defaultnoexcept

Member Function Documentation

◆ Commands()

auto helios::app::SystemContext::Commands ( ) -> ecs::WorldCmdBuffer<CommandAllocator>
inlinenoexcept

Creates a command buffer for deferred world operations.

Command buffer allows queuing operations that will be executed during ecs::World::Update(). This is the thread-safe way to modify the world. Uses the frame allocator for internal storage.

Note
Thread-safe, but keep in mind that world command buffer is not, avoid sharing between threads.
Returns
WorldCmdBuffer for queuing commands using frame allocator
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 142 of file system_context.hpp.

142 {
143 return ecs::WorldCmdBuffer<CommandAllocator>(local_storage_, CommandAllocator(local_storage_.FrameAllocator()));
144 }
memory::STLGrowableAllocator< std::unique_ptr< ecs::Command >, memory::FrameAllocator > CommandAllocator
Allocator type for command pointers in command buffers.
FrameAllocatorType & FrameAllocator() noexcept
Gets reference to the frame allocator.
BasicQuery< World, Allocator, Components... > Query
Type alias for query with mutable world access.
Definition query.hpp:2481

◆ EmitEvent()

template<ecs::EventTrait T>
void helios::app::SystemContext::EmitEvent ( const T &  event)
inline

Emits an event to the local event queue.

Events are stored in system-local storage and flushed after schedule execution.

Note
Not thread-safe, only one thread should emit events for a system at a time.
Warning
Triggers assertion if event type is not registered.
Template Parameters
TEvent type
Parameters
eventEvent to emit
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 475 of file system_context.hpp.

475 {
476 HELIOS_ASSERT(world_.HasEvent<T>(),
477 "Failed to emit event of type '{}': Event type not registered in world! "
478 "Add World::AddEvent<{}>() during initialization.",
480 local_storage_.WriteEvent(event);
481}
#define HELIOS_ASSERT(condition,...)
Assertion macro that aborts execution in debug builds.
Definition assert.hpp:140
bool HasEvent() const
Checks if a event registered.
Definition world.hpp:545
void WriteEvent(const T &event)
Writes an event to the local event queue.

◆ EmitEventBulk()

template<std::ranges::sized_range R>
requires ecs::EventTrait<std::ranges::range_value_t<R>>
void helios::app::SystemContext::EmitEventBulk ( const R events)
inline

Emits multiple events in bulk.

More efficient than calling EmitEvent multiple times.

Note
Not thread-safe, only one thread should emit events for a system at a time.
Warning
Triggers assertion if event type is not registered.
Template Parameters
RRange of events
Parameters
eventsRange of events to emit
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 485 of file system_context.hpp.

485 {
486 using EventType = std::ranges::range_value_t<R>;
488 "Failed to emit events of type '{}': Event type not registered in world! "
489 "Add World::AddEvent<{}>() during initialization.",
491 local_storage_.WriteEventBulk(events);
492}
void WriteEventBulk(const R &events)
Writes multiple events to the local event queue in bulk.

◆ EntityCommands()

auto helios::app::SystemContext::EntityCommands ( ecs::Entity  entity) -> ecs::EntityCmdBuffer<CommandAllocator>
inline

Creates an entity command buffer for a specific entity.

Provides convenient interface for entity-specific operations. Uses the frame allocator for internal storage.

Note
Thread-safe, but keep in mind that entity command buffer is not, avoid sharing between threads.
Parameters
entityEntity to operate on
Returns
EntityCmdBuffer for the entity using frame allocator
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 154 of file system_context.hpp.

154 {
155 return {entity, local_storage_, CommandAllocator(local_storage_.FrameAllocator())};
156 }

◆ EntityCount()

size_t helios::app::SystemContext::EntityCount ( ) const
inlinenoexcept

Gets the number of entities in the world.

Note
Thread-safe.
Returns
Number of entities in the world.
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 315 of file system_context.hpp.

315{ return world_.EntityCount(); }
size_t EntityCount() const noexcept
Gets the number of entities in the world.
Definition world.hpp:565

◆ EntityExists()

bool helios::app::SystemContext::EntityExists ( ecs::Entity  entity) const
inline

Checks if entity exists in the world.

Note
Thread-safe.
Warning
Triggers assertion if entity is invalid.
Parameters
entityEntity to check.
Returns
True if entity exists, false otherwise.
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 503 of file system_context.hpp.

503 {
504 HELIOS_ASSERT(entity.Valid(), "Failed to check if entity exists: Entity is invalid!");
505 return world_.Exists(entity);
506}
bool Exists(Entity entity) const
Checks if entity exists in the world.
Definition world.hpp:944

◆ Executor()

async::Executor & helios::app::SystemContext::Executor ( )
inlinenoexcept

Gets reference to the executor for async work.

Note
Thread-safe.
Warning
Triggers assertion if executor is not available.
Returns
Reference to the executor
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 533 of file system_context.hpp.

533 {
535 "Failed to get executor: Executor not available in this context! "
536 "System '{}' is likely running on a parallel schedule.",
537 system_info_.name);
538 return std::get<std::reference_wrapper<async::Executor>>(async_context_).get();
539}
bool HasExecutor() const noexcept
Checks if Executor is available in this context.
std::string name
System name (for debugging/profiling)

◆ FrameAllocator() [1/2]

const ecs::details::SystemLocalStorage::FrameAllocatorType & helios::app::SystemContext::FrameAllocator ( ) const
inlinenoexcept

Gets const reference to the per-system frame allocator.

Note
Thread-safe.
Warning
Data allocated with the frame allocator is only valid for the current frame.
Returns
Const reference to the growable frame allocator

Definition at line 353 of file system_context.hpp.

353 {
354 return local_storage_.FrameAllocator();
355 }

◆ FrameAllocator() [2/2]

ecs::details::SystemLocalStorage::FrameAllocatorType & helios::app::SystemContext::FrameAllocator ( )
inlinenoexcept

Gets reference to the per-system frame allocator.

Use this allocator for temporary per-frame allocations that don't need individual deallocation. The allocator is reset at frame boundaries.

Ideal for:

  • Temporary containers used within a single system execution
  • Scratch buffers for algorithms
  • Short-lived data structures
Note
Thread-safe.
Warning
Data allocated with the frame allocator is only valid for the current frame. All pointers and references to frame-allocated data become invalid after the frame ends. Do not store frame-allocated data in components, resources, or any persistent storage.
Returns
Reference to the growable frame allocator
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 343 of file system_context.hpp.

343 {
344 return local_storage_.FrameAllocator();
345 }

◆ FrameAllocatorStats()

memory::AllocatorStats helios::app::SystemContext::FrameAllocatorStats ( ) const
inlinenoexcept

Gets frame allocator statistics.

Useful for debugging and profiling memory usage within systems.

Note
Thread-safe.
Returns
Allocator statistics with current usage information
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 323 of file system_context.hpp.

323 {
324 return local_storage_.FrameAllocatorStats();
325 }
memory::AllocatorStats FrameAllocatorStats() const noexcept
Gets frame allocator statistics.

◆ GetSystemInfo()

const details::SystemInfo & helios::app::SystemContext::GetSystemInfo ( ) const
inlinenoexcept

Gets the system information.

Note
Thread-safe.
Returns
Const reference to system info
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 419 of file system_context.hpp.

419{ return system_info_; }

◆ GetSystemName()

std::string_view helios::app::SystemContext::GetSystemName ( ) const
inlinenoexcept

Gets the system name.

Note
Thread-safe.
Returns
System name
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 426 of file system_context.hpp.

426{ return system_info_.name; }

◆ HasComponent()

template<ecs::ComponentTrait T>
bool helios::app::SystemContext::HasComponent ( ecs::Entity  entity) const
inline

Checks if entity has component.

Note
Thread-safe.
Warning
Triggers assertion in next cases:
  1. Entity is invalid.
  2. World does not own entity.
Template Parameters
TComponent type.
Parameters
entityEntity to check.
Returns
True if entity has component, false otherwise.
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 509 of file system_context.hpp.

509 {
510 HELIOS_ASSERT(entity.Valid(), "Failed to check if entity has component: Entity is invalid!");
512 "Failed to check if entity has component: World does not own entity with index '{}'!", entity.Index());
513 return world_.HasComponent<T>(entity);
514}
bool EntityExists(ecs::Entity entity) const
Checks if entity exists in the world.
bool HasComponent(Entity entity) const
Checks if entity has component.
Definition world.hpp:950

◆ HasComponents()

template<ecs::ComponentTrait... Ts>
requires utils::UniqueTypes<Ts...>
auto helios::app::SystemContext::HasComponents ( ecs::Entity  entity) const -> std::array<bool, sizeof...(Ts)>
inline

Checks if entity has components.

Note
Thread-safe.
Warning
Triggers assertion if entity is invalid.
Template Parameters
TsComponents types.
Parameters
entityEntity to check.
Returns
Array of bools indicating whether entity has each component (true if entity has component, false otherwise).
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 518 of file system_context.hpp.

518 {
519 HELIOS_ASSERT(entity.Valid(), "Failed to check if entity has components: Entity is invalid!");
521 "Failed to check if entity has components: World does not own entity with index '{}'!", entity.Index());
522 return world_.HasComponents<Ts...>(entity);
523}
auto HasComponents(Entity entity) const -> std::array< bool, sizeof...(Ts)>
Checks if entity has components.
Definition world.hpp:959

◆ HasExecutor()

bool helios::app::SystemContext::HasExecutor ( ) const
inlinenoexcept

Checks if Executor is available in this context.

Note
Thread-safe.
Returns
True if executor is available, false otherwise
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 306 of file system_context.hpp.

306 {
307 return std::holds_alternative<std::reference_wrapper<async::Executor>>(async_context_);
308 }

◆ HasResource()

template<ecs::ResourceTrait T>
bool helios::app::SystemContext::HasResource ( ) const
inline

Checks if a resource exists.

Note
Thread-safe.
Template Parameters
TResource type
Returns
True if resource exists, false otherwise
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 288 of file system_context.hpp.

288 {
289 return world_.HasResource<T>();
290 }
bool HasResource() const
Checks if a resource exists.
Definition world.hpp:534

◆ HasSubTaskGraph()

bool helios::app::SystemContext::HasSubTaskGraph ( ) const
inlinenoexcept

Checks if SubTaskGraph is available in this context.

Note
Thread-safe.
Returns
True if sub task graph is available, false otherwise
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 297 of file system_context.hpp.

297 {
298 return std::holds_alternative<std::reference_wrapper<async::SubTaskGraph>>(async_context_);
299 }

◆ MakeFrameAllocator()

template<typename T >
auto helios::app::SystemContext::MakeFrameAllocator ( ) -> memory::STLGrowableAllocator<T, memory::FrameAllocator>
inlinenoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 394 of file system_context.hpp.

394 {
395 return memory::STLGrowableAllocator<T, memory::FrameAllocator>(local_storage_.FrameAllocator());
396 }

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ Query()

auto helios::app::SystemContext::Query ( ) -> ecs::QueryBuilder<QueryAllocator>
inlinenoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp, and /home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/system.hpp.

Definition at line 109 of file system_context.hpp.

109 {
110 return {world_, system_info_.access_policy, QueryAllocator(local_storage_.FrameAllocator())};
111 }
memory::STLGrowableAllocator< ecs::ComponentTypeId, memory::FrameAllocator > QueryAllocator
Allocator type for component type IDs in queries.
app::AccessPolicy access_policy
Access policy for validation.

◆ ReadEvents()

template<ecs::EventTrait T>
auto helios::app::SystemContext::ReadEvents ( ) const -> ecs::EventReader<T>
inlinenoexcept

Gets an event reader for type T.

Provides a type-safe, ergonomic API for reading events with support for iteration, filtering, and searching. Event must be registered via World::AddEvent<T>() first.

Note
Thread-safe.
Warning
Triggers assertion if event type is not registered.
Template Parameters
TEvent type
Returns
EventReader for type T
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 495 of file system_context.hpp.

495 {
496 HELIOS_ASSERT(world_.HasEvent<T>(),
497 "Failed to get event reader for type '{}': Event type not registered in world! "
498 "Add World::AddEvent<{}>() during initialization.",
500 return world_.ReadEvents<T>();
501}
auto ReadEvents() const noexcept -> EventReader< T >
Gets an event reader for type T.
Definition world.hpp:985

◆ ReadOnlyQuery()

auto helios::app::SystemContext::ReadOnlyQuery ( ) const -> ecs::ReadOnlyQueryBuilder<QueryAllocator>
inlinenoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 130 of file system_context.hpp.

130 {
131 return {world_, system_info_.access_policy, QueryAllocator(local_storage_.FrameAllocator())};
132 }

◆ ReadResource()

template<ecs::ResourceTrait T>
const T & helios::app::SystemContext::ReadResource ( ) const
inline

Gets const reference to a resource.

Note
Thread-safe.
Warning
Triggers assertion in next cases:
  • Resource not declared for read access.
  • Resource doesn't exist.
Template Parameters
TResource type
Returns
Const reference to resource
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp, and /home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/ecs/system.hpp.

Definition at line 457 of file system_context.hpp.

457 {
459 return world_.ReadResource<T>();
460}
const T & ReadResource() const
Gets const reference to a resource.
Definition world.hpp:939

◆ ReserveEntity()

ecs::Entity helios::app::SystemContext::ReserveEntity ( )
inline

Reserves an entity ID for deferred creation.

The actual entity creation is deferred until ecs::World::Update().

Note
Thread-safe.
Returns
Reserved entity ID
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 164 of file system_context.hpp.

164{ return world_.ReserveEntity(); }
Entity ReserveEntity()
Reserves an entity ID for deferred creation.
Definition world.hpp:121

◆ SubTaskGraph()

async::SubTaskGraph & helios::app::SystemContext::SubTaskGraph ( )
inlinenoexcept

Gets reference to the sub task graph for parallel work.

Note
Thread-safe.
Warning
Triggers assertion if sub task graph is not available.
Returns
Reference to the async sub task graph
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 525 of file system_context.hpp.

525 {
527 "Failed to get sub task graph: SubTaskGraph not available in this context! "
528 "System '{}' is likely running on main schedule.",
529 system_info_.name);
530 return std::get<std::reference_wrapper<async::SubTaskGraph>>(async_context_).get();
531}
bool HasSubTaskGraph() const noexcept
Checks if SubTaskGraph is available in this context.

◆ TryReadResource()

template<ecs::ResourceTrait T>
const T * helios::app::SystemContext::TryReadResource ( ) const
inline

Tries to get const pointer to a resource.

Note
Thread-safe.
Warning
Triggers assertion if resource not declared for read access.
Template Parameters
TResource type
Returns
Const pointer to resource, or nullptr if not found
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 469 of file system_context.hpp.

469 {
471 return world_.TryReadResource<T>();
472}
const T * TryReadResource() const
Tries to get const pointer to a resource.
Definition world.hpp:428

◆ TryWriteResource()

template<ecs::ResourceTrait T>
T * helios::app::SystemContext::TryWriteResource ( )
inline

Tries to get mutable pointer to a resource.

Note
Thread-safe.
Warning
Triggers assertion if resource not declared for write access.
Template Parameters
TResource type
Returns
Pointer to resource, or nullptr if not found
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 463 of file system_context.hpp.

463 {
465 return world_.TryWriteResource<T>();
466}
T * TryWriteResource()
Tries to get mutable pointer to a resource.
Definition world.hpp:417

◆ WriteResource()

template<ecs::ResourceTrait T>
T & helios::app::SystemContext::WriteResource ( )
inline

Gets mutable reference to a resource.

Note
Thread-safe.
Warning
Triggers assertion in next cases:
  • Resource not declared for write access.
  • Resource doesn't exist.
Template Parameters
TResource type
Returns
Mutable reference to resource
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_context.hpp.

Definition at line 451 of file system_context.hpp.

451 {
453 return world_.WriteResource<T>();
454}
T & WriteResource()
Gets reference to a resource.
Definition world.hpp:933