Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::ecs::details::InsertResourceCmd< T > Class Template Referencefinal

Command to insert a resource into the world. More...

#include <commands.hpp>

Inheritance diagram for helios::ecs::details::InsertResourceCmd< T >:
helios::ecs::Command

Public Member Functions

constexpr InsertResourceCmd (const T &resource) noexcept(std::is_nothrow_copy_constructible_v< T >)
 Constructs insert resource command with copy.
 
constexpr InsertResourceCmd (T &&resource) noexcept(std::is_nothrow_move_constructible_v< T >)
 Constructs insert resource command with move.
 
constexpr InsertResourceCmd (const InsertResourceCmd &) noexcept(std::is_nothrow_copy_constructible_v< T >)=default
 
constexpr InsertResourceCmd (InsertResourceCmd &&) noexcept(std::is_nothrow_move_constructible_v< T >)=default
 
constexpr ~InsertResourceCmd () noexcept(std::is_nothrow_destructible_v< T >) override=default
 
constexpr InsertResourceCmdoperator= (const InsertResourceCmd &) noexcept(std::is_nothrow_copy_assignable_v< T >)=default
 
constexpr InsertResourceCmdoperator= (InsertResourceCmd &&) noexcept(std::is_nothrow_move_assignable_v< T >)=default
 
void Execute (World &world) override
 Executes resource insertion.
 
- Public Member Functions inherited from helios::ecs::Command
virtual constexpr ~Command () noexcept=default
 

Detailed Description

template<ResourceTrait T>
class helios::ecs::details::InsertResourceCmd< T >

Command to insert a resource into the world.

Adds resource of type T to the world during execution. If world already has the resource, it will be replaced.

Template Parameters
TResource type to insert

Definition at line 628 of file commands.hpp.

Constructor & Destructor Documentation

◆ InsertResourceCmd() [1/4]

template<ResourceTrait T>
constexpr helios::ecs::details::InsertResourceCmd< T >::InsertResourceCmd ( const T &  resource)
inlineexplicitconstexprnoexcept

Constructs insert resource command with copy.

Parameters
resourceResource to copy

Definition at line 634 of file commands.hpp.

635 : resource_(resource) {}
BasicQuery< World, Allocator, Components... > Query
Type alias for query with mutable world access.
Definition query.hpp:2481

◆ InsertResourceCmd() [2/4]

template<ResourceTrait T>
constexpr helios::ecs::details::InsertResourceCmd< T >::InsertResourceCmd ( T &&  resource)
inlineexplicitconstexprnoexcept

Constructs insert resource command with move.

Parameters
resourceResource to move

Definition at line 641 of file commands.hpp.

642 : resource_(std::move(resource)) {}

◆ InsertResourceCmd() [3/4]

template<ResourceTrait T>
constexpr helios::ecs::details::InsertResourceCmd< T >::InsertResourceCmd ( const InsertResourceCmd< T > &  ) const
constexprdefaultnoexcept

◆ InsertResourceCmd() [4/4]

template<ResourceTrait T>
constexpr helios::ecs::details::InsertResourceCmd< T >::InsertResourceCmd ( InsertResourceCmd< T > &&  ) const
constexprdefaultnoexcept

◆ ~InsertResourceCmd()

template<ResourceTrait T>
constexpr helios::ecs::details::InsertResourceCmd< T >::~InsertResourceCmd ( )
constexproverridedefaultnoexcept

Member Function Documentation

◆ Execute()

template<ResourceTrait T>
void helios::ecs::details::InsertResourceCmd< T >::Execute ( World world)
inlineoverridevirtual

Executes resource insertion.

Parameters
worldWorld to insert resource into

Implements helios::ecs::Command.

Definition at line 657 of file commands.hpp.

657{ world.InsertResource(std::move(resource_)); }

◆ operator=() [1/2]

template<ResourceTrait T>
constexpr InsertResourceCmd & helios::ecs::details::InsertResourceCmd< T >::operator= ( const InsertResourceCmd< T > &  )
constexprdefaultnoexcept

◆ operator=() [2/2]

template<ResourceTrait T>
constexpr InsertResourceCmd & helios::ecs::details::InsertResourceCmd< T >::operator= ( InsertResourceCmd< T > &&  )
constexprdefaultnoexcept