QHsmTst is a contrived state machine from Chapter 2 of the PSiCC2 book for testing all possible transition topologies with up to 4-levels of state nesting.
Test active object
: QHsm(Q_STATE_CAST(&QHsmTst::initial))
(void)e; // avoid compiler warning
me->m_foo = 0U;
BSP_display("top-INIT;");
QS_FUN_DICTIONARY(&QHsm::top);
QS_FUN_DICTIONARY(&QHsmTst::s);
QS_FUN_DICTIONARY(&QHsmTst::s1);
QS_FUN_DICTIONARY(&QHsmTst::s11);
QS_FUN_DICTIONARY(&QHsmTst::s2);
QS_FUN_DICTIONARY(&QHsmTst::s21);
QS_FUN_DICTIONARY(&QHsmTst::s211);
QS_SIG_DICTIONARY(A_SIG, me);
QS_SIG_DICTIONARY(B_SIG, me);
QS_SIG_DICTIONARY(C_SIG, me);
QS_SIG_DICTIONARY(D_SIG, me);
QS_SIG_DICTIONARY(E_SIG, me);
QS_SIG_DICTIONARY(F_SIG, me);
QS_SIG_DICTIONARY(G_SIG, me);
QS_SIG_DICTIONARY(H_SIG, me);
QS_SIG_DICTIONARY(I_SIG, me);
QS_SIG_DICTIONARY(TERMINATE_SIG, me);
QS_SIG_DICTIONARY(IGNORE_SIG, me);
BSP_display("s-ENTRY;");
BSP_display("s-EXIT;");
BSP_display("s-INIT;");
me->m_foo
me->m_foo = 0U;
BSP_display("s-I;");
BSP_display("s-E;");
BSP_terminate(0);
BSP_display("s1-ENTRY;");
BSP_display("s1-EXIT;");
BSP_display("s1-INIT;");
BSP_display("s1-I;");
!me->m_foo
me->m_foo = true;
BSP_display("s1-D;");
BSP_display("s1-A;");
BSP_display("s1-B;");
BSP_display("s1-F;");
BSP_display("s1-C;");
BSP_display("s11-ENTRY;");
BSP_display("s11-EXIT;");
BSP_display("s11-H;");
me->m_foo
me->m_foo = false;
BSP_display("s11-D;");
BSP_display("s11-G;");
BSP_display("s2-ENTRY;");
BSP_display("s2-EXIT;");
BSP_display("s2-INIT;");
!me->m_foo
me->m_foo = true;
BSP_display("s2-I;");
BSP_display("s2-F;");
BSP_display("s2-C;");
BSP_display("s21-ENTRY;");
BSP_display("s21-EXIT;");
BSP_display("s21-INIT;");
BSP_display("s21-G;");
BSP_display("s21-A;");
BSP_display("s21-B;");
BSP_display("s211-ENTRY;");
BSP_display("s211-EXIT;");
BSP_display("s211-H;");
BSP_display("s211-D;");
#ifndef qhsmtst_h
#define qhsmtst_h
namespace QHSMTST {
enum QHsmTstSignals {
A_SIG = QP::Q_USER_SIG,
B_SIG,
C_SIG,
D_SIG,
E_SIG,
F_SIG,
G_SIG,
H_SIG,
I_SIG,
TERMINATE_SIG,
IGNORE_SIG,
MAX_SIG
};
extern QP::QHsm * const the_hsm; // opaque pointer to the test HSM
// BSP functions to dispaly a message and exit
void BSP_display(char_t const *msg);
void BSP_terminate(int16_t const result);
} // namespace QHSMTST
#endif // qhsmtst_h
#include "qpcpp.h"
#include "qhsmtst.h"
namespace QHSMTST {
$declare(HSMs::QHsmTst)
static QHsmTst l_hsmtst; // the only instance of the QHsmTst class
// global-scope definitions -----------------------------------------
QP::QHsm * const the_hsm = &l_hsmtst; // the opaque pointer
$define(HSMs::QHsmTst)
} // namespace QHSMTST