DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
State machine state as used by class StateMachine. A state mainly wraps a state function of the member function pointer type CallableT to be invoked by the state machine. More...
Public Types | |
using | StateEnumType = return_of_t< CallableT > |
using | CallableType = CallableT |
Public Member Functions | |
constexpr | StateMachineState (StateEnumType State, CallableT StateFunction, const char *Description="", const bool IsFinal=false) noexcept |
Constructs a state machine state and assigns fixed parameters to it. More... | |
constexpr StateEnumType | GetState () const noexcept |
Returns the state's unique identifier. More... | |
constexpr auto | GetDescription () const noexcept |
Returns the state's description. More... | |
constexpr bool | IsFinal () const noexcept |
Returns whether this is a final state. More... | |
template<typename... ArgTs> | |
StateEnumType | Invoke (instance_of_t< CallableT > &Instance, ArgTs &&... Args) const |
Invokes the state function associated with this state on an instance of the class the state function is a member functions of. More... | |
Private Attributes | |
const StateEnumType | State |
const std::decay_t< CallableT > | StateFunction |
const char * | Description |
const bool | Final |
For final states, it is ensured that the state's state function can delete the state machine. No memory assigned to the state machine will be accessed after the call to Invoke(). More... | |
State machine state as used by class StateMachine. A state mainly wraps a state function of the member function pointer type CallableT to be invoked by the state machine.
CallableT | Type of the state function associated with the state machine state. The state function is expected to be a member function of the class also managing the state machine. It can accept an arbitrary amount of arguments (such as a reference to DynExp::ModuleInstance). Furthermore, it is expected to return a value of type StateEnumType as the identifier of the next state machine state. StateEnumType is an enum class type of elements being identifiers of all states associated with a state machine. |
using Util::StateMachineState< CallableT, >::CallableType = CallableT |
using Util::StateMachineState< CallableT, >::StateEnumType = return_of_t<CallableT> |
|
inlineconstexprnoexcept |
Constructs a state machine state and assigns fixed parameters to it.
State | Unique identifier of the state |
StateFunction | Function pointer to the state's state function |
Description | Human-readable description of what the state does |
IsFinal | Indicates whether this is a final state. Refer to field StateMachineState::Final. |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inline |
Invokes the state function associated with this state on an instance of the class the state function is a member functions of.
...ArgTs | Type of the parameter pack to forward to the state function |
Instance | Instance to invoke the state function on |
...Args | Parameters to forward to the state function |
|
inlineconstexprnoexcept |
|
private |
|
private |
|
private |
|
private |