A list of pairs of states and corresponding methods to process. This struct is used only once, namely with the field StateMachine::Program. The constructor of class App fills this list with all commands defined in the enumeration States. While the insertion method Add is provided for convenience, more complex manipulation of the list is allowed using the interface inherited from std::vector.
The list will be sorted at the start of method App::Main. Consequently all commands have to be added prior to its invocation.
Definition at line 232 of file app.hpp.
template<typename TDerived, auto TMethodAddress>
| void alib::app::App::StateMachine::CommandList::Add |
( |
Enum | state | ) |
|
|
inline |
Adds a custom execution command to this list. 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 member of the given type TDerived, which is usually the descendant singleton-type, that implements 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.
- See also
- A code sample is provided in chapter 2.1 A Simple Linear State Machine of the Programmer's Manual of this module.
- Template Parameters
-
| TDerived | The enclosing type of the method. This usually is the custom implementation type of class App. |
| TMethodAddress | The address of the member which is to be called with this command. |
- Parameters
-
| state | The enum element (of a custom type) to identify the command and define the state of the machine during execution. |
Definition at line 252 of file app.hpp.