Hierarchical State Machine class (QMsm-style state machine implementation strategy). More...
#include <qp.hpp>
Public Member Functions | |
| void | init (void const *const e, std::uint_fast8_t const qsId) override |
| Implementation of the top-most initial transition in QP::QMsm. | |
| void | dispatch (QEvt const *const e, std::uint_fast8_t const qsId) override |
| Implementation of dispatching events to a QP::QMsm. | |
| bool | isIn (QStateHandler const stateHndl) noexcept override |
| Tests if a given state is part of the current active state configuration. | |
| QStateHandler | getStateHandler () const noexcept override |
| Obtain the current active state from a MSM (read only). | |
| QMState const * | childStateObj (QMState const *const parentHndl) const noexcept |
| Obtain the current active child state of a given parent in QP::QMsm. | |
| virtual void | init (std::uint_fast8_t const qsId) |
| Virtual function to take the top-most initial transition in the state machine (overloaded). | |
| Public Member Functions inherited from QP::QAsm | |
| virtual | ~QAsm ()=default |
| Virtual destructor of the QP::QAsm abstract base class. | |
| QStateHandler | state () const noexcept |
| QMState const * | stateObj () const noexcept |
Static Public Member Functions | |
| static QMState const * | topQMState () noexcept |
| Static Public Member Functions inherited from QP::QAsm | |
| static constexpr QState | Q_HANDLED () |
| static constexpr QState | Q_UNHANDLED () |
| static constexpr QState | QM_HANDLED () |
| static constexpr QState | QM_UNHANDLED () |
| static constexpr QState | QM_SUPER () |
| static QState | top (void *const me, QEvt const *const e) noexcept |
| Top state handler that ignores all events. | |
Protected Member Functions | |
| QMsm (QStateHandler const initial) noexcept | |
| Constructor of QP::QMsm. | |
| Protected Member Functions inherited from QP::QAsm | |
| QAsm () noexcept | |
| Constructor of the QP::QAsm base class. | |
| QState | tran (QStateHandler const target) noexcept |
| Internal helper function to take a state transition in sublclasses of QP::QAsm. | |
| QState | tran_hist (QStateHandler const hist) noexcept |
| Internal helper function to take a state transition to history in sublclasses of QP::QAsm. | |
| QState | super (QStateHandler const superstate) noexcept |
| Internal helper function to indicate superstate of a given state in sublclasses of QP::QAsm. | |
| QState | qm_tran (void const *const tatbl) noexcept |
| Internal helper function to take a state transition in QP::QMsm. | |
| QState | qm_tran_init (void const *const tatbl) noexcept |
| QState | qm_tran_hist (QMState const *const hist, void const *const tatbl) noexcept |
| Internal helper function to take a state transition to history in QP::QMsm. | |
| QState | qm_entry (QMState const *const s) noexcept |
| Internal helper function to execute state entry actions in QP::QMsm. | |
| QState | qm_exit (QMState const *const s) noexcept |
| Internal helper function to execute state exit actions in QP::QMsm. | |
Private Member Functions | |
| QState | execTatbl_ (QMTranActTable const *const tatbl, std::uint_fast8_t const qsId) |
| Execute a transition-action table in QP::QMsm. | |
| void | exitToTranSource_ (QMState const *const curr_state, QMState const *const tran_source, std::uint_fast8_t const qsId) |
| Exit the given current-state up to the given tran-source in QP::QMsm. | |
| QState | enterHistory_ (QMState const *const hist, std::uint_fast8_t const qsId) |
| Enter the history of a given state in QP::QMsm. | |
Friends | |
| class | QS |
Additional Inherited Members | |
| Public Attributes inherited from QP::QAsm | |
| QAsmAttr | m_state |
| Current state (pointer to the current state-handler function). | |
| QAsmAttr | m_temp |
| Temporary storage for target/act-table etc. | |
| Static Public Attributes inherited from QP::QAsm | |
| static constexpr QState | Q_RET_SUPER {0U} |
| static constexpr QState | Q_RET_UNHANDLED {1U} |
| static constexpr QState | Q_RET_HANDLED {2U} |
| static constexpr QState | Q_RET_TRAN {3U} |
| static constexpr QState | Q_RET_TRAN_HIST {4U} |
| static constexpr QState | Q_RET_IGNORED {5U} |
| static constexpr QState | Q_RET_ENTRY {6U} |
| static constexpr QState | Q_RET_EXIT {7U} |
| static constexpr QState | Q_RET_TRAN_INIT {8U} |
| static constexpr QSignal | Q_EMPTY_SIG {0U} |
| static constexpr QSignal | Q_ENTRY_SIG {1U} |
| static constexpr QSignal | Q_EXIT_SIG {2U} |
| static constexpr QSignal | Q_INIT_SIG {3U} |
| static constexpr QMState const * | QM_STATE_NULL { nullptr } |
| static constexpr QActionHandler const | Q_ACTION_NULL { nullptr } |
Hierarchical State Machine class (QMsm-style state machine implementation strategy).
Details
QP::QMsm (QM State Machine) provides a more efficient state machine implementation strategy than QP::QHsm, but requires the use of the QM modeling tool, but are the fastest and need the least run-time support (the smallest event-processor taking up the least code space).
Backward Traceability
Usage
The following example illustrates how to derive a state machine class from QP::QMsm.
|
explicitprotectednoexcept |
Constructor of QP::QMsm.
Details
Performs the first step of QMsm initialization by assigning the initial pseudostate to the currently active state of the state machine.
| [in] | initial | the top-most initial transition for the MSM. |
Usage
The following example illustrates how to invoke QMsm() constructor in the "constructor" of a derived state machine:
Forward Traceability
|
overridevirtual |
Implementation of the top-most initial transition in QP::QMsm.
Details
This function synchronously executes the top-most initial transition in a state machine.
| [in] | e | pointer to an extra parameter (might be NULL) |
| [in] | qsId | QS-id of this state machine (for QS local filter) |
Implements QP::QAsm.
|
overridevirtual |
Implementation of dispatching events to a QP::QMsm.
Details
This function synchronously dispatches an event for processing to a state machine. The processing of an event represents one run-to-completion (RTC) step.
| [in] | e | pointer to the event to be dispatched to the MSM |
| [in] | qsId | QS-id of this state machine (for QS local filter) |
Backward Traceability
Forward Traceability
Implements QP::QAsm.
|
overridevirtualnoexcept |
Tests if a given state is part of the current active state configuration.
Details
Check if a given state is part of the current active state configuration in ::QMsm subclasses. Please note that in a hierarchical state machine, to "be in a state" means also to be in a superstate of of the state.
Backward Traceability
Implements QP::QAsm.
|
overridevirtualnoexcept |
Obtain the current active child state of a given parent in QP::QMsm.
Details
Finds the child state of the given parent, such that this child state is an ancestor of the currently active state. The main purpose of this function is to support **shallow history*transitions in state machines derived from QMsm.
| [in] | parentHndl | pointer to the state-handler object |
|
staticnoexcept |
|
private |
Execute a transition-action table in QP::QMsm.
Execute transition-action table.
Details
This helper function executes the provided transition-action table calling each action in the table until nullptr (the end of the table) is reached.
| [in] | tatbl | transition-action table to execute |
| [in] | qsId | QS-id of this state machine (for QS local filter) |
Backward Traceability
Forward Traceability
Details
Helper function to execute transition sequence in a transition-action table.
| [in] | tatbl | pointer to the transition-action table |
| [in] | qsId | QS-id of this state machine (for QS local filter) |
|
private |
Exit the given current-state up to the given tran-source in QP::QMsm.
Exit the current state up to the explicit transition source.
Details
This helper function scans the state hierarchy (by following the state.superstate links) and calls the exit action for each state object, starting with the current-state and ending at the tran-source state.
| [in] | curr_state | pointer to the current state object |
| [in] | tran_source | pointer to the transition source object |
| [in] | qsId | QS-id of this state machine (for QS local filter) |
Backward Traceability
Forward Traceability
Details
Static helper function to exit the current state configuration to the transition source, which in a hierarchical state machine might be a superstate of the current state.
| [in] | curr_state | pointer to the current state |
| [in] | tran_source | pointer to the transition source state |
| [in] | qsId | QS-id of this state machine (for QS local filter) |
Forward Traceability
Enter the history of a given state in QP::QMsm.
Enter history of a composite state.
Details
This helper function dynamically enters the given history state, which is the substate of m_state.obj.
| [in] | hist | pointer to the history state to be entered |
| [in] | qsId | QS-id of this state machine (for QS local filter) |
Backward Traceability
Forward Traceability
DVR_QP_PCLP_732: loss of sign in accessing array element path[ip])
Details
Static helper function to execute the segment of transition to history after entering the composite state and
| [in] | hist | pointer to the history substate |
| [in] | qsId | QS-id of this state machine (for QS local filter) |
Forward Traceability
|
virtual |
Virtual function to take the top-most initial transition in the state machine (overloaded).
Details
Synchronously executes the top-most initial transition in a state machine. This overloaded version takes no initialization parameter.
| [in] | qsId | QS-id of this state machine (for QS local filter) |
Reimplemented from QP::QAsm.
Definition at line 218 of file qf_act.cpp.