Action.hpp
A mechanism to abstract functions from their underlying type and provide run-time names.
- Todo:
Create an ActionDefaults class that can take fewer args than expected and fill in rest.
Allow for named arguments to facilitate interpreted functions.
Note
Status: Beta
Functions
-
class ActionBase
- #include <Action.hpp>
BaseActions abstract functions and allow for signals to be setup at runtime; they can be called with types specified in the call.
Actions can be a bit heavyweight, but can easily be converted to std::function objects.
Subclassed by ActionSize< sizeof…(ARGS)>, ActionSize< ARG_COUNT >
Public Functions
-
inline virtual ~ActionBase()
-
virtual size_t GetArgCount() const = 0
Get number of arguments this action takes.
-
virtual ActionBase *Clone() const = 0
Clone() will produce a pointer to a full copy of an Action, going through derived version.
Protected Functions
-
ActionBase(const ActionBase&) = default
-
ActionBase(ActionBase&&) = default
-
ActionBase &operator=(const ActionBase&) = default
-
ActionBase &operator=(ActionBase&&) = default
-
inline virtual ~ActionBase()
-
template<size_t ARG_COUNT>
class ActionSize : public ActionBase - #include <Action.hpp>
ActionSize is a second layer of abstract actions that know the number of arguments used at compile time to facilitate easy type-checking.
Public Functions
-
inline virtual size_t GetArgCount() const
Get number of arguments this action takes.
-
inline virtual size_t GetArgCount() const
-
template<typename ...ARGS>
class Action<void(ARGS...)> : public ActionSize<sizeof...(ARGS)> - #include <Action.hpp>
This Action class specialization takes a function with a void return type and builds it off of the action base classes.
-
template<typename RETURN, typename ...ARGS>
class Action<RETURN(ARGS...)> : public ActionSize<sizeof...(ARGS)> - #include <Action.hpp>
This Action class specialization takes a function with any non-void return type and builds it off of the action base classes.
Public Types
-
using parent_t = ActionSize<sizeof...(ARGS)>
Public Functions
-
using parent_t = ActionSize<sizeof...(ARGS)>