ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::app::App::StateMachine::Command Struct Reference

Description:

A struct denoting the next state and the corresponding method to execute.

Definition at line 155 of file app.inl.

Inner Type Index:

union  MethodPointer

Public Static Method Index:

template<typename TDerived, auto TMethodAddress>
static Command MakeCustom (Enum state)

Public Field Index:

MethodPointer Method
Enum State

Field Details:

◆ Method

MethodPointer alib::app::App::StateMachine::Command::Method

A pointer union to either a built-in virtual method or a method of the custom derived type.

Definition at line 184 of file app.inl.

◆ State

Enum alib::app::App::StateMachine::Command::State

The identifier of the command which is likewise the state of the machine. During execution, this identifier will be stored in the member State of the outer class StateMachine. In case it is a built-in identifier of type States, it will be stored in addition in its field BuiltInState.

Definition at line 180 of file app.inl.

Method Details:

◆ MakeCustom()

template<typename TDerived, auto TMethodAddress>
Command alib::app::App::StateMachine::Command::MakeCustom ( Enum state)
inlinestatic

A static helper-function that creates a custom command, i.e. a command that is not built-in and as such is not executing one of the pre-defined virtual methods of class App. Instead, it is executing a non-virtual member of the given type TDerived, which is usually the descendant singleton-type, that is implementing the custom application.

Note
For technical reasons, the invocation of this static function is a little counter-intuitive. The two template parameters have to be explicitly provided, where the second is the address of the custom method! (This is C++ 20 magic). The only normal parameter then is the custom enumeration element.
Template Parameters
TDerivedThe enclosing type of the method. This usually is the custom implementation type of class App.
TMethodAddressThe address of the member which is to be called with this command.
Parameters
stateThe enum element (of a custom type) to identify the command and define the state of the machine during execution.
Returns
The command object.

Definition at line 205 of file app.inl.


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