QM State Machine implementation strategy. More...
#include <qep.hpp>
Public Member Functions | |
void | init (void const *const e, std::uint_fast8_t const qs_id) override |
Performs the second step of SM initialization by triggering the top-most initial transition. More... | |
void | init (std::uint_fast8_t const qs_id) override |
overloaded init(qs_id) More... | |
void | dispatch (QEvt const *const e, std::uint_fast8_t const qs_id) override |
Dispatches an event to a HSM. More... | |
bool | isInState (QMState const *const st) const noexcept |
Tests if a given state is part of the active state configuration. More... | |
QMState const * | stateObj (void) const noexcept |
Return the current active state object (read only) More... | |
QMState const * | childStateObj (QMState const *const parent) const noexcept |
Obtain the current active child state of a given parent (read only) More... | |
![]() | |
virtual | ~QHsm () |
virtual destructor More... | |
bool | isIn (QStateHandler const s) noexcept |
Tests if a given state is part of the current active state configuration. More... | |
QStateHandler | state (void) const noexcept |
Obtain the current state (state handler function) More... | |
QStateHandler | childState (QStateHandler const parent) noexcept |
Obtain the current active child state of a given parent. More... | |
Protected Member Functions | |
QMsm (QStateHandler const initial) noexcept | |
Protected constructor. More... | |
QStateHandler | getStateHandler () noexcept override |
Get the current state handler of the QMsm. More... | |
![]() | |
QHsm (QStateHandler const initial) noexcept | |
Protected constructor of QHsm. More... | |
QState | tran (QStateHandler const target) noexcept |
Helper function to specify a state transition. More... | |
QState | tran_hist (QStateHandler const hist) noexcept |
Helper function to specify a transition to history. More... | |
QState | super (QStateHandler const superstate) noexcept |
Helper function to specify the superstate of a given state. More... | |
QState | qm_tran (void const *const tatbl) noexcept |
Helper function to specify a regular state transition in a QM state-handler. More... | |
QState | qm_tran_hist (QMState const *const hist, void const *const tatbl) noexcept |
Helper function to specifiy a transition to history in a QM state-handler. More... | |
QState | qm_tran_init (void const *const tatbl) noexcept |
Helper function to specify an initial state transition in a QM state-handler. More... | |
QState | qm_tran_ep (void const *const tatbl) noexcept |
Helper function to specify a transition to an entry point to a submachine state in a QM state-handler. More... | |
QState | qm_tran_xp (QActionHandler const xp, void const *const tatbl) noexcept |
Helper function to specify a transition to an exit point from a submachine state in a QM state-handler. More... | |
QState | qm_entry (QMState const *const s) noexcept |
Helper function to specify a state entry in a QM state-handler. More... | |
QState | qm_exit (QMState const *const s) noexcept |
Helper function to specify a state exit in a QM state-handler. More... | |
QState | qm_sm_exit (QMState const *const s) noexcept |
Helper function to specify a submachine exit in a QM state-handler. More... | |
QState | qm_super_sub (QMState const *const s) noexcept |
Helper function to call in a QM state-handler when it passes the event to the host submachine state to handle an event. More... | |
Private Member Functions | |
bool | isIn (QStateHandler const s) noexcept=delete |
disallow inhertited isIn() function in QP::QMsm and subclasses More... | |
QStateHandler | state (void) const noexcept=delete |
disallow inhertited state() function in QP::QMsm and subclasses More... | |
QStateHandler | childState (QStateHandler const parent) noexcept=delete |
disallow inhertited childState() function in QP::QMsm and subclasses More... | |
QState | execTatbl_ (QMTranActTable const *const tatbl, std::uint_fast8_t const qs_id) |
Internal helper function to execute a transition-action table. More... | |
void | exitToTranSource_ (QMState const *s, QMState const *const ts, std::uint_fast8_t const qs_id) |
Internal helper function to exit current state to transition source. More... | |
QState | enterHistory_ (QMState const *const hist, std::uint_fast8_t const qs_id) |
Internal helper function to enter state history. More... | |
Static Private Member Functions | |
static QState | top (void *const me, QEvt const *const e) noexcept=delete |
disallow inhertited top() function in QP::QMsm and subclasses More... | |
Static Private Attributes | |
static constexpr std::int_fast8_t | MAX_ENTRY_DEPTH_ {4} |
maximum depth of implemented entry levels for transitions to history More... | |
static QMState const | msm_top_s |
the top state object for the QMsm More... | |
Friends | |
class | QMActive |
Additional Inherited Members | |
![]() | |
static QState | top (void *const me, QEvt const *const e) noexcept |
the top-state. More... | |
![]() | |
static constexpr QState | Q_RET_SUPER {static_cast<QState>(0)} |
event passed to the superstate to handle More... | |
static constexpr QState | Q_RET_SUPER_SUB {static_cast<QState>(1)} |
event passed to submachine superstate More... | |
static constexpr QState | Q_RET_UNHANDLED {static_cast<QState>(2)} |
event unhandled due to a guard evaluating to 'false' More... | |
static constexpr QState | Q_RET_HANDLED {static_cast<QState>(3)} |
event handled (internal transition) More... | |
static constexpr QState | Q_RET_IGNORED {static_cast<QState>(4)} |
event silently ignored (bubbled up to top) More... | |
static constexpr QState | Q_RET_ENTRY {static_cast<QState>(5)} |
state entry action executed More... | |
static constexpr QState | Q_RET_EXIT {static_cast<QState>(6)} |
state exit action executed More... | |
static constexpr QState | Q_RET_NULL {static_cast<QState>(7)} |
return value without any effect More... | |
static constexpr QState | Q_RET_TRAN {static_cast<QState>(8)} |
regular transition taken More... | |
static constexpr QState | Q_RET_TRAN_INIT {static_cast<QState>(9)} |
initial transition taken More... | |
static constexpr QState | Q_RET_TRAN_EP {static_cast<QState>(10)} |
entry-point transition into a submachine More... | |
static constexpr QState | Q_RET_TRAN_HIST {static_cast<QState>(11)} |
transition to history of a given state More... | |
static constexpr QState | Q_RET_TRAN_XP {static_cast<QState>(12)} |
exit-point transition out of a submachine More... | |
![]() | |
enum | ReservedHsmSignals : QSignal { Q_ENTRY_SIG = 1 , Q_EXIT_SIG , Q_INIT_SIG } |
QM State Machine implementation strategy.
|
explicitprotectednoexcept |
Protected constructor.
[in] | initial | the top-most initial transition for the MSM. |
Definition at line 83 of file qep_msm.cpp.
|
overridevirtual |
Performs the second step of SM initialization by triggering the top-most initial transition.
[in] | e | pointer to an extra parameter (might be nullptr) |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
Reimplemented from QHsm.
Definition at line 101 of file qep_msm.cpp.
|
inlineoverridevirtual |
|
overridevirtual |
Dispatches an event to a HSM.
[in] | e | pointer to the event to be dispatched to the MSM |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
Reimplemented from QHsm.
Definition at line 149 of file qep_msm.cpp.
|
noexcept |
Tests if a given state is part of the active state configuration.
[in] | st | pointer to the QMState object that corresponds to the tested state. |
st
and 'false' otherwise Definition at line 524 of file qep_msm.cpp.
|
inlinenoexcept |
Obtain the current active child state of a given parent (read only)
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] | parent | pointer to the state-handler object |
parent
state, which is an ancestor of the currently active state. For the corner case when the currently active state is the given parent
state, function returns the parent
state. Definition at line 554 of file qep_msm.cpp.
|
overrideprotectedvirtualnoexcept |
Get the current state handler of the QMsm.
Reimplemented from QHsm.
Definition at line 321 of file qep_msm.cpp.
|
privatedeletenoexcept |
disallow inhertited isIn() function in QP::QMsm and subclasses
|
privatedeletenoexcept |
disallow inhertited state() function in QP::QMsm and subclasses
|
privatedeletenoexcept |
disallow inhertited childState() function in QP::QMsm and subclasses
disallow inhertited top() function in QP::QMsm and subclasses
|
private |
Internal helper function to execute a transition-action table.
[in] | tatbl | pointer to the transition-action table |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
Definition at line 340 of file qep_msm.cpp.
|
private |
Internal helper function to exit current state to transition source.
[in] | s | pointer to the current state |
[in] | ts | pointer to the transition source state |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
Definition at line 415 of file qep_msm.cpp.
|
private |
Internal helper function to enter state history.
[in] | hist | pointer to the history substate |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
Definition at line 456 of file qep_msm.cpp.
|
staticconstexprprivate |
|
staticprivate |