Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
FunctionUtils::CallableFunction< TCallable, TReturn, TArgs > Class Template Reference

Abstract class that holds a callable object, to be later stored in a container. More...

#include <CallableFunction.hpp>

Inheritance diagram for FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >:
FunctionUtils::BaseFunction< TReturn, TArgs... >

Public Member Functions

 CallableFunction (TCallable callable)
 Constructor for CallableFunction.
 ~CallableFunction () override=default
 Destructor for CallableFunction.
TReturn operator() (TArgs... args) const override
 Calls the stored callable object with the provided arguments.
FunctionID GetID () const override
 Returns the unique ID of the callable object.
std::string GetName () const override
 Returns the name of the callable object.
Public Member Functions inherited from FunctionUtils::BaseFunction< TReturn, TArgs... >
virtual ~BaseFunction ()=default
TReturn Call (TArgs... args) const
 External Call function.

Static Public Member Functions

static FunctionID GetCallableID (TCallable callable)
 Get the ID of the callable object.
static std::string GetCallableName (TCallable callable)

Private Attributes

TCallable _callable
FunctionID _id = 0
 Unique ID for the function.
std::string _name
 Name of the function.

Detailed Description

template<typename TCallable, typename TReturn, typename... TArgs>
class FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >

Abstract class that holds a callable object, to be later stored in a container.

Constructor & Destructor Documentation

◆ CallableFunction()

template<typename TCallable, typename TReturn, typename... TArgs>
FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >::CallableFunction ( TCallable callable)
inlineexplicit

Constructor for CallableFunction.

Parameters
callableThe callable object to be stored.

◆ ~CallableFunction()

template<typename TCallable, typename TReturn, typename... TArgs>
FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >::~CallableFunction ( )
overridedefault

Destructor for CallableFunction.

Member Function Documentation

◆ GetCallableID()

template<typename TCallable, typename TReturn, typename... TArgs>
FunctionID FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >::GetCallableID ( TCallable callable)
inlinestatic

Get the ID of the callable object.

Parameters
callableThe callable object.
Template Parameters
TCallableThe type of the callable object.
Returns
The ID of the callable object.

◆ GetCallableName()

template<typename TCallable, typename TReturn, typename... TArgs>
std::string FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >::GetCallableName ( TCallable callable)
inlinestatic

◆ GetID()

template<typename TCallable, typename TReturn, typename... TArgs>
FunctionID FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >::GetID ( ) const
inlineoverridevirtual

Returns the unique ID of the callable object.

Returns
Unique ID of the callable object.

Implements FunctionUtils::BaseFunction< TReturn, TArgs... >.

◆ GetName()

template<typename TCallable, typename TReturn, typename... TArgs>
std::string FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >::GetName ( ) const
inlineoverridevirtual

Returns the name of the callable object.

Returns
Name of the callable object.

Implements FunctionUtils::BaseFunction< TReturn, TArgs... >.

◆ operator()()

template<typename TCallable, typename TReturn, typename... TArgs>
TReturn FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >::operator() ( TArgs... args) const
inlineoverridevirtual

Calls the stored callable object with the provided arguments.

Parameters
argsArguments to pass to the callable object.
Returns
Return value of the callable object.

Implements FunctionUtils::BaseFunction< TReturn, TArgs... >.

Member Data Documentation

◆ _callable

template<typename TCallable, typename TReturn, typename... TArgs>
TCallable FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >::_callable
private

◆ _id

template<typename TCallable, typename TReturn, typename... TArgs>
FunctionID FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >::_id = 0
private

Unique ID for the function.

◆ _name

template<typename TCallable, typename TReturn, typename... TArgs>
std::string FunctionUtils::CallableFunction< TCallable, TReturn, TArgs >::_name
private

Name of the function.


The documentation for this class was generated from the following file: