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

Description:

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.

#include <app.hpp>

Inheritance diagram for alib::app::App::StateMachine::CommandList:
[legend]
Collaboration diagram for alib::app::App::StateMachine::CommandList:
[legend]

Public Method Index:

template<typename TDerived, auto TMethodAddress>
void Add (Enum state)

Method Details:

◆ Add()

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
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.

Definition at line 252 of file app.hpp.

Here is the call graph for this function:

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