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.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...

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;
16
17import helios.ecs.components;
18
19using namespace helios::ecs::components;
22
24
31 template <typename THandle, typename TFunc>
33
34 TFunc lambda_;
35
36 public:
37
39
44 explicit CallableSystem(TFunc lambda) : lambda_(std::move(lambda)) {}
45
46
52 std::invoke(lambda_, updateContext);
53 }
54
55 };
56
67 template<typename THandle, typename TFunc>
69 using FuncType = std::remove_cvref_t<TFunc>;
70
71 return CallableSystem<THandle, FuncType>(std::forward<TFunc>(func));
72
73 };
74}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.