State machine context as used by class StateMachine. A state machine context holds a map with keys and values of unique state identifiers of type StateEnumType (refer to class StateMachineState). Each map entry indicates a state (key) to be replaced by another state (value). StateMachine::Invoke checks the state identifiers returned by StateMachineState::Invoke and possibly replaces them according to the current context before setting the new state machine state. Contexts can be derived from base contexts unifying and including their replacement lists.
More...
template<typename StateMachineStateT>
class Util::StateMachineContext< StateMachineStateT >
State machine context as used by class StateMachine. A state machine context holds a map with keys and values of unique state identifiers of type StateEnumType (refer to class StateMachineState). Each map entry indicates a state (key) to be replaced by another state (value). StateMachine::Invoke checks the state identifiers returned by StateMachineState::Invoke and possibly replaces them according to the current context before setting the new state machine state. Contexts can be derived from base contexts unifying and including their replacement lists.
- Template Parameters
-
Definition at line 1361 of file Util.h.
◆ ReplacementListType
template<typename StateMachineStateT >
◆ StateEnumType
template<typename StateMachineStateT >
◆ StateType
template<typename StateMachineStateT >
◆ StateMachineContext() [1/2]
template<typename StateMachineStateT >
Default constructor constructs an empty context not performing any state replacement.
◆ StateMachineContext() [2/2]
template<typename StateMachineStateT >
Constructs a StateMachineContext from a replacement list appending the replacement lists of each context in BaseContexts
.
- Parameters
-
ReplacementList | Map containing the StateType to replace (keys) with other state types (values) |
Description | Human-readable description of what the context does |
BaseContexts | List of pointers to other state machine contexts this context should be derived from. If this context's replacement list already contains a specific key to replace, further tuples with the same key are ignored and not inserted. Thus, base contexts should be passed as a list ordered in descending priority. |
Definition at line 1383 of file Util.h.
◆ AdaptState()
template<typename StateMachineStateT >
Checks whether the context contains a replacement entry for the state identified by State
and returns the identifier of the state to replace State
with.
- Parameters
-
State | State identifier to check for replacement |
- Returns
- Returns a replacement of
State
or State
itself if there is no replacement registered.
Definition at line 1404 of file Util.h.
◆ GetDescription()
template<typename StateMachineStateT >
Returns the context's description.
- Returns
- Context's description
Definition at line 1396 of file Util.h.
◆ Description
template<typename StateMachineStateT >
◆ ReplacementList
template<typename StateMachineStateT >
Within this context, the map's key states are replaced by the corresponding value states. The list must not be modified after the StateMachineContext's constructor has run.
Definition at line 1416 of file Util.h.
The documentation for this class was generated from the following file: