Hierarchical State Machine base class. More...
#include <qep.hpp>
Public Member Functions | |
virtual void | init (void const *const e, std::uint_fast8_t const qs_id) |
executes the top-most initial transition in QP::QHsm More... | |
virtual void | init (std::uint_fast8_t const qs_id) |
overloaded init(qs_id) More... | |
virtual void | dispatch (QEvt const *const e, std::uint_fast8_t const qs_id) |
Dispatches an event to QHsm. 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... | |
Static Public Member Functions | |
static QState | top (void *const me, QEvt const *const e) noexcept |
The top-state handler. More... | |
Static Public Attributes | |
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... | |
Protected Types | |
enum | ReservedHsmSignals : QSignal { Q_ENTRY_SIG = 1 , Q_EXIT_SIG , Q_INIT_SIG } |
Protected Member Functions | |
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... | |
virtual QStateHandler | getStateHandler () noexcept |
Get the current state handler of the HSM. 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 | |
std::int_fast8_t | hsm_tran (QStateHandler(&path)[MAX_NEST_DEPTH_], std::uint_fast8_t const qs_id) |
Helper function to take a transition in QP::QHsm. More... | |
Private Attributes | |
QHsmAttr | m_state |
current active state (state-variable) More... | |
QHsmAttr | m_temp |
temporary: transition chain, target state, etc. More... | |
Static Private Attributes | |
static constexpr std::int_fast8_t | MAX_NEST_DEPTH_ {6} |
maximum nesting depth of states in HSM More... | |
Friends | |
class | QMsm |
class | QActive |
class | QMActive |
class | QF |
class | QS |
class | QXK |
class | QXThread |
class | QXMutex |
class | QXSemaphore |
class | QHsmDummy |
class | QActiveDummy |
QHsm is also the base class for the QMsm state machine, which provides a superior efficiency, but requires the use of the QM modeling tool to generate code.
|
protected |
|
explicitprotectednoexcept |
[in] | initial | pointer to the top-most initial state-handler function in the derived state machine |
Definition at line 109 of file qep_hsm.cpp.
|
virtual |
[in] | e | pointer to an extra parameter (might be NULL) |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
traces to: RQP103
traces to: RQP120I
traces to: RQP120D
Reimplemented in QTicker, QHsmDummy, QActiveDummy, QXThread, QMsm, and QMActive.
Definition at line 115 of file qep_hsm.cpp.
|
inlinevirtual |
|
virtual |
[in] | e | pointer to the event to be dispatched to the HSM |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
traces to: RQP103
traces to: RQP120A
traces to: RQP120B
traces to: RQP120C
traces to: RQP120D
traces to: RQP120E
Reimplemented in QTicker, QHsmDummy, QActiveDummy, QXThread, QMsm, and QMActive.
Definition at line 192 of file qep_hsm.cpp.
|
noexcept |
[in] | s | pointer to the state-handler function to be tested |
state
and 'false' otherwisetraces to: RQP103
traces to: RQP120S
Definition at line 486 of file qep_hsm.cpp.
|
inlinenoexcept |
|
noexcept |
Definition at line 511 of file qep_hsm.cpp.
[in] | me | pointer to the HSM instance |
[in] | e | pointer to the event to be dispatched to the HSM |
traces to: RQP103
traces to: RQP120T
Definition at line 185 of file qep_hsm.cpp.
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
protectedvirtualnoexcept |
Reimplemented in QMsm, and QMActive.
Definition at line 480 of file qep_hsm.cpp.
|
private |
[in,out] | path | array of pointers to state-handler functions to execute the entry actions |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
path
parameter.traces to: RQP103
traces to: RQP120E
traces to: RQP120F
Definition at line 348 of file qep_hsm.cpp.
|
friend |
|
friend |
|
staticconstexprprivate |