Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
WrappedSystem.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "BaseFunction.hpp"
4#include "Demangle.hpp"
5
6namespace Engine {
7class Core;
8
13template <typename TSystem, typename TErrorCallback>
14class WrappedSystem : public FunctionUtils::BaseFunction<void, Core &> {
15 public:
19 explicit WrappedSystem(TSystem system, TErrorCallback errorCallback);
20
22 ~WrappedSystem() override = default;
23
26 void operator()(Engine::Core &core) const override;
27
30 FunctionUtils::FunctionID GetID() const override;
31
34 std::string GetName() const override;
35
40 static FunctionUtils::FunctionID GetCallableID(const TSystem &callable);
41
46 static std::string GetCallableName(const TSystem &callable);
47
48 private:
50 [[no_unique_address]] TSystem _system;
51
53 [[no_unique_address]] TErrorCallback _errorCallback;
54
57
59 std::string _name;
60};
61} // namespace Engine
62
The core is the place where all the data of the engine is stored. It contains the registry (entities)...
Definition Core.hpp:33
WrappedSystem(TSystem system, TErrorCallback errorCallback)
Constructor for WrappedSystem.
Definition WrappedSystem.ipp:5
FunctionUtils::FunctionID GetID() const override
Returns the unique ID of the system.
Definition WrappedSystem.ipp:27
std::string _name
Name of the system.
Definition WrappedSystem.hpp:59
static FunctionUtils::FunctionID GetCallableID(const TSystem &callable)
Get the ID of the system.
Definition WrappedSystem.ipp:38
~WrappedSystem() override=default
Destructor for WrappedSystem.
TSystem _system
The wrapped system.
Definition WrappedSystem.hpp:50
static std::string GetCallableName(const TSystem &callable)
Get the name of the system.
Definition WrappedSystem.ipp:51
TErrorCallback _errorCallback
The error callback to be called if the system throws an exception.
Definition WrappedSystem.hpp:53
void operator()(Engine::Core &core) const override
Calls the system.
Definition WrappedSystem.ipp:13
FunctionUtils::FunctionID _id
Unique ID for the system.
Definition WrappedSystem.hpp:56
std::string GetName() const override
Get the name of the system.
Definition WrappedSystem.ipp:32
Base class for all functions contained in a FunctionContainer.
Definition BaseFunction.hpp:10
Definition Core.hpp:17
std::size_t FunctionID
FunctionID class to represent a unique identifier for functions.
Definition FunctionID.hpp:9