mirror of
https://github.com/QuantumLeaps/qpcpp.git
synced 2025-01-14 05:42:57 +08:00
334 lines
11 KiB
XML
334 lines
11 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<model version="5.0.4" links="1">
|
|
<documentation>QMsmTst is a test for the QMsm state machine implementation strategy based on the state machine design from Chapter 2 of the PSiCC2 book.</documentation>
|
|
<!--${qpcpp}-->
|
|
<framework name="qpcpp" license="../../../QPCPP-EVAL.qlc"/>
|
|
<!--${SMs}-->
|
|
<package name="SMs" stereotype="0x02">
|
|
<!--${SMs::QMsmTst}-->
|
|
<class name="QMsmTst" superclass="qpcpp::QMsm">
|
|
<documentation>Test active object</documentation>
|
|
<!--${SMs::QMsmTst::m_foo}-->
|
|
<attribute name="m_foo" type="bool" visibility="0x02" properties="0x00"/>
|
|
<!--${SMs::QMsmTst::QMsmTst}-->
|
|
<operation name="QMsmTst" type="" visibility="0x00" properties="0x02">
|
|
<code> : QMsm(&initial)</code>
|
|
</operation>
|
|
<!--${SMs::QMsmTst::SM}-->
|
|
<statechart properties="0x02">
|
|
<!--${SMs::QMsmTst::SM::initial}-->
|
|
<initial target="../1/5">
|
|
<action>(void)e; // avoid compiler warning
|
|
m_foo = 0U;
|
|
BSP_display("top-INIT;");</action>
|
|
<initial_glyph conn="76,2,4,1,6,-8">
|
|
<action box="-7,6,13,4"/>
|
|
</initial_glyph>
|
|
</initial>
|
|
<!--${SMs::QMsmTst::SM::s}-->
|
|
<state name="s">
|
|
<entry>BSP_display("s-ENTRY;");</entry>
|
|
<exit>BSP_display("s-EXIT;");</exit>
|
|
<!--${SMs::QMsmTst::SM::s::initial}-->
|
|
<initial target="../4/7">
|
|
<action>BSP_display("s-INIT;");</action>
|
|
<initial_glyph conn="31,7,5,0,-6,20">
|
|
<action box="-6,0,6,2"/>
|
|
</initial_glyph>
|
|
</initial>
|
|
<!--${SMs::QMsmTst::SM::s::I}-->
|
|
<tran trig="I">
|
|
<!--${SMs::QMsmTst::SM::s::I::[m_foo]}-->
|
|
<choice>
|
|
<guard>m_foo</guard>
|
|
<action>m_foo = 0U;
|
|
BSP_display("s-I;");</action>
|
|
<choice_glyph conn="7,10,5,-1,8">
|
|
<action box="1,0,12,4"/>
|
|
</choice_glyph>
|
|
</choice>
|
|
<tran_glyph conn="2,10,3,-1,5">
|
|
<action box="1,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::E}-->
|
|
<tran trig="E" target="../4/7">
|
|
<action>BSP_display("s-E;");</action>
|
|
<tran_glyph conn="28,39,2,2,-6">
|
|
<action box="1,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::TERMINATE}-->
|
|
<tran trig="TERMINATE">
|
|
<action>BSP_terminate(0);</action>
|
|
<tran_glyph conn="71,19,1,-1,4,17">
|
|
<action box="0,-2,9,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s1}-->
|
|
<state name="s1">
|
|
<entry>BSP_display("s1-ENTRY;");</entry>
|
|
<exit>BSP_display("s1-EXIT;");</exit>
|
|
<!--${SMs::QMsmTst::SM::s::s1::initial}-->
|
|
<initial target="../7">
|
|
<action>BSP_display("s1-INIT;");</action>
|
|
<initial_glyph conn="32,19,5,0,-5,8">
|
|
<action box="-4,0,6,2"/>
|
|
</initial_glyph>
|
|
</initial>
|
|
<!--${SMs::QMsmTst::SM::s::s1::I}-->
|
|
<tran trig="I">
|
|
<action>BSP_display("s1-I;");</action>
|
|
<tran_glyph conn="13,23,3,-1,6">
|
|
<action box="1,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s1::D}-->
|
|
<tran trig="D">
|
|
<!--${SMs::QMsmTst::SM::s::s1::D::[!m_foo]}-->
|
|
<choice target="../../..">
|
|
<guard>!m_foo</guard>
|
|
<action>m_foo = true;
|
|
BSP_display("s1-D;");</action>
|
|
<choice_glyph conn="7,17,4,3,6,-5">
|
|
<action box="-4,2,11,4"/>
|
|
</choice_glyph>
|
|
</choice>
|
|
<tran_glyph conn="13,17,3,-1,-6">
|
|
<action box="-2,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s1::A}-->
|
|
<tran trig="A" target="..">
|
|
<action>BSP_display("s1-A;");</action>
|
|
<tran_glyph conn="27,15,0,0,-3,4,3">
|
|
<action box="1,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s1::B}-->
|
|
<tran trig="B" target="../7">
|
|
<action>BSP_display("s1-B;");</action>
|
|
<tran_glyph conn="13,29,3,3,6">
|
|
<action box="1,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s1::F}-->
|
|
<tran trig="F" target="../../5/4/4">
|
|
<action>BSP_display("s1-F;");</action>
|
|
<tran_glyph conn="34,31,1,3,17">
|
|
<action box="0,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s1::C}-->
|
|
<tran trig="C" target="../../5">
|
|
<action>BSP_display("s1-C;");</action>
|
|
<tran_glyph conn="34,17,1,3,5">
|
|
<action box="0,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s1::s11}-->
|
|
<state name="s11">
|
|
<entry>BSP_display("s11-ENTRY;");</entry>
|
|
<exit>BSP_display("s11-EXIT;");</exit>
|
|
<!--${SMs::QMsmTst::SM::s::s1::s11::H}-->
|
|
<tran trig="H" target="../../..">
|
|
<action>BSP_display("s11-H;");</action>
|
|
<tran_glyph conn="24,33,2,2,6">
|
|
<action box="1,0,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s1::s11::D}-->
|
|
<tran trig="D">
|
|
<!--${SMs::QMsmTst::SM::s::s1::s11::D::[m_foo]}-->
|
|
<choice target="../../..">
|
|
<guard>m_foo</guard>
|
|
<action>m_foo = false;
|
|
BSP_display("s11-D;");</action>
|
|
<choice_glyph conn="7,31,4,3,-6,6">
|
|
<action box="-4,-5,11,4"/>
|
|
</choice_glyph>
|
|
</choice>
|
|
<tran_glyph conn="19,31,3,-1,-12">
|
|
<action box="-2,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s1::s11::G}-->
|
|
<tran trig="G" target="../../../5/4/4">
|
|
<action>BSP_display("s11-G;");</action>
|
|
<tran_glyph conn="31,29,1,3,20">
|
|
<action box="0,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<state_glyph node="19,27,12,6">
|
|
<entry box="1,2,6,2"/>
|
|
<exit box="1,4,6,2"/>
|
|
</state_glyph>
|
|
</state>
|
|
<state_glyph node="13,15,21,21">
|
|
<entry box="1,2,6,2"/>
|
|
<exit box="1,4,6,2"/>
|
|
</state_glyph>
|
|
</state>
|
|
<!--${SMs::QMsmTst::SM::s::s2}-->
|
|
<state name="s2">
|
|
<entry>BSP_display("s2-ENTRY;");</entry>
|
|
<exit>BSP_display("s2-EXIT;");</exit>
|
|
<!--${SMs::QMsmTst::SM::s::s2::initial}-->
|
|
<initial target="../4/4">
|
|
<action>BSP_display("s2-INIT;");</action>
|
|
<initial_glyph conn="65,10,5,0,-8,15">
|
|
<action box="-4,0,6,2"/>
|
|
</initial_glyph>
|
|
</initial>
|
|
<!--${SMs::QMsmTst::SM::s::s2::I}-->
|
|
<tran trig="I">
|
|
<!--${SMs::QMsmTst::SM::s::s2::I::[!m_foo]}-->
|
|
<choice>
|
|
<guard>!m_foo</guard>
|
|
<action>m_foo = true;
|
|
BSP_display("s2-I;");</action>
|
|
<choice_glyph conn="45,14,5,-1,8">
|
|
<action box="1,0,10,4"/>
|
|
</choice_glyph>
|
|
</choice>
|
|
<tran_glyph conn="39,14,3,-1,6">
|
|
<action box="1,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s2::F}-->
|
|
<tran trig="F" target="../../4/7">
|
|
<action>BSP_display("s2-F;");</action>
|
|
<tran_glyph conn="39,24,3,0,-9,3">
|
|
<action box="-4,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s2::C}-->
|
|
<tran trig="C" target="../../4">
|
|
<action>BSP_display("s2-C;");</action>
|
|
<tran_glyph conn="39,19,3,1,-5">
|
|
<action box="-3,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s2::s21}-->
|
|
<state name="s21">
|
|
<entry>BSP_display("s21-ENTRY;");</entry>
|
|
<exit>BSP_display("s21-EXIT;");</exit>
|
|
<!--${SMs::QMsmTst::SM::s::s2::s21::initial}-->
|
|
<initial target="../4">
|
|
<action>BSP_display("s21-INIT;");</action>
|
|
<initial_glyph conn="64,23,5,0,-4,2">
|
|
<action box="-2,0,5,2"/>
|
|
</initial_glyph>
|
|
</initial>
|
|
<!--${SMs::QMsmTst::SM::s::s2::s21::G}-->
|
|
<tran trig="G" target="../../../4">
|
|
<action>BSP_display("s21-G;");</action>
|
|
<tran_glyph conn="45,21,3,1,-11">
|
|
<action box="-3,-2,8,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s2::s21::A}-->
|
|
<tran trig="A" target="..">
|
|
<action>BSP_display("s21-A;");</action>
|
|
<tran_glyph conn="59,19,0,0,-3,4,3">
|
|
<action box="1,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s2::s21::B}-->
|
|
<tran trig="B" target="../4">
|
|
<action>BSP_display("s21-B;");</action>
|
|
<tran_glyph conn="66,27,1,1,-4">
|
|
<action box="-2,-2,5,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s2::s21::s211}-->
|
|
<state name="s211">
|
|
<entry>BSP_display("s211-ENTRY;");</entry>
|
|
<exit>BSP_display("s211-EXIT;");</exit>
|
|
<!--${SMs::QMsmTst::SM::s::s2::s21::s211::H}-->
|
|
<tran trig="H" target="../../../..">
|
|
<action>BSP_display("s211-H;");</action>
|
|
<tran_glyph conn="57,32,2,2,7">
|
|
<action box="1,0,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<!--${SMs::QMsmTst::SM::s::s2::s21::s211::D}-->
|
|
<tran trig="D" target="../..">
|
|
<action>BSP_display("s211-D;");</action>
|
|
<tran_glyph conn="62,30,1,1,4">
|
|
<action box="0,-2,6,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<state_glyph node="51,25,11,7">
|
|
<entry box="1,2,7,2"/>
|
|
<exit box="1,4,6,2"/>
|
|
</state_glyph>
|
|
</state>
|
|
<state_glyph node="45,19,21,15">
|
|
<entry box="1,2,7,2"/>
|
|
<exit box="1,4,6,2"/>
|
|
</state_glyph>
|
|
</state>
|
|
<state_glyph node="39,6,29,30">
|
|
<entry box="1,2,7,2"/>
|
|
<exit box="1,4,6,2"/>
|
|
</state_glyph>
|
|
</state>
|
|
<state_glyph node="2,2,69,37">
|
|
<entry box="1,2,5,2"/>
|
|
<exit box="1,4,6,2"/>
|
|
</state_glyph>
|
|
</state>
|
|
<state_diagram size="79,41"/>
|
|
</statechart>
|
|
</class>
|
|
</package>
|
|
<!--${.}-->
|
|
<directory name=".">
|
|
<!--${.::qmsmtst.hpp}-->
|
|
<file name="qmsmtst.hpp">
|
|
<text>#ifndef QMSMTST_HPP
|
|
#define QMSMTST_HPP
|
|
|
|
enum QMsmTstSignals {
|
|
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::QMsm * const the_msm; // opaque pointer to the test MSM
|
|
|
|
// BSP functions to dispaly a message and exit
|
|
void BSP_display(char_t const *msg);
|
|
void BSP_terminate(int16_t const result);
|
|
|
|
#endif // QMSMTST_HPP
|
|
</text>
|
|
</file>
|
|
<!--${.::qmsmtst.cpp}-->
|
|
<file name="qmsmtst.cpp">
|
|
<text>#include "qpcpp.hpp"
|
|
#include "qmsmtst.hpp"
|
|
|
|
$declare(SMs::QMsmTst)
|
|
|
|
static QMsmTst l_msmtst; // the only instance of the QMsmTst class
|
|
|
|
// global-scope definitions -----------------------------------------
|
|
QP::QMsm * const the_msm = &l_msmtst; // the opaque pointer
|
|
|
|
$define(SMs::QMsmTst)
|
|
</text>
|
|
</file>
|
|
</directory>
|
|
</model>
|