2019-12-31 15:56:23 -05:00

384 lines
11 KiB
C++

//.$file${.::qhsmtst.cpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//
// Model: qhsmtst.qm
// File: ${.::qhsmtst.cpp}
//
// This code has been generated by QM 4.6.0 <www.state-machine.com/qm/>.
// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
//
// This program is open source software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
//.$endhead${.::qhsmtst.cpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#include "qpcpp.hpp"
#include "qhsmtst.hpp"
//.$declare${HSMs::QHsmTst} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//.${HSMs::QHsmTst} ..........................................................
class QHsmTst : public QP::QHsm {
private:
bool m_foo;
public:
QHsmTst()
: QHsm(Q_STATE_CAST(&QHsmTst::initial))
{}
protected:
Q_STATE_DECL(initial);
Q_STATE_DECL(s);
Q_STATE_DECL(s1);
Q_STATE_DECL(s11);
Q_STATE_DECL(s2);
Q_STATE_DECL(s21);
Q_STATE_DECL(s211);
};
//.$enddecl${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
//.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//. Check for the minimum required QP version
#if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U))
#error qpcpp version 6.5.0 or higher required
#endif
//.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//.$define${HSMs::QHsmTst} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//.${HSMs::QHsmTst} ..........................................................
//.${HSMs::QHsmTst::SM} ......................................................
Q_STATE_DEF(QHsmTst, initial) {
//.${HSMs::QHsmTst::SM::initial}
(void)e; // unused parameter
m_foo = 0U;
BSP_display("top-INIT;");
QS_FUN_DICTIONARY(&s);
QS_FUN_DICTIONARY(&s1);
QS_FUN_DICTIONARY(&s11);
QS_FUN_DICTIONARY(&s2);
QS_FUN_DICTIONARY(&s21);
QS_FUN_DICTIONARY(&s211);
return tran(&s2);
}
//.${HSMs::QHsmTst::SM::s} ...................................................
Q_STATE_DEF(QHsmTst, s) {
QP::QState status_;
switch (e->sig) {
//.${HSMs::QHsmTst::SM::s}
case Q_ENTRY_SIG: {
BSP_display("s-ENTRY;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s}
case Q_EXIT_SIG: {
BSP_display("s-EXIT;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::initial}
case Q_INIT_SIG: {
BSP_display("s-INIT;");
status_ = tran(&s11);
break;
}
//.${HSMs::QHsmTst::SM::s::I}
case I_SIG: {
//.${HSMs::QHsmTst::SM::s::I::[m_foo]}
if (m_foo) {
m_foo = 0U;
BSP_display("s-I;");
status_ = Q_RET_HANDLED;
}
else {
status_ = Q_RET_UNHANDLED;
}
break;
}
//.${HSMs::QHsmTst::SM::s::E}
case E_SIG: {
BSP_display("s-E;");
status_ = tran(&s11);
break;
}
//.${HSMs::QHsmTst::SM::s::TERMINATE}
case TERMINATE_SIG: {
BSP_terminate(0);
status_ = Q_RET_HANDLED;
break;
}
default: {
status_ = super(&top);
break;
}
}
return status_;
}
//.${HSMs::QHsmTst::SM::s::s1} ...............................................
Q_STATE_DEF(QHsmTst, s1) {
QP::QState status_;
switch (e->sig) {
//.${HSMs::QHsmTst::SM::s::s1}
case Q_ENTRY_SIG: {
BSP_display("s1-ENTRY;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s1}
case Q_EXIT_SIG: {
BSP_display("s1-EXIT;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s1::initial}
case Q_INIT_SIG: {
BSP_display("s1-INIT;");
status_ = tran(&s11);
break;
}
//.${HSMs::QHsmTst::SM::s::s1::I}
case I_SIG: {
BSP_display("s1-I;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s1::D}
case D_SIG: {
//.${HSMs::QHsmTst::SM::s::s1::D::[!m_foo]}
if (!m_foo) {
m_foo = true;
BSP_display("s1-D;");
status_ = tran(&s);
}
else {
status_ = Q_RET_UNHANDLED;
}
break;
}
//.${HSMs::QHsmTst::SM::s::s1::A}
case A_SIG: {
BSP_display("s1-A;");
status_ = tran(&s1);
break;
}
//.${HSMs::QHsmTst::SM::s::s1::B}
case B_SIG: {
BSP_display("s1-B;");
status_ = tran(&s11);
break;
}
//.${HSMs::QHsmTst::SM::s::s1::F}
case F_SIG: {
BSP_display("s1-F;");
status_ = tran(&s211);
break;
}
//.${HSMs::QHsmTst::SM::s::s1::C}
case C_SIG: {
BSP_display("s1-C;");
status_ = tran(&s2);
break;
}
default: {
status_ = super(&s);
break;
}
}
return status_;
}
//.${HSMs::QHsmTst::SM::s::s1::s11} ..........................................
Q_STATE_DEF(QHsmTst, s11) {
QP::QState status_;
switch (e->sig) {
//.${HSMs::QHsmTst::SM::s::s1::s11}
case Q_ENTRY_SIG: {
BSP_display("s11-ENTRY;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s1::s11}
case Q_EXIT_SIG: {
BSP_display("s11-EXIT;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s1::s11::H}
case H_SIG: {
BSP_display("s11-H;");
status_ = tran(&s);
break;
}
//.${HSMs::QHsmTst::SM::s::s1::s11::D}
case D_SIG: {
//.${HSMs::QHsmTst::SM::s::s1::s11::D::[m_foo]}
if (m_foo) {
m_foo = false;
BSP_display("s11-D;");
status_ = tran(&s1);
}
else {
status_ = Q_RET_UNHANDLED;
}
break;
}
//.${HSMs::QHsmTst::SM::s::s1::s11::G}
case G_SIG: {
BSP_display("s11-G;");
status_ = tran(&s211);
break;
}
default: {
status_ = super(&s1);
break;
}
}
return status_;
}
//.${HSMs::QHsmTst::SM::s::s2} ...............................................
Q_STATE_DEF(QHsmTst, s2) {
QP::QState status_;
switch (e->sig) {
//.${HSMs::QHsmTst::SM::s::s2}
case Q_ENTRY_SIG: {
BSP_display("s2-ENTRY;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s2}
case Q_EXIT_SIG: {
BSP_display("s2-EXIT;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s2::initial}
case Q_INIT_SIG: {
BSP_display("s2-INIT;");
status_ = tran(&s211);
break;
}
//.${HSMs::QHsmTst::SM::s::s2::I}
case I_SIG: {
//.${HSMs::QHsmTst::SM::s::s2::I::[!m_foo]}
if (!m_foo) {
m_foo = true;
BSP_display("s2-I;");
status_ = Q_RET_HANDLED;
}
else {
status_ = Q_RET_UNHANDLED;
}
break;
}
//.${HSMs::QHsmTst::SM::s::s2::F}
case F_SIG: {
BSP_display("s2-F;");
status_ = tran(&s11);
break;
}
//.${HSMs::QHsmTst::SM::s::s2::C}
case C_SIG: {
BSP_display("s2-C;");
status_ = tran(&s1);
break;
}
default: {
status_ = super(&s);
break;
}
}
return status_;
}
//.${HSMs::QHsmTst::SM::s::s2::s21} ..........................................
Q_STATE_DEF(QHsmTst, s21) {
QP::QState status_;
switch (e->sig) {
//.${HSMs::QHsmTst::SM::s::s2::s21}
case Q_ENTRY_SIG: {
BSP_display("s21-ENTRY;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s2::s21}
case Q_EXIT_SIG: {
BSP_display("s21-EXIT;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s2::s21::initial}
case Q_INIT_SIG: {
BSP_display("s21-INIT;");
status_ = tran(&s211);
break;
}
//.${HSMs::QHsmTst::SM::s::s2::s21::G}
case G_SIG: {
BSP_display("s21-G;");
status_ = tran(&s1);
break;
}
//.${HSMs::QHsmTst::SM::s::s2::s21::A}
case A_SIG: {
BSP_display("s21-A;");
status_ = tran(&s21);
break;
}
//.${HSMs::QHsmTst::SM::s::s2::s21::B}
case B_SIG: {
BSP_display("s21-B;");
status_ = tran(&s211);
break;
}
default: {
status_ = super(&s2);
break;
}
}
return status_;
}
//.${HSMs::QHsmTst::SM::s::s2::s21::s211} ....................................
Q_STATE_DEF(QHsmTst, s211) {
QP::QState status_;
switch (e->sig) {
//.${HSMs::QHsmTst::SM::s::s2::s21::s211}
case Q_ENTRY_SIG: {
BSP_display("s211-ENTRY;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s2::s21::s211}
case Q_EXIT_SIG: {
BSP_display("s211-EXIT;");
status_ = Q_RET_HANDLED;
break;
}
//.${HSMs::QHsmTst::SM::s::s2::s21::s211::H}
case H_SIG: {
BSP_display("s211-H;");
status_ = tran(&s);
break;
}
//.${HSMs::QHsmTst::SM::s::s2::s21::s211::D}
case D_SIG: {
BSP_display("s211-D;");
status_ = tran(&s21);
break;
}
default: {
status_ = super(&s21);
break;
}
}
return status_;
}
//.$enddef${HSMs::QHsmTst} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^