52Q_DEFINE_THIS_MODULE(
"qep_msm")
55QP::QMState const l_msm_top_s = {
64static constexpr std::int_fast8_t QMSM_MAX_NEST_DEPTH_ {8};
67static constexpr std::int_fast8_t QMSM_MAX_TRAN_LENGTH_ {2*QMSM_MAX_NEST_DEPTH_};
70static constexpr std::int_fast8_t QMSM_MAX_ENTRY_DEPTH_ {4};
79#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U)%0x2710U))
80#error qpcpp version 7.3.0 or higher required
92 m_state.obj = &l_msm_top_s;
99 std::uint_fast8_t
const qsId)
132 std::int_fast8_t lbound = QMSM_MAX_NEST_DEPTH_;
159 QEvt const *
const e,
160 std::uint_fast8_t
const qsId)
189 std::int_fast8_t lbound = QMSM_MAX_NEST_DEPTH_;
219 }
while ((t !=
nullptr) && (lbound > 0));
258 lbound = QMSM_MAX_NEST_DEPTH_;
305 else if (t ==
nullptr) {
329 bool inState =
false;
331 QMState const *s = m_state.obj;
332 std::int_fast8_t lbound = QMSM_MAX_NEST_DEPTH_;
333 for (; (s !=
nullptr) && (lbound > 0); --lbound) {
353 QMState const *child = m_state.obj;
354 bool isFound =
false;
357 std::int_fast8_t lbound = QMSM_MAX_NEST_DEPTH_;
358 for (s = m_state.obj;
359 (s !=
nullptr) && (lbound > 0);
377 lbound = QMSM_MAX_NEST_DEPTH_;
379 (s !=
nullptr) && (lbound > 0);
405 std::uint_fast8_t
const qsId)
419 std::int_fast8_t lbound = QMSM_MAX_TRAN_LENGTH_;
421 for (; (*a !=
nullptr) && (lbound > 0); ++a) {
469 std::uint_fast8_t
const qsId)
479 std::int_fast8_t lbound = QMSM_MAX_NEST_DEPTH_;
480 for (; (s != ts) && (lbound > 0); --lbound) {
482 if (s->exitAction !=
nullptr) {
484 static_cast<void>((*s->exitAction)(
this));
506 std::uint_fast8_t
const qsId)
513 QMState const *epath[QMSM_MAX_ENTRY_DEPTH_];
515 std::int_fast8_t i = 0;
516 while ((s !=
m_state.
obj) && (i < (QMSM_MAX_ENTRY_DEPTH_ - 1))) {
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_NULL
return value without any effect
@ Q_RET_TRAN_INIT
initial transition in a state
@ Q_RET_EXIT
state exit action executed
@ Q_RET_SUPER
event passed to superstate to handle
QAsmAttr m_temp
Temporary storage for target/act-table etc.
QAsmAttr m_state
Current state (pointer to the current state-handler function)
QSignal sig
Signal of the event (see Event Signal)
bool verify_() const noexcept
Internal function to verify the internal integrity of the event instance (QP FuSa Subsystem)
QState execTatbl_(QMTranActTable const *const tatbl, std::uint_fast8_t const qsId)
void dispatch(QEvt const *const e, std::uint_fast8_t const qsId) override
Virtual function to dispatch an event to the state machine.
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)
void init(void const *const e, std::uint_fast8_t const qsId) override
Virtual function to take the top-most initial transition in the state machine.
bool isIn(QStateHandler const state) noexcept override
QMsm(QStateHandler const initial) noexcept
QMState const * topQMState() const noexcept
QMState const * childStateObj(QMState const *const parent) const noexcept
QState(*)(void *const me) QActionHandler
Pointer to an action-handler function.
std::uint_fast8_t QState
Type returned from state-handler functions.
QState(*)(void *const me, QEvt const *const e) QStateHandler
Pointer to a state-handler function.
#define Q_EVT_CAST(subclass_)
#define Q_UNUSED_PAR(par_)
Helper macro to clearly mark unused parameters of functions.
Internal (package scope) QP/C++ interface.
#define QS_BEGIN_PRE(rec_, qsId_)
QS/C++ port to a 32-bit CPU, generic C++ compiler.
QP Functional Safety (FuSa) Subsystem.
#define Q_ASSERT_INCRIT(id_, expr_)
#define Q_INVARIANT_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]
QMTranActTable const * tatbl