Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
BaseFunction.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "FunctionID.hpp"
4#include <string>
5
6namespace FunctionUtils {
10template <typename TReturn, typename... TArgs> class BaseFunction {
11 public:
12 virtual ~BaseFunction() = default;
13
19 virtual TReturn operator()(TArgs... args) const = 0;
20
27 TReturn Call(TArgs... args) const { return (*this)(args...); }
28
33 virtual FunctionID GetID() const = 0;
34
39 virtual std::string GetName() const = 0;
40};
41} // namespace FunctionUtils
Base class for all functions contained in a FunctionContainer.
Definition BaseFunction.hpp:10
virtual FunctionID GetID() const =0
Pure virtual function to get the unique ID of the function.
virtual ~BaseFunction()=default
virtual TReturn operator()(TArgs... args) const =0
Pure virtual function call operator to be implemented by derived functions.
TReturn Call(TArgs... args) const
External Call function.
Definition BaseFunction.hpp:27
virtual std::string GetName() const =0
Pure virtual function to get the name of the function.
Definition BaseFunction.hpp:6
std::size_t FunctionID
FunctionID class to represent a unique identifier for functions.
Definition FunctionID.hpp:9