Skip to main content

CallableSystem.ixx File

Small ECS system wrapper around an update lambda. More...

Included Headers​

#include <memory> #include <functional> #include <type_traits> #include <utility> #include <helios.ecs.components> #include <helios.engine.runtime.messaging.command.concepts> #include <helios.engine.runtime.world.UpdateContext> #include <helios.engine.runtime.world.tags.SystemRole>

Namespaces Index​

namespacehelios
namespaceengine
namespacecore
namespacesystems
namespacecomponents

Classes Index​

classCallableSystem<THandle, TFunc>

ECS system that executes a stored lambda on each update. More...

classCallableSystem<THandle, TCommandBuffer, TFunc>

ECS system that executes a stored lambda on each update. More...

Description​

Small ECS system wrapper around an update lambda.

File Listing​

The file content with the documentation metadata removed is:

1
5module;
6
7#include <memory>
8#include <functional>
9#include <type_traits>
10#include <utility>
11
12export module helios.engine.core.systems.CallableSystem;
13
14import helios.engine.runtime.world.tags.SystemRole;
15import helios.engine.runtime.world.UpdateContext;
16import helios.engine.runtime.messaging.command.concepts;
17
18import helios.ecs.components;
19
20using namespace helios::ecs::components;
23using namespace helios::engine::runtime::messaging::command::concepts;
25
26 template <typename THandle, typename... TArgs>
28
35 template <typename THandle, typename TFunc>
36 class CallableSystem<THandle, TFunc> {
37
38 TFunc lambda_;
39
40 public:
41
43
48 explicit CallableSystem(TFunc lambda) : lambda_(std::move(lambda)) {}
49
50
56 std::invoke(lambda_, updateContext);
57 }
58
59 };
60
67 template <typename THandle, typename TCommandBuffer, typename TFunc>
70
71 TFunc lambda_;
72
73 public:
74
76
78
83 explicit CallableSystem(TFunc lambda) : lambda_(std::move(lambda)) {}
84
85
91 void update(UpdateContext& updateContext, TCommandBuffer& commandBuffer) noexcept {
92 std::invoke(lambda_, updateContext, commandBuffer);
93 }
94
95 };
96
107 template<typename THandle, typename TFunc>
109 using FuncType = std::remove_cvref_t<TFunc>;
110
111 return CallableSystem<THandle, FuncType>(std::forward<TFunc>(func));
112
113 };
114
126 template<typename THandle, typename TCommandBuffer, typename TFunc>
129 using FuncType = std::remove_cvref_t<TFunc>;
130
132
133 };
134}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.