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

Command to try destroy multiple entities. More...

#include <commands.hpp>

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

Public Member Functions

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

Detailed Description

Command to try destroy multiple entities.

Definition at line 179 of file commands.hpp.

Constructor & Destructor Documentation

◆ TryDestroyEntitiesCmd() [1/3]

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

Constructs try 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 209 of file commands.hpp.

210 : entities_(std::ranges::begin(entities), std::ranges::end(entities)) {
211 for (const Entity& entity : entities_) {
212 HELIOS_ASSERT(entity.Valid(),
213 "Failed to construct try destroy entities command: Entity with index '{}' is invalid!",
214 entity.Index());
215 }
216}
#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

◆ TryDestroyEntitiesCmd() [2/3]

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

◆ TryDestroyEntitiesCmd() [3/3]

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

◆ ~TryDestroyEntitiesCmd()

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

Member Function Documentation

◆ Execute()

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

Executes entities destruction if they exist.

Parameters
worldWorld to remove entities from

Implements helios::ecs::Command.

Definition at line 201 of file commands.hpp.

201{ world.TryDestroyEntities(entities_); }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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