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

Command that executes a function with World reference. More...

#include <builtin_commands.hpp>

Public Member Functions

constexpr FunctionCmd (const F &func) noexcept(std::is_nothrow_copy_constructible_v< F >)
 Constructs function command from an lvalue callable.
constexpr FunctionCmd (F &&func) noexcept(std::is_nothrow_move_constructible_v< F >)
 Constructs function command from an rvalue callable.
constexpr FunctionCmd (const FunctionCmd &) noexcept(std::is_nothrow_copy_constructible_v< F >)=default
constexpr FunctionCmd (FunctionCmd &&) noexcept(std::is_nothrow_move_constructible_v< F >)=default
constexpr ~FunctionCmd () noexcept(std::is_nothrow_destructible_v< F >)=default
constexpr FunctionCmdoperator= (const FunctionCmd &) noexcept(std::is_nothrow_copy_assignable_v< F >)=default
constexpr FunctionCmdoperator= (FunctionCmd &&) noexcept(std::is_nothrow_move_assignable_v< F >)=default
void Execute (World &world) noexcept(std::is_nothrow_invocable_v< F, World & >)
 Executes the wrapped function.

Detailed Description

template<typename F>
requires std::invocable<F, World&>
class helios::ecs::FunctionCmd< F >

Command that executes a function with World reference.

Wraps arbitrary functions for deferred execution during World::Update(). The function must be invocable with a World& parameter.

Template Parameters
FFunction type that accepts World&

Definition at line 29 of file builtin_commands.hpp.

Constructor & Destructor Documentation

◆ FunctionCmd() [1/4]

template<typename F>
helios::ecs::FunctionCmd< F >::FunctionCmd ( const F & func)
inlineexplicitconstexprnoexcept

Constructs function command from an lvalue callable.

Parameters
funcFunction to copy, must accept World& parameter

Definition at line 35 of file builtin_commands.hpp.

◆ FunctionCmd() [2/4]

template<typename F>
helios::ecs::FunctionCmd< F >::FunctionCmd ( F && func)
inlineexplicitconstexprnoexcept

Constructs function command from an rvalue callable.

Parameters
funcFunction to move, must accept World& parameter

Definition at line 43 of file builtin_commands.hpp.

◆ FunctionCmd() [3/4]

template<typename F>
helios::ecs::FunctionCmd< F >::FunctionCmd ( const FunctionCmd< F > & ) const
constexprdefaultnoexcept

◆ FunctionCmd() [4/4]

template<typename F>
helios::ecs::FunctionCmd< F >::FunctionCmd ( FunctionCmd< F > && ) const
constexprdefaultnoexcept

◆ ~FunctionCmd()

template<typename F>
helios::ecs::FunctionCmd< F >::~FunctionCmd ( )
constexprdefaultnoexcept

Member Function Documentation

◆ Execute()

template<typename F>
void helios::ecs::FunctionCmd< F >::Execute ( World & world)
inlinenoexcept

Executes the wrapped function.

Parameters
worldWorld reference to pass to the function

Definition at line 63 of file builtin_commands.hpp.

◆ operator=() [1/2]

template<typename F>
FunctionCmd & helios::ecs::FunctionCmd< F >::operator= ( const FunctionCmd< F > & )
constexprdefaultnoexcept

◆ operator=() [2/2]

template<typename F>
FunctionCmd & helios::ecs::FunctionCmd< F >::operator= ( FunctionCmd< F > && )
constexprdefaultnoexcept