Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
helios::ecs::Local< T > Class Template Reference

Read-only or mutable access to a system-local resource. More...

#include <local_param.hpp>

Public Member Functions

constexpr Local (ResourceManager &resources) noexcept
 Constructs a local resource.
constexpr Local (const Local &) noexcept=default
constexpr Local (Local &&) noexcept=default
constexpr ~Local () noexcept=default
constexpr Localoperator= (const Local &) noexcept=default
constexpr Localoperator= (Local &&) noexcept=default
template<ResourceTrait U>
requires std::same_as<DecayedT, std::remove_cvref_t<U>> && (!std::is_const_v<T>)
void Insert (U &&value) const
 Inserts a local resource.
template<typename... Args>
requires std::constructible_from<DecayedT, Args...> && (!std::is_const_v<T>)
void Emplace (Args &&... args) const
 Emplaces a local resource.
T & operator* () const noexcept
T * operator-> () const noexcept
T & Get () const noexcept
 Gets the local resource.
constexpr ResourceManagerResources () const noexcept
 Gets the local resource manager.

Detailed Description

template<ResourceTrait T>
class helios::ecs::Local< T >

Read-only or mutable access to a system-local resource.

Only one system ever accesses it. Use Local<const T> for read-only access and Local<T> for mutable access.

Template Parameters
TResource type. Qualify with const for read-only access

Definition at line 20 of file local_param.hpp.

Constructor & Destructor Documentation

◆ Local() [1/3]

template<ResourceTrait T>
helios::ecs::Local< T >::Local ( ResourceManager & resources)
inlineexplicitconstexprnoexcept

Constructs a local resource.

Parameters
resourcesResource manager

Definition at line 29 of file local_param.hpp.

◆ Local() [2/3]

template<ResourceTrait T>
helios::ecs::Local< T >::Local ( const Local< T > & )
constexprdefaultnoexcept

◆ Local() [3/3]

template<ResourceTrait T>
helios::ecs::Local< T >::Local ( Local< T > && )
constexprdefaultnoexcept

◆ ~Local()

template<ResourceTrait T>
helios::ecs::Local< T >::~Local ( )
constexprdefaultnoexcept

Member Function Documentation

◆ Emplace()

template<ResourceTrait T>
template<typename... Args>
requires std::constructible_from<DecayedT, Args...> && (!std::is_const_v<T>)
void helios::ecs::Local< T >::Emplace ( Args &&... args) const
inline

Emplaces a local resource.

Replaces existing resource if present.

Template Parameters
ArgsResource constructor arguments
Parameters
argsResource constructor arguments

Definition at line 59 of file local_param.hpp.

◆ Get()

template<ResourceTrait T>
T & helios::ecs::Local< T >::Get ( ) const
inlinenodiscardnoexcept

Gets the local resource.

Returns
Reference to the local resource

Definition at line 76 of file local_param.hpp.

◆ Insert()

template<ResourceTrait T>
template<ResourceTrait U>
requires std::same_as<DecayedT, std::remove_cvref_t<U>> && (!std::is_const_v<T>)
void helios::ecs::Local< T >::Insert ( U && value) const
inline

Inserts a local resource.

Replaces existing resource if present.

Template Parameters
UResource type
Parameters
valueResource value

Definition at line 47 of file local_param.hpp.

◆ operator*()

template<ResourceTrait T>
T & helios::ecs::Local< T >::operator* ( ) const
inlinenodiscardnoexcept

Definition at line 64 of file local_param.hpp.

◆ operator->()

template<ResourceTrait T>
T * helios::ecs::Local< T >::operator-> ( ) const
inlinenodiscardnoexcept

Definition at line 68 of file local_param.hpp.

◆ operator=() [1/2]

template<ResourceTrait T>
Local & helios::ecs::Local< T >::operator= ( const Local< T > & )
constexprdefaultnoexcept

◆ operator=() [2/2]

template<ResourceTrait T>
Local & helios::ecs::Local< T >::operator= ( Local< T > && )
constexprdefaultnoexcept

◆ Resources()

template<ResourceTrait T>
ResourceManager & helios::ecs::Local< T >::Resources ( ) const
inlinenodiscardconstexprnoexcept

Gets the local resource manager.

Returns
Reference to the local resource manager

Definition at line 84 of file local_param.hpp.