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

Command to destroy a single entity. More...

#include <commands.hpp>

Inheritance diagram for helios::ecs::details::DestroyEntityCmd:
helios::ecs::Command

Public Member Functions

constexpr DestroyEntityCmd (Entity entity) noexcept
 Constructs destroy entity command.
 
constexpr DestroyEntityCmd (const DestroyEntityCmd &) noexcept=default
 
constexpr DestroyEntityCmd (DestroyEntityCmd &&) noexcept=default
 
constexpr ~DestroyEntityCmd () noexcept override=default
 
constexpr DestroyEntityCmdoperator= (const DestroyEntityCmd &) noexcept=default
 
constexpr DestroyEntityCmdoperator= (DestroyEntityCmd &&) noexcept=default
 
void Execute (World &world) override
 Executes entity destruction.
 
- Public Member Functions inherited from helios::ecs::Command
virtual constexpr ~Command () noexcept=default
 

Detailed Description

Command to destroy a single entity.

Removes entity and all its components from the world during execution. Will assert if the world does not own (entity index/generation mismatch) the entity.

Definition at line 67 of file commands.hpp.

Constructor & Destructor Documentation

◆ DestroyEntityCmd() [1/3]

constexpr helios::ecs::details::DestroyEntityCmd::DestroyEntityCmd ( Entity  entity)
explicitconstexprnoexcept

Constructs destroy entity command.

Warning
Triggers assertion if entity is invalid.
Parameters
entityEntity to destroy

Definition at line 92 of file commands.hpp.

92 : entity_(entity) {
93 HELIOS_ASSERT(entity.Valid(), "Failed to construct destroy entity command: Entity with index '{}' is invalid!",
94 entity.Index());
95}
#define HELIOS_ASSERT(condition,...)
Assertion macro that aborts execution in debug builds.
Definition assert.hpp:140

◆ DestroyEntityCmd() [2/3]

constexpr helios::ecs::details::DestroyEntityCmd::DestroyEntityCmd ( const DestroyEntityCmd )
constexprdefaultnoexcept

◆ DestroyEntityCmd() [3/3]

constexpr helios::ecs::details::DestroyEntityCmd::DestroyEntityCmd ( DestroyEntityCmd &&  )
constexprdefaultnoexcept

◆ ~DestroyEntityCmd()

constexpr helios::ecs::details::DestroyEntityCmd::~DestroyEntityCmd ( )
constexproverridedefaultnoexcept

Member Function Documentation

◆ Execute()

void helios::ecs::details::DestroyEntityCmd::Execute ( World world)
inlineoverridevirtual

Executes entity destruction.

Parameters
worldWorld to remove entity from

Implements helios::ecs::Command.

Definition at line 86 of file commands.hpp.

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

◆ operator=() [1/2]

constexpr DestroyEntityCmd & helios::ecs::details::DestroyEntityCmd::operator= ( const DestroyEntityCmd )
constexprdefaultnoexcept

◆ operator=() [2/2]

constexpr DestroyEntityCmd & helios::ecs::details::DestroyEntityCmd::operator= ( DestroyEntityCmd &&  )
constexprdefaultnoexcept