37 #include "qs_dummy.hpp"
43Q_DEFINE_THIS_MODULE(
"qep_hsm")
48static constexpr std::array<
QP::QEvt, 4> l_resEvt_ {
66#define QS_STATE_ACT_(rec_, state_) \
68 QS_BEGIN_PRE((rec_), qsId) \
75#define QS_TOP_INIT_(rec_, trg_) \
77 QS_BEGIN_PRE((rec_), qsId) \
85#define QS_TRAN_SEG_(rec_, src_, trg_) \
87 QS_BEGIN_PRE((rec_), qsId) \
95#define QS_TRAN_ACT_(rec_, state_) \
97 QS_BEGIN_PRE((rec_), qsId) \
100 QS_FUN_PRE(state_); \
105#define QS_TRAN0_(rec_, trg_) \
107 QS_BEGIN_PRE((rec_), qsId) \
109 QS_SIG_PRE(e->sig); \
116#define QS_TRAN_END_(rec_, src_, trg_) \
118 QS_BEGIN_PRE((rec_), qsId) \
120 QS_SIG_PRE(e->sig); \
128#define QS_STATE_ACT_(rec_, state_) (static_cast<void>(0))
129#define QS_TOP_INIT_(rec_, trg_) (static_cast<void>(0))
130#define QS_TRAN_SEG_(rec_, src_, trg_) (static_cast<void>(0))
131#define QS_TRAN_ACT_(rec_, state_) (static_cast<void>(0))
132#define QS_TRAN0_(rec_, trg_) (static_cast<void>(0))
133#define QS_TRAN_END_(rec_, src_, trg_) (static_cast<void>(0))
151 void const *
const e,
152 std::uint_fast8_t
const qsId)
193 std::array <QStateHandler, MAX_NEST_DEPTH_> path;
208 }
while (
m_temp.fun != s);
226 QEvt const *
const e,
227 std::uint_fast8_t
const qsId)
243 std::uintptr_t
const state_dis =
m_temp.uint;
251 std::array <QStateHandler, MAX_NEST_DEPTH_> path;
329 std::array<QStateHandler, MAX_NEST_DEPTH_> &path,
330 std::uint_fast8_t
const qsId)
365 static_cast<void>((*s)(
this, &l_resEvt_[
Q_EMPTY_SIG]));
375 else if (
m_temp.fun == path[0U]) {
396 std::array<QStateHandler, MAX_NEST_DEPTH_> &path,
397 std::uint_fast8_t
const qsId)
432 static_cast<void>((*s)(
this, &l_resEvt_[
Q_EXIT_SIG]));
462 static_cast<void>((*s)(
this, &l_resEvt_[
Q_EMPTY_SIG]));
485 std::array<QStateHandler, MAX_NEST_DEPTH_> &path,
486 std::size_t
const depth,
487 std::uint_fast8_t
const qsId)
494 std::size_t ip = depth;
534 }
while (
m_temp.fun != t);
555 bool inState =
false;
561 if (s == stateHndl) {
585 bool isFound =
false;
593 if (
m_temp.fun == parentHndl) {
QAsm() noexcept
Constructor of the QP::QAsm base class.
static constexpr QState Q_RET_UNHANDLED
static constexpr QState Q_RET_TRAN
QAsmAttr m_temp
Temporary storage for target/act-table etc.
static constexpr QState Q_RET_IGNORED
static constexpr QState Q_RET_SUPER
static constexpr QState Q_RET_TRAN_HIST
static constexpr QSignal Q_INIT_SIG
QAsmAttr m_state
Current state (pointer to the current state-handler function).
static constexpr QSignal Q_ENTRY_SIG
static constexpr QSignal Q_EXIT_SIG
static constexpr QSignal Q_EMPTY_SIG
static constexpr QState Q_RET_HANDLED
static QState top(void *const me, QEvt const *const e) noexcept
Top state handler that ignores all events.
void dispatch(QEvt const *const e, std::uint_fast8_t const qsId) override
Virtual function to dispatch an event to the state machine.
static constexpr std::size_t MAX_NEST_DEPTH_
void enter_target_(std::array< QStateHandler, MAX_NEST_DEPTH_ > &path, std::size_t const depth, std::uint_fast8_t const qsId)
QStateHandler childState(QStateHandler const parentHndl) noexcept
Obtain the current active child state of a given parent in QP::QMsm.
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.
std::size_t tran_simple_(std::array< QStateHandler, MAX_NEST_DEPTH_ > &path, std::uint_fast8_t const qsId)
QHsm(QStateHandler const initial) noexcept
bool isIn(QStateHandler const stateHndl) noexcept override
Check whether the HSM is in a given state.
std::size_t tran_complex_(std::array< QStateHandler, MAX_NEST_DEPTH_ > &path, std::uint_fast8_t const qsId)
QStateHandler getStateHandler() const noexcept override
Virtual method for getting the current state handler.
QP/C++ Framework namespace.
@ 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_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
static T_ dis_update(T_ const org)
Internal function template to calculate the Duplicate Inverse Storage (DIS).
static bool dis_verify(T_ const org, T_ const dis)
Internal function template to verify the Duplicate Inverse Storage (DIS).
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.
std::uint16_t QSignal
The signal of event QP::QEvt.
#define Q_EVT_CAST(subclass_)
Perform downcast of an event onto a subclass of QP::QEvt class_.
#define Q_UNUSED_PAR(par_)
Helper macro to mark unused parameters of functions.
#define Q_STATE_CAST(handler_)
Perform cast to QP::QStateHandler.
QP/C++ Framework in C++ internal (package-scope) interface.
#define QS_CRIT_STAT
Internal QS macro for defining the critical section status.
#define QS_FUN_DICTIONARY(fun_)
Produce function dictionary (typically for state-handler functions).
#define QS_CRIT_EXIT()
Internal macro for exiting a critical section.
#define QS_CRIT_ENTRY()
Internal macro for entering a critical section.
QS (QP/Spy software tracing) internal (package-scope) interface.
QP Functional Safety (FuSa) Subsystem.
#define Q_REQUIRE_LOCAL(id_, expr_)
Assertion for checking a precondition (local critical section).
#define Q_ERROR_LOCAL(id_)
Assertion with user-specified ID for a wrong path through the code (local critical section).
#define Q_ENSURE_LOCAL(id_, expr_)
Assertion for checking a postcondition (local critical section).
#define Q_ASSERT_LOCAL(id_, expr_)
General-purpose assertion with user-specified ID number (local critical section).
#define Q_INVARIANT_LOCAL(id_, expr_)
Assertion for checking a postcondition (local critical section).