Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / msm / doc / HTML / ch03.html
1 <html><head>
2       <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3    <title>Chapter&nbsp;3.&nbsp;Tutorial</title><link rel="stylesheet" href="boostbook.css" type="text/css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.75.2"><link rel="home" href="index.html" title="Meta State Machine (MSM)"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;User' guide"><link rel="prev" href="ch02s04.html" title="State machine glossary"><link rel="next" href="ch03s02.html" title="Basic front-end"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;3.&nbsp;Tutorial</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s04.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;User' guide</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter&nbsp;3.&nbsp;Tutorial"><div class="titlepage"><div><div><h2 class="title"><a name="d0e322"></a>Chapter&nbsp;3.&nbsp;Tutorial</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch03.html#d0e325">Design</a></span></dt><dt><span class="sect1"><a href="ch03s02.html">Basic front-end</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch03s02.html#d0e344">A simple example</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e358">Transition table</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e406">Defining states with entry/exit actions</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e419">What do you actually do inside actions / guards?</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e471">Defining a simple state machine</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e529">Defining a submachine</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e577">Orthogonal regions, terminate state, event deferring</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e668">History</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e713">Completion (anonymous) transitions</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e740">Internal transitions</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e842">more row types</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e875">Explicit entry / entry and exit pseudo-state / fork</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e1064">Flags</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e1126">Event Hierarchy</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e1147">Customizing a state machine / Getting more speed</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e1196">Choosing the initial event</a></span></dt><dt><span class="sect2"><a href="ch03s02.html#d0e1209"> Containing state machine (deprecated)</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch03s03.html">Functor front-end</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch03s03.html#d0e1248"> Transition table </a></span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e1281">Defining states with entry/exit actions</a></span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e1300">What do you actually do inside actions / guards (Part 2)?</a></span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e1312">Defining a simple state machine</a></span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e1320">Anonymous transitions</a></span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e1346">Internal
4                         transitions</a></span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e1392">Kleene (any) event</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch03s04.html">eUML</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch03s04.html#d0e1462">Transition table</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e1503">A simple example: rewriting only our transition table </a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e1536">Defining events, actions and states with entry/exit actions</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e1649">Wrapping up a simple state machine and first complete examples</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e1697">Defining a submachine</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e1713">
5                         Attributes / Function call</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e1813">Orthogonal regions, flags, event deferring</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e1925">
6                         Customizing a state machine / Getting
7                         more speed</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e1960">Completion / Anonymous transitions</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e1978">Internal transitions</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e2009">Kleene(any) event)</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e2024">Other state types</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e2088">Helper functions</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e2191">Phoenix-like STL support</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e2244">Writing actions with Boost.Phoenix (in development)</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch03s05.html">Back-end</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch03s05.html#d0e2303">Creation </a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2312">Starting and stopping a state
8                         machine</a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2331">Event dispatching</a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2340">Active state(s)</a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2354">Serialization</a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2407">Base state type </a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2433">Visitor</a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2476">Flags</a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2489">Getting a state</a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2502"> State machine constructor with arguments </a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2542">Trading run-time speed for
9                         better compile-time / multi-TU compilation</a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2624">Compile-time state machine analysis </a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2668"> Enqueueing events for later
10                         processing </a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2691"> Customizing the message queues </a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2706">Policy definition with Boost.Parameter </a></span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e2714">Choosing when to switch active
11                         states </a></span></dt></dl></dd></dl></div><div class="sect1" title="Design"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e325"></a>Design</h2></div></div></div><p>MSM is divided between front&#8211;ends and back-ends. At the moment, there is just
12                     one back-end. On the front-end side, you will find three of them which are as
13                     many state machine description languages, with many more possible. For potential
14                     language writers, this document contains a <a class="link" href="ch06s02.html#internals-front-back-interface">description of the interface
15                         between front-end and back-end</a>.</p><p>The first front-end is an adaptation of the example provided in the <a class="link" href="http://boostpro.com/mplbook" target="_top">MPL book</a> with actions
16                     defined as pointers to state or state machine methods. The second one is based
17                     on functors. The third, eUML (embedded UML) is an experimental language based on
18                     Boost.Proto and Boost.Typeof and hiding most of the metaprogramming to increase
19                     readability. Both eUML and the functor front-end also offer a functional library
20                     (a bit like Boost.Phoenix) for use as action language (UML defining
21                     none).</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s04.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch03s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">State machine glossary&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Basic front-end</td></tr></table></div></body></html>