2020-11-09 12:59:49 -05:00

188 lines
6.0 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<model version="5.0.4" links="1">
<documentation>QMsmTst is a contrived state machine from Chapter 2 of the PSiCC2 book for testing the QMsm class implementation.</documentation>
<!--${qpc}-->
<framework name="qpc" license="../../../QPC-EVAL.qlc"/>
<!--${SMs}-->
<package name="SMs" stereotype="0x02">
<!--${SMs::ToastOven}-->
<class name="ToastOven" superclass="qpc::QMsm">
<documentation>Oven state machine</documentation>
<!--${SMs::ToastOven::SM}-->
<statechart properties="0x01">
<!--${SMs::ToastOven::SM::initial}-->
<initial target="../1">
<action>(void)par; /* unused parameter */</action>
<initial_glyph conn="3,2,5,1,51,4,-4">
<action box="2,-2,13,4"/>
</initial_glyph>
</initial>
<!--${SMs::ToastOven::SM::doorClosed}-->
<state name="doorClosed">
<entry>PRINTF_S(&quot;%s;&quot;, &quot;door-Closed&quot;);</entry>
<!--${SMs::ToastOven::SM::doorClosed::initial}-->
<initial target="../8">
<initial_glyph conn="40,10,4,0,14">
<action box="0,-2,6,2"/>
</initial_glyph>
</initial>
<!--${SMs::ToastOven::SM::doorClosed::history}-->
<history type="deep" target="../8">
<history_glyph conn="50,16,1,0,-6,8"/>
</history>
<!--${SMs::ToastOven::SM::doorClosed::TERMINATE}-->
<tran trig="TERMINATE" target="../../3">
<tran_glyph conn="50,30,1,0,18,2">
<action box="0,-2,9,2"/>
</tran_glyph>
</tran>
<!--${SMs::ToastOven::SM::doorClosed::OPEN}-->
<tran trig="OPEN" target="../../2">
<tran_glyph conn="50,10,1,3,10">
<action box="0,-2,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::ToastOven::SM::doorClosed::TOAST}-->
<tran trig="TOAST" target="../7/1">
<tran_glyph conn="12,38,2,2,-6">
<action box="0,-2,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::ToastOven::SM::doorClosed::BAKE}-->
<tran trig="BAKE" target="../7/2">
<tran_glyph conn="26,38,2,2,-6">
<action box="0,-2,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::ToastOven::SM::doorClosed::OFF}-->
<tran trig="OFF" target="../8">
<tran_glyph conn="42,38,2,2,-6">
<action box="0,-2,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::ToastOven::SM::doorClosed::heating}-->
<state name="heating">
<entry>PRINTF_S(&quot;%s;&quot;, &quot;heater-On&quot;);</entry>
<exit>PRINTF_S(&quot;%s;&quot;, &quot;heater-Off&quot;);</exit>
<!--${SMs::ToastOven::SM::doorClosed::heating::initial}-->
<initial target="../1">
<initial_glyph conn="6,20,5,0,6,4">
<action box="0,-2,10,2"/>
</initial_glyph>
</initial>
<!--${SMs::ToastOven::SM::doorClosed::heating::toasting}-->
<state name="toasting">
<entry>PRINTF_S(&quot;%s;&quot;, &quot;toasting&quot;);</entry>
<state_glyph node="6,24,12,8">
<entry box="1,2,5,2"/>
</state_glyph>
</state>
<!--${SMs::ToastOven::SM::doorClosed::heating::baking}-->
<state name="baking">
<entry>PRINTF_S(&quot;%s;&quot;, &quot;baking&quot;);</entry>
<state_glyph node="20,24,12,8">
<entry box="1,2,5,2"/>
</state_glyph>
</state>
<state_glyph node="4,12,30,22">
<entry box="1,2,6,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<!--${SMs::ToastOven::SM::doorClosed::off}-->
<state name="off">
<entry>PRINTF_S(&quot;%s;&quot;, &quot;toaster-Off&quot;);</entry>
<state_glyph node="36,24,12,8">
<entry box="1,2,5,2"/>
</state_glyph>
</state>
<state_glyph node="2,4,48,34">
<entry box="1,2,5,2"/>
</state_glyph>
</state>
<!--${SMs::ToastOven::SM::doorOpen}-->
<state name="doorOpen">
<documentation>state that transitions to history</documentation>
<entry>PRINTF_S(&quot;%s;&quot;, &quot;door-Open,lamp-On&quot;);</entry>
<exit>PRINTF_S(&quot;%s;&quot;, &quot;lamp-Off&quot;);</exit>
<!--${SMs::ToastOven::SM::doorOpen::CLOSE}-->
<tran trig="CLOSE" target="../../1" cpref="../../1/1">
<tran_glyph conn="60,16,3,1,-9">
<action box="-6,-2,7,2"/>
</tran_glyph>
</tran>
<!--${SMs::ToastOven::SM::doorOpen::TERMINATE}-->
<tran trig="TERMINATE" target="../../3">
<tran_glyph conn="72,26,2,0,6">
<action box="0,0,9,2"/>
</tran_glyph>
</tran>
<state_glyph node="60,4,16,22">
<entry box="1,2,7,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<!--${SMs::ToastOven::SM::final}-->
<state name="final">
<entry>PRINTF_S(&quot;\n%s\n&quot;, &quot;Bye! Bye!&quot;);
QF_onCleanup();
exit(0);</entry>
<state_glyph node="60,32,16,6">
<entry box="1,2,5,2"/>
</state_glyph>
</state>
<state_diagram size="80,40"/>
</statechart>
</class>
<!--${SMs::ToastOven_ctor}-->
<operation name="ToastOven_ctor" type="void" visibility="0x00" properties="0x00">
<code>ToastOven *me = &amp;l_oven;
QMsm_ctor(&amp;me-&gt;super, Q_STATE_CAST(&amp;ToastOven_initial));</code>
</operation>
</package>
<!--${.}-->
<directory name=".">
<!--${.::history.h}-->
<file name="history.h">
<text>#ifndef HISTORY_H
#define HISTORY_H
enum ToastOvenSignals {
OPEN_SIG = Q_USER_SIG,
CLOSE_SIG,
TOAST_SIG,
BAKE_SIG,
OFF_SIG,
TERMINATE_SIG /* terminate the application */
};
extern QHsm * const the_oven; /* opaque pointer to the oven MSM */
$declare(SMs::ToastOven_ctor)
#endif /* HISTORY_H */
</text>
</file>
<!--${.::history.c}-->
<file name="history.c">
<text>#include &quot;qpc.h&quot;
#include &quot;history.h&quot;
#include &quot;safe_std.h&quot; /* portable &quot;safe&quot; &lt;stdio.h&gt;/&lt;string.h&gt; facilities */
#include &lt;stdlib.h&gt;
//Q_DEFINE_THIS_FILE
$declare(SMs::ToastOven)
static ToastOven l_oven; /* the only instance of the ToastOven class */
/* global-scope definitions -----------------------------------------*/
QHsm * const the_oven = &amp;l_oven.super.super; /* the opaque pointer */
$define(SMs::ToastOven_ctor)
$define(SMs::ToastOven)</text>
</file>
</directory>
</model>