51 #include "qs_dummy.hpp"
60Q_DEFINE_THIS_MODULE(
"qep_msm")
63static constexpr std::int_fast8_t MAX_NEST_DEPTH_ {6};
66static constexpr std::int_fast8_t MAX_TRAN_LENGTH_ {3*MAX_NEST_DEPTH_};
69static constexpr std::int_fast8_t MAX_ENTRY_DEPTH_ {4};
87#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U))
88#error qpcpp version 7.3.0 or higher required
101 m_state.obj = &l_msm_top_s;
102 m_temp.fun = initial;
107 void const *
const e,
108 std::uint_fast8_t
const qsId)
141 std::int_fast8_t limit = MAX_NEST_DEPTH_;
168 QEvt const *
const e,
169 std::uint_fast8_t
const qsId)
197 std::int_fast8_t limit = MAX_NEST_DEPTH_;
231 }
while ((t !=
nullptr) && (limit > 0));
246 limit = MAX_NEST_DEPTH_;
276 r = (*tmp.
act)(
this);
351 else if (t ==
nullptr) {
375 bool inState =
false;
377 QMState const *s = m_state.obj;
378 std::int_fast8_t limit = MAX_NEST_DEPTH_;
379 for (; (s !=
nullptr) && (limit > 0); --limit) {
399 bool inState =
false;
401 QMState const *s = m_state.obj;
402 std::int_fast8_t limit = MAX_NEST_DEPTH_;
403 for (; (s !=
nullptr) && (limit > 0); --limit) {
423 QMState const *child = m_state.obj;
424 bool isFound =
false;
427 std::int_fast8_t limit = MAX_NEST_DEPTH_;
428 for (s = m_state.obj;
429 (s !=
nullptr) && (limit > 0);
447 limit = MAX_NEST_DEPTH_;
449 (s !=
nullptr) && (limit > 0);
473 std::uint_fast8_t
const qsId)
487 std::int_fast8_t limit = MAX_TRAN_LENGTH_;
489 for (; (*a !=
nullptr) && (limit > 0); ++a) {
549 std::uint_fast8_t
const qsId)
559 std::int_fast8_t limit = MAX_NEST_DEPTH_;
560 for (; (s != ts) && (limit > 0); --limit) {
562 if (s->exitAction !=
nullptr) {
564 static_cast<void>((*s->exitAction)(
this));
570 QS_FUN_PRE_(s->stateHandler);
593 std::uint_fast8_t
const qsId)
601 QMState const *epath[MAX_ENTRY_DEPTH_];
615 std::int_fast8_t i = 0;
616 while ((s != ts) && (i < MAX_ENTRY_DEPTH_)) {
639 QS_FUN_PRE_(epath[i]->stateHandler);
Abstract State Machine class (state machine interface)
@ Q_RET_HANDLED
event handled (internal transition)
@ Q_RET_ENTRY
state entry action executed
@ Q_RET_UNHANDLED
event unhandled due to a guard
@ Q_RET_TRAN
regular transition
@ Q_RET_TRAN_HIST
transition to history of a given state
@ Q_RET_TRAN_XP
exit-point transition out of a submachine
@ Q_RET_SUPER_SUB
event passed to submachine superstate
@ Q_RET_NULL
return value without any effect
@ Q_RET_TRAN_INIT
initial transition in a state or submachine
@ Q_RET_TRAN_EP
entry-point transition into a submachine
@ Q_RET_EXIT
state exit action executed
@ Q_RET_SUPER
event passed to superstate to handle
static bool verify_(QEvt const *const e) noexcept
void exitToTranSource_(QMState const *const cs, QMState const *const ts, std::uint_fast8_t const qsId)
QState enterHistory_(QMState const *const hist, std::uint_fast8_t const qsId)
bool isIn(QStateHandler const state) noexcept override
QMsm(QStateHandler const initial) noexcept
void dispatch(QEvt const *const e, std::uint_fast8_t const qsId) override
bool isInState(QMState const *const stateObj) const noexcept
void init(void const *const e, std::uint_fast8_t const qsId) override
QMState const * topQMState() const noexcept
QMState const * childStateObj(QMState const *const parent) const noexcept
QState execTatbl_(QMTranActTable const *const tatbl, std::uint_fast8_t const qsId)
QState(*)(void *const me) QActionHandler
QState(*)(void *const me, QEvt const *const e) QStateHandler
@ QS_QEP_DISPATCH
an event was dispatched (begin of RTC step)
@ QS_QEP_STATE_ENTRY
a state was entered
@ QS_QEP_STATE_EXIT
a state was exited
@ QS_QEP_TRAN_HIST
a tran to history was taken
@ QS_QEP_IGNORED
an event was ignored (silently discarded)
@ QS_QEP_UNHANDLED
an event was un-handled due to a guard
@ QS_QEP_TRAN_XP
a tran to exit point out of a submachine
@ QS_QEP_TRAN_EP
a tran to entry point into a submachine
@ QS_QEP_STATE_INIT
an initial transition was taken in a state
@ QS_QEP_TRAN
a regular transition was taken
@ QS_QEP_INIT_TRAN
the top-most initial transition was taken
@ QS_QEP_INTERN_TRAN
an internal transition was taken
#define Q_EVT_CAST(subclass_)
#define Q_UNUSED_PAR(par_)
Internal (package scope) QP/C++ interface.
QS/C++ package-scope interface.
QS/C++ port to a 32-bit CPU, generic C++ compiler.
QP Functional Safety (FuSa) Subsystem.
#define Q_ASSERT_INCRIT(id_, expr_)
#define Q_ENSURE_INCRIT(id_, expr_)
#define Q_REQUIRE_INCRIT(id_, expr_)
State object for the QP::QMsm class (QM State Machine).
QActionHandler const entryAction
QStateHandler const stateHandler
QMState const * superstate
QActionHandler const initAction
Transition-Action Table for the QP::QMsm State Machine.
QActionHandler const act[1]
Attribute of for the QP::QAsm class (Abstract State Machine).
QMTranActTable const * tatbl