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

Command to try remove a single component (only if present). More...

#include <commands.hpp>

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

Public Member Functions

constexpr TryRemoveComponentCmd (Entity entity) noexcept
 Constructs try remove component command.
 
constexpr TryRemoveComponentCmd (const TryRemoveComponentCmd &) noexcept=default
 
constexpr TryRemoveComponentCmd (TryRemoveComponentCmd &&) noexcept=default
 
constexpr ~TryRemoveComponentCmd () noexcept override=default
 
constexpr TryRemoveComponentCmdoperator= (const TryRemoveComponentCmd &) noexcept=default
 
constexpr TryRemoveComponentCmdoperator= (TryRemoveComponentCmd &&) noexcept=default
 
void Execute (World &world) override
 Executes component removal if entity has it.
 
- Public Member Functions inherited from helios::ecs::Command
virtual constexpr ~Command () noexcept=default
 

Detailed Description

template<ComponentTrait T>
class helios::ecs::details::TryRemoveComponentCmd< T >

Command to try remove a single component (only if present).

Template Parameters
TComponent type

Definition at line 518 of file commands.hpp.

Constructor & Destructor Documentation

◆ TryRemoveComponentCmd() [1/3]

template<ComponentTrait T>
constexpr helios::ecs::details::TryRemoveComponentCmd< T >::TryRemoveComponentCmd ( Entity  entity)
explicitconstexprnoexcept

Constructs try remove component command.

Warning
Triggers assertion if entity is invalid.
Parameters
entityEntity to remove component from

Definition at line 544 of file commands.hpp.

544 : entity_(entity) {
545 HELIOS_ASSERT(entity.Valid(), "Failed to construct try remove component command: Entity with index '{}' is invalid!",
546 entity.Index());
547}
#define HELIOS_ASSERT(condition,...)
Assertion macro that aborts execution in debug builds.
Definition assert.hpp:140

◆ TryRemoveComponentCmd() [2/3]

template<ComponentTrait T>
constexpr helios::ecs::details::TryRemoveComponentCmd< T >::TryRemoveComponentCmd ( const TryRemoveComponentCmd< T > &  )
constexprdefaultnoexcept

◆ TryRemoveComponentCmd() [3/3]

template<ComponentTrait T>
constexpr helios::ecs::details::TryRemoveComponentCmd< T >::TryRemoveComponentCmd ( TryRemoveComponentCmd< T > &&  )
constexprdefaultnoexcept

◆ ~TryRemoveComponentCmd()

template<ComponentTrait T>
constexpr helios::ecs::details::TryRemoveComponentCmd< T >::~TryRemoveComponentCmd ( )
constexproverridedefaultnoexcept

Member Function Documentation

◆ Execute()

template<ComponentTrait T>
void helios::ecs::details::TryRemoveComponentCmd< T >::Execute ( World world)
inlineoverridevirtual

Executes component removal if entity has it.

Parameters
worldWorld to remove component from

Implements helios::ecs::Command.

Definition at line 537 of file commands.hpp.

537{ world.TryRemoveComponent<T>(entity_); }
BasicQuery< World, Allocator, Components... > Query
Type alias for query with mutable world access.
Definition query.hpp:2481

◆ operator=() [1/2]

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

◆ operator=() [2/2]

template<ComponentTrait T>
constexpr TryRemoveComponentCmd & helios::ecs::details::TryRemoveComponentCmd< T >::operator= ( TryRemoveComponentCmd< T > &&  )
constexprdefaultnoexcept