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

Command to destroy multiple entities. More...

#include <commands.hpp>

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

Public Member Functions

template<std::ranges::range R>
requires std::same_as<std::ranges::range_value_t<R>, Entity>
constexpr DestroyEntitiesCmd (const R &entities)
 Constructs destroy entities command from range.
 
constexpr DestroyEntitiesCmd (const DestroyEntitiesCmd &) noexcept=default
 
constexpr DestroyEntitiesCmd (DestroyEntitiesCmd &&) noexcept=default
 
constexpr ~DestroyEntitiesCmd () noexcept override=default
 
constexpr DestroyEntitiesCmdoperator= (const DestroyEntitiesCmd &) noexcept=default
 
constexpr DestroyEntitiesCmdoperator= (DestroyEntitiesCmd &&) noexcept=default
 
void Execute (World &world) override
 Executes entities destruction.
 
- Public Member Functions inherited from helios::ecs::Command
virtual constexpr ~Command () noexcept=default
 

Detailed Description

Command to destroy multiple entities.

Efficiently destroys multiple entities in a single operation. Will assert if any of the entities do not exist in the world (when world implementation updated).

Definition at line 103 of file commands.hpp.

Constructor & Destructor Documentation

◆ DestroyEntitiesCmd() [1/3]

template<std::ranges::range R>
requires std::same_as<std::ranges::range_value_t<R>, Entity>
constexpr helios::ecs::details::DestroyEntitiesCmd::DestroyEntitiesCmd ( const R entities)
explicitconstexpr

Constructs destroy entities command from range.

Warning
Triggers assertion if any entity is invalid.
Template Parameters
RRange type containing Entity elements
Parameters
entitiesRange of entities to destroy

Definition at line 133 of file commands.hpp.

134 : entities_(std::ranges::begin(entities), std::ranges::end(entities)) {
135 for (const Entity& entity : entities_) {
136 HELIOS_ASSERT(entity.Valid(), "Failed to construct destroy entities command: Entity with index '{}' is invalid!",
137 entity.Index());
138 }
139}
#define HELIOS_ASSERT(condition,...)
Assertion macro that aborts execution in debug builds.
Definition assert.hpp:140
BasicQuery< World, Allocator, Components... > Query
Type alias for query with mutable world access.
Definition query.hpp:2481

◆ DestroyEntitiesCmd() [2/3]

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

◆ DestroyEntitiesCmd() [3/3]

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

◆ ~DestroyEntitiesCmd()

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

Member Function Documentation

◆ Execute()

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

Executes entities destruction.

Parameters
worldWorld to remove entities from

Implements helios::ecs::Command.

Definition at line 125 of file commands.hpp.

125{ world.DestroyEntities(entities_); }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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