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

Command to add multiple components to an entity. More...

#include <builtin_commands.hpp>

Public Member Functions

template<ComponentTrait... Us>
requires (sizeof...(Us) == sizeof...(Ts)) && (std::same_as<Ts, std::remove_cvref_t<Us>> && ...)
constexpr AddComponentsCmd (Entity entity, Us &&... components) noexcept(noexcept(std::tuple< Us... >(std::forward< Us >(components)...)))
 Constructs add components command.
constexpr AddComponentsCmd (const AddComponentsCmd &) noexcept=default
constexpr AddComponentsCmd (AddComponentsCmd &&) noexcept=default
constexpr ~AddComponentsCmd () noexcept=default
constexpr AddComponentsCmdoperator= (const AddComponentsCmd &) noexcept=default
constexpr AddComponentsCmdoperator= (AddComponentsCmd &&) noexcept=default
void Execute (World &world)
 Executes components addition.

Detailed Description

template<ComponentTrait... Ts>
requires utils::UniqueTypes<Ts...> && (sizeof...(Ts) > 0)
class helios::ecs::AddComponentsCmd< Ts >

Command to add multiple components to an entity.

Efficiently adds multiple components in a single operation. If entity already has any of the components, they will be replaced.

Warning
Will trigger assertion if the entity does not exist in the world (when world updated).
Template Parameters
TsComponent types to add (must be unique)

Definition at line 240 of file builtin_commands.hpp.

Constructor & Destructor Documentation

◆ AddComponentsCmd() [1/3]

template<ComponentTrait... Ts>
template<ComponentTrait... Us>
requires (sizeof...(Us) == sizeof...(Ts)) && (std::same_as<Ts, std::remove_cvref_t<Us>> && ...)
helios::ecs::AddComponentsCmd< Ts >::AddComponentsCmd ( Entity entity,
Us &&... components )
inlineconstexprnoexcept

Constructs add components command.

Warning
Triggers assertion if entity is invalid.
Template Parameters
UsComponent types to add (must match Ts)
Parameters
entityEntity to add components to
componentsComponents to add

Definition at line 252 of file builtin_commands.hpp.

◆ AddComponentsCmd() [2/3]

template<ComponentTrait... Ts>
helios::ecs::AddComponentsCmd< Ts >::AddComponentsCmd ( const AddComponentsCmd< Ts > & )
constexprdefaultnoexcept

◆ AddComponentsCmd() [3/3]

template<ComponentTrait... Ts>
helios::ecs::AddComponentsCmd< Ts >::AddComponentsCmd ( AddComponentsCmd< Ts > && )
constexprdefaultnoexcept

◆ ~AddComponentsCmd()

template<ComponentTrait... Ts>
helios::ecs::AddComponentsCmd< Ts >::~AddComponentsCmd ( )
constexprdefaultnoexcept

Member Function Documentation

◆ Execute()

template<ComponentTrait... Ts>
void helios::ecs::AddComponentsCmd< Ts >::Execute ( World & world)
inline

Executes components addition.

Warning
Triggers assertion if the entity does not exist in the world.
Parameters
worldWorld to add components in

Definition at line 271 of file builtin_commands.hpp.

◆ operator=() [1/2]

template<ComponentTrait... Ts>
AddComponentsCmd & helios::ecs::AddComponentsCmd< Ts >::operator= ( AddComponentsCmd< Ts > && )
constexprdefaultnoexcept

◆ operator=() [2/2]

template<ComponentTrait... Ts>
AddComponentsCmd & helios::ecs::AddComponentsCmd< Ts >::operator= ( const AddComponentsCmd< Ts > & )
constexprdefaultnoexcept