|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61125 - in sandbox/msm/libs/msm/doc: HTML PDF src
From: christophe.j.henry_at_[hidden]
Date: 2010-04-07 10:00:48
Author: chenry
Date: 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
New Revision: 61125
URL: http://svn.boost.org/trac/boost/changeset/61125
Log:
highlighted code examples
Binary files modified:
sandbox/msm/libs/msm/doc/PDF/msm.pdf
Text files modified:
sandbox/msm/libs/msm/doc/HTML/ch03.html | 8
sandbox/msm/libs/msm/doc/HTML/ch03s02.html | 281 ++++++---
sandbox/msm/libs/msm/doc/HTML/ch03s03.html | 53 +
sandbox/msm/libs/msm/doc/HTML/ch03s04.html | 213 ++++---
sandbox/msm/libs/msm/doc/HTML/ch03s05.html | 89 +-
sandbox/msm/libs/msm/doc/HTML/ch04.html | 4
sandbox/msm/libs/msm/doc/HTML/ch04s02.html | 2
sandbox/msm/libs/msm/doc/HTML/ch04s03.html | 2
sandbox/msm/libs/msm/doc/HTML/ch04s04.html | 2
sandbox/msm/libs/msm/doc/HTML/ch04s05.html | 21
sandbox/msm/libs/msm/doc/HTML/ch05.html | 9
sandbox/msm/libs/msm/doc/HTML/ch06.html | 4
sandbox/msm/libs/msm/doc/HTML/ch06s02.html | 2
sandbox/msm/libs/msm/doc/HTML/ch06s03.html | 2
sandbox/msm/libs/msm/doc/HTML/ch06s04.html | 2
sandbox/msm/libs/msm/doc/HTML/ch07.html | 2
sandbox/msm/libs/msm/doc/HTML/ch07s02.html | 2
sandbox/msm/libs/msm/doc/HTML/ch08.html | 2
sandbox/msm/libs/msm/doc/HTML/ch09.html | 4
sandbox/msm/libs/msm/doc/HTML/ch10.html | 18
sandbox/msm/libs/msm/doc/HTML/index.html | 14
sandbox/msm/libs/msm/doc/HTML/pt01.html | 12
sandbox/msm/libs/msm/doc/HTML/pt02.html | 2
sandbox/msm/libs/msm/doc/HTML/re01.html | 4
sandbox/msm/libs/msm/doc/HTML/re02.html | 96 +-
sandbox/msm/libs/msm/doc/HTML/re03.html | 480 +++++++++-------
sandbox/msm/libs/msm/doc/src/msm.xml | 1134 +++++++++++++++++++++------------------
27 files changed, 1389 insertions(+), 1075 deletions(-)
Modified: sandbox/msm/libs/msm/doc/HTML/ch03.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch03.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch03.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,10 +1,10 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Chapter 3. 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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch02s03.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 3. Tutorial</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s03.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch03s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 3. Tutorial"><div class="titlep
age"><div><div><h2 class="title"><a name="d0e402"></a>Chapter 3. Tutorial</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">Design</span></dt><dt><span class="sect1">Basic front-end</span></dt><dd><dl><dt><span class="sect2">A simple example</span></dt><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2">Orthogonal regions, terminate state, event deferring</span></dt><dt><span class="sect2">History</span></dt><dt><span class="sect2"><a hre
f="ch03s02.html#d0e1429">Completion (anonymous) transitions</a></span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">more row types</span></dt><dt><span class="sect2">Explicit entry / entry and exit pseudo-state / fork</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Event Hierarchy</span></dt><dt><span class="sect2">Customizing a state machine / Getting more speed</span></dt><dt><span class="sect2">Choosing the initial event</span></dt><dt><span class="sect2"> Containing state machine (deprecated)</span></dt></dl></dd><dt><span class="sect1">Functor front-end</span></dt><dd><dl><dt><span class="sect2"><a href="ch03s03.html#d0e1953"> Transitio
n table </a></span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Anonymous transitions</span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e2566">Internal
- transitions</a></span></dt></dl></dd><dt><span class="sect1">eUML (experimental)</span></dt><dd><dl><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining events, actions and states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e3117">
- Attributes / Function call</a></span></dt><dt><span class="sect2">Orthogonal regions, flags, event deferring</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e3361">
+ <title>Chapter 3. 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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch02s03.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 3. Tutorial</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s03.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch03s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 3. Tutorial"><div class="titlep
age"><div><div><h2 class="title"><a name="d0e402"></a>Chapter 3. Tutorial</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">Design</span></dt><dt><span class="sect1">Basic front-end</span></dt><dd><dl><dt><span class="sect2">A simple example</span></dt><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2">Orthogonal regions, terminate state, event deferring</span></dt><dt><span class="sect2">History</span></dt><dt><span class="sect2"><a href
="ch03s02.html#d0e1393">Completion (anonymous) transitions</a></span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">more row types</span></dt><dt><span class="sect2">Explicit entry / entry and exit pseudo-state / fork</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Event Hierarchy</span></dt><dt><span class="sect2">Customizing a state machine / Getting more speed</span></dt><dt><span class="sect2">Choosing the initial event</span></dt><dt><span class="sect2"> Containing state machine (deprecated)</span></dt></dl></dd><dt><span class="sect1">Functor front-end</span></dt><dd><dl><dt><span class="sect2"><a href="ch03s03.html#d0e1886"> Transition
table </a></span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Anonymous transitions</span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e2458">Internal
+ transitions</a></span></dt></dl></dd><dt><span class="sect1">eUML (experimental)</span></dt><dd><dl><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining events, actions and states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e2954">
+ Attributes / Function call</a></span></dt><dt><span class="sect2">Orthogonal regions, flags, event deferring</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e3166">
Customizing a state machine / Getting
- more speed</a></span></dt><dt><span class="sect2">Completion / Anonymous transitions</span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">Other state types</span></dt><dt><span class="sect2">Helper functions</span></dt><dt><span class="sect2">Phoenix-like STL support</span></dt></dl></dd><dt><span class="sect1">Back-end</span></dt><dd><dl><dt><span class="sect2">Creation </span></dt><dt><span class="sect2">Starting a state machine</span></dt><dt><span class="sect2">Event dispatching</span></dt><dt><span class="sect2">Active state(s)</span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3744">Base state ty
pe </a></span></dt><dt><span class="sect2">Visitor</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Getting a state</span></dt><dt><span class="sect2"> State machine constructor with arguments </span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3917">Trading run-time speed for
+ more speed</a></span></dt><dt><span class="sect2">Completion / Anonymous transitions</span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">Other state types</span></dt><dt><span class="sect2">Helper functions</span></dt><dt><span class="sect2">Phoenix-like STL support</span></dt></dl></dd><dt><span class="sect1">Back-end</span></dt><dd><dl><dt><span class="sect2">Creation </span></dt><dt><span class="sect2">Starting a state machine</span></dt><dt><span class="sect2">Event dispatching</span></dt><dt><span class="sect2">Active state(s)</span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3506">Base state ty
pe </a></span></dt><dt><span class="sect2">Visitor</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Getting a state</span></dt><dt><span class="sect2"> State machine constructor with arguments </span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3616">Trading run-time speed for
better compile-time / multi-TU compilation</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="d0e405"></a>Design</h2></div></div></div><p>MSM is divided between front–ends and back-ends. At the moment, there is just
one back-end. On the front-end side, you will find three of them which are as
many state machine description languages, with many more possible. For potential
Modified: sandbox/msm/libs/msm/doc/HTML/ch03s02.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch03s02.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch03s02.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -184,35 +184,46 @@
state, action and guard.</p></li><li class="listitem"><p><code class="code">a_row</code> (“a” for action) allows defining only the
action and omit the guard condition.</p></li><li class="listitem"><p><code class="code">g_row</code> (“g” for guard) allows omitting the action
behavior and defining only the guard.</p></li><li class="listitem"><p><code class="code">_row</code> allows omitting action and guard.</p></li></ul></div><p>The signature for an action methods is void method_name (event
- const&), for example:</p><p><code class="code">void stop_playback(stop const&)</code></p><p>Action methods return nothing and take the argument as const reference. Of
+ const&), for example:</p><pre class="programlisting">void stop_playback(stop const&)</pre><p>Action methods return nothing and take the argument as const reference. Of
course nothing forbids you from using the same action for several
- events:</p><p><code class="code">template <class Event> void stop_playback(Event
- const&)</code></p><p>Guards have as only difference the return value, which is a
- boolean:</p><p><code class="code">bool good_disk_format(cd_detected const& evt)</code></p><p>The transition table is actually a MPL vector (or list), which brings the
+ events:</p><pre class="programlisting">template <class Event> void stop_playback(Eventconst&)</pre><p>Guards have as only difference the return value, which is a
+ boolean:</p><pre class="programlisting">bool good_disk_format(cd_detected const& evt)</pre><p>The transition table is actually a MPL vector (or list), which brings the
limitation that the default maximum size of the table is 20. If you need
more transitions, overriding this default behavior is necessary, so you need
- to add before any header:</p><p><code class="code">#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS </code></p><p><code class="code">#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 // or whatever you need
- </code></p><p><code class="code">#define BOOST_MPL_LIMIT_MAP_SIZE 30 // or whatever you need
- </code></p><p>The other limitation is that the MPL types are defined only up to 50
+ to add before any header:</p><pre class="programlisting">#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 //or whatever you need
+#define BOOST_MPL_LIMIT_MAP_SIZE 30 //or whatever you need </pre><p>The other limitation is that the MPL types are defined only up to 50
entries. For the moment, the only solution to achieve more is to add headers
- to the MPL (luckily, this is not very complicated).</p></div><div class="sect2" title="Defining states with entry/exit actions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e984"></a>Defining states with entry/exit actions</h3></div></div></div><p>While states were enums in the MPL book, they now are classes, which
+ to the MPL (luckily, this is not very complicated).</p></div><div class="sect2" title="Defining states with entry/exit actions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e974"></a>Defining states with entry/exit actions</h3></div></div></div><p>While states were enums in the MPL book, they now are classes, which
allows them to hold data, provide entry, exit behaviors and be reusable (as
they do not know anything about the containing state machine). To define a
state, inherit from the desired state type. You will mainly use simple
- states:</p><p>struct Empty : public msm::front::state<> {};</p><p>They can optionally provide entry and exit behaviors:</p><p><code class="code">struct Empty : public msm::front::state<> {</code></p><p><code class="code">template <class Event, class Fsm> </code></p><p><code class="code">void on_entry(Event const&, Fsm& ) {std::cout <<
- "entering: Empty" << std::endl;} </code></p><p><code class="code">template <class Event, class Fsm> </code></p><p><code class="code">void on_exit(Event const&, Fsm& ) {std::cout <<
- "leaving: Empty" << std::endl;} </code></p><p><code class="code">};</code></p><p>Notice how the entry and exit behaviors are templatized on the event and
+ states:</p><p>struct Empty : public msm::front::state<> {};</p><p>They can optionally provide entry and exit behaviors:</p><pre class="programlisting">
+struct Empty : public msm::front::state<>
+{
+ template <class Event, class Fsm>
+ void on_entry(Event const&, Fsm& )
+ {std::cout <<"entering: Empty" << std::endl;}
+ template <class Event, class Fsm>
+ void on_exit(Event const&, Fsm& )
+ {std::cout <<"leaving: Empty" << std::endl;}
+};
+ </pre><p>Notice how the entry and exit behaviors are templatized on the event and
state machine. Being generic facilitates reuse. There are more state types
(terminate, interrupt, pseudo states, etc.) corresponding to the UML
standard state types. These will be described in details in the next
- sections.</p></div><div class="sect2" title="Defining a simple state machine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1013"></a>Defining a simple state machine</h3></div></div></div><p>Declaring a state machine is straightforward and is done with a high
+ sections.</p></div><div class="sect2" title="Defining a simple state machine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e987"></a>Defining a simple state machine</h3></div></div></div><p>Declaring a state machine is straightforward and is done with a high
signal / noise ratio. In our player example, we declare the state machine
- as:</p><p><code class="code">struct player_ : public msm::front::state_machine_def<player_>{
- /* see below */}</code></p><p>This declares a state machine using the basic front-end. We now declare
- inside the state machine structure the initial state:</p><p><code class="code">typedef Empty initial_state;</code></p><p>And that is about all of what is absolutely needed. In the example, the
+ as:</p><pre class="programlisting">struct player_ : public msm::front::state_machine_def<player_>{
+ /* see below */}</pre><p>This declares a state machine using the basic front-end. We now declare
+ inside the state machine structure the initial state:</p><p>
+ </p><pre class="programlisting">typedef Empty initial_state;</pre><p>
+ </p><p>And that is about all of what is absolutely needed. In the example, the
states are declared inside the state machine for readability but this is not
a requirements, states can be declared wherever you like.</p><p>All what is left to do is to pick a back-end (which is quite simple as
- there is only one at the moment):</p><p><code class="code">typedef msm::back::state_machine<player_> player;</code></p><p>You now have a ready-to-use state machine with entry/exit actions, guards,
+ there is only one at the moment):</p><p>
+ </p><pre class="programlisting">typedef msm::back::state_machine<player_> player;</pre><p>
+ </p><p>You now have a ready-to-use state machine with entry/exit actions, guards,
transition actions, a message queue so that processing an event can generate
another event. The state machine also adapted itself to your need and
removed almost all features we didn't use in this simple example. Note that
@@ -222,23 +233,29 @@
explicitly tell it.</p><p>State objects are built automatically with the state machine. They will
exist until state machine destruction. MSM is using Boost.Fusion behind the
hood. This unfortunately means that if you define more than 10 states, you
- will need to extend the default:</p><p><code class="code">#define FUSION_MAX_VECTOR_SIZE 20 // or whatever you need
- </code></p><p>When an unexpected event is fired, the <code class="code">no_transition(event, state
+ will need to extend the default:</p><p>
+ </p><pre class="programlisting">#define FUSION_MAX_VECTOR_SIZE 20 // or whatever you need
+ </pre><p>
+ </p><p>When an unexpected event is fired, the <code class="code">no_transition(event, state
machine, state id)</code> method of the state machine is called . By
default, this method simply asserts when called. It is possible to overwrite
- the <code class="code">no_transition</code> method to define a different handling:</p><p><code class="code">template <class Fsm,class Event> void no_transition(Event
- const& e, Fsm& ,int state){...}</code></p><p><span class="underline">Note</span>: you might have noticed that
+ the <code class="code">no_transition</code> method to define a different handling:</p><p>
+ </p><pre class="programlisting">template <class Fsm,class Event>
+void no_transition(Event const& e, Fsm& ,int state){...}</pre><p>
+ </p><p><span class="underline">Note</span>: you might have noticed that
the tutorial calls <code class="code">start()</code> on the state machine just after
creation. The start method will initiate the state machine, meaning it will
activate the initial state, which means in turn that the initial state's
entry behavior will be called. The reason why we need this will be explained
in the <a class="link" href="ch03s05.html#backend-start">back-end part</a>. After a call
- to start, the state machine is ready to process events.</p></div><div class="sect2" title="Defining a submachine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1061"></a>Defining a submachine</h3></div></div></div><p>We now want to extend our last state machine by making the Playing state a
+ to start, the state machine is ready to process events.</p></div><div class="sect2" title="Defining a submachine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1042"></a>Defining a submachine</h3></div></div></div><p>We now want to extend our last state machine by making the Playing state a
state machine itself (a submachine).</p><p><span class="inlinemediaobject"><img src="../images/CompositeTutorial.jpg" width="60%"></span></p><p>Again, an <a class="link" href="examples/CompositeTutorial.cpp" target="_top">example</a>
is also provided.</p><p>A submachine really is a state machine itself, so we declare Playing as
- such, choosing a front-end and a back-end:</p><p><code class="code">struct Playing_ : public
- msm::front::state_machine_def<Playing_>{...} </code></p><p><code class="code">typedef msm::back::state_machine<Playing_> Playing;</code></p><p>Like for any state machine, one also needs a transition table and an
- initial state:</p><p>struct transition_table : mpl::vector<</p><table id="d0e1087"><tbody><tr>
+ such, choosing a front-end and a back-end:</p><p>
+ </p><pre class="programlisting">struct Playing_ : public msm::front::state_machine_def<Playing_>{...}
+typedef msm::back::state_machine<Playing_> Playing;</pre><p>
+ </p><p>Like for any state machine, one also needs a transition table and an
+ initial state:</p><p> struct transition_table : mpl::vector<</p><table id="d0e1067"><tbody><tr>
<td>//</td>
<td>Start</td>
<td>Event</td>
@@ -302,12 +319,14 @@
<td> </td>
<td> </td>
<td> </td>
- </tr></tbody></table><p><code class="code">typedef Song1 initial_state; </code></p><p>This is about all you need to do. MSM will now automatically recognize
+ </tr></tbody></table><p>
+ </p><pre class="programlisting">typedef Song1 initial_state; </pre><p>
+ </p><p>This is about all you need to do. MSM will now automatically recognize
Playing as a submachine and all events handled by Playing (NextSong and
PreviousSong) will now be automatically forwarded to Playing whenever this
state is active. All other state machine features described later are also
available. You can even decide to use a state machine sometimes as
- submachine or sometimes as an independent state machine.</p></div><div class="sect2" title="Orthogonal regions, terminate state, event deferring"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1278"></a>Orthogonal regions, terminate state, event deferring</h3></div></div></div><p>It is a very common problem in many state machines to have to handle
+ submachine or sometimes as an independent state machine.</p></div><div class="sect2" title="Orthogonal regions, terminate state, event deferring"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1260"></a>Orthogonal regions, terminate state, event deferring</h3></div></div></div><p>It is a very common problem in many state machines to have to handle
errors. It usually involves defining a transition from all the states to a
special error state. Translation: not fun. It is also not practical to find
from which state the error originated. The following diagram shows an
@@ -325,7 +344,9 @@
handling the event, in the order as declared by the
<code class="code">initial_state</code> type.</p><p>Adding an orthogonal region is easy, one only needs to declare more states
in the <code class="code">initial_state</code> typedef. So, adding a new region with
- AllOk as the region's initial state is:</p><p><code class="code">typedef mpl::vector<Empty,AllOk> initial_state;</code></p><p><span class="inlinemediaobject"><img src="../images/Orthogonal-deferred.jpg" width="60%"></span></p><p>Furthermore, when you detect an error, you usually do not want events to
+ AllOk as the region's initial state is:</p><p>
+ </p><pre class="programlisting">typedef mpl::vector<Empty,AllOk> initial_state;</pre><p>
+ </p><p><span class="inlinemediaobject"><img src="../images/Orthogonal-deferred.jpg" width="60%"></span></p><p>Furthermore, when you detect an error, you usually do not want events to
be further processed. To achieve this, we use another UML feature, terminate
states. When any region moves to a terminate state, the state machine
“terminates” (the state machine and all its states stay alive) and all
@@ -345,8 +366,13 @@
the event will be handled because only Empty and Open defer the
event.</p><p>UML defines event deferring as a state property. To accommodate this, MSM
lets you specify this in states by providing a <code class="code">deferred_events</code>
- type:</p><p><code class="code">struct Empty : public msm::front::state<> </code></p><p><code class="code">{ </code></p><p><code class="code">// if the play event is fired while in this state, defer it until a
- state </code></p><p><code class="code">// handles or rejects it</code></p><p><code class="code"> typedef mpl::vector<play> deferred_events;</code></p><p><code class="code">...};</code></p><p>Please have a look at the <a class="link" href="examples/Orthogonal-deferred.cpp" target="_top">complete
+ type:</p><pre class="programlisting">struct Empty : public msm::front::state<>
+{
+ // if the play event is fired while in this state, defer it until a state
+ // handles or rejects it
+ typedef mpl::vector<play> deferred_events;
+...
+}; </pre><p>Please have a look at the <a class="link" href="examples/Orthogonal-deferred.cpp" target="_top">complete
example</a>.</p><p>While this is wanted by UML and is simple, it is not always practical
because one could wish to defer only in certain conditions. One could also
want to make this be part of a transition action with the added bonus of a
@@ -357,10 +383,15 @@
the functor front-end. For a complete description of the <code class="code">Row</code>
type, please have a look at the <span class="command"><strong><a class="command" href="ch03s03.html#functor-front-end">functor front-end.</a></strong></span></p><p>First, as there is no state where MSM can automatically find out the usage
of this feature, we need to require deferred events capability explicitly,
- by adding a type in the state machine definition:</p><p><code class="code">struct player_ : public
- msm::front::state_machine_def<player_></code></p><p><code class="code">{ </code></p><p><code class="code">typedef int activate_deferred_events;</code></p><p><code class="code">...};</code></p><p>We can now defer an event in any transition of the transition table by
+ by adding a type in the state machine definition:</p><pre class="programlisting">struct player_ : public msm::front::state_machine_def<player_>
+{
+ typedef int activate_deferred_events;
+...
+}; </pre><p>We can now defer an event in any transition of the transition table by
using as action the predefined <code class="code">msm::front::Defer</code> functor, for
- example:</p><p><code class="code">Row < Empty , play , none , Defer , none ></code></p><p>This is an internal transition row(see <span class="command"><strong><a class="command" href="ch03s02.html#internal-transitions">internal transitions</a></strong></span>) but
+ example:</p><p>
+ </p><pre class="programlisting">Row < Empty , play , none , Defer , none ></pre><p>
+ </p><p>This is an internal transition row(see <span class="command"><strong><a class="command" href="ch03s02.html#internal-transitions">internal transitions</a></strong></span>) but
you can ignore this for the moment. It just means that we are not leaving
the Empty state. What matters is that we use Defer as action. This is
roughly equivalent to the previous syntax but has the advantage of giving
@@ -369,8 +400,9 @@
transition can play in the resolution of <span class="command"><strong><a class="command" href="ch02s02.html#transition-conflict">transition conflicts</a></strong></span>. For
example, we could model an "if (condition2) move to Playing else if
(condition1) defer play event":</p><p>
- <code class="code">Row < Empty , play , none , Defer , condition1 >,</code></p><p><code class="code">g_row < Empty , play , Playing , &player_::condition2
- ></code></p><p>Please have a look at <a class="link" href="examples/Orthogonal-deferred2.cpp" target="_top">this possible implementation</a>.</p></div><div class="sect2" title="History"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1393"></a>History</h3></div></div></div><p>UML defines two types of history, Shallow History and Deep History. In the
+ </p><pre class="programlisting">Row < Empty , play , none , Defer , condition1 >,
+g_row < Empty , play , Playing , &player_::condition2 ></pre><p>
+ </p><p>Please have a look at <a class="link" href="examples/Orthogonal-deferred2.cpp" target="_top">this possible implementation</a>.</p></div><div class="sect2" title="History"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1351"></a>History</h3></div></div></div><p>UML defines two types of history, Shallow History and Deep History. In the
previous examples, if the player was playing the second song and the user
pressed pause, leaving Playing, at the next press on the play button, the
Playing state would become active and the first song would play again. Soon
@@ -379,8 +411,12 @@
it the player was stopped, then it should restart from the first song. How
can it be done? Of course, you could add a bit of programming logic and
generate extra events to make the second song start if coming from Pause.
- Something like: </p><p><code class="code">if (Event == end_pause) { for (int i=0;i< song number;++i) {
- player.process_event(NextSong()); } } </code></p><p>Not much to like in this example, isn't it? To solve this problem, you
+ Something like: </p><p>
+ </p><pre class="programlisting">if (Event == end_pause)
+{
+ for (int i=0;i< song number;++i) {player.process_event(NextSong()); }
+} </pre><p>
+ </p><p>Not much to like in this example, isn't it? To solve this problem, you
define what is called a shallow or a deep history. A shallow history
reactivates the last active substate of a submachine when this submachine
becomes active again. The deep history does the same recursively, so if this
@@ -396,10 +432,12 @@
types (the <a class="link" href="re02.html#history-interface">reference</a> explains
what needs to be done). Furthermore, History is a backend policy. This
allows you to reuse the same state machine definition with different history
- policies in different contexts.</p><p>Concretely, your frontend stays unchanged:</p><p><code class="code">struct Playing_ : public
- msm::front::state_machine_def<Playing_></code></p><p>You then add the policy to the backend as second parameter:</p><p><code class="code">typedef
- msm::back::state_machine<Playing_,msm::back::ShallowHistory<mpl::vector<end_pause>
- > > Playing;</code></p><p>This states that a shallow history must be activated if the Playing state
+ policies in different contexts.</p><p>Concretely, your frontend stays unchanged:</p><p>
+ </p><pre class="programlisting">struct Playing_ : public msm::front::state_machine_def<Playing_></pre><p>
+ </p><p>You then add the policy to the backend as second parameter:</p><p>
+ </p><pre class="programlisting">typedef msm::back::state_machine<Playing_,
+ msm::back::ShallowHistory<mpl::vector<end_pause> > > Playing;</pre><p>
+ </p><p>This states that a shallow history must be activated if the Playing state
machine gets activated by the end_pause event and only this one (or any
other event added to the mpl::vector). If the state machine was in the
Stopped state and the event play was generated, the history would not be
@@ -411,7 +449,7 @@
be added). The reason is that it would conflict with policies which
submachines could define. Of course, if for example, Song1 were a state
machine itself, it could use the ShallowHistory policy itself thus creating
- Deep History for itself. </p></div><div class="sect2" title="Completion (anonymous) transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1429"></a>Completion (anonymous) transitions</h3></div></div></div><p><span class="command"><strong><a name="anonymous-transitions"></a></strong></span>The following diagram shows an
+ Deep History for itself. </p></div><div class="sect2" title="Completion (anonymous) transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1393"></a>Completion (anonymous) transitions</h3></div></div></div><p><span class="command"><strong><a name="anonymous-transitions"></a></strong></span>The following diagram shows an
example making use of this feature:</p><p><span class="inlinemediaobject"><img src="../images/Anonymous.jpg" width="60%"></span></p><p>Anonymous transitions are transitions without a named event. This means
that the transition automatically fires when the predecessor state is
entered (to be exact, after the entry action). Otherwise it is a normal
@@ -435,9 +473,10 @@
other UML name for anonymous transitions) after every taken transition. This
will therefore double the event processing cost, which is not as bad as it
sounds as MSM’s execution speed is very high anyway.</p><p>To define such a transition, use “none” as event in the transition table,
- for example:</p><p><code class="code">row < State3 , none , State4 , &p::State3ToState4 ,
- &p::always_true ></code></p><p><a class="link" href="examples/AnonymousTutorial.cpp" target="_top">An implementation</a>
- of the state machine diagram is also provided.</p></div><div class="sect2" title="Internal transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1454"></a><span class="command"><strong><a name="internal-transitions"></a></strong></span>Internal transitions</h3></div></div></div><p>Internal transitions are transitions executing in the scope of the active
+ for example:</p><p>
+ </p><pre class="programlisting">row < State3 , none , State4 , &p::State3ToState4 , &p::always_true ></pre><p>
+ </p><p><a class="link" href="examples/AnonymousTutorial.cpp" target="_top">An implementation</a>
+ of the state machine diagram is also provided.</p></div><div class="sect2" title="Internal transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1420"></a><span class="command"><strong><a name="internal-transitions"></a></strong></span>Internal transitions</h3></div></div></div><p>Internal transitions are transitions executing in the scope of the active
state, a simple state or a submachine. One can see them as a self-transition
of this state, without an entry or exit action called. This is useful when
all you want is to execute some code for a given event in a given
@@ -450,15 +489,20 @@
transitions have no target state, therefore we need new row types. We had
a_row, g_row, _row and row, we now add a_irow, g_irow, _irow and irow which
are like normal transitions but define no target state. For, example an
- internal transition with a guard condition could be:</p><p><code class="code">g_irow < Empty /*state*/ , cd_detected
- /*event*/,&p::internal_guard /* guard */ ></code></p><p>These new row types can be placed anywhere in the transition table so that
+ internal transition with a guard condition could be:</p><p>
+ </p><pre class="programlisting">g_irow < Empty /*state*/,cd_detected/*event*/,&p::internal_guard/* guard */></pre><p>
+ </p><p>These new row types can be placed anywhere in the transition table so that
you can still have your state machine structure grouped together. The only
difference of behavior with the UML standard is the missing notion of higher
priority for internal transitions. Please have a look at <a class="link" href="examples/SimpleTutorialInternal.cpp" target="_top">the
example</a>.</p><p>It is also possible to do it the UML-conform way by declaring a transition
table called <code class="code">internal transition_table</code> inside the state itself
- and using internal row types. For example:</p><p><code class="code">struct Empty : public msm::front::state<> {</code></p><p><code class="code">struct internal_transition_table : mpl::vector<</code></p><p><code class="code">a_internal < cd_detected , Empty, &Empty::internal_action
- ></code></p><p><code class="code">> {};</code></p><p><code class="code">};</code></p><p>This declares an internal transition table called
+ and using internal row types. For example:</p><pre class="programlisting">struct Empty : public msm::front::state<>
+{
+ struct internal_transition_table : mpl::vector<
+ a_internal < cd_detected , Empty, &Empty::internal_action >
+ > {};
+};</pre><p>This declares an internal transition table called
internal_transition_table and reacting on the event cd_detected by calling
internal_action on Empty. Let us note a few points:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>internal tables are NOT called transition_table but
internal_transition_table</p></li><li class="listitem"><p>they use different but similar row types: a_internal,
@@ -497,14 +541,16 @@
alternative, adding orthogonal regions, because event dispatching will, if
accepted by the internal table, not continue to the subregions. This gives
you a O(1) dispatch instead of O(number of regions). While the example is
- with eUML, the same is also possible with any front-end.</p></div><div class="sect2" title="more row types"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1567"></a>more row types</h3></div></div></div><p>It is also possible to write transitions using actions and guards not just
+ with eUML, the same is also possible with any front-end.</p></div><div class="sect2" title="more row types"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1522"></a>more row types</h3></div></div></div><p>It is also possible to write transitions using actions and guards not just
from the state machine but also from its contained states. In this case, one
must specify not just a method pointer but also the object on which to call
it. This transition row is called, not very originally, <code class="code">row2</code>.
They come, like normal transitions in four flavors: <code class="code">a_row2, g_row2,
_row2 and row2</code>. For example, a transition calling an action from
- the state Empty could be:</p><p><code class="code">a_row2 < Stopped , open_close , Open , Empty /*action source*/ ,
- &Empty::open_drawer /*action*/></code></p><p>The same capabilities are also available for internal transitions so that
+ the state Empty could be:</p><p>
+ </p><pre class="programlisting">a_row2<Stopped,open_close,Open,Empty
+ /*action source*/,&Empty::open_drawer/*action*/></pre><p>
+ </p><p>The same capabilities are also available for internal transitions so that
we have: <code class="code">a_irow2, g_irow2, _irow2 and row2</code>. For transitions
defined as part of the <code class="code">internal_transition_table</code>, you can use
the <span class="command"><strong><a class="command" href="ch03s02.html#internal-transitions">a_internal, g_internal,
@@ -512,7 +558,7 @@
sections.</p><p>These row types allow us to distribute the state machine code among
states, making them reusable and more useful. Using transition tables inside
states also contributes to this possibility. An <a class="link" href="examples/SimpleTutorial2.cpp" target="_top">example</a> of these new
- rows is also provided.</p></div><div class="sect2" title="Explicit entry / entry and exit pseudo-state / fork"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1597"></a>Explicit entry / entry and exit pseudo-state / fork</h3></div></div></div><p>MSM (almost) fully supports these features, described in the <span class="command"><strong><a class="command" href="ch02s02.html#uml-history">small UML tutorial</a></strong></span>. Almost because
+ rows is also provided.</p></div><div class="sect2" title="Explicit entry / entry and exit pseudo-state / fork"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1554"></a>Explicit entry / entry and exit pseudo-state / fork</h3></div></div></div><p>MSM (almost) fully supports these features, described in the <span class="command"><strong><a class="command" href="ch02s02.html#uml-history">small UML tutorial</a></strong></span>. Almost because
there are currently two limitations: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>it is only possible to explicitly enter a sub- state of the
target but not a sub-sub state.</p></li><li class="listitem"><p>it is not possible to explicitly exit. Exit points must be
used.</p></li></ul></div><p>Let us see a concrete example:</p><p><span class="inlinemediaobject"><img src="../images/entry%20tutorial.jpg" width="60%"></span></p><p>We find in this diagram:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>A “normal” activation of SubFsm2, triggered by event1. In each
@@ -532,14 +578,18 @@
transition and both regions are exited, as SubFsm2 becomes
inactive. Note that if no transition is defined from
PseudoExit1, an error (as defined in the UML standard) will be
- detected and no_transition called.</p></li></ul></div><p>The example is also <a class="link" href="examples/DirectEntryTutorial.cpp" target="_top">fully implemented</a>.</p><p>This sounds complicated but the syntax is simple.</p><div class="sect3" title="Explicit entry"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1643"></a>Explicit entry</h4></div></div></div><p>First, to define that a state is an explicit entry, you have to make
+ detected and no_transition called.</p></li></ul></div><p>The example is also <a class="link" href="examples/DirectEntryTutorial.cpp" target="_top">fully implemented</a>.</p><p>This sounds complicated but the syntax is simple.</p><div class="sect3" title="Explicit entry"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1600"></a>Explicit entry</h4></div></div></div><p>First, to define that a state is an explicit entry, you have to make
it a state and mark it as explicit, giving as template parameters the
region id (the region id starts with 0 and corresponds to the first
- initial state of the initial_state type sequence).</p><p><code class="code">struct SubState2 : public msm::front::state<> , public
- msm::front::explicit_entry<0></code></p><p>And define the submachine as:</p><p><code class="code">typedef msm::back::state_machine<SubFsm2_>
- SubFsm2;</code></p><p>You can then use it as target in a transition with State1 as
- source:</p><p><code class="code">_row < State1, Event2, SubFsm2::direct<
- SubFsm2_::SubState2> ></code></p><p>The syntax deserves some explanation. SubFsm2_ is a front end.
+ initial state of the initial_state type sequence).</p><p>
+ </p><pre class="programlisting">struct SubState2 : public msm::front::state<> ,
+ public msm::front::explicit_entry<0></pre><p>
+ </p><p>And define the submachine as:</p><p>
+ </p><pre class="programlisting">typedef msm::back::state_machine<SubFsm2_> SubFsm2;</pre><p>
+ </p><p>You can then use it as target in a transition with State1 as
+ source:</p><p>
+ </p><pre class="programlisting">_row < State1, Event2, SubFsm2::direct< SubFsm2_::SubState2> ></pre><p>
+ </p><p>The syntax deserves some explanation. SubFsm2_ is a front end.
SubState2 is a nested state, therefore the SubFsm2_::SubState2 syntax.
The containing machine (containing State1 and SubFsm2) refers to the
backend instance (SubFsm2). SubFsm2::direct states that an explicit
@@ -550,28 +600,41 @@
NOT get automatically created. To explicitly create such states, you
need to add in the state machine containing the explicit states a simple
typedef giving a sequence of states to be explicitly created
- like:</p><p><code class="code">typedef mpl::vector<SubState2,SubState2b>
- explicit_creation;</code></p></div><div class="sect3" title="Fork"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1670"></a>Fork</h4></div></div></div><p>Need a fork instead of an explicit entry? As a fork is an explicit
+ like:</p><p>
+ </p><pre class="programlisting">typedef mpl::vector<SubState2,SubState2b> explicit_creation;</pre><p>
+ </p></div><div class="sect3" title="Fork"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1635"></a>Fork</h4></div></div></div><p>Need a fork instead of an explicit entry? As a fork is an explicit
entry into states of different regions, we do not change the state
definition compared to the explicit entry and specify as target a list
- of explicit entry states:</p><p><code class="code">_row < State1, Event3, mpl::vector<SubFsm2::direct<
- SubFsm2_::SubState2>, SubFsm2::direct <SubFsm2_::SubState2b>
- ></code></p><p>With SubState2 defined as before and SubState2b defined as being in
+ of explicit entry states:</p><p>
+ </p><pre class="programlisting">_row < State1, Event3,
+ mpl::vector<SubFsm2::direct<SubFsm2_::SubState2>,
+ SubFsm2::direct <SubFsm2_::SubState2b>
+ ></pre><p>
+ </p><p>With SubState2 defined as before and SubState2b defined as being in
the second region (Caution: MSM does not check that the region is
- correct):</p><p><code class="code">struct SubState2b : public msm::front::state<> , public
- msm::front::explicit_entry<1></code></p></div><div class="sect3" title="Entry pseudo states"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1683"></a>Entry pseudo states</h4></div></div></div><p> To define an entry pseudo state, you need derive from the
- corresponding class and give the region id:</p><p><code class="code">struct PseudoEntry1 : public
- msm::front::entry_pseudo_state<0></code></p><p>And add the corresponding transition in the top-level state machine's
- transition table:</p><p><code class="code">_row < State1, Event4,
- SubFsm2::entry_pt<SubFsm2_::PseudoEntry1> ></code></p><p>And another in the SubFsm2_ submachine definition (remember that UML
+ correct):</p><p>
+ </p><pre class="programlisting">struct SubState2b : public msm::front::state<> ,
+ public msm::front::explicit_entry<1></pre><p>
+ </p></div><div class="sect3" title="Entry pseudo states"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1652"></a>Entry pseudo states</h4></div></div></div><p> To define an entry pseudo state, you need derive from the
+ corresponding class and give the region id:</p><p>
+ </p><pre class="programlisting">struct PseudoEntry1 : public msm::front::entry_pseudo_state<0></pre><p>
+ </p><p>And add the corresponding transition in the top-level state machine's
+ transition table:</p><p>
+ </p><pre class="programlisting">_row < State1, Event4, SubFsm2::entry_pt<SubFsm2_::PseudoEntry1> ></pre><p>
+ </p><p>And another in the SubFsm2_ submachine definition (remember that UML
defines an entry point as a connection between two transitions), for
- example this time with an action method:</p><p><code class="code">_row < PseudoEntry1, Event4, SubState3,
- &SubFsm2_::entry_action ></code></p></div><div class="sect3" title="Exit pseudo states"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1701"></a> Exit pseudo states </h4></div></div></div><p>And finally, exit pseudo states are to be used almost the same way,
+ example this time with an action method:</p><p>
+ </p><pre class="programlisting">_row < PseudoEntry1, Event4, SubState3,&SubFsm2_::entry_action ></pre><p>
+ </p></div><div class="sect3" title="Exit pseudo states"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1676"></a> Exit pseudo states </h4></div></div></div><p>And finally, exit pseudo states are to be used almost the same way,
but defined differently: it takes as template argument the event to be
- forwarded (no region id is necessary):</p><p><code class="code">struct PseudoExit1 : public
- exit_pseudo_state<event6></code></p><p>And you need, like for entry pseudo states, two transitions, one in
- the submachine:</p><p><code class="code">_row < SubState3, Event5, PseudoExit1 ></code></p><p>And one in the containing state machine:</p><p><code class="code">_row < SubFsm2::exit_pt<SubFsm2_::PseudoExit1>, Event6,
- State2 ></code></p><p><span class="underline">Important note 1:</span> UML defines
+ forwarded (no region id is necessary):</p><p>
+ </p><pre class="programlisting">struct PseudoExit1 : public exit_pseudo_state<event6></pre><p>
+ </p><p>And you need, like for entry pseudo states, two transitions, one in
+ the submachine:</p><p>
+ </p><pre class="programlisting">_row < SubState3, Event5, PseudoExit1 ></pre><p>
+ </p><p>And one in the containing state machine:</p><p>
+ </p><pre class="programlisting">_row < SubFsm2::exit_pt<SubFsm2_::PseudoExit1>, Event6,State2 ></pre><p>
+ </p><p><span class="underline">Important note 1:</span> UML defines
transiting to an entry pseudo state and having either no second
transition or one with a guard as an error but defines no error
handling. MSM will tolerate this behavior; the entry pseudo state will
@@ -586,35 +649,46 @@
inside transition to be convertible to the one of the outside
transition. In our case, event6 is convertible from event5. Notice that
the forwarded event must be named in the exit point definition. For
- example, we could define event6 as simply as:</p><p><code class="code">struct event6 { event6(){} template <class Event>
- event6(Event const&){} };//convertible from any event</code>
- </p></div></div><div class="sect2" title="Flags"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1735"></a>Flags</h3></div></div></div><p>This <a class="link" href="examples/Flags.cpp" target="_top">tutorial</a> is devoted to a
+ example, we could define event6 as simply as:</p><p>
+ </p><pre class="programlisting">struct event6
+{
+ event6(){}
+ template <class Event>
+ event6(Event const&){}
+}; //convertible from any event</pre><p>
+ </p></div></div><div class="sect2" title="Flags"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1717"></a>Flags</h3></div></div></div><p>This <a class="link" href="examples/Flags.cpp" target="_top">tutorial</a> is devoted to a
concept not defined in UML: flags. It has been added into MSM after proving
itself useful on many occasions. Please, do not be frightened as we are not
talking about ugly shortcuts made of an improbable collusion of
Booleans.</p><p>If you look into the Boost.Statechart documentation you'll find this
- code:</p><p><code class="code">if ( ( state_downcast< const NumLockOff * >() != 0 ) &&
- </code></p><p><code class="code">( state_downcast< const CapsLockOff * >() != 0 ) &&
- </code></p><p><code class="code">( state_downcast< const ScrollLockOff * >() != 0 ) )
- </code></p><p>While correct and found in many UML books, this can be error-prone and a
+ code:</p><pre class="programlisting">if ( ( state_downcast< const NumLockOff * >() != 0 ) &&
+ ( state_downcast< const CapsLockOff * >() != 0 ) &&
+ ( state_downcast< const ScrollLockOff * >() != 0 ) )
+ </pre><p>While correct and found in many UML books, this can be error-prone and a
potential time-bomb when your state machine grows and you add new states or
orthogonal regions.</p><p>And most of all, it hides the real question, which would be “does my state
machine's current state define a special property”? In this special case
“are my keys in a lock state”? So let's apply the Fundamental Theorem of
Software Engineering and move one level of abstraction higher.</p><p>In our player example, let's say we need to know if the player has a
- loaded CD. We could do the same:</p><p><code class="code">if ( ( state_downcast< const Stopped * >() != 0 ) &&
- </code></p><p><code class="code">( state_downcast< const Open * >() != 0 ) &&
- </code></p><p><code class="code">( state_downcast< const Paused * >() != 0 )
- &&</code></p><p><code class="code">( state_downcast< const Playing * >() != 0 )</code></p><p><code class="code"> ) </code></p><p>Or flag these 4 states as CDLoaded-able. You add a flag_list type into
- each flagged state:</p><p><code class="code">typedef mpl::vector1<CDLoaded> flag_list;</code></p><p>You can even define a list of flags, for example in Playing:</p><p><code class="code">typedef mpl::vector2<PlayingPaused,CDLoaded>
- flag_list;</code></p><p>This means that Playing supports both properties. To check if your player
- has a loaded CD, check if your flag is active in the current state:</p><p><code class="code">player p; if (p.is_flag_active<CDLoaded>()) ... </code></p><p>And what if you have orthogonal regions? How to decide if a state machine
+ loaded CD. We could do the same:</p><pre class="programlisting">if ( ( state_downcast< const Stopped * >() != 0 ) &&
+ ( state_downcast< const Open * >() != 0 ) &&
+ ( state_downcast< const Paused * >() != 0 ) &&
+ ( state_downcast< const Playing * >() != 0 )) </pre><p>Or flag these 4 states as CDLoaded-able. You add a flag_list type into
+ each flagged state:</p><p>
+ </p><pre class="programlisting">typedef mpl::vector1<CDLoaded> flag_list;</pre><p>
+ </p><p>You can even define a list of flags, for example in Playing:</p><p>
+ </p><pre class="programlisting">typedef mpl::vector2<PlayingPaused,CDLoaded> flag_list;</pre><p>
+ </p><p>This means that Playing supports both properties. To check if your player
+ has a loaded CD, check if your flag is active in the current state:</p><p>
+ </p><pre class="programlisting">player p; if (p.is_flag_active<CDLoaded>()) ... </pre><p>
+ </p><p>And what if you have orthogonal regions? How to decide if a state machine
is in a flagged state? By default, you keep the same code and the current
states will be OR'ed, meaning if one of the active states has the flag, then
is_flag_active returns true. Of course, in some cases, you might want that
all of the active states are flagged for the state to be active. You can
- also AND the active states:</p><p><code class="code">if (p.is_flag_active<CDLoaded,player::Flag_AND>())
- ...</code></p><p>The following diagram displays the flag situation in the tutorial.</p><p><span class="inlinemediaobject"><img src="../images/FlagsTutorial.jpg" width="60%"></span></p></div><div class="sect2" title="Event Hierarchy"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1801"></a><span class="command"><strong><a name="event-hierarchy"></a></strong></span>Event Hierarchy</h3></div></div></div><p>There are cases where one needs transitions based on categories of events.
+ also AND the active states:</p><p>
+ </p><pre class="programlisting">if (p.is_flag_active<CDLoaded,player::Flag_AND>()) ...</pre><p>
+ </p><p>The following diagram displays the flag situation in the tutorial.</p><p><span class="inlinemediaobject"><img src="../images/FlagsTutorial.jpg" width="60%"></span></p></div><div class="sect2" title="Event Hierarchy"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1771"></a><span class="command"><strong><a name="event-hierarchy"></a></strong></span>Event Hierarchy</h3></div></div></div><p>There are cases where one needs transitions based on categories of events.
An example is text parsing. Let's say you want to parse a string and use a
state machine to manage your parsing state. You want to parse 4 digits and
decide to use a state for every matched digit. Your state machine could look
@@ -622,11 +696,12 @@
transitions on char_0, char_1... between two states as it would force us to
write 4 x 10 transitions and the compile-time would suffer. To solve this
problem, MSM supports the triggering of a transition on a subclass event.
- For example, if we define digits as: </p><p><code class="code">struct digit {};</code></p><p><code class="code">struct char_0 : public digit {}; </code></p><p>And to the same for other digits, we can now fire char_0, char_1 events
+ For example, if we define digits as: </p><pre class="programlisting">struct digit {};
+struct char_0 : public digit {}; </pre><p>And to the same for other digits, we can now fire char_0, char_1 events
and this will cause a transition with "digit" as trigger to be taken.</p><p>An <a class="link" href="examples/ParsingDigits.cpp" target="_top">example</a> with
performance measurement, taken from the documentation of Boost.Xpressive
illustrates this example. You might notice that the performance is actually
- very good (in this case even better).</p></div><div class="sect2" title="Customizing a state machine / Getting more speed"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1826"></a>Customizing a state machine / Getting more speed</h3></div></div></div><p>MSM is offering many UML features at a high-speed, but sometimes, you just
+ very good (in this case even better).</p></div><div class="sect2" title="Customizing a state machine / Getting more speed"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1792"></a>Customizing a state machine / Getting more speed</h3></div></div></div><p>MSM is offering many UML features at a high-speed, but sometimes, you just
need more speed and are ready to give up some features in exchange. A
process_event is handling several tasks: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>checking for terminate/interrupt states</p></li><li class="listitem"><p>handling the message queue (for entry/exit/transition actions
generating themselves events)</p></li><li class="listitem"><p>handling deferred events</p></li><li class="listitem"><p>catching exceptions (or not)</p></li><li class="listitem"><p>handling the state switching and action calls</p></li></ul></div><p>Of these tasks, only the last one is absolutely necessary to
@@ -641,8 +716,15 @@
itself generate a new event and MSM can save us the message
queue.</p></li></ul></div><p>The third configuration possibility, explained <a class="link" href="ch03s02.html#basic-defer">here</a>, is to manually activate deferred
events, using <code class="code">activate_deferred_events</code>. For example, the
- following state machine sets all three configuration types:</p><p><code class="code">struct player_ : public msm::front::state_machine_def<player_>
- {</code></p><p><code class="code">// no need for exception handling or message queue</code></p><p><code class="code">typedef int no_exception_thrown;</code></p><p><code class="code">typedef int no_message_queue;</code></p><p><code class="code">// also manually enable deferred events</code></p><p><code class="code">typedef int activate_deferred_events</code></p><p><code class="code">...// rest of implementation</code></p><p><code class="code">};</code></p></div><div class="sect2" title="Choosing the initial event"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1890"></a>Choosing the initial event</h3></div></div></div><p>A state machine is started using the <code class="code">start</code> method. This
+ following state machine sets all three configuration types:</p><pre class="programlisting">struct player_ : public msm::front::state_machine_def<player_>
+{
+ // no need for exception handling or message queue
+ typedef int no_exception_thrown;
+ typedef int no_message_queue;
+ // also manually enable deferred events
+ typedef int activate_deferred_events
+ ...// rest of implementation
+};</pre></div><div class="sect2" title="Choosing the initial event"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1834"></a>Choosing the initial event</h3></div></div></div><p>A state machine is started using the <code class="code">start</code> method. This
causes the initial state's entry behavior to be executed. Like every entry
behavior, it becomes as parameter the event causing the state to be entered.
But when the machine starts, there was no event triggered. In this case, MSM
@@ -650,8 +732,11 @@
not be the default you'd want. For this special case, MSM provides a
configuration mechanism in the form of a typedef. If the state machine's
front-end definition provides an initial_event typedef set to another event,
- this event will be used. For example:</p><p><code class="code">struct my_initial_event{};</code></p><p><code class="code">struct player_ : public
- msm::front::state_machine_def<player_>{</code></p><p><code class="code">...</code></p><p><code class="code">typedef my_initial_event initial_event; };</code></p></div><div class="sect2" title="Containing state machine (deprecated)"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1913"></a> Containing state machine (deprecated)</h3></div></div></div><p>This feature is still supported in MSM for backward compatibility but made
+ this event will be used. For example:</p><pre class="programlisting">struct my_initial_event{};
+struct player_ : public msm::front::state_machine_def<player_>{
+...
+typedef my_initial_event initial_event;
+};</pre></div><div class="sect2" title="Containing state machine (deprecated)"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1847"></a> Containing state machine (deprecated)</h3></div></div></div><p>This feature is still supported in MSM for backward compatibility but made
obsolete by the fact that every guard/action/entry action/exit action get
the state machine passed as argument and might be removed at a later
time.</p><p>All of the states defined in the state machine are created upon state
@@ -659,7 +744,7 @@
noise. The cost is a small loss of control for the user on the state
creation and access. But sometimes you needed a way for a state to get
access to its containing state machine. Basically, a state needs to change
- its declaration to:</p><p><code class="code">struct Stopped : public msm::front::state<sm_ptr></code></p><p>And to provide a set_sm_ptr function: <code class="code">void set_sm_ptr(player*
+ its declaration to:</p><pre class="programlisting">struct Stopped : public msm::front::state<sm_ptr></pre><p>And to provide a set_sm_ptr function: <code class="code">void set_sm_ptr(player*
pl)</code></p><p>to get a pointer to the containing state machine. The same applies to
terminate_state / interrupt_state and entry_pseudo_state /
exit_pseudo_state. </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. Tutorial </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Functor front-end</td></tr></table></div></body></html>
\ No newline at end of file
Modified: sandbox/msm/libs/msm/doc/HTML/ch03s03.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch03s03.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch03s03.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Functor front-end</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) V2.10"><link rel="up" href="ch03.html" title="Chapter 3. Tutorial"><link rel="prev" href="ch03s02.html" title="Basic front-end"><link rel="next" href="ch03s04.html" title="eUML (experimental)"></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">Functor front-end</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Tutorial</th><td width="20%" align="right"> <a accesskey="n" href="ch03s04.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Functor front-end"><div class="titlepage"><div><div><h2 class="title" style="c
lear: both"><a name="d0e1929"></a><span class="command"><strong><a name="functor-front-end"></a></strong></span>Functor front-end</h2></div></div></div><p>The functor front-end is the preferred front-end at the moment. It is more
+ <title>Functor front-end</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) V2.10"><link rel="up" href="ch03.html" title="Chapter 3. Tutorial"><link rel="prev" href="ch03s02.html" title="Basic front-end"><link rel="next" href="ch03s04.html" title="eUML (experimental)"></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">Functor front-end</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Tutorial</th><td width="20%" align="right"> <a accesskey="n" href="ch03s04.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Functor front-end"><div class="titlepage"><div><div><h2 class="title" style="c
lear: both"><a name="d0e1862"></a><span class="command"><strong><a name="functor-front-end"></a></strong></span>Functor front-end</h2></div></div></div><p>The functor front-end is the preferred front-end at the moment. It is more
powerful than the standard front-end and has a more readable transition table.
It also makes it easier to reuse parts of state machines. Like <span class="command"><strong><a class="command" href="ch03s04.html#eUML-front-end">eUML</a></strong></span>, it also comes with a good deal
of predefined actions. Actually, eUML generates a functor front-end through
@@ -11,9 +11,9 @@
means syntactic noise and more to learn.</p></li><li class="listitem"><p>Function pointers are weird in C++.</p></li><li class="listitem"><p>The action/guard signature is limited and does not allow for more
variations of parameters (source state, target state, current state
machine, etc.)</p></li><li class="listitem"><p>It is not easy to reuse action code from a state machine to
- another.</p></li></ul></div><div class="sect2" title="Transition table"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1953"></a> Transition table </h3></div></div></div><p>We can change the definition of the simple tutorial's transition table
+ another.</p></li></ul></div><div class="sect2" title="Transition table"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1886"></a> Transition table </h3></div></div></div><p>We can change the definition of the simple tutorial's transition table
to:</p><p>
- </p><table id="d0e1960"><tbody><tr>
+ </p><table id="d0e1893"><tbody><tr>
<td>//</td>
<td>Start</td>
<td>Event</td>
@@ -186,10 +186,15 @@
source state, event, target state, action and guard. Wherever there is
nothing (for example actions and guards), write "none". Actions and guards
are no more methods but functors getting as arguments the detected event,
- the state machine, source and target state:</p><p><code class="code">struct store_cd_info { </code></p><p><code class="code">template <class Fsm,class Evt,class SourceState,class
- TargetState> </code></p><p><code class="code">void operator()(Evt const&, Fsm& fsm, SourceState&,
- TargetState& ) </code></p><p><code class="code"> {</code></p><p><code class="code"> cout << "player::store_cd_info" << endl;
- fsm.process_event(play()); </code></p><p><code class="code"> } </code></p><p><code class="code">}; </code></p><p>The advantage of functors compared to functions are that functors are
+ the state machine, source and target state:</p><pre class="programlisting">struct store_cd_info
+{
+ template <class Fsm,class Evt,class SourceState,class TargetState>
+ void operator()(Evt const&, Fsm& fsm, SourceState&,TargetState& )
+ {
+ cout << "player::store_cd_info" << endl;
+ fsm.process_event(play());
+ }
+}; </pre><p>The advantage of functors compared to functions are that functors are
generic and reusable. They also allow passing more parameters than just
events. The guard functors are the same but have an operator() returning a
bool.</p><p>It is also possible to mix rows from different front-ends. To show this, a
@@ -200,16 +205,15 @@
functors. Please refer to eUML for the <a class="link" href="pt02.html#Reference-begin">full list</a>. For example, we are now going to replace the first
action by an action sequence and the guard by a more complex functor.</p><p>We decide we now want to execute two actions in the first transition
(Stopped -> Playing). We only need to change the action start_playback to
- <code class="code">ActionSequence_< mpl::vector<some_action, start_playback> >
- </code> and now will execute some_action and start_playback every time the
- transition is taken. ActionSequence_ is a functor calling each action of the
- mpl::vector in sequence.</p><p>We also want to replace good_disk_format by a condition of the type:
+ </p><pre class="programlisting">ActionSequence_< mpl::vector<some_action, start_playback> ></pre><p>and
+ now will execute some_action and start_playback every time the transition is
+ taken. ActionSequence_ is a functor calling each action of the mpl::vector
+ in sequence.</p><p>We also want to replace good_disk_format by a condition of the type:
“good_disk_format && (some_condition || some_other_condition)”. We
can achieve this using And_ and Or_ functors:
- <code class="code">And_<good_disk_format,Or_< some_condition ,
- some_other_condition> ></code>. It even starts looking like functional
- programming. MSM ships with functors for operators, state machine usage, STL
- algorithms or container methods.</p></div><div class="sect2" title="Defining states with entry/exit actions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2491"></a>Defining states with entry/exit actions</h3></div></div></div><p>You probably noticed that we just showed a different transition table and
+ </p><pre class="programlisting">And_<good_disk_format,Or_< some_condition , some_other_condition> ></pre><p>It
+ even starts looking like functional programming. MSM ships with functors for
+ operators, state machine usage, STL algorithms or container methods.</p></div><div class="sect2" title="Defining states with entry/exit actions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2405"></a>Defining states with entry/exit actions</h3></div></div></div><p>You probably noticed that we just showed a different transition table and
that we even mixed rows from different front-ends. This means that you can
do this and leave the definitions for states unchanged. Most examples are
doing this as it is the simplest solution. You still enjoy the simplicity of
@@ -218,23 +222,30 @@
adapted from the earlier example does just this.</p><p>Of course, it is also possible to define states where entry and exit
actions are also provided as functors as these are generated by eUML and
both front-ends are equivalent. For example, we can define a state
- as:</p><p><code class="code">struct Empty_Entry { </code></p><p><code class="code">template <class Event,class Fsm,class State> </code></p><p><code class="code">void operator()(Event const&,Fsm&,State&) </code></p><p><code class="code"> {</code></p><p><code class="code"> ... </code></p><p><code class="code"> } </code></p><p><code class="code">}; // same for Empty_Exit</code></p><p><code class="code">struct Empty : public
- msm::front::euml::func_state<Empty_Entry,Empty_Exit>{};</code></p><p>This also means that you can, like in the transition table, write entry /
+ as:</p><pre class="programlisting">struct Empty_Entry
+{
+ template <class Event,class Fsm,class State>
+ void operator()(Event const&,Fsm&,State&)
+ {
+ ...
+ }
+}; // same for Empty_Exit
+struct Empty : public msm::front::euml::func_state<Empty_Entry,Empty_Exit>{};</pre><p>This also means that you can, like in the transition table, write entry /
exit actions made of more complicated action combinations. The previous
example can therefore <a class="link" href="examples/SimpleWithFunctors2.cpp" target="_top">be
rewritten</a>.</p><p>Usually, however, one will probably use the standard state definition as
it provides the same capabilities as this front-end state definition, unless
one needs some of the shipped predefined functors or is a fan of functional
- programming.</p></div><div class="sect2" title="Defining a simple state machine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2532"></a>Defining a simple state machine</h3></div></div></div><p>Like states, state machines can be defined using the previous front-end,
+ programming.</p></div><div class="sect2" title="Defining a simple state machine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2424"></a>Defining a simple state machine</h3></div></div></div><p>Like states, state machines can be defined using the previous front-end,
as the previous example showed, or with the functor front-end, which allows
you to define a state machine entry and exit functions as functors, as in
<a class="link" href="examples/SimpleWithFunctors2.cpp" target="_top">this
- example</a>.</p></div><div class="sect2" title="Anonymous transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2540"></a>Anonymous transitions</h3></div></div></div><p>Anonymous (completion) transitions are transitions without a named event.
+ example</a>.</p></div><div class="sect2" title="Anonymous transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2432"></a>Anonymous transitions</h3></div></div></div><p>Anonymous (completion) transitions are transitions without a named event.
We saw how this front-end uses <code class="code">none</code> when no action or guard is
required. We can also use <code class="code">none</code> instead of an event to mark an
anonymous transition. For example, the following transition makes an
- immediate transition from State1 to State2:</p><p>Row < State1 , none , State2 ></p><p>The following transition does the same but calling an action in the
- process:</p><p>Row < State1 , none , State2 , State1ToState2, none ></p><p>The following diagram shows an example and its <a class="link" href="examples/AnonymousTutorialWithFunctors.cpp" target="_top">implementation</a>:</p><p><span class="inlinemediaobject"><img src="../images/Anonymous.jpg" width="70%"></span></p></div><div class="sect2" title="Internal transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2566"></a><span class="command"><strong><a name="functor-internal-transitions"></a></strong></span>Internal
+ immediate transition from State1 to State2:</p><pre class="programlisting">Row < State1 , none , State2 ></pre><p>The following transition does the same but calling an action in the
+ process:</p><pre class="programlisting">Row < State1 , none , State2 , State1ToState2, none ></pre><p>The following diagram shows an example and its <a class="link" href="examples/AnonymousTutorialWithFunctors.cpp" target="_top">implementation</a>:</p><p><span class="inlinemediaobject"><img src="../images/Anonymous.jpg" width="70%"></span></p></div><div class="sect2" title="Internal transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2458"></a><span class="command"><strong><a name="functor-internal-transitions"></a></strong></span>Internal
transitions</h3></div></div></div><p>The <a class="link" href="examples/SimpleTutorialInternalFunctors.cpp" target="_top">following example</a> uses internal transitions with the functor
front-end. As for the simple standard front-end, both methods of defining
internal transitions are supported:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>providing a <code class="code">Row</code> in the state machine's transition
Modified: sandbox/msm/libs/msm/doc/HTML/ch03s04.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch03s04.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch03s04.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>eUML (experimental)</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) V2.10"><link rel="up" href="ch03.html" title="Chapter 3. Tutorial"><link rel="prev" href="ch03s03.html" title="Functor front-end"><link rel="next" href="ch03s05.html" title="Back-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">eUML (experimental)</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Tutorial</th><td width="20%" align="right"> <a accesskey="n" href="ch03s05.html">Next</a></td></tr></table><hr></div><div class="sect1" title="eUML (experimental)"><div class="titlepage"><div><div><h2 class="title" style="clea
r: both"><a name="d0e2612"></a><span class="command"><strong><a name="eUML-front-end"></a></strong></span>eUML (experimental)</h2></div></div></div><p><span class="underline">Important note</span>: eUML requires a compiler
+ <title>eUML (experimental)</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) V2.10"><link rel="up" href="ch03.html" title="Chapter 3. Tutorial"><link rel="prev" href="ch03s03.html" title="Functor front-end"><link rel="next" href="ch03s05.html" title="Back-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">eUML (experimental)</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Tutorial</th><td width="20%" align="right"> <a accesskey="n" href="ch03s05.html">Next</a></td></tr></table><hr></div><div class="sect1" title="eUML (experimental)"><div class="titlepage"><div><div><h2 class="title" style="clea
r: both"><a name="d0e2504"></a><span class="command"><strong><a name="eUML-front-end"></a></strong></span>eUML (experimental)</h2></div></div></div><p><span class="underline">Important note</span>: eUML requires a compiler
supporting the C++0x decltype/typeof feature (for example VC >= 9, g++ >= 4.3.
VC8 supports eUML but will crash with middle-size state machines). More
generally, eUML has experimental status because most compilers will start
@@ -18,11 +18,18 @@
all the underlying Boost libraries are not Typeof-enabled, so for the moment,
you will need a compiler where Typeof is natively implemented (like VC8-9-10,
g++ >= 4.3).</p><p>Examples will be provided in the next paragraphs. You need to include eUML
- basic features: </p><p><code class="code">#include <msm/front/euml/euml.hpp></code></p><p>To add STL support (at possible cost of longer compilation times), include: </p><p><code class="code">#include <msm/front/euml/stl.hpp></code></p><p>eUML is defined in the namespace <code class="code">msm::front::euml</code>.</p><div class="sect2" title="Transition table"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2641"></a>Transition table</h3></div></div></div><p>A transition can be defined using eUML as: </p><p><code class="code">source + event [guard] / action == target</code>
- </p><p>or as</p><p><code class="code">target == source + event [guard] / action</code></p><p>The first version looks like a drawn transition in a diagram, the second
+ basic features: </p><p>
+ </p><pre class="programlisting">#include <msm/front/euml/euml.hpp></pre><p>
+ </p><p>To add STL support (at possible cost of longer compilation times), include: </p><p>
+ </p><pre class="programlisting">#include <msm/front/euml/stl.hpp></pre><p>
+ </p><p>eUML is defined in the namespace <code class="code">msm::front::euml</code>.</p><div class="sect2" title="Transition table"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2537"></a>Transition table</h3></div></div></div><p>A transition can be defined using eUML as: </p><p>
+ </p><pre class="programlisting">source + event [guard] / action == target</pre><p>
+ </p><p>or as</p><p>
+ </p><pre class="programlisting">target == source + event [guard] / action</pre><p>
+ </p><p>The first version looks like a drawn transition in a diagram, the second
one seems natural to a C++ developer.</p><p>The simple transition table written with the <span class="command"><strong><a class="command" href="ch03s03.html#functor-front-end">previous front-end</a></strong></span> can now be
written as:</p><p>
- </p><table frame="void" id="d0e2664"><tbody><tr>
+ </p><table frame="void" id="d0e2563"><tbody><tr>
<td>BOOST_MSM_EUML_TRANSITION_TABLE(( </td>
<td> </td>
</tr><tr>
@@ -55,7 +62,7 @@
<td> </td>
</tr></tbody></table><p>
</p><p>Or, using the alternative notation, it can be:</p><p>
- </p><table id="d0e2756"><tbody><tr>
+ </p><table id="d0e2655"><tbody><tr>
<td>BOOST_MSM_EUML_TRANSITION_TABLE((</td>
<td> </td>
<td> </td>
@@ -104,9 +111,11 @@
[good_disk_format && (some_condition || some_other_condition)]. This
was possible with our previously defined functors, but using a complicated
template syntax. This syntax is now possible exactly as written, which means
- without any syntactic noise at all.</p></div><div class="sect2" title="Defining events, actions and states with entry/exit actions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2858"></a>Defining events, actions and states with entry/exit actions</h3></div></div></div><div class="sect3" title="Events"><div class="titlepage"><div><div><h4 class="title"><a name="d0e2861"></a>Events</h4></div></div></div><p>Events must be proto-enabled. To achieve this, they must inherit from
+ without any syntactic noise at all.</p></div><div class="sect2" title="Defining events, actions and states with entry/exit actions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2757"></a>Defining events, actions and states with entry/exit actions</h3></div></div></div><div class="sect3" title="Events"><div class="titlepage"><div><div><h4 class="title"><a name="d0e2760"></a>Events</h4></div></div></div><p>Events must be proto-enabled. To achieve this, they must inherit from
a proto terminal (euml_event<event-name>). eUML also provides a macro
- to make this easier:</p><p><code class="code">BOOST_MSM_EUML_EVENT(play)</code></p><p>This declares an event type and an instance of this type called
+ to make this easier:</p><p>
+ </p><pre class="programlisting">BOOST_MSM_EUML_EVENT(play)</pre><p>
+ </p><p>This declares an event type and an instance of this type called
<code class="code">play</code>, which is now ready to use in state or transition
behaviors.</p><p>There is a second macro, BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES, which
takes as second parameter the attributes an event will contain, using
@@ -117,24 +126,31 @@
<code class="code">fsm.process_event(play());</code> or do we have to write:
<code class="code">fsm.process_event(play);</code></p><p>The answer is you can do both. The second one is easier but unlike
other front-ends, the second uses a defined operator(), which creates an
- event on the fly.</p></div><div class="sect3" title="Actions"><div class="titlepage"><div><div><h4 class="title"><a name="d0e2890"></a>Actions</h4></div></div></div><p>Actions (returning void) and guards (returning a bool) are defined
+ event on the fly.</p></div><div class="sect3" title="Actions"><div class="titlepage"><div><div><h4 class="title"><a name="d0e2791"></a>Actions</h4></div></div></div><p>Actions (returning void) and guards (returning a bool) are defined
like previous functors, with the difference that they also must be
proto-enabled. This can be done by inheriting from euml_action<
- functor-name >. eUML also provides a macro:</p><p><code class="code">BOOST_MSM_EUML_ACTION(some_condition)</code></p><p><code class="code">{ </code></p><p><code class="code">template <class Fsm,class Evt,class SourceState,class
- TargetState></code></p><p><code class="code">bool operator()(Evt const& ,Fsm& ,SourceState&
- ,TargetState& ) { return true; } </code></p><p><code class="code">}; </code></p><p>Like for events, this macro declares a functor type and an instance
+ functor-name >. eUML also provides a macro:</p><pre class="programlisting">BOOST_MSM_EUML_ACTION(some_condition)
+{
+ template <class Fsm,class Evt,class SourceState,class TargetState>
+ bool operator()(Evt const& ,Fsm& ,SourceState&,TargetState& )
+ { return true; }
+}; </pre><p>Like for events, this macro declares a functor type and an instance
for use in transition or state behaviors.</p><p>It is possible to use the same action grammar from the transition
table to define state entry and exit behaviors. So
<code class="code">(action1,action2)</code> is a valid entry or exit behavior
executing both actions in turn.</p><p>The state functors have a slightly different signature as there is no
source and target state but only a current state (entry/exit actions are
- transition-independent), for example:</p><p><code class="code">BOOST_MSM_EUML_ACTION(Empty_Entry)</code></p><p><code class="code">{ </code></p><p><code class="code">template <class Evt,class Fsm,class State></code></p><p><code class="code">void operator()(Evt const& ,Fsm& ,State& ) { ... }
- </code></p><p><code class="code">}; </code></p></div><div class="sect3" title="States"><div class="titlepage"><div><div><h4 class="title"><a name="d0e2934"></a>States</h4></div></div></div><p>There is also a macro for states. This macro has 2 arguments, first
+ transition-independent), for example:</p><pre class="programlisting">BOOST_MSM_EUML_ACTION(Empty_Entry)
+{
+ template <class Evt,class Fsm,class State>
+ void operator()(Evt const& ,Fsm& ,State& ) { ... }
+}; </pre></div><div class="sect3" title="States"><div class="titlepage"><div><div><h4 class="title"><a name="d0e2809"></a>States</h4></div></div></div><p>There is also a macro for states. This macro has 2 arguments, first
the expression defining the state, then the state (instance)
- name:</p><p><code class="code">BOOST_MSM_EUML_STATE((),Paused)</code></p><p>This defines a simple state without entry or exit action. You can
+ name:</p><pre class="programlisting">BOOST_MSM_EUML_STATE((),Paused)</pre><p>This defines a simple state without entry or exit action. You can
provide in the expression parameter the state behaviors (entry and exit)
- using the action grammar, like in the transition table:</p><p><code class="code">BOOST_MSM_EUML_STATE(((Empty_Entry,Dummy_Entry)/*2 entry
- actions*/,Empty_Exit/*1 exit action*/ ),Empty)</code></p><p>This means that Empty is defined as a state with an entry action made
+ using the action grammar, like in the transition table:</p><pre class="programlisting">BOOST_MSM_EUML_STATE(((Empty_Entry,Dummy_Entry)/*2 entryactions*/,
+ Empty_Exit/*1 exit action*/ ),
+ Empty)</pre><p>This means that Empty is defined as a state with an entry action made
of two sub-actions, Empty_Entry and Dummy_Entry (enclosed inside
parenthesis), and an exit action, Empty_Exit.</p><p>There are several possibilitites for the <span class="command"><strong><a name="eUML-build-state"></a></strong></span> expression syntax:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>(): state without entry or exit action.</p></li><li class="listitem"><p>(Expr1): state with entry but no exit action.</p></li><li class="listitem"><p>(Expr1,Expr2): state with entry and exit action.</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes): state with entry and exit
action, defining some attributes (read further on).</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure): state with entry and
@@ -152,21 +168,24 @@
states some special behavior. In this case, you will have to do the
macro's job by hand, which is not very complicated. The state will need
to inherit from <code class="code">msm::front::state<></code>, like any state, and
- from <code class="code">euml_statestate-name></code> to be proto-enabled. You will
- then need to declare an instance for use in the transition table. For
- example:</p><p><code class="code">struct Empty_impl : public msm::front::state<> , public
- euml_state<Empty_impl> {</code></p><p><code class="code">void activate_empty() {std::cout << "switching to Empty "
- << std::endl;}</code></p><p><code class="code">template <class Event,class Fsm></code></p><p><code class="code">void on_entry(Event const& evt,Fsm&
- fsm){...}</code></p><p><code class="code">template <class Event,class Fsm> </code></p><p><code class="code">void on_exit(Event const& evt,Fsm&
- fsm){...}</code></p><p><code class="code">};</code></p><p><code class="code">//instance for use in the transition table</code></p><p><code class="code">Empty_impl const Empty;</code></p><p>Notice also that we defined a method named activate_empty. We would
+ from <code class="code">euml_state<state-name></code> to be proto-enabled. You
+ will then need to declare an instance for use in the transition table.
+ For example:</p><pre class="programlisting">struct Empty_impl : public msm::front::state<> , public euml_state<Empty_impl>
+{
+ void activate_empty() {std::cout << "switching to Empty " << std::endl;}
+ template <class Event,class Fsm>
+ void on_entry(Event const& evt,Fsm&fsm){...}
+ template <class Event,class Fsm>
+ void on_exit(Event const& evt,Fsm&fsm){...}
+};
+//instance for use in the transition table
+Empty_impl const Empty;</pre><p>Notice also that we defined a method named activate_empty. We would
like to call it inside a behavior. This can be done using the
- BOOST_MSM_EUML_METHOD macro. </p><p><code class="code">BOOST_MSM_EUML_METHOD(ActivateEmpty_ , activate_empty ,
- activate_empty_ , void , void )</code></p><p>The first parameter is the name of the underlying functor, which you
+ BOOST_MSM_EUML_METHOD macro. </p><pre class="programlisting">BOOST_MSM_EUML_METHOD(ActivateEmpty_,activate_empty,activate_empty_,void,void)</pre><p>The first parameter is the name of the underlying functor, which you
could use with the functor front-end, the second is the state method
name, the third is the eUML-generated function, the fourth and fifth the
return value when used inside a transition or a state behavior. You can
- now use this inside a transition:</p><p><code class="code">Empty == Open + open_close /
- (close_drawer,activate_empty_(target_))</code></p></div></div><div class="sect2" title="Defining a simple state machine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3019"></a>Defining a simple state machine</h3></div></div></div><p>You can reuse the state machine definition method from the standard
+ now use this inside a transition:</p><pre class="programlisting">Empty == Open + open_close / (close_drawer,activate_empty_(target_))</pre></div></div><div class="sect2" title="Defining a simple state machine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2865"></a>Defining a simple state machine</h3></div></div></div><p>You can reuse the state machine definition method from the standard
front-end and simply replace the transition table by this new one. You can
also use eUML to define a state machine "on the fly" (if, for example, you
need to provide an on_entry/on_exit for this state machine as a functor).
@@ -191,7 +210,7 @@
added and a non-default base state (see the <a class="link" href="ch03s05.html#backend-base-state">back-end
description</a>) is defined.</p></li></ul></div><p>For example, a minimum state machine could be defined
as:</p><p>
- </p><table id="d0e3054"><tbody><tr>
+ </p><table id="d0e2900"><tbody><tr>
<td>BOOST_MSM_EUML_TRANSITION_TABLE((</td>
<td> </td>
<td> </td>
@@ -200,12 +219,12 @@
<td> </td>
<td> </td>
</tr></tbody></table><p>
- </p><p><code class="code">BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,init_
- << Empty ),player_)</code></p><p>Please have a look at the player tutorial written using eUML's <a class="link" href="examples/SimpleTutorialEuml2.cpp" target="_top">first</a> and <a class="link" href="examples/SimpleTutorialEuml.cpp" target="_top">second</a> syntax. The
+ </p><pre class="programlisting">BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,init_ << Empty ),
+ player_)</pre><p>Please have a look at the player tutorial written using eUML's <a class="link" href="examples/SimpleTutorialEuml2.cpp" target="_top">first</a> and <a class="link" href="examples/SimpleTutorialEuml.cpp" target="_top">second</a> syntax. The
BOOST_MSM_EUML_DECLARE_ATTRIBUTE macro, to which we will get back shortly,
declares attributes given to an eUML type (state or event) using the
<span class="command"><strong><a class="command" href="ch03s04.html#eUML-attributes">attribute
- syntax</a></strong></span>.</p></div><div class="sect2" title="Defining a submachine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3093"></a>Defining a submachine</h3></div></div></div><p>Defining a submachine (see <a class="link" href="examples/CompositeTutorialEuml.cpp" target="_top">tutorial</a>) with
+ syntax</a></strong></span>.</p></div><div class="sect2" title="Defining a submachine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2938"></a>Defining a submachine</h3></div></div></div><p>Defining a submachine (see <a class="link" href="examples/CompositeTutorialEuml.cpp" target="_top">tutorial</a>) with
other front-ends simply means using a state which is a state machine in the
transition table of another state machine. This is the same with eUML. One
only needs define a second state machine and reference it in the transition
@@ -213,9 +232,10 @@
BOOST_MSM_EUML_DECLARE_STATE_MACHINE defines a type, not an instance because
a type is what the back-end requires. This means that you will need to
declare yourself an instance to reference your submachine into another state
- machine, for example:</p><p><code class="code">BOOST_MSM_EUML_DECLARE_STATE_MACHINE(...,Playing_)</code></p><p><code class="code">typedef msm::back::state_machine<Playing_>
- Playing_type;</code></p><p><code class="code">Playing_type const Playing;</code></p><p>We can now use this instance inside the transition table of the containing
- state machine:</p><p><code class="code">Paused == Playing + pause / pause_playback</code></p></div><div class="sect2" title="Attributes / Function call"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3117"></a>
+ machine, for example:</p><pre class="programlisting">BOOST_MSM_EUML_DECLARE_STATE_MACHINE(...,Playing_)
+typedef msm::back::state_machine<Playing_> Playing_type;
+Playing_type const Playing;</pre><p>We can now use this instance inside the transition table of the containing
+ state machine:</p><pre class="programlisting">Paused == Playing + pause / pause_playback</pre></div><div class="sect2" title="Attributes / Function call"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2954"></a>
<span class="command"><strong><a name="eUML-attributes"></a></strong></span>Attributes / Function call</h3></div></div></div><p>We now want to make our grammar more useful. Very often, one needs only
very simple action methods, for example ++Counter or Counter > 5 where
Counter is usually defined as some attribute of the class containing the
@@ -223,20 +243,21 @@
action. Furthermore, states within MSM are also classes so they can have
attributes, and we would also like to provide them with attributes. </p><p>If you look back at our examples using the <a class="link" href="examples/SimpleTutorialEuml2.cpp" target="_top">first</a> and <a class="link" href="examples/SimpleTutorialEuml.cpp" target="_top">second</a> syntaxes, you
will find a BOOST_MSM_EUML_DECLARE_ATTRIBUTE and a BOOST_MSM_EUML_ATTRIBUTES
- macro. The first one declares possible attributes:</p><p><code class="code">BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)</code></p><p><code class="code">BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)</code></p><p>This declares two attributes: cd_name of type std::string and cd_type of
+ macro. The first one declares possible attributes:</p><pre class="programlisting">BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)</pre><p>This declares two attributes: cd_name of type std::string and cd_type of
type DiskTypeEnum. These attributes are not part of any event or state in
particular, we just declared a name and a type. Now, we can add attributes
- to our cd_detected event using the second one:</p><p><code class="code">BOOST_MSM_EUML_ATTRIBUTES((attributes_ << cd_name <<
- cd_type ), cd_detected_attributes)</code></p><p>This declares an attribute list which is not linked to anything in
+ to our cd_detected event using the second one:</p><pre class="programlisting">BOOST_MSM_EUML_ATTRIBUTES((attributes_ << cd_name << cd_type ),
+ cd_detected_attributes)</pre><p>This declares an attribute list which is not linked to anything in
particular yet. It can be attached to a state or an event. For example, if
we want the event cd_detected to have these defined attributes we
- write:</p><p><code class="code">BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(cd_detected,cd_detected_attributes)</code></p><p>For states, we use the BOOST_MSM_EUML_STATE macro, which has an expression
- form where one can provide attributes. For example:</p><p><code class="code">BOOST_MSM_EUML_STATE((no_action /*entry*/,no_action/*exit*/,
- attributes_ << cd_detected_attributes),some_state)</code></p><p>OK, great, we now have a way to add attributes to a class, which we could
+ write:</p><pre class="programlisting">BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(cd_detected,cd_detected_attributes)</pre><p>For states, we use the BOOST_MSM_EUML_STATE macro, which has an expression
+ form where one can provide attributes. For example:</p><pre class="programlisting">BOOST_MSM_EUML_STATE((no_action /*entry*/,no_action/*exit*/,
+ attributes_ << cd_detected_attributes),
+ some_state)</pre><p>OK, great, we now have a way to add attributes to a class, which we could
have done more easily, so what is the point? The point is that we can now
reference these attributes directly, at compile-time, in the transition
- table. For example, in the example, you will find this transition:</p><p><code class="code">Stopped == Empty + cd_detected [good_disk_format &&
- (event_(cd_type)==Int_<DISK_CD>())] </code></p><p>Read event_(cd_type) as event_->cd_type with event_ a type generic for
+ table. For example, in the example, you will find this transition:</p><pre class="programlisting">Stopped==Empty+cd_detected[good_disk_format&&(event_(cd_type)==Int_<DISK_CD>())] </pre><p>Read event_(cd_type) as event_->cd_type with event_ a type generic for
events, whatever the concrete event is (in this particular case, it happens
to be a cd_detected as the transition shows).</p><p>The main advantage of this feature is that you do not need to define a new
functor and you do not need to look inside the functor to know what it does,
@@ -254,8 +275,7 @@
like to create a eUML functor and call it from inside the transition table.
This is done using the MSM_EUML_METHOD / MSM_EUML_FUNCTION macros. The first
creates a functor to a method, the second to a free function. In the
- tutorial, we write:</p><p><code class="code">MSM_EUML_METHOD(ActivateEmpty_ , activate_empty , activate_empty_ ,
- void , void )</code></p><p>The first parameter is the functor name, for use with the functor
+ tutorial, we write:</p><pre class="programlisting">MSM_EUML_METHOD(ActivateEmpty_,activate_empty,activate_empty_,void,void)</pre><p>The first parameter is the functor name, for use with the functor
front-end. The second is the name of the method to call. The third is the
function name for use with eUML, the fourth is the return type of the
function if used in the context of a transition action, the fifth is the
@@ -263,39 +283,40 @@
fourth and fifth are the same). We now have a new eUML function calling a
method of "something", and this "something" is one of the five previously
shown generic helpers. We can now use this in a transition, for
- example:</p><p><code class="code">Empty == Open + open_close /
- (close_drawer,activate_empty_(target_))</code></p><p>The action is now defined as a sequence of two actions: close_drawer and
+ example:</p><pre class="programlisting">Empty == Open + open_close / (close_drawer,activate_empty_(target_))</pre><p>The action is now defined as a sequence of two actions: close_drawer and
activate_empty, which is called on the target itself. The target being Empty
(the state defined left), this really will call Empty::activate_empty().
This method could also have an (or several) argument(s), for example the
event, we could then call activate_empty_(target_ , event_).</p><p>More examples can be found in the <a class="link" href="examples/CompilerStressTestEuml.cpp" target="_top">terrible compiler
stress test</a>, the <a class="link" href="examples/SimpleTimer.cpp" target="_top">timer example</a> or in the <a class="link" href="examples/iPodSearchEuml.cpp" target="_top">iPodSearch with eUML</a>
- (for String_ and more).</p></div><div class="sect2" title="Orthogonal regions, flags, event deferring"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3227"></a>Orthogonal regions, flags, event deferring</h3></div></div></div><p>Defining orthogonal regions really means providing more initial states. To
+ (for String_ and more).</p></div><div class="sect2" title="Orthogonal regions, flags, event deferring"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3054"></a>Orthogonal regions, flags, event deferring</h3></div></div></div><p>Defining orthogonal regions really means providing more initial states. To
add more initial states, “shift left” some, for example, if we had another
- initial state named AllOk :</p><p><code class="code">BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,init_
- << Empty << AllOk ),player_)</code></p><p>You remember from the <span class="command"><strong><a class="command" href="ch03s04.html#eUML-build-state">BOOST_MSM_EUML_STATE </a></strong></span> and <span class="command"><strong><a class="command" href="ch03s04.html#eUML-build-sm">BOOST_MSM_EUML_DECLARE_STATE_MACHINE</a></strong></span> signatures that just
+ initial state named AllOk :</p><pre class="programlisting">BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,
+ init_ << Empty << AllOk ),
+ player_)</pre><p>You remember from the <span class="command"><strong><a class="command" href="ch03s04.html#eUML-build-state">BOOST_MSM_EUML_STATE </a></strong></span> and <span class="command"><strong><a class="command" href="ch03s04.html#eUML-build-sm">BOOST_MSM_EUML_DECLARE_STATE_MACHINE</a></strong></span> signatures that just
after attributes, we can define flags, like in the basic MSM front-end. To
- do this, we have another "shift-left" grammar, for example:</p><p><code class="code">BOOST_MSM_EUML_STATE((no_action,no_action, attributes_ <<
- no_attributes_, </code></p><p><code class="code">/* flags */ configure_<< PlayingPaused << CDLoaded
- ),Paused)</code></p><p>We now defined that Paused will get two flags, PlayingPaused and CDLoaded,
- defined, with another macro:</p><p><code class="code">BOOST_MSM_EUML_FLAG(CDLoaded)</code></p><p>This corresponds to the following basic front-end definition of
- Paused:</p><p><code class="code">struct Paused : public msm::front::state<> </code></p><p><code class="code">{ typedef mpl::vector2<PlayingPaused,CDLoaded> flag_list; };
- </code></p><p>Under the hood, what you get really is a mpl::vector2.</p><p><span class="underline">Note</span>: As we use the version of
+ do this, we have another "shift-left" grammar, for example:</p><pre class="programlisting">BOOST_MSM_EUML_STATE((no_action,no_action, attributes_ <<no_attributes_,
+ /* flags */ configure_<< PlayingPaused << CDLoaded),
+ Paused)</pre><p>We now defined that Paused will get two flags, PlayingPaused and CDLoaded,
+ defined, with another macro:</p><pre class="programlisting">BOOST_MSM_EUML_FLAG(CDLoaded)</pre><p>This corresponds to the following basic front-end definition of
+ Paused:</p><pre class="programlisting">struct Paused : public msm::front::state<>
+{
+ typedef mpl::vector2<PlayingPaused,CDLoaded> flag_list;
+};</pre><p>Under the hood, what you get really is a mpl::vector2.</p><p><span class="underline">Note</span>: As we use the version of
BOOST_MSM_EUML_STATE's expression with 4 arguments, we need to tell eUML
that we need no attributes. Similarly to a <code class="code">cout << endl</code>,
we need a <code class="code">attributes_ << no_attributes_</code> syntax.</p><p>You can use the flag with the is_flag_active method of a state machine.
You can also use the provided helper function is_flag_ (returning a bool)
for state and transition behaviors. For example, in the <a class="link" href="examples/iPodEuml.cpp" target="_top">iPod implementation with eUML</a>,
- you find the following transition:</p><p><code class="code">ForwardPressed == NoForward + EastPressed
- [!is_flag_(NoFastFwd)]</code></p><p>The function also has an optional second parameter which is the state
+ you find the following transition:</p><pre class="programlisting">ForwardPressed == NoForward + EastPressed[!is_flag_(NoFastFwd)]</pre><p>The function also has an optional second parameter which is the state
machine on which the function is called. By default, fsm_ is used (the
current state machine) but you could provide a functor returning a reference
to another state machine.</p><p>eUML also supports defining deferred events in the state (state machine)
- definition. To this aim, we can reuse the flag grammar. For example:</p><p><code class="code">BOOST_MSM_EUML_STATE((Empty_Entry,Empty_Exit, attributes_ <<
- no_attributes_, </code></p><p><code class="code">/* deferred */ configure_<< play ),Empty) </code></p><p>The configure_ left shift is also responsible for deferring events. Shift
+ definition. To this aim, we can reuse the flag grammar. For example:</p><pre class="programlisting">BOOST_MSM_EUML_STATE((Empty_Entry,Empty_Exit, attributes_ << no_attributes_,
+ /* deferred */ configure_<< play ),Empty) </pre><p>The configure_ left shift is also responsible for deferring events. Shift
inside configure_ a flag and the state will get a flag, shift an event and
it will get a deferred event. This replaces the basic front-end
- definition:</p><p><code class="code">typedef mpl::vector<play> deferred_events;</code></p><p>In <a class="link" href="examples/OrthogonalDeferredEuml.cpp" target="_top">this
+ definition:</p><pre class="programlisting">typedef mpl::vector<play> deferred_events;</pre><p>In <a class="link" href="examples/OrthogonalDeferredEuml.cpp" target="_top">this
tutorial</a>, player is defining a second orthogonal region with
AllOk as initial state. The <code class="code">Empty</code> and <code class="code">Open</code> states
also defer the event <code class="code">play</code>. <code class="code">Open</code>,
@@ -305,18 +326,22 @@
inside a transition, which makes possible conditional deferring. This is
also possible with eUML through the use of the defer_ order, as shown in
<a class="link" href="examples/OrthogonalDeferredEuml.cpp" target="_top">this
- tutorial</a>. You will find the following transition:</p><p><code class="code">Open + play / defer_</code></p><p>This is an <span class="command"><strong><a class="command" href="ch03s04.html#eUML-internal">internal
+ tutorial</a>. You will find the following transition:</p><pre class="programlisting">Open + play / defer_</pre><p>This is an <span class="command"><strong><a class="command" href="ch03s04.html#eUML-internal">internal
transition</a></strong></span>. Ignore it for the moment. Interesting is, that
when the event <code class="code">play</code> is fired and <code class="code">Open</code> is active,
the event will be deferred. Now add a guard and you can conditionally defer
- the event, for example:</p><p><code class="code">Open + play [ some_condition ] / defer_</code></p><p>This is similar to what we did with the functor front-end. This means that
+ the event, for example:</p><pre class="programlisting">Open + play [ some_condition ] / defer_</pre><p>This is similar to what we did with the functor front-end. This means that
we have the same constraints. Using defer_ instead of a state declaration,
we need to tell MSM that we have deferred events in this state machine. We
do this (again) using a configure_ declaration in the state machine
- definition in which we shift the deferred_events configuration flag:</p><p><code class="code">BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,init_
- << Empty << AllOk,</code></p><p><code class="code">Entry_Action, Exit_Action, attributes_ << no_attributes_,
- configure_<< deferred_events ),player_)</code></p><p>A <a class="link" href="examples/OrthogonalDeferredEuml2.cpp" target="_top">tutorial</a>
- illustrates this possibility.</p></div><div class="sect2" title="Customizing a state machine / Getting more speed"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3361"></a>
+ definition in which we shift the deferred_events configuration flag:</p><pre class="programlisting">BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,
+ init_ << Empty << AllOk,
+ Entry_Action,
+ Exit_Action,
+ attributes_ << no_attributes_,
+ configure_<< deferred_events ),
+ player_)</pre><p>A <a class="link" href="examples/OrthogonalDeferredEuml2.cpp" target="_top">tutorial</a>
+ illustrates this possibility.</p></div><div class="sect2" title="Customizing a state machine / Getting more speed"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3166"></a>
<span class="command"><strong><a name="eUML-Configuration"></a></strong></span>Customizing a state machine / Getting
more speed</h3></div></div></div><p>We just saw how to use configure_ to define deferred events or flags. We
can also use it to configure our state machine like we did with the other front-ends:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">configure_ << no_exception</code>: disables
@@ -325,22 +350,27 @@
enables event deferring</p></li></ul></div><p>Deactivating the first two features and not activating the third if not
needed greatly improves the event dispatching speed of your state machine.
Our <a class="link" href="examples/EumlSimple.cpp" target="_top">speed testing</a> example
- with eUML does this for the best performance.</p></div><div class="sect2" title="Completion / Anonymous transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3389"></a>Completion / Anonymous transitions</h3></div></div></div><p>Anonymous transitions (See <span class="command"><strong><a class="command" href="ch02s02.html#uml-anonymous">UML
+ with eUML does this for the best performance.</p></div><div class="sect2" title="Completion / Anonymous transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3194"></a>Completion / Anonymous transitions</h3></div></div></div><p>Anonymous transitions (See <span class="command"><strong><a class="command" href="ch02s02.html#uml-anonymous">UML
tutorial</a></strong></span>) are transitions without a named event, which are
therefore triggered immediately when the source state becomes active,
provided a guard allows it. As there is no event, to define such a
transition, simply omit the “+” part of the transition (the event), for
- example: </p><p><code class="code">State3 == State4 [always_true] / State3ToState4</code></p><p><code class="code">State4 [always_true] / State3ToState4 == State3</code></p><p>Please have a look at <a class="link" href="examples/AnonymousTutorialEuml.cpp" target="_top">this example</a>,
+ example: </p><pre class="programlisting">State3 == State4 [always_true] / State3ToState4
+State4 [always_true] / State3ToState4 == State3</pre><p>Please have a look at <a class="link" href="examples/AnonymousTutorialEuml.cpp" target="_top">this example</a>,
which implements the <span class="command"><strong><a class="command" href="ch03s02.html#anonymous-transitions">previously
- defined</a></strong></span> state machine with eUML.</p></div><div class="sect2" title="Internal transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3411"></a><span class="command"><strong><a name="eUML-internal"></a></strong></span>Internal transitions</h3></div></div></div><p>Like both other front-ends, eUML supports two ways of defining internal transitions:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>in the state machine's transition table. In this case, you
+ defined</a></strong></span> state machine with eUML.</p></div><div class="sect2" title="Internal transitions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3212"></a><span class="command"><strong><a name="eUML-internal"></a></strong></span>Internal transitions</h3></div></div></div><p>Like both other front-ends, eUML supports two ways of defining internal transitions:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>in the state machine's transition table. In this case, you
need to specify a source state, event, actions and guards but no
target state, which eUML will interpret as an internal
transition, for example this defines a transition internal to
- Open, on the event open_close:</p><p><code class="code">Open + open_close [internal_guard1] /
- internal_action1</code></p><p><a class="link" href="examples/EumlInternal.cpp" target="_top">A full
+ Open, on the event open_close:</p><pre class="programlisting">Open + open_close [internal_guard1] / internal_action1</pre><p><a class="link" href="examples/EumlInternal.cpp" target="_top">A full
example</a> is also provided.</p></li><li class="listitem"><p>in a state's <code class="code">internal_transition_table</code>. For
- example:</p><p><code class="code">BOOST_MSM_EUML_DECLARE_STATE((Open_Entry,Open_Exit),Open_def)</code></p><p><code class="code">struct Open_impl : public Open_def</code></p><p><code class="code">BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE((</code></p><p><code class="code">open_close [internal_guard1] /
- internal_action1</code></p><p><code class="code">))</code></p><p>Notice how we do not need to repeat that the transition
+ example:</p><pre class="programlisting">BOOST_MSM_EUML_DECLARE_STATE((Open_Entry,Open_Exit),Open_def)
+struct Open_impl : public Open_def
+{
+ BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE((
+ open_close [internal_guard1] / internal_action1
+ ))
+};</pre><p>Notice how we do not need to repeat that the transition
originates from Open as we already are in Open's context. </p><p>The <a class="link" href="examples/EumlInternalDistributed.cpp" target="_top">implementation</a> also shows the added bonus offered
for submachines, which can have both the standard
transition_table and an internal_transition_table (which has
@@ -349,7 +379,7 @@
the standard alternative, adding orthogonal regions, because
event dispatching will, if accepted by the internal table, not
continue to the subregions. This gives you a O(1) dispatch
- instead of O(number of regions).</p></li></ul></div></div><div class="sect2" title="Other state types"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3456"></a>Other state types</h3></div></div></div><p>We saw the <span class="command"><strong><a class="command" href="ch03s04.html#eUML-build-state">build_state</a></strong></span>
+ instead of O(number of regions).</p></li></ul></div></div><div class="sect2" title="Other state types"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3243"></a>Other state types</h3></div></div></div><p>We saw the <span class="command"><strong><a class="command" href="ch03s04.html#eUML-build-state">build_state</a></strong></span>
function, which creates a simple state. Likewise, eUML provides other
state-building macros for other types of states:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>BOOST_MSM_EUML_TERMINATE_STATE takes the same arguments as
BOOST_MSM_EUML_STATE and defines, well, a terminate
@@ -382,13 +412,14 @@
submachine.</p></li></ul></div><p>To use these states in the transition table, eUML offers the functions
<code class="code">explicit_</code>, <code class="code">exit_pt_</code> and
<code class="code">entry_pt_</code>. For example, a direct entry into the substate
- SubState2 from SubFsm2 could be:</p><p><code class="code">explicit_(SubFsm2,SubState2) == State1 + event2</code></p><p>Forks being a list on direct entries, eUML supports a logical syntax
- (state1, state2, ...), for example:</p><p><code class="code">(explicit_(SubFsm2,SubState2), explicit_(SubFsm2,SubState2b),
- explicit_(SubFsm2,SubState2c)) == State1 + event3 </code></p><p>An entry point is entered using the same syntax as explicit entries:
- <code class="code">entry_pt_(SubFsm2,PseudoEntry1) == State1 + event4</code></p><p>For exit points, it is again the same syntax except that exit points are
- used as source of the transition: <code class="code">State2 ==
- exit_pt_(SubFsm2,PseudoExit1) + event6 </code></p><p>The <a class="link" href="examples/DirectEntryEuml.cpp" target="_top">entry tutorial</a>
- is also available with eUML.</p></div><div class="sect2" title="Helper functions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3522"></a>Helper functions</h3></div></div></div><p>We saw a few helpers but there are more, so let us have a more complete description:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>event_ : used inside any action, the event triggering the
+ SubState2 from SubFsm2 could be:</p><pre class="programlisting">explicit_(SubFsm2,SubState2) == State1 + event2</pre><p>Forks being a list on direct entries, eUML supports a logical syntax
+ (state1, state2, ...), for example:</p><pre class="programlisting">(explicit_(SubFsm2,SubState2),
+ explicit_(SubFsm2,SubState2b),
+ explicit_(SubFsm2,SubState2c)) == State1 + event3 </pre><p>An entry point is entered using the same syntax as explicit entries:
+ </p><pre class="programlisting">entry_pt_(SubFsm2,PseudoEntry1) == State1 + event4</pre><p>For exit points, it is again the same syntax except that exit points are
+ used as source of the transition:
+ </p><pre class="programlisting">State2 == exit_pt_(SubFsm2,PseudoExit1) + event6 </pre><p>The <a class="link" href="examples/DirectEntryEuml.cpp" target="_top">entry tutorial</a>
+ is also available with eUML.</p></div><div class="sect2" title="Helper functions"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3307"></a>Helper functions</h3></div></div></div><p>We saw a few helpers but there are more, so let us have a more complete description:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>event_ : used inside any action, the event triggering the
transition</p></li><li class="listitem"><p>state_: used inside entry and exit actions, the entered /
exited state</p></li><li class="listitem"><p>source_: used inside a transition action, the source
state</p></li><li class="listitem"><p>target_: used inside a transition action, the target
@@ -412,10 +443,12 @@
is_flag_active on the current state machine or on the one passed
as 2nd argument</p></li><li class="listitem"><p>Predicate_<some predicate>: Used in STL algorithms. Wraps
unary/binary functions to make them eUML-compatible so that they
- can be used in STL algorithms</p></li></ul></div><p>This can be quite fun. For example, </p><p><code class="code">/( if_then_else_(--fsm_(m_SongIndex) > Int_<0>(),/*if
- clause*/</code></p><p><code class="code">show_playing_song(), /*then clause*/</code></p><p><code class="code">(fsm_(m_SongIndex)=Int_<1>(),process_(EndPlay())) /*else clause*/
- ) )</code> means:</p><p>if (fsm.SongIndex > 0, call show_playing_song else {fsm.SongIndex=1;
- process EndPlay on fsm;}</p><p>A few examples are using these features:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>the iPod example introduced at the BoostCon09 <a class="link" href="examples/iPodEuml.cpp" target="_top">has been rewritten</a>
+ can be used in STL algorithms</p></li></ul></div><p>This can be quite fun. For example, </p><pre class="programlisting">/( if_then_else_(--fsm_(m_SongIndex) > Int_<0>(),/*if clause*/
+ show_playing_song, /*then clause*/
+ (fsm_(m_SongIndex)=Int_<1>(),process_(EndPlay))/*else clause*/
+ )
+ )</pre><p>means: if (fsm.SongIndex > 0, call show_playing_song else
+ {fsm.SongIndex=1; process EndPlay on fsm;}</p><p>A few examples are using these features:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>the iPod example introduced at the BoostCon09 <a class="link" href="examples/iPodEuml.cpp" target="_top">has been rewritten</a>
with eUML (weak compilers please move on...)</p></li><li class="listitem"><p>the iPodSearch example also introduced at the BoostCon09 <a class="link" href="examples/iPodSearchEuml.cpp" target="_top">has been
rewritten</a> with eUML. In this example, you will also
find some examples of STL functor usage.</p></li><li class="listitem"><p><a class="link" href="examples/SimpleTimer.cpp" target="_top">A simpler
@@ -423,7 +456,7 @@
MSM_EUML_METHOD or MSM_EUML_FUNCTION will create a correct functor. Your own
eUML functors written as described at the beginning of this section will
also work well, <span class="underline">except</span>, for the
- moment, with the while_, if_then_, if_then_else_ functions.</p></div><div class="sect2" title="Phoenix-like STL support"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3627"></a>Phoenix-like STL support</h3></div></div></div><p>eUML supports most C++ operators (except address-of). For example it is
+ moment, with the while_, if_then_, if_then_else_ functions.</p></div><div class="sect2" title="Phoenix-like STL support"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3404"></a>Phoenix-like STL support</h3></div></div></div><p>eUML supports most C++ operators (except address-of). For example it is
possible to write event_(some_attribute)++ or [source_(some_bool) &&
fsm_(some_other_bool)]. But a programmer needs more than operators in his
daily programming. The STL is clearly a must have. Therefore, eUML comes in
@@ -438,9 +471,11 @@
lists all eUML functions and the underlying functor (so that this
possibility is not reserved to eUML but also to the functor-based
front-end). The file structure of this Phoenix-like library matches the one
- of Boost.Phoenix. All functors for STL algorithms are to be found in:</p><p><code class="code">#include <msm/front/euml/algorithm.hpp></code></p><p>The algorithms are also divided into sub-headers, matching the phoenix
- structure for simplicity:</p><p><code class="code">#include < msm/front/euml/iteration.hpp> </code></p><p><code class="code">#include < msm/front/euml/transformation.hpp> </code></p><p><code class="code">#include < msm/front/euml/querying.hpp> </code></p><p>Container methods can be found in:</p><p><code class="code">#include < msm/front/euml/container.hpp></code></p><p>Or one can simply include the whole STL support (you will also need to
- include euml.hpp):</p><p><code class="code">#include < msm/front/euml/stl.hpp></code></p><p>A few examples (to be found in <a class="link" href="examples/iPodSearchEuml.cpp" target="_top">this tutorial</a>):</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">push_back_(fsm_(m_tgt_container),event_(m_song))</code>:
+ of Boost.Phoenix. All functors for STL algorithms are to be found in:</p><pre class="programlisting">#include <msm/front/euml/algorithm.hpp></pre><p>The algorithms are also divided into sub-headers, matching the phoenix
+ structure for simplicity:</p><pre class="programlisting">#include < msm/front/euml/iteration.hpp>
+#include < msm/front/euml/transformation.hpp>
+#include < msm/front/euml/querying.hpp> </pre><p>Container methods can be found in:</p><pre class="programlisting">#include < msm/front/euml/container.hpp></pre><p>Or one can simply include the whole STL support (you will also need to
+ include euml.hpp):</p><pre class="programlisting">#include < msm/front/euml/stl.hpp></pre><p>A few examples (to be found in <a class="link" href="examples/iPodSearchEuml.cpp" target="_top">this tutorial</a>):</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">push_back_(fsm_(m_tgt_container),event_(m_song))</code>:
the state machine has an attribute m_tgt_container of type
std::vector<OneSong> and the event has an attribute m_song of
type OneSong. The line therefore pushes m_song at the end of
Modified: sandbox/msm/libs/msm/doc/HTML/ch03s05.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch03s05.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch03s05.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Back-end</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) V2.10"><link rel="up" href="ch03.html" title="Chapter 3. Tutorial"><link rel="prev" href="ch03s04.html" title="eUML (experimental)"><link rel="next" href="ch04.html" title="Chapter 4. Performance / Compilers"></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">Back-end</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Tutorial</th><td width="20%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Back-end"><div class="titlepage"><div><div><h2 class="title" style="clea
r: both"><a name="d0e3690"></a>Back-end</h2></div></div></div><p>There is, at the moment, one back-end. This back-end contains the library
+ <title>Back-end</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) V2.10"><link rel="up" href="ch03.html" title="Chapter 3. Tutorial"><link rel="prev" href="ch03s04.html" title="eUML (experimental)"><link rel="next" href="ch04.html" title="Chapter 4. Performance / Compilers"></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">Back-end</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Tutorial</th><td width="20%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Back-end"><div class="titlepage"><div><div><h2 class="title" style="clea
r: both"><a name="d0e3457"></a>Back-end</h2></div></div></div><p>There is, at the moment, one back-end. This back-end contains the library
engine and defines the performance and functionality trade-offs. The currently
available back-end implements most of the functionality defined by the UML 2.0
standard at very high runtime speed, in exchange for longer compile-time. The
@@ -8,19 +8,18 @@
capabilities allowing the framework to adapt itself to the features used by a
given concrete state machine. All unneeded features either disable themselves or
can be manually disabled. See section 5.1 for a complete description of the
- run-to-completion algorithm.</p><div class="sect2" title="Creation"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3695"></a>Creation </h3></div></div></div><p>MSM being divided between front and back-end, one needs to first define a
+ run-to-completion algorithm.</p><div class="sect2" title="Creation"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3462"></a>Creation </h3></div></div></div><p>MSM being divided between front and back-end, one needs to first define a
front-end. Then, to create a real state machine, the back-end must be
- declared: <code class="code">typedef msm::back::state_machine<my_front_end>
- my_fsm;</code>
- </p><p>We now have a fully functional state machine type. The next sections will
- describe what can be done with it.</p></div><div class="sect2" title="Starting a state machine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3705"></a><span class="command"><strong><a name="backend-start"></a></strong></span>Starting a state machine</h3></div></div></div><p>The <code class="code">start</code> method starts the state machine, meaning it will
+ declared:
+ </p><pre class="programlisting">typedef msm::back::state_machine<my_front_end> my_fsm;</pre><p>We now have a fully functional state machine type. The next sections will
+ describe what can be done with it.</p></div><div class="sect2" title="Starting a state machine"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3471"></a><span class="command"><strong><a name="backend-start"></a></strong></span>Starting a state machine</h3></div></div></div><p>The <code class="code">start</code> method starts the state machine, meaning it will
activate the initial state, which means in turn that the initial state's
entry behavior will be called. We need the start method because you do not
always want the entry behavior of the initial state to be called immediately
but only when your state machine is ready to process events. A good example
of this is when you use a state machine to write an algorithm and each loop
back to the initial state is an algorithm call. Each call to start will make
- the algorithm run once. The <a class="link" href="examples/iPodSearch.cpp" target="_top">iPodSearch</a> example uses this possibility.</p></div><div class="sect2" title="Event dispatching"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3717"></a>Event dispatching</h3></div></div></div><p>The main reason to exist for a state machine is to dispatch events. For
+ the algorithm run once. The <a class="link" href="examples/iPodSearch.cpp" target="_top">iPodSearch</a> example uses this possibility.</p></div><div class="sect2" title="Event dispatching"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3483"></a>Event dispatching</h3></div></div></div><p>The main reason to exist for a state machine is to dispatch events. For
MSM, events are objects of a given event type. The object itself can contain
data, but the event type is what decides of the transition to be taken. For
MSM, if some_event is a given type (a simple struct for example) and e1 and
@@ -29,15 +28,16 @@
you can use them inside actions. Events are dispatched as const reference,
so actions cannot modify events for obvious side-effect reasons. To dispatch
an event of type some_event, you can simply create one on the fly or
- instantiate if before processing: </p><p><code class="code">my_fsm fsm; fsm.process_event(some_event());</code></p><p><code class="code">some_event e1; fsm.process_event(e1)</code></p><p>Creating an event on the fly will be optimized by the compiler so the
- performance will not degrade.</p></div><div class="sect2" title="Active state(s)"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3730"></a>Active state(s)</h3></div></div></div><p>The backend also offers a way to know which state is active, though you
+ instantiate if before processing: </p><pre class="programlisting">my_fsm fsm; fsm.process_event(some_event());
+some_event e1; fsm.process_event(e1)</pre><p>Creating an event on the fly will be optimized by the compiler so the
+ performance will not degrade.</p></div><div class="sect2" title="Active state(s)"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3492"></a>Active state(s)</h3></div></div></div><p>The backend also offers a way to know which state is active, though you
will normally only need this for debugging purposes. If what you need simply
is doing something with the active state, <span class="command"><strong><a class="command" href="ch02s02.html#UML-internal-transition">internal transitions</a></strong></span> or
<span class="command"><strong><a class="command" href="ch03s05.html#backend-visitor">visitors</a></strong></span> are a better
alternative. If you need to know what state is active, const int*
current_state() will return an array of state ids. Please refer to the
<span class="command"><strong><a class="command" href="ch06s03.html#internals-state-id">internals section</a></strong></span> to
- know how state ids are generated.</p></div><div class="sect2" title="Base state type"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3744"></a><span class="command"><strong><a name="backend-base-state"></a></strong></span>Base state type </h3></div></div></div><p>Sometimes, one needs to customize states to avoid repetition and provide a
+ know how state ids are generated.</p></div><div class="sect2" title="Base state type"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3506"></a><span class="command"><strong><a name="backend-base-state"></a></strong></span>Base state type </h3></div></div></div><p>Sometimes, one needs to customize states to avoid repetition and provide a
common functionality, for example in the form of a virtual method. You might
also want to make your states polymorphic so that you can call typeid on
them for logging or debugging. It is also useful if you need a visitor, like
@@ -49,20 +49,18 @@
interrupt_states for which it is the second argument, the first
one being the event ending the interrupt), for example,
my_base_state being your new base state for all states in a
- given state machine: <code class="code">struct Empty : public
- msm::front::state<my_base_state></code> Now,
- my_base_state is your new base state. If it has a virtual
+ given state machine:
+ </p><pre class="programlisting">struct Empty : public msm::front::state<my_base_state></pre><p>
+ Now, my_base_state is your new base state. If it has a virtual
function, your states become polymorphic. MSM also provides a
default polymorphic base type,
<code class="code">msm::front::polymorphic_state</code>
</p></li><li class="listitem"><p>Add the user-defined base state in the state machine frontend
definition, as a second template argument, for example:
- <code class="code">struct player_ : public
- msm::front::state_machine<player_,my_base_state>
- </code></p></li></ul></div><p>You can also ask for a state with a given id (which you might have gotten
+ </p><pre class="programlisting">struct player_ : public msm::front::state_machine<player_,my_base_state> </pre></li></ul></div><p>You can also ask for a state with a given id (which you might have gotten
from current_state()) using <code class="code">const base_state* get_state_by_id(int id)
const</code> where base_state is the one you just defined. You can now
- do something polymorphically.</p></div><div class="sect2" title="Visitor"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3770"></a><span class="command"><strong><a name="backend-visitor"></a></strong></span>Visitor</h3></div></div></div><p>In some cases, having a pointer-to-base of the currently active states is
+ do something polymorphically.</p></div><div class="sect2" title="Visitor"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3532"></a><span class="command"><strong><a name="backend-visitor"></a></strong></span>Visitor</h3></div></div></div><p>In some cases, having a pointer-to-base of the currently active states is
not enough. You might want to call non-virtually a method of the currently
active states. It will not be said that MSM forces the virtual keyword down
your throat!</p><p>To achieve this goal, MSM provides its own variation of a visitor pattern
@@ -73,40 +71,54 @@
to be called on the currently active states. Typically, you will also want
to provide an empty default accept in your base state in order in order not
to force all your states to implement accept. For example your base state
- could be:</p><p><code class="code">struct my_visitable_state{</code></p><p><code class="code">// signature of the accept function</code></p><p><code class="code">typedef args<void> accept_sig;</code></p><p><code class="code">// we also want polymorphic states</code></p><p><code class="code">virtual ~my_visitable_state() {}</code></p><p><code class="code">// default implementation for states who do not need to be
- visited</code></p><p><code class="code">void accept() const {}</code></p><p><code class="code">};</code></p><p>This makes your states polymorphic and visitable. In this case, accept is
- made const and takes no argument. It could also be:</p><p><code class="code">struct SomeVisitor {…};</code></p><p><code class="code">struct my_visitable_state{</code></p><p><code class="code">// signature of the accept function</code></p><p><code class="code">typedef args<void,SomeVisitor&> accept_sig;</code></p><p><code class="code">// we also want polymorphic states</code></p><p><code class="code">virtual ~my_visitable_state() {}</code></p><p><code class="code">// default implementation for states who do not need to be
- visited</code></p><p><code class="code">void accept(SomeVisitor&) const {}</code></p><p><code class="code">};</code></p><p>And now, <code class="code">accept</code> will take one argument (it could also be
+ could be:</p><pre class="programlisting">struct my_visitable_state
+{
+ // signature of the accept function
+ typedef args<void> accept_sig;
+ // we also want polymorphic states
+ virtual ~my_visitable_state() {}
+ // default implementation for states who do not need to be visited
+ void accept() const {}
+};</pre><p>This makes your states polymorphic and visitable. In this case, accept is
+ made const and takes no argument. It could also be:</p><pre class="programlisting">struct SomeVisitor {…};
+struct my_visitable_state
+{
+ // signature of the accept function
+ typedef args<void,SomeVisitor&> accept_sig;
+ // we also want polymorphic states
+ virtual ~my_visitable_state() {}
+ // default implementation for states who do not need to be visited
+ void accept(SomeVisitor&) const {}
+};</pre><p>And now, <code class="code">accept</code> will take one argument (it could also be
non-const). By default, <code class="code">accept</code> takes up to 2 arguments. To get
more, set #define BOOST_MSM_VISITOR_ARG_SIZE to another value before
- including state_machine.hpp. For example:</p><p><code class="code">#define BOOST_MSM_VISITOR_ARG_SIZE 3</code></p><p><code class="code">#include <boost/msm/back/state_machine.hpp></code></p><p>Note that accept will be called on ALL active states <span class="underline">and also automatically on sub-states of a
+ including state_machine.hpp. For example:</p><pre class="programlisting">#define BOOST_MSM_VISITOR_ARG_SIZE 3
+#include <boost/msm/back/state_machine.hpp></pre><p>Note that accept will be called on ALL active states <span class="underline">and also automatically on sub-states of a
submachine</span>.</p><p><span class="underline">Important warning</span>: The method
visit_current_states takes its parameter by value, so if the signature of
the accept function is to contain a parameter passed by reference, pass this
parameter with a boost:ref/cref to avoid undesired copies or slicing. So,
- for example, in the above case, call:</p><p><code class="code">SomeVisitor vis; sm.visit_current_states(boost::ref(vis));
- </code></p><p>This <a class="link" href="examples/SM-2Arg.cpp" target="_top">example</a> uses a
- visiting function with 2 arguments.</p></div><div class="sect2" title="Flags"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3865"></a>Flags</h3></div></div></div><p>Flags is a MSM-only concept, supported by all front-ends, which base
- themselves on the functions: </p><p><code class="code">template <class Flag> bool is_flag_active()</code> and</p><p><code class="code">template <class Flag,class BinaryOp> bool is_flag_active()</code>
- </p><p>These functions return true if the currently active state(s) support the
+ for example, in the above case, call:</p><pre class="programlisting">SomeVisitor vis; sm.visit_current_states(boost::ref(vis));</pre><p>This <a class="link" href="examples/SM-2Arg.cpp" target="_top">example</a> uses a
+ visiting function with 2 arguments.</p></div><div class="sect2" title="Flags"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3575"></a>Flags</h3></div></div></div><p>Flags is a MSM-only concept, supported by all front-ends, which base
+ themselves on the functions: </p><pre class="programlisting">template <class Flag> bool is_flag_active()
+template <class Flag,class BinaryOp> bool is_flag_active()</pre><p>These functions return true if the currently active state(s) support the
Flag property. The first variant ORs the result if there are several
- orthogonal regions, the second one expects OR or AND, for example:</p><p><code class="code">my_fsm.is_flag_active<MyFlag>()</code></p><p><code class="code">my_fsm.is_flag_active<MyFlag,my_fsm_type::Flag_OR>()</code></p><p>Please refer to the front-ends sections for usage examples.</p></div><div class="sect2" title="Getting a state"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3888"></a>Getting a state</h3></div></div></div><p>It is sometimes necessary to have the client code get access to the
+ orthogonal regions, the second one expects OR or AND, for example:</p><pre class="programlisting">my_fsm.is_flag_active<MyFlag>()
+my_fsm.is_flag_active<MyFlag,my_fsm_type::Flag_OR>()</pre><p>Please refer to the front-ends sections for usage examples.</p></div><div class="sect2" title="Getting a state"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3588"></a>Getting a state</h3></div></div></div><p>It is sometimes necessary to have the client code get access to the
states' data. After all, the states are created once for good and hang
around as long as the state machine does so why not use it? You simply just
need sometimes to get information about any state, even inactive ones. An
example is if you want to write a coverage tool and know how many times a
state was visited. To get a state, use the get_state method giving the state
- name, for example: </p><p><code class="code">player::Stopped* tempstate =
- p.get_state<player::Stopped*>();</code> or </p><p><code class="code">player::Stopped& tempstate2 =
- p.get_state<player::Stopped&>();</code> depending on your
- personal taste. </p></div><div class="sect2" title="State machine constructor with arguments"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3901"></a> State machine constructor with arguments </h3></div></div></div><p>You might want to define a state machine with a non-default constructor.
- For example, you might want to write: </p><p><code class="code">struct player_ : public msm::front::state_machine_def<player_> {
- player_(int some_value){…} } </code></p><p>This is possible, using the back-end as forwarding object: </p><p><code class="code">typedef msm::back::state_machine<player_ > player; player
- p(3);</code> The back-end will call the corresponding front-end
- constructor upon creation.</p><p>You can pass arguments up to the value of the
+ name, for example: </p><pre class="programlisting">player::Stopped* tempstate = p.get_state<player::Stopped*>();</pre><p> or </p><pre class="programlisting">player::Stopped& tempstate2 = p.get_state<player::Stopped&>();</pre><p>depending on your personal taste. </p></div><div class="sect2" title="State machine constructor with arguments"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3601"></a> State machine constructor with arguments </h3></div></div></div><p>You might want to define a state machine with a non-default constructor.
+ For example, you might want to write: </p><pre class="programlisting">struct player_ : public msm::front::state_machine_def<player_>
+{
+ player_(int some_value){…}
+}; </pre><p>This is possible, using the back-end as forwarding object: </p><pre class="programlisting">typedef msm::back::state_machine<player_ > player; player p(3);</pre><p>The back-end will call the corresponding front-end constructor upon
+ creation.</p><p>You can pass arguments up to the value of the
BOOST_MSM_CONSTRUCTOR_ARG_SIZE macro (currently 5) arguments. Change this
value before including any header if you need to overwrite the default.
- </p></div><div class="sect2" title="Trading run-time speed for better compile-time / multi-TU compilation"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3917"></a><span class="command"><strong><a name="backend-tradeof-rt-ct"></a></strong></span>Trading run-time speed for
+ </p></div><div class="sect2" title="Trading run-time speed for better compile-time / multi-TU compilation"><div class="titlepage"><div><div><h3 class="title"><a name="d0e3616"></a><span class="command"><strong><a name="backend-tradeof-rt-ct"></a></strong></span>Trading run-time speed for
better compile-time / multi-TU compilation</h3></div></div></div><p>MSM is optimized for run-time speed at the cost of longer compile-time.
This can become a problem with older compilers and big state machines,
especially if you don't really care about run-time speed that much and would
@@ -124,7 +136,8 @@
includes
<code class="code"><msm/back/favor_compile_time.hpp></code></p></li><li class="listitem"><p>add for each submachine a cpp file including your header and
calling a macro, which generates helper code, for
- example:</p><p><code class="code">#include "mysubmachine.hpp"</code></p><p><code class="code">BOOST_MSM_BACK_GENERATE_PROCESS_EVENT(mysubmachine)</code></p></li><li class="listitem"><p>configure your compiler for multi-core compilation</p></li></ul></div><p>You will now compile your state machine on as many cores as you have
+ example:</p><pre class="programlisting">#include "mysubmachine.hpp"
+BOOST_MSM_BACK_GENERATE_PROCESS_EVENT(mysubmachine)</pre></li><li class="listitem"><p>configure your compiler for multi-core compilation</p></li></ul></div><p>You will now compile your state machine on as many cores as you have
submachines, which will greatly speed up the compilation if you factor your
state machine into smaller submachines.</p><p>Independently, transition conflicts resolution will also be much
faster.</p><p>This policy uses boost.any behind the hood, which means that we will lose
Modified: sandbox/msm/libs/msm/doc/HTML/ch04.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch04.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch04.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Chapter 4. Performance / Compilers</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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch03s05.html" title="Back-end"><link rel="next" href="ch04s02.html" title="Executable size"></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 4. Performance / Compilers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch04s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 4. Performan
ce / Compilers"><div class="titlepage"><div><div><h2 class="title"><a name="d0e4003"></a>Chapter 4. Performance / Compilers</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">Speed</span></dt><dt><span class="sect1">Executable size</span></dt><dt><span class="sect1">Supported compilers</span></dt><dt><span class="sect1"> Limitations </span></dt><dt><span class="sect1"> Compilers corner </span></dt></dl></div><p>Tests were made on different PCs running Windows XP and Vista and compiled with
+ <title>Chapter 4. Performance / Compilers</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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch03s05.html" title="Back-end"><link rel="next" href="ch04s02.html" title="Executable size"></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 4. Performance / Compilers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch04s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 4. Performan
ce / Compilers"><div class="titlepage"><div><div><h2 class="title"><a name="d0e3698"></a>Chapter 4. Performance / Compilers</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">Speed</span></dt><dt><span class="sect1">Executable size</span></dt><dt><span class="sect1">Supported compilers</span></dt><dt><span class="sect1"> Limitations </span></dt><dt><span class="sect1"> Compilers corner </span></dt></dl></div><p>Tests were made on different PCs running Windows XP and Vista and compiled with
VC9 SP1 or Ubuntu and compiled with g++ 4.2 and 4.3. For these tests, the same
player state machine was written using Boost.Statechart, as a <a class="link" href="examples/SC Simple.cpp" target="_top">state machine with only simple states</a>
and as a <a class="link" href="examples/SC Composite.cpp" target="_top">state machine with a composite
@@ -9,5 +9,5 @@
the simple one also with <a class="link" href="examples/MsmSimpleFunctors.cpp" target="_top">functors</a> and with <a class="link" href="examples/EumlSimple.cpp" target="_top">eUML</a>. As these simple machines need no terminate/interrupt states, no
message queue and have no-throw guarantee on their actions, the MSM state machines
are defined with minimum functionality. Test machine is a Q6600 2.4GHz, Vista
- 64.</p><div class="sect1" title="Speed"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4025"></a>Speed</h2></div></div></div><p>VC9:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>The simple test completes 90 times faster with MSM than with
+ 64.</p><div class="sect1" title="Speed"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3720"></a>Speed</h2></div></div></div><p>VC9:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>The simple test completes 90 times faster with MSM than with
Boost.Statechart</p></li><li class="listitem"><p>The composite test completes 25 times faster with MSM</p></li></ul></div><p>gcc 4.2.3 (Ubuntu 8.04 in VMWare, same PC):</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>The simple test completes 46 times faster with MSM</p></li><li class="listitem"><p>The composite test completes 19 times faster with Msm</p></li></ul></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Back-end </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Executable size</td></tr></table></div>
</body></html>
\ No newline at end of file
Modified: sandbox/msm/libs/msm/doc/HTML/ch04s02.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch04s02.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch04s02.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Executable size</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) V2.10"><link rel="up" href="ch04.html" title="Chapter 4. Performance / Compilers"><link rel="prev" href="ch04.html" title="Chapter 4. Performance / Compilers"><link rel="next" href="ch04s03.html" title="Supported compilers"></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">Executable size</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Performance / Compilers</th><td width="20%" align="right"> <a accesskey="n" href="ch04s03.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Executable size"><div clas
s="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4046"></a>Executable size</h2></div></div></div><p>There are some worries that MSM generates huge code. Is it true? The 2
+ <title>Executable size</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) V2.10"><link rel="up" href="ch04.html" title="Chapter 4. Performance / Compilers"><link rel="prev" href="ch04.html" title="Chapter 4. Performance / Compilers"><link rel="next" href="ch04s03.html" title="Supported compilers"></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">Executable size</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Performance / Compilers</th><td width="20%" align="right"> <a accesskey="n" href="ch04s03.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Executable size"><div clas
s="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3741"></a>Executable size</h2></div></div></div><p>There are some worries that MSM generates huge code. Is it true? The 2
compilers I tested disagree with this claim. On VC9, the test state machines
used in the performance section produce executables of 14kB (for simple and
eUML) and 21kB (for the composite). This includes the test code and iostreams.
Modified: sandbox/msm/libs/msm/doc/HTML/ch04s03.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch04s03.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch04s03.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Supported compilers</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) V2.10"><link rel="up" href="ch04.html" title="Chapter 4. Performance / Compilers"><link rel="prev" href="ch04s02.html" title="Executable size"><link rel="next" href="ch04s04.html" title="Limitations"></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">Supported compilers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Performance / Compilers</th><td width="20%" align="right"> <a accesskey="n" href="ch04s04.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Supported compilers"><div class="titlepage"><div><
div><h2 class="title" style="clear: both"><a name="d0e4051"></a>Supported compilers</h2></div></div></div><p> MSM was successfully tested with: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>VC8 (please read further), VC9SP1, VC10 Beta 1 and 2</p></li><li class="listitem"><p>g++ 4.1 and higher</p></li><li class="listitem"><p>Green Hills Software MULTI for ARM v5.0.5 patch 4416 (Simple and
+ <title>Supported compilers</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) V2.10"><link rel="up" href="ch04.html" title="Chapter 4. Performance / Compilers"><link rel="prev" href="ch04s02.html" title="Executable size"><link rel="next" href="ch04s04.html" title="Limitations"></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">Supported compilers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Performance / Compilers</th><td width="20%" align="right"> <a accesskey="n" href="ch04s04.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Supported compilers"><div class="titlepage"><div><
div><h2 class="title" style="clear: both"><a name="d0e3746"></a>Supported compilers</h2></div></div></div><p> MSM was successfully tested with: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>VC8 (please read further), VC9SP1, VC10 Beta 1 and 2</p></li><li class="listitem"><p>g++ 4.1 and higher</p></li><li class="listitem"><p>Green Hills Software MULTI for ARM v5.0.5 patch 4416 (Simple and
Composite tutorials)</p></li></ul></div><p> eUML will only work with: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>VC8 (partly). You cannot, however use any overloaded function
(like splice) and compile times and RAM consumption explode</p></li><li class="listitem"><p>VC9SP1, VC10 Beta1-2</p></li><li class="listitem"><p>g++ 4.3 and higher (previous versions lack native typeof
support)</p></li></ul></div><p>VC8 and to some lesser extent VC9 suffer from a bug. Enabling the option
Modified: sandbox/msm/libs/msm/doc/HTML/ch04s04.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch04s04.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch04s04.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Limitations</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) V2.10"><link rel="up" href="ch04.html" title="Chapter 4. Performance / Compilers"><link rel="prev" href="ch04s03.html" title="Supported compilers"><link rel="next" href="ch04s05.html" title="Compilers corner"></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"> Limitations </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Performance / Compilers</th><td width="20%" align="right"> <a accesskey="n" href="ch04s05.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Limitations"><div class="titlepage"><div><div><h2 class
="title" style="clear: both"><a name="d0e4080"></a> Limitations </h2></div></div></div><p>
+ <title>Limitations</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) V2.10"><link rel="up" href="ch04.html" title="Chapter 4. Performance / Compilers"><link rel="prev" href="ch04s03.html" title="Supported compilers"><link rel="next" href="ch04s05.html" title="Compilers corner"></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"> Limitations </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Performance / Compilers</th><td width="20%" align="right"> <a accesskey="n" href="ch04s05.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Limitations"><div class="titlepage"><div><div><h2 class
="title" style="clear: both"><a name="d0e3775"></a> Limitations </h2></div></div></div><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Compilation times of state machines with > 80 transitions that are
going to make you storm the CFO's office and make sure you get a
shiny octocore with 12GB RAM by next week, unless he's interested in
Modified: sandbox/msm/libs/msm/doc/HTML/ch04s05.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch04s05.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch04s05.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,14 +1,19 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Compilers corner</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) V2.10"><link rel="up" href="ch04.html" title="Chapter 4. Performance / Compilers"><link rel="prev" href="ch04s04.html" title="Limitations"><link rel="next" href="ch05.html" title="Chapter 5. Questions & Answers"></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"> Compilers corner </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Performance / Compilers</th><td width="20%" align="right"> <a accesskey="n" href="ch05.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Compilers corner"><div class="t
itlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4096"></a> Compilers corner </h2></div></div></div><p>Compilers are sometimes full of surprises and such strange errors happened in
+ <title>Compilers corner</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) V2.10"><link rel="up" href="ch04.html" title="Chapter 4. Performance / Compilers"><link rel="prev" href="ch04s04.html" title="Limitations"><link rel="next" href="ch05.html" title="Chapter 5. Questions & Answers"></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"> Compilers corner </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Performance / Compilers</th><td width="20%" align="right"> <a accesskey="n" href="ch05.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Compilers corner"><div class="t
itlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3791"></a> Compilers corner </h2></div></div></div><p>Compilers are sometimes full of surprises and such strange errors happened in
the course of the development that I wanted to list the most fun for readers’
- entertainment.</p><p><span class="underline">VC8</span>: </p><p><code class="code">template <class StateType> </code></p><p><code class="code">typename ::boost::enable_if< </code></p><p><code class="code">typename ::boost::mpl::and_<</code></p><p><code class="code">typename ::boost::mpl::not_<typename
- has_exit_pseudo_states<StateType>::type>::type, </code></p><p><code class="code">typename ::boost::mpl::not_<typename
- is_pseudo_exit<StateType>::type>::type >::type,BaseState*>::type
- </code></p><p>I get the following error:</p><p>error C2770: invalid explicit template argument(s) for '`global
- namespace'::boost::enable_if<is_pseudo_exit<StateType>::type,BaseState*>::type
- boost::msm::state_machine<Derived,HistoryPolicy,BaseState>::add_state<ContainingSM>::new_state_helper(boost::msm::dummy<__formal>)
- const' </p><p>If I now remove the first “::” in ::boost::mpl , the compiler shuts up. So in
+ entertainment.</p><p><span class="underline">VC8</span>: </p><pre class="programlisting">template <class StateType>
+typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::not_<
+ typename has_exit_pseudo_states<StateType>::type
+ >::type,
+ typename ::boost::mpl::not_<
+ typename is_pseudo_exit<StateType>::type
+ >::type
+ >::type,
+ BaseState*>::type </pre><p>I get the following error:</p><p>error C2770: invalid explicit template argument(s) for '`global
+ namespace'::boost::enable_if<...>::...' </p><p>If I now remove the first “::” in ::boost::mpl , the compiler shuts up. So in
this case, it is not possible to follow Boost’s guidelines.</p><p><span class="underline">VC9</span>:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>This one is my all times’ favorite. Do you know why the exit
pseudo states are referenced in the transition table with a
“submachine::exit_pt” ? Because “exit” will crash the compiler.
Modified: sandbox/msm/libs/msm/doc/HTML/ch05.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch05.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch05.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Chapter 5. Questions & Answers</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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch04s05.html" title="Compilers corner"><link rel="next" href="ch06.html" title="Chapter 6. Internals"></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 5. Questions & Answers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s05.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch06.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 5.&
nbsp;Questions & Answers"><div class="titlepage"><div><div><h2 class="title"><a name="d0e4159"></a>Chapter 5. Questions & Answers</h2></div></div></div><p><span class="underline">Question</span>: on_entry gets as argument, the
+ <title>Chapter 5. Questions & Answers</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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch04s05.html" title="Compilers corner"><link rel="next" href="ch06.html" title="Chapter 6. Internals"></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 5. Questions & Answers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s05.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch06.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 5.&
nbsp;Questions & Answers"><div class="titlepage"><div><div><h2 class="title"><a name="d0e3841"></a>Chapter 5. Questions & Answers</h2></div></div></div><p><span class="underline">Question</span>: on_entry gets as argument, the
sent event. What event do I get when the state becomes default-activated (because it
is an initial state)?</p><p>
<span class="underline">Answer</span>: To allow you to know that the state
@@ -17,8 +17,9 @@
Row, it could mean that you forgot a "none". </p><p><span class="underline">Question</span>: Why do I get a very long compile
error when I define more than 20 rows in the transition table? </p><p><span class="underline">Answer</span>: MSM uses Boost.MPL under the hood
and this is the default maximum size. Please define the following 3 macros before
- including any MSM headers: </p><p><code class="code">#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS </code></p><p><code class="code">#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 // or whatever you need
- </code></p><p><code class="code">#define BOOST_MPL_LIMIT_MAP_SIZE 30 // or whatever you need </code></p><p><span class="underline">Question</span>: Why do I get this error: ”error
+ including any MSM headers: </p><pre class="programlisting">#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 // or whatever you need
+#define BOOST_MPL_LIMIT_MAP_SIZE 30 // or whatever you need </pre><p><span class="underline">Question</span>: Why do I get this error: ”error
C2977: 'boost::mpl::vector' : too many template arguments”? </p><p><span class="underline">Answer</span>: The first possibility is that you
defined a transition table as, say, vector17 and have 18 entries. The second is that
you have 17 entries and have a composite state. Under the hood, MSM adds a row for
@@ -28,4 +29,4 @@
a mpl/map60/70….hpp </p><p><span class="underline">Question</span>: Why do I get a very long compile
error when I define more than 10 states in a state machine? </p><p><span class="underline">Answer</span>: MSM uses Boost.Fusion under the hood
and this is the default maximum size. Please define the following macro before
- including any MSM headers: </p><p><code class="code">#define FUSION_MAX_VECTOR_SIZE 20 // or whatever you need </code></p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> Compilers corner </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. Internals</td></tr></table></div></body></html>
\ No newline at end of file
+ including any MSM headers: </p><pre class="programlisting">#define FUSION_MAX_VECTOR_SIZE 20 // or whatever you need </pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> Compilers corner </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. Internals</td></tr></table></div></body></html>
\ No newline at end of file
Modified: sandbox/msm/libs/msm/doc/HTML/ch06.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch06.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch06.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,9 +1,9 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Chapter 6. Internals</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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch05.html" title="Chapter 5. Questions & Answers"><link rel="next" href="ch06s02.html" title="Frontend / Backend interface"></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 6. Internals</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch06s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 6.&nb
sp;Internals"><div class="titlepage"><div><div><h2 class="title"><a name="d0e4231"></a>Chapter 6. Internals</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">Backend: Run To Completion</span></dt><dt><span class="sect1"><a href="ch06s02.html">Frontend / Backend
+ <title>Chapter 6. Internals</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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch05.html" title="Chapter 5. Questions & Answers"><link rel="next" href="ch06s02.html" title="Frontend / Backend interface"></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 6. Internals</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch06s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 6.&nb
sp;Internals"><div class="titlepage"><div><div><h2 class="title"><a name="d0e3905"></a>Chapter 6. Internals</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">Backend: Run To Completion</span></dt><dt><span class="sect1"><a href="ch06s02.html">Frontend / Backend
interface</a></span></dt><dt><span class="sect1"> Generated state ids </span></dt><dt><span class="sect1">Metaprogramming tools</span></dt></dl></div><p>This chapter describes the internal machinery of the back-end, which can be useful
for UML experts but can be safely ignored for most users. For implementers, the
- interface between front- and back- end is also described in detail.</p><div class="sect1" title="Backend: Run To Completion"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4236"></a><span class="command"><strong><a name="run-to-completion"></a></strong></span>Backend: Run To Completion</h2></div></div></div><p>The back-end implements the following run-to completion algorithm:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Check if one region of the concrete state machine is in a
+ interface between front- and back- end is also described in detail.</p><div class="sect1" title="Backend: Run To Completion"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3910"></a><span class="command"><strong><a name="run-to-completion"></a></strong></span>Backend: Run To Completion</h2></div></div></div><p>The back-end implements the following run-to completion algorithm:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Check if one region of the concrete state machine is in a
terminate or interrupt state. If yes, event processing is disabled
while the condition lasts (forever for a terminate pseudo-state,
while active for an interrupt pseudo-state).</p></li><li class="listitem"><p>If the message queue feature is enabled and if the state machine
Modified: sandbox/msm/libs/msm/doc/HTML/ch06s02.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch06s02.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch06s02.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,7 +1,7 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Frontend / Backend interface</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) V2.10"><link rel="up" href="ch06.html" title="Chapter 6. Internals"><link rel="prev" href="ch06.html" title="Chapter 6. Internals"><link rel="next" href="ch06s03.html" title="Generated state ids"></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">Frontend / Backend
- interface</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Internals</th><td width="20%" align="right"> <a accesskey="n" href="ch06s03.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Frontend / Backend interface"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4302"></a><span class="command"><strong><a name="internals-front-back-interface"></a></strong></span>Frontend / Backend
+ interface</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Internals</th><td width="20%" align="right"> <a accesskey="n" href="ch06s03.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Frontend / Backend interface"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3976"></a><span class="command"><strong><a name="internals-front-back-interface"></a></strong></span>Frontend / Backend
interface</h2></div></div></div><p>The design of MSM tries to make front-ends and back-ends (later) to be as
interchangeable as possible. Of course, no back-end will ever implement every
feature defined by any possible front-end and inversely, but the goal is to make
Modified: sandbox/msm/libs/msm/doc/HTML/ch06s03.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch06s03.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch06s03.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Generated state ids</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) V2.10"><link rel="up" href="ch06.html" title="Chapter 6. Internals"><link rel="prev" href="ch06s02.html" title="Frontend / Backend interface"><link rel="next" href="ch06s04.html" title="Metaprogramming tools"></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"> Generated state ids </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s02.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Internals</th><td width="20%" align="right"> <a accesskey="n" href="ch06s04.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Generated state ids"><div class="titlepage"><div><div><
h2 class="title" style="clear: both"><a name="d0e4480"></a><span class="command"><strong><a name="internals-state-id"></a></strong></span> Generated state ids </h2></div></div></div><p>Normally, one does not need to know the ids are generated for all the states
+ <title>Generated state ids</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) V2.10"><link rel="up" href="ch06.html" title="Chapter 6. Internals"><link rel="prev" href="ch06s02.html" title="Frontend / Backend interface"><link rel="next" href="ch06s04.html" title="Metaprogramming tools"></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"> Generated state ids </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s02.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Internals</th><td width="20%" align="right"> <a accesskey="n" href="ch06s04.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Generated state ids"><div class="titlepage"><div><div><
h2 class="title" style="clear: both"><a name="d0e4154"></a><span class="command"><strong><a name="internals-state-id"></a></strong></span> Generated state ids </h2></div></div></div><p>Normally, one does not need to know the ids are generated for all the states
of a state machine, unless for debugging purposes, like the pstate function does
in the tutorials in order to display the name of the current state. This section
will show how to automatically display typeid-generated names, but these are not
Modified: sandbox/msm/libs/msm/doc/HTML/ch06s04.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch06s04.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch06s04.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Metaprogramming tools</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) V2.10"><link rel="up" href="ch06.html" title="Chapter 6. Internals"><link rel="prev" href="ch06s03.html" title="Generated state ids"><link rel="next" href="ch07.html" title="Chapter 7. Acknowledgements"></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">Metaprogramming tools</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s03.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Internals</th><td width="20%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Metaprogramming tools"><div class="titlepage"><div><
div><h2 class="title" style="clear: both"><a name="d0e4492"></a>Metaprogramming tools</h2></div></div></div><p>We can find for the transition table more uses than what we have seen so far.
+ <title>Metaprogramming tools</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) V2.10"><link rel="up" href="ch06.html" title="Chapter 6. Internals"><link rel="prev" href="ch06s03.html" title="Generated state ids"><link rel="next" href="ch07.html" title="Chapter 7. Acknowledgements"></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">Metaprogramming tools</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s03.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Internals</th><td width="20%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Metaprogramming tools"><div class="titlepage"><div><
div><h2 class="title" style="clear: both"><a name="d0e4166"></a>Metaprogramming tools</h2></div></div></div><p>We can find for the transition table more uses than what we have seen so far.
Let's suppose you need to write a coverage tool. A state machine would be
perfect for such a job, if only it could provide some information about its
structure. Thanks to the transition table and Boost.MPL, it does.</p><p>What is needed for a coverage tool? You need to know how many states are
Modified: sandbox/msm/libs/msm/doc/HTML/ch07.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch07.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch07.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Chapter 7. Acknowledgements</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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch06s04.html" title="Metaprogramming tools"><link rel="next" href="ch07s02.html" title="MSM v1"></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 7. Acknowledgements</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s04.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch07s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 7. Acknowledgements"><div
class="titlepage"><div><div><h2 class="title"><a name="d0e4526"></a>Chapter 7. Acknowledgements</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">MSM v2</span></dt><dt><span class="sect1"> MSM v1</span></dt></dl></div><p>I am in debt to the following people who helped MSM along the way.</p><div class="sect1" title="MSM v2"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4531"></a>MSM v2</h2></div></div></div><p>
+ <title>Chapter 7. Acknowledgements</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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch06s04.html" title="Metaprogramming tools"><link rel="next" href="ch07s02.html" title="MSM v1"></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 7. Acknowledgements</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s04.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="ch07s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 7. Acknowledgements"><div
class="titlepage"><div><div><h2 class="title"><a name="d0e4200"></a>Chapter 7. Acknowledgements</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">MSM v2</span></dt><dt><span class="sect1"> MSM v1</span></dt></dl></div><p>I am in debt to the following people who helped MSM along the way.</p><div class="sect1" title="MSM v2"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4205"></a>MSM v2</h2></div></div></div><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Thanks to Dave Abrahams for managing the review</p></li><li class="listitem"><p>Thanks to Eric Niebler for his patience correcting my grammar
errors</p></li><li class="listitem"><p>Special thanks to Joel de Guzman who gave me very good ideas at
the BoostCon09. These ideas were the starting point of the redesign.
Modified: sandbox/msm/libs/msm/doc/HTML/ch07s02.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch07s02.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch07s02.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>MSM v1</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) V2.10"><link rel="up" href="ch07.html" title="Chapter 7. Acknowledgements"><link rel="prev" href="ch07.html" title="Chapter 7. Acknowledgements"><link rel="next" href="ch08.html" title="Chapter 8. Version history"></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"> MSM v1</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><th width="60%" align="center">Chapter 7. Acknowledgements</th><td width="20%" align="right"> <a accesskey="n" href="ch08.html">Next</a></td></tr></table><hr></div><div class="sect1" title="MSM v1"><div class="titlepage"><div><div><h2 class="titl
e" style="clear: both"><a name="d0e4556"></a> MSM v1</h2></div></div></div><p>
+ <title>MSM v1</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) V2.10"><link rel="up" href="ch07.html" title="Chapter 7. Acknowledgements"><link rel="prev" href="ch07.html" title="Chapter 7. Acknowledgements"><link rel="next" href="ch08.html" title="Chapter 8. Version history"></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"> MSM v1</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><th width="60%" align="center">Chapter 7. Acknowledgements</th><td width="20%" align="right"> <a accesskey="n" href="ch08.html">Next</a></td></tr></table><hr></div><div class="sect1" title="MSM v1"><div class="titlepage"><div><div><h2 class="titl
e" style="clear: both"><a name="d0e4230"></a> MSM v1</h2></div></div></div><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>The original version of this framework is based on the brilliant
work of David Abrahams and Aleksey Gurtovoy who laid down the base
and the principles of the framework in their excellent book, “C++
Modified: sandbox/msm/libs/msm/doc/HTML/ch08.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch08.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch08.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Chapter 8. Version history</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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch07s02.html" title="MSM v1"><link rel="next" href="pt02.html" title="Part II. Reference"></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 8. Version history</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s02.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="pt02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 8. Version history"><div c
lass="titlepage"><div><div><h2 class="title"><a name="d0e4572"></a>Chapter 8. Version history</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">From V2.0 to V2.10</span></dt></dl></div><div class="sect1" title="From V2.0 to V2.10"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4575"></a>From V2.0 to V2.10</h2></div></div></div><p>
+ <title>Chapter 8. Version history</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) V2.10"><link rel="up" href="pt01.html" title="Part I. User' guide"><link rel="prev" href="ch07s02.html" title="MSM v1"><link rel="next" href="pt02.html" title="Part II. Reference"></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 8. Version history</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s02.html">Prev</a> </td><th width="60%" align="center">Part I. User' guide</th><td width="20%" align="right"> <a accesskey="n" href="pt02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 8. Version history"><div c
lass="titlepage"><div><div><h2 class="title"><a name="d0e4246"></a>Chapter 8. Version history</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1">From V2.0 to V2.10</span></dt></dl></div><div class="sect1" title="From V2.0 to V2.10"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4249"></a>From V2.0 to V2.10</h2></div></div></div><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>New documentation</p></li><li class="listitem"><p>Internal transitions. Either as part of the transition table or
using a state's internal transition table</p></li><li class="listitem"><p>increased dispatch and copy speed</p></li><li class="listitem"><p>new eUML syntax, better attribute support, macros to ease
developer's life. Even VC8 seems to like it better.</p></li><li class="listitem"><p>New policy for reduced compile-time at the cost of dispatch
Modified: sandbox/msm/libs/msm/doc/HTML/ch09.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch09.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch09.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,7 +1,7 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Chapter 9. eUML operators and basic helpers</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) V2.10"><link rel="up" href="pt02.html" title="Part II. Reference"><link rel="prev" href="pt02.html" title="Part II. Reference"><link rel="next" href="ch10.html" title="Chapter 10. Functional programming"></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 9. eUML operators and basic helpers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="pt02.html">Prev</a> </td><th width="60%" align="center">Part II. Reference</th><td width="20%" align="right"> <a accesskey="n" href="ch10.html">Next</a></td></tr></table><hr></div><div cl
ass="chapter" title="Chapter 9. eUML operators and basic helpers"><div class="titlepage"><div><div><h2 class="title"><a name="d0e4607"></a>Chapter 9. eUML operators and basic helpers</h2></div></div></div><p>The following table lists the supported operators: </p><p>
- </p><div class="table"><a name="d0e4614"></a><p class="title"><b>Table 9.1. Operators and state machine helpers</b></p><div class="table-contents"><table summary="Operators and state machine helpers" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>eUML function / operator</th><th>Description</th><th>Functor</th></tr></thead><tbody><tr><td>&&</td><td>Calls lazily Action1&& Action2</td><td>And_</td></tr><tr><td>||</td><td>Calls lazily Action1|| Action2</td><td>Or_</td></tr><tr><td>!</td><td>Calls lazily !Action1</td><td>Not_</td></tr><tr><td>!=</td><td>Calls lazily Action1 != Action2</td><td>NotEqualTo_</td></tr><tr><td>==</td><td>Calls lazily Action1 == Action2</td><td>EqualTo_</td></tr><tr><td>></td><td>Calls lazily Action1 > Action2</td><td>Greater_</td></tr><tr><td>>=</td><td>Calls lazily Action1 >= Action2</td><td>Greater_Equal_</td></tr><tr><td><</td><td>Calls lazily Action1 < Action2</td><td>Less_</td></tr><tr><td><=</td><td>C
alls lazily Action1 <= Action2</td><td>Less_Equal_</td></tr><tr><td>&</td><td>Calls lazily Action1 & Action2</td><td>Bitwise_And_</td></tr><tr><td>|</td><td>Calls lazily Action1 | Action2</td><td>Bitwise_Or_</td></tr><tr><td>^</td><td>Calls lazily Action1 ^ Action2</td><td>Bitwise_Xor_</td></tr><tr><td>--</td><td>Calls lazily --Action1 / Action1--</td><td>Pre_Dec_ / Post_Dec_</td></tr><tr><td>++</td><td>Calls lazily ++Action1 / Action1++</td><td>Pre_Inc_ / Post_Inc_</td></tr><tr><td>/</td><td>Calls lazily Action1 / Action2</td><td>Divides_</td></tr><tr><td>/=</td><td>Calls lazily Action1 /= Action2</td><td>Divides_Assign_</td></tr><tr><td>*</td><td>Calls lazily Action1 * Action2</td><td>Multiplies_</td></tr><tr><td>*=</td><td>Calls lazily Action1 *= Action2</td><td>Multiplies_Assign_</td></tr><tr><td>+ (binary)</td><td>Calls lazily Action1 + Action2</td><td>Plus_</td></tr><tr><td>+ (unary)</td><td>Calls lazily +Action1</td><td>Unary_Plus_</td></tr><tr><td>+=</td><td>Calls lazily Action1 += Action2
</td><td>Plus_Assign_</td></tr><tr><td>- (binary)</td><td>Calls lazily Action1 - Action2</td><td>Minus_</td></tr><tr><td>- (unary)</td><td>Calls lazily -Action1</td><td>Unary_Minus_</td></tr><tr><td>-=</td><td>Calls lazily Action1 -= Action2</td><td>Minus_Assign_</td></tr><tr><td>%</td><td>Calls lazily Action1 % Action2</td><td>Modulus_</td></tr><tr><td>%=</td><td>Calls lazily Action1 %= Action2</td><td>Modulus_Assign_</td></tr><tr><td>>></td><td>Calls lazily Action1 >> Action2</td><td>ShiftRight_</td></tr><tr><td>>>=</td><td>Calls lazily Action1 >>= Action2</td><td>ShiftRight_Assign_</td></tr><tr><td><<</td><td>Calls lazily Action1 << Action2</td><td>ShiftLeft_</td></tr><tr><td><<=</td><td>Calls lazily Action1 <<= Action2</td><td>ShiftLeft_Assign_</td></tr><tr><td>[] (works on vector, map, arrays)</td><td>Calls lazily Action1 [Action2]</td><td>Subscript_</td></tr><tr><td>if_then_else_(Condition,Action1,Action2)</td><td>Returns either the result of calling Acti
on1 or the result of
+ <title>Chapter 9. eUML operators and basic helpers</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) V2.10"><link rel="up" href="pt02.html" title="Part II. Reference"><link rel="prev" href="pt02.html" title="Part II. Reference"><link rel="next" href="ch10.html" title="Chapter 10. Functional programming"></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 9. eUML operators and basic helpers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="pt02.html">Prev</a> </td><th width="60%" align="center">Part II. Reference</th><td width="20%" align="right"> <a accesskey="n" href="ch10.html">Next</a></td></tr></table><hr></div><div cl
ass="chapter" title="Chapter 9. eUML operators and basic helpers"><div class="titlepage"><div><div><h2 class="title"><a name="d0e4281"></a>Chapter 9. eUML operators and basic helpers</h2></div></div></div><p>The following table lists the supported operators: </p><p>
+ </p><div class="table"><a name="d0e4288"></a><p class="title"><b>Table 9.1. Operators and state machine helpers</b></p><div class="table-contents"><table summary="Operators and state machine helpers" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>eUML function / operator</th><th>Description</th><th>Functor</th></tr></thead><tbody><tr><td>&&</td><td>Calls lazily Action1&& Action2</td><td>And_</td></tr><tr><td>||</td><td>Calls lazily Action1|| Action2</td><td>Or_</td></tr><tr><td>!</td><td>Calls lazily !Action1</td><td>Not_</td></tr><tr><td>!=</td><td>Calls lazily Action1 != Action2</td><td>NotEqualTo_</td></tr><tr><td>==</td><td>Calls lazily Action1 == Action2</td><td>EqualTo_</td></tr><tr><td>></td><td>Calls lazily Action1 > Action2</td><td>Greater_</td></tr><tr><td>>=</td><td>Calls lazily Action1 >= Action2</td><td>Greater_Equal_</td></tr><tr><td><</td><td>Calls lazily Action1 < Action2</td><td>Less_</td></tr><tr><td><=</td><td>C
alls lazily Action1 <= Action2</td><td>Less_Equal_</td></tr><tr><td>&</td><td>Calls lazily Action1 & Action2</td><td>Bitwise_And_</td></tr><tr><td>|</td><td>Calls lazily Action1 | Action2</td><td>Bitwise_Or_</td></tr><tr><td>^</td><td>Calls lazily Action1 ^ Action2</td><td>Bitwise_Xor_</td></tr><tr><td>--</td><td>Calls lazily --Action1 / Action1--</td><td>Pre_Dec_ / Post_Dec_</td></tr><tr><td>++</td><td>Calls lazily ++Action1 / Action1++</td><td>Pre_Inc_ / Post_Inc_</td></tr><tr><td>/</td><td>Calls lazily Action1 / Action2</td><td>Divides_</td></tr><tr><td>/=</td><td>Calls lazily Action1 /= Action2</td><td>Divides_Assign_</td></tr><tr><td>*</td><td>Calls lazily Action1 * Action2</td><td>Multiplies_</td></tr><tr><td>*=</td><td>Calls lazily Action1 *= Action2</td><td>Multiplies_Assign_</td></tr><tr><td>+ (binary)</td><td>Calls lazily Action1 + Action2</td><td>Plus_</td></tr><tr><td>+ (unary)</td><td>Calls lazily +Action1</td><td>Unary_Plus_</td></tr><tr><td>+=</td><td>Calls lazily Action1 += Action2
</td><td>Plus_Assign_</td></tr><tr><td>- (binary)</td><td>Calls lazily Action1 - Action2</td><td>Minus_</td></tr><tr><td>- (unary)</td><td>Calls lazily -Action1</td><td>Unary_Minus_</td></tr><tr><td>-=</td><td>Calls lazily Action1 -= Action2</td><td>Minus_Assign_</td></tr><tr><td>%</td><td>Calls lazily Action1 % Action2</td><td>Modulus_</td></tr><tr><td>%=</td><td>Calls lazily Action1 %= Action2</td><td>Modulus_Assign_</td></tr><tr><td>>></td><td>Calls lazily Action1 >> Action2</td><td>ShiftRight_</td></tr><tr><td>>>=</td><td>Calls lazily Action1 >>= Action2</td><td>ShiftRight_Assign_</td></tr><tr><td><<</td><td>Calls lazily Action1 << Action2</td><td>ShiftLeft_</td></tr><tr><td><<=</td><td>Calls lazily Action1 <<= Action2</td><td>ShiftLeft_Assign_</td></tr><tr><td>[] (works on vector, map, arrays)</td><td>Calls lazily Action1 [Action2]</td><td>Subscript_</td></tr><tr><td>if_then_else_(Condition,Action1,Action2)</td><td>Returns either the result of calling Acti
on1 or the result of
calling Action2</td><td>If_Else_</td></tr><tr><td>if_then_(Condition,Action)</td><td>Returns the result of calling Action if Condition</td><td>If_Then_</td></tr><tr><td>while_(Condition, Body)</td><td>While Condition(), calls Body(). Returns nothing</td><td>While_Do_</td></tr><tr><td>do_while_(Condition, Body)</td><td>Calls Body() while Condition(). Returns nothing</td><td>Do_While_</td></tr><tr><td>for_(Begin,Stop,EndLoop,Body)</td><td>Calls for(Begin;Stop;EndLoop){Body;}</td><td>For_Loop_</td></tr><tr><td>process_(Event [,fsm1] [,fsm2] [,fsm3] [,fsm4])</td><td>Processes Event on the current state machine (if no fsm
specified) or on up to 4 state machines returned by an
appropriate functor.</td><td>Process_</td></tr><tr><td>process2_(Event, Data [,fsm1] [,fsm2] [,fsm3])</td><td>Processes Event on the current state machine (if no fsm
Modified: sandbox/msm/libs/msm/doc/HTML/ch10.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/ch10.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/ch10.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,33 +1,33 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Chapter 10. Functional programming</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) V2.10"><link rel="up" href="pt02.html" title="Part II. Reference"><link rel="prev" href="ch09.html" title="Chapter 9. eUML operators and basic helpers"><link rel="next" href="re01.html" title="Common headers"></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 10.
- Functional programming </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09.html">Prev</a> </td><th width="60%" align="center">Part II. Reference</th><td width="20%" align="right"> <a accesskey="n" href="re01.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 10. Functional programming"><div class="titlepage"><div><div><h2 class="title"><a name="d0e4951"></a>Chapter 10.
+ Functional programming </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09.html">Prev</a> </td><th width="60%" align="center">Part II. Reference</th><td width="20%" align="right"> <a accesskey="n" href="re01.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 10. Functional programming"><div class="titlepage"><div><div><h2 class="title"><a name="d0e4625"></a>Chapter 10.
<span class="command"><strong><a name="eUML-STL-all"></a></strong></span>Functional programming </h2></div></div></div><p>To use these functions, you need to include: </p><p><code class="code">#include <msm/front/euml/stl.hpp></code></p><p>or the specified header in the following tables.</p><p>The following tables list the supported STL algorithms: </p><p>
<span class="command"><strong><a name="eUML-STL-querying"></a></strong></span>
- </p><div class="table"><a name="d0e4969"></a><p class="title"><b>Table 10.1. STL algorithms</b></p><div class="table-contents"><table summary="STL algorithms" border="1"><colgroup><col><col></colgroup><thead><tr><th>STL algorithms in querying.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>find_(first, last, value)</td><td>Find_</td></tr><tr><td>find_if_(first, last, value)</td><td>FindIf_</td></tr><tr><td>lower_bound_(first, last, value [,opᵃ])</td><td>LowerBound_</td></tr><tr><td>upper_bound_(first, last, value [,opᵃ])</td><td>UpperBound_</td></tr><tr><td>equal_range_(first, last, value [,opᵃ])</td><td>EqualRange_</td></tr><tr><td>binary_search_(first, last, value [,opᵃ])</td><td>BinarySearch_</td></tr><tr><td>min_element_(first, last[,opᵃ])</td><td>MinElement_</td></tr><tr><td>max_element_(first, last[,opᵃ])</td><td>MaxElement_</td></tr><tr><td>adjacent_find_(first, last[,opᵃ])</td><td>AdjacentFind_</td></tr><tr><td>find_end_( first1
, last1, first2, last2 [,op ᵃ])</td><td>FindEnd_</td></tr><tr><td>find_first_of_( first1, last1, first2, last2 [,op ᵃ])</td><td>FindFirstOf_</td></tr><tr><td>equal_( first1, last1, first2 [,op ᵃ])</td><td>Equal_</td></tr><tr><td>search_( first1, last1, first2, last2 [,op ᵃ])</td><td>Search_</td></tr><tr><td>includes_( first1, last1, first2, last2 [,op ᵃ])</td><td>Includes_</td></tr><tr><td>lexicographical_compare_ ( first1, last1, first2, last2 [,op
+ </p><div class="table"><a name="d0e4643"></a><p class="title"><b>Table 10.1. STL algorithms</b></p><div class="table-contents"><table summary="STL algorithms" border="1"><colgroup><col><col></colgroup><thead><tr><th>STL algorithms in querying.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>find_(first, last, value)</td><td>Find_</td></tr><tr><td>find_if_(first, last, value)</td><td>FindIf_</td></tr><tr><td>lower_bound_(first, last, value [,opᵃ])</td><td>LowerBound_</td></tr><tr><td>upper_bound_(first, last, value [,opᵃ])</td><td>UpperBound_</td></tr><tr><td>equal_range_(first, last, value [,opᵃ])</td><td>EqualRange_</td></tr><tr><td>binary_search_(first, last, value [,opᵃ])</td><td>BinarySearch_</td></tr><tr><td>min_element_(first, last[,opᵃ])</td><td>MinElement_</td></tr><tr><td>max_element_(first, last[,opᵃ])</td><td>MaxElement_</td></tr><tr><td>adjacent_find_(first, last[,opᵃ])</td><td>AdjacentFind_</td></tr><tr><td>find_end_( first1
, last1, first2, last2 [,op ᵃ])</td><td>FindEnd_</td></tr><tr><td>find_first_of_( first1, last1, first2, last2 [,op ᵃ])</td><td>FindFirstOf_</td></tr><tr><td>equal_( first1, last1, first2 [,op ᵃ])</td><td>Equal_</td></tr><tr><td>search_( first1, last1, first2, last2 [,op ᵃ])</td><td>Search_</td></tr><tr><td>includes_( first1, last1, first2, last2 [,op ᵃ])</td><td>Includes_</td></tr><tr><td>lexicographical_compare_ ( first1, last1, first2, last2 [,op
ᵃ]) </td><td>LexicographicalCompare_</td></tr><tr><td>count_(first, last, value [,size])</td><td>Count_</td></tr><tr><td>count_if_(first, last, op ᵃ [,size])</td><td>CountIf_</td></tr><tr><td>distance_(first, last)</td><td>Distance_</td></tr><tr><td>mismatch _( first1, last1, first2 [,op ᵃ])</td><td>Mismatch_</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
<span class="command"><strong><a name="eUML-STL-iteration"></a></strong></span>
- </p><div class="table"><a name="d0e5082"></a><p class="title"><b>Table 10.2. STL algorithms</b></p><div class="table-contents"><table summary="STL algorithms" border="1"><colgroup><col><col></colgroup><thead><tr><th>STL algorithms in iteration.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>for_each_(first,last, unary opᵃ)</td><td>ForEach_</td></tr><tr><td>accumulate_first, last, init [,opᵃ])</td><td>Accumulate_</td></tr></tbody></table></div></div><p><br class="table-break">
+ </p><div class="table"><a name="d0e4756"></a><p class="title"><b>Table 10.2. STL algorithms</b></p><div class="table-contents"><table summary="STL algorithms" border="1"><colgroup><col><col></colgroup><thead><tr><th>STL algorithms in iteration.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>for_each_(first,last, unary opᵃ)</td><td>ForEach_</td></tr><tr><td>accumulate_first, last, init [,opᵃ])</td><td>Accumulate_</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
<span class="command"><strong><a name="eUML-STL-transformation"></a></strong></span>
- </p><div class="table"><a name="d0e5110"></a><p class="title"><b>Table 10.3. STL algorithms</b></p><div class="table-contents"><table summary="STL algorithms" border="1"><colgroup><col><col></colgroup><thead><tr><th>STL algorithms in transformation.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>copy_(first, last, result)</td><td>Copy_</td></tr><tr><td>copy_backward_(first, last, result)</td><td>CopyBackward_</td></tr><tr><td>reverse_(first, last)</td><td>Reverse_</td></tr><tr><td>reverse_copy_(first, last , result)</td><td>ReverseCopy_</td></tr><tr><td>remove_(first, last, value)</td><td>Remove_</td></tr><tr><td>remove_if_(first, last , opᵃ)</td><td>RemoveIf_</td></tr><tr><td>remove_copy_(first, last , output, value)</td><td>RemoveCopy_</td></tr><tr><td>remove_copy_if_(first, last, output, opᵃ)</td><td>RemoveCopyIf_</td></tr><tr><td>fill_(first, last, value)</td><td>Fill_</td></tr><tr><td>fill_n_(first, size, value)ᵇ</td><td>FillN_</td></tr><tr><td>generate_(
first, last, generatorᵃ)</td><td>Generate_</td></tr><tr><td>generate_(first, size, generatorᵃ)ᵇ</td><td>GenerateN_</td></tr><tr><td>unique_(first, last [,opᵃ])</td><td>Unique_</td></tr><tr><td>unique_copy_(first, last, output [,opᵃ])</td><td>UniqueCopy_</td></tr><tr><td>random_shuffle_(first, last [,opᵃ])</td><td>RandomShuffle_</td></tr><tr><td>rotate_copy_(first, middle, last, output)</td><td>RotateCopy_</td></tr><tr><td>partition_ (first, last [,opᵃ])</td><td>Partition_</td></tr><tr><td>stable_partition_ (first, last [,opᵃ])</td><td>StablePartition_</td></tr><tr><td>stable_sort_(first, last [,opᵃ])</td><td>StableSort_</td></tr><tr><td>sort_(first, last [,opᵃ])</td><td>Sort_</td></tr><tr><td>partial_sort_(first, middle, last [,opᵃ])</td><td>PartialSort_</td></tr><tr><td>partial_sort_copy_ (first, last, res_first, res_last [,opᵃ]) </td><td>PartialSortCopy_</td></tr><tr><td>nth_element_(first, nth, last [,opᵃ])</td><td>NthElement_</
td></tr><tr><td>merge_( first1, last1, first2, last2, output [,op ᵃ])</td><td>Merge_</td></tr><tr><td>inplace_merge_(first, middle, last [,opᵃ])</td><td>InplaceMerge_</td></tr><tr><td>set_union_(first1, last1, first2, last2, output [,op
+ </p><div class="table"><a name="d0e4784"></a><p class="title"><b>Table 10.3. STL algorithms</b></p><div class="table-contents"><table summary="STL algorithms" border="1"><colgroup><col><col></colgroup><thead><tr><th>STL algorithms in transformation.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>copy_(first, last, result)</td><td>Copy_</td></tr><tr><td>copy_backward_(first, last, result)</td><td>CopyBackward_</td></tr><tr><td>reverse_(first, last)</td><td>Reverse_</td></tr><tr><td>reverse_copy_(first, last , result)</td><td>ReverseCopy_</td></tr><tr><td>remove_(first, last, value)</td><td>Remove_</td></tr><tr><td>remove_if_(first, last , opᵃ)</td><td>RemoveIf_</td></tr><tr><td>remove_copy_(first, last , output, value)</td><td>RemoveCopy_</td></tr><tr><td>remove_copy_if_(first, last, output, opᵃ)</td><td>RemoveCopyIf_</td></tr><tr><td>fill_(first, last, value)</td><td>Fill_</td></tr><tr><td>fill_n_(first, size, value)ᵇ</td><td>FillN_</td></tr><tr><td>generate_(
first, last, generatorᵃ)</td><td>Generate_</td></tr><tr><td>generate_(first, size, generatorᵃ)ᵇ</td><td>GenerateN_</td></tr><tr><td>unique_(first, last [,opᵃ])</td><td>Unique_</td></tr><tr><td>unique_copy_(first, last, output [,opᵃ])</td><td>UniqueCopy_</td></tr><tr><td>random_shuffle_(first, last [,opᵃ])</td><td>RandomShuffle_</td></tr><tr><td>rotate_copy_(first, middle, last, output)</td><td>RotateCopy_</td></tr><tr><td>partition_ (first, last [,opᵃ])</td><td>Partition_</td></tr><tr><td>stable_partition_ (first, last [,opᵃ])</td><td>StablePartition_</td></tr><tr><td>stable_sort_(first, last [,opᵃ])</td><td>StableSort_</td></tr><tr><td>sort_(first, last [,opᵃ])</td><td>Sort_</td></tr><tr><td>partial_sort_(first, middle, last [,opᵃ])</td><td>PartialSort_</td></tr><tr><td>partial_sort_copy_ (first, last, res_first, res_last [,opᵃ]) </td><td>PartialSortCopy_</td></tr><tr><td>nth_element_(first, nth, last [,opᵃ])</td><td>NthElement_</
td></tr><tr><td>merge_( first1, last1, first2, last2, output [,op ᵃ])</td><td>Merge_</td></tr><tr><td>inplace_merge_(first, middle, last [,opᵃ])</td><td>InplaceMerge_</td></tr><tr><td>set_union_(first1, last1, first2, last2, output [,op
ᵃ])</td><td>SetUnion_</td></tr><tr><td>push_heap_(first, last [,op ᵃ])</td><td>PushHeap_</td></tr><tr><td>pop_heap_(first, last [,op ᵃ])</td><td>PopHeap_</td></tr><tr><td>make_heap_(first, last [,op ᵃ])</td><td>MakeHeap_</td></tr><tr><td>sort_heap_(first, last [,op ᵃ])</td><td>SortHeap_</td></tr><tr><td>next_permutation_(first, last [,op ᵃ])</td><td>NextPermutation_</td></tr><tr><td>prev_permutation_(first, last [,op ᵃ])</td><td>PrevPermutation_</td></tr><tr><td>inner_product_(first1, last1, first2, init [,op1ᵃ] [,op2ᵃ]) </td><td>InnerProduct_</td></tr><tr><td>partial_sum_(first, last, output [,opᵃ])</td><td>PartialSum_</td></tr><tr><td>adjacent_difference_(first, last, output [,opᵃ])</td><td>AdjacentDifference_</td></tr><tr><td>replace_(first, last, old_value, new_value)</td><td>Replace_</td></tr><tr><td>replace_if_(first, last, opᵃ, new_value)</td><td>ReplaceIf_</td></tr><tr><td>replace_copy_(first,
last, result, old_value,
new_value)</td><td>ReplaceCopy_</td></tr><tr><td>replace_copy_if_(first, last, result, opᵃ, new_value)</td><td>ReplaceCopyIf_</td></tr><tr><td>rotate_(first, middle, last)ᵇ</td><td>Rotate_</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
<span class="command"><strong><a name="eUML-STL-container"></a></strong></span>
- </p><div class="table"><a name="d0e5328"></a><p class="title"><b>Table 10.4. STL container methods</b></p><div class="table-contents"><table summary="STL container methods" border="1"><colgroup><col><col></colgroup><thead><tr><th>STL container methods(common) in container.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>container::reference front_(container)</td><td>Front_</td></tr><tr><td>container::reference back_(container)</td><td>Back_</td></tr><tr><td>container::iterator begin_(container)</td><td>Begin_</td></tr><tr><td>container::iterator end_(container)</td><td>End_</td></tr><tr><td>container::reverse_iterator rbegin_(container)</td><td>RBegin_</td></tr><tr><td>container::reverse_iterator rend_(container)</td><td>REnd_</td></tr><tr><td>void push_back_(container, value)</td><td>Push_Back_</td></tr><tr><td>void pop_back_(container, value)</td><td>Pop_Back_</td></tr><tr><td>void push_front_(container, value)</td><td>Push_Front_</td></tr><tr><td>void pop_front_(container, va
lue)</td><td>Pop_Front_</td></tr><tr><td>void clear_(container)</td><td>Clear_</td></tr><tr><td>size_type capacity_(container)</td><td>Capacity_</td></tr><tr><td>size_type size_(container)</td><td>Size_</td></tr><tr><td>size_type max_size_(container)</td><td>Max_Size_</td></tr><tr><td>void reserve_(container, value)</td><td>Reserve _</td></tr><tr><td>void resize_(container, value)</td><td>Resize _</td></tr><tr><td>iterator insert_(container, pos, value)</td><td>Insert_</td></tr><tr><td>void insert_( container , pos, first, last)</td><td>Insert_</td></tr><tr><td>void insert_( container , pos, number, value)</td><td>Insert_</td></tr><tr><td>void swap_( container , other_container)</td><td>Swap_</td></tr><tr><td>void erase_( container , pos)</td><td>Erase_</td></tr><tr><td>void erase_( container , first, last) </td><td>Erase_</td></tr><tr><td>bool empty_( container)</td><td>Empty_</td></tr></tbody></table></div></div><p><br class="table-break">
+ </p><div class="table"><a name="d0e5002"></a><p class="title"><b>Table 10.4. STL container methods</b></p><div class="table-contents"><table summary="STL container methods" border="1"><colgroup><col><col></colgroup><thead><tr><th>STL container methods(common) in container.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>container::reference front_(container)</td><td>Front_</td></tr><tr><td>container::reference back_(container)</td><td>Back_</td></tr><tr><td>container::iterator begin_(container)</td><td>Begin_</td></tr><tr><td>container::iterator end_(container)</td><td>End_</td></tr><tr><td>container::reverse_iterator rbegin_(container)</td><td>RBegin_</td></tr><tr><td>container::reverse_iterator rend_(container)</td><td>REnd_</td></tr><tr><td>void push_back_(container, value)</td><td>Push_Back_</td></tr><tr><td>void pop_back_(container, value)</td><td>Pop_Back_</td></tr><tr><td>void push_front_(container, value)</td><td>Push_Front_</td></tr><tr><td>void pop_front_(container, va
lue)</td><td>Pop_Front_</td></tr><tr><td>void clear_(container)</td><td>Clear_</td></tr><tr><td>size_type capacity_(container)</td><td>Capacity_</td></tr><tr><td>size_type size_(container)</td><td>Size_</td></tr><tr><td>size_type max_size_(container)</td><td>Max_Size_</td></tr><tr><td>void reserve_(container, value)</td><td>Reserve _</td></tr><tr><td>void resize_(container, value)</td><td>Resize _</td></tr><tr><td>iterator insert_(container, pos, value)</td><td>Insert_</td></tr><tr><td>void insert_( container , pos, first, last)</td><td>Insert_</td></tr><tr><td>void insert_( container , pos, number, value)</td><td>Insert_</td></tr><tr><td>void swap_( container , other_container)</td><td>Swap_</td></tr><tr><td>void erase_( container , pos)</td><td>Erase_</td></tr><tr><td>void erase_( container , first, last) </td><td>Erase_</td></tr><tr><td>bool empty_( container)</td><td>Empty_</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
- </p><div class="table"><a name="d0e5459"></a><p class="title"><b>Table 10.5. STL list methods</b></p><div class="table-contents"><table summary="STL list methods" border="1"><colgroup><col><col></colgroup><thead><tr><th>std::list methods in container.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>void list_remove_(container, value)</td><td>ListRemove_</td></tr><tr><td>void list_remove_if_(container, opᵃ)</td><td>ListRemove_If_</td></tr><tr><td>void list_merge_(container, other_list)</td><td>ListMerge_</td></tr><tr><td>void list_merge_(container, other_list, opᵃ)</td><td>ListMerge_</td></tr><tr><td>void splice_(container, iterator, other_list)</td><td>Splice_</td></tr><tr><td>void splice_(container, iterator, other_list,
+ </p><div class="table"><a name="d0e5133"></a><p class="title"><b>Table 10.5. STL list methods</b></p><div class="table-contents"><table summary="STL list methods" border="1"><colgroup><col><col></colgroup><thead><tr><th>std::list methods in container.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>void list_remove_(container, value)</td><td>ListRemove_</td></tr><tr><td>void list_remove_if_(container, opᵃ)</td><td>ListRemove_If_</td></tr><tr><td>void list_merge_(container, other_list)</td><td>ListMerge_</td></tr><tr><td>void list_merge_(container, other_list, opᵃ)</td><td>ListMerge_</td></tr><tr><td>void splice_(container, iterator, other_list)</td><td>Splice_</td></tr><tr><td>void splice_(container, iterator, other_list,
iterator)</td><td>Splice_</td></tr><tr><td>void splice_(container, iterator, other_list, first,
last)</td><td>Splice_</td></tr><tr><td>void list_reverse_(container)</td><td>ListReverse_</td></tr><tr><td>void list_unique_(container)</td><td>ListUnique_</td></tr><tr><td>void list_unique_(container, opᵃ)</td><td>ListUnique_</td></tr><tr><td>void list_sort_(container)</td><td>ListSort_</td></tr><tr><td>void list_sort_(container, opᵃ)</td><td>ListSort_</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
- </p><div class="table"><a name="d0e5535"></a><p class="title"><b>Table 10.6. STL associative container methods </b></p><div class="table-contents"><table summary="STL associative container methods " border="1"><colgroup><col><col></colgroup><thead><tr><th>Associative container methods in container.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>iterator insert_(container, pos, value)</td><td>Insert_</td></tr><tr><td>void insert_( container , first, last)</td><td>Insert_</td></tr><tr><td>pair<iterator, bool> insert_( container , value)</td><td>Insert_</td></tr><tr><td>void associative_erase_( container , pos)</td><td>Associative_Erase_</td></tr><tr><td>void associative_erase_( container , first, last)</td><td>Associative_Erase_</td></tr><tr><td>size_type associative_erase_( container , key)</td><td>Associative_Erase_</td></tr><tr><td>iterator associative_find_( container , key)</td><td>Associative_Find_</td></tr><tr><td>size_type associative_count_( container , key)</td><t
d>AssociativeCount_</td></tr><tr><td>iterator associative_lower_bound_( container , key)</td><td>Associative_Lower_Bound_</td></tr><tr><td>iterator associative_upper_bound_( container , key)</td><td>Associative_Upper_Bound_</td></tr><tr><td>pair<iterator, iterator> associative_equal_range_(
+ </p><div class="table"><a name="d0e5209"></a><p class="title"><b>Table 10.6. STL associative container methods </b></p><div class="table-contents"><table summary="STL associative container methods " border="1"><colgroup><col><col></colgroup><thead><tr><th>Associative container methods in container.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>iterator insert_(container, pos, value)</td><td>Insert_</td></tr><tr><td>void insert_( container , first, last)</td><td>Insert_</td></tr><tr><td>pair<iterator, bool> insert_( container , value)</td><td>Insert_</td></tr><tr><td>void associative_erase_( container , pos)</td><td>Associative_Erase_</td></tr><tr><td>void associative_erase_( container , first, last)</td><td>Associative_Erase_</td></tr><tr><td>size_type associative_erase_( container , key)</td><td>Associative_Erase_</td></tr><tr><td>iterator associative_find_( container , key)</td><td>Associative_Find_</td></tr><tr><td>size_type associative_count_( container , key)</td><t
d>AssociativeCount_</td></tr><tr><td>iterator associative_lower_bound_( container , key)</td><td>Associative_Lower_Bound_</td></tr><tr><td>iterator associative_upper_bound_( container , key)</td><td>Associative_Upper_Bound_</td></tr><tr><td>pair<iterator, iterator> associative_equal_range_(
container , key)</td><td>Associative_Equal_Range_</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
- </p><div class="table"><a name="d0e5606"></a><p class="title"><b>Table 10.7. STL pair</b></p><div class="table-contents"><table summary="STL pair" border="1"><colgroup><col><col></colgroup><thead><tr><th>std::pair in container.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>first_type first_(pair<T1, T2>)</td><td>First_</td></tr><tr><td>second_type second_(pair<T1, T2>)</td><td>Second_</td></tr></tbody></table></div></div><p><br class="table-break">
+ </p><div class="table"><a name="d0e5280"></a><p class="title"><b>Table 10.7. STL pair</b></p><div class="table-contents"><table summary="STL pair" border="1"><colgroup><col><col></colgroup><thead><tr><th>std::pair in container.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>first_type first_(pair<T1, T2>)</td><td>First_</td></tr><tr><td>second_type second_(pair<T1, T2>)</td><td>Second_</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
- </p><div class="table"><a name="d0e5632"></a><p class="title"><b>Table 10.8. STL string</b></p><div class="table-contents"><table summary="STL string" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>STL string method</th><th>std::string method in container.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>substr (size_type pos, size_type size)</td><td>string substr_(container, pos, length)</td><td>Substr_</td></tr><tr><td>int compare(string)</td><td>int string_compare_(container, another_string)</td><td>StringCompare_</td></tr><tr><td>int compare(char*)</td><td>int string_compare_(container, another_string)</td><td>StringCompare_</td></tr><tr><td>int compare(size_type pos, size_type size, string)</td><td>int string_compare_(container, pos, size,
+ </p><div class="table"><a name="d0e5306"></a><p class="title"><b>Table 10.8. STL string</b></p><div class="table-contents"><table summary="STL string" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>STL string method</th><th>std::string method in container.hpp</th><th>Functor</th></tr></thead><tbody><tr><td>substr (size_type pos, size_type size)</td><td>string substr_(container, pos, length)</td><td>Substr_</td></tr><tr><td>int compare(string)</td><td>int string_compare_(container, another_string)</td><td>StringCompare_</td></tr><tr><td>int compare(char*)</td><td>int string_compare_(container, another_string)</td><td>StringCompare_</td></tr><tr><td>int compare(size_type pos, size_type size, string)</td><td>int string_compare_(container, pos, size,
another_string)</td><td>StringCompare_</td></tr><tr><td>int compare (size_type pos, size_type size, string, size_type
length)</td><td>int string_compare_(container, pos, size, another_string,
length)</td><td>StringCompare_</td></tr><tr><td>string& append(const string&)</td><td>string& append_(container, another_string)</td><td>Append_</td></tr><tr><td>string& append (charT*)</td><td>string& append_(container, another_string)</td><td>Append_</td></tr><tr><td>string& append (string , size_type pos, size_type
Modified: sandbox/msm/libs/msm/doc/HTML/index.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/index.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/index.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -6,11 +6,11 @@
</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface">Preface</span></dt><dt><span class="part">I. User' guide</span></dt><dd><dl><dt><span class="chapter">1. Founding idea</span></dt><dt><span class="chapter">2. UML Short Guide</span></dt><dd><dl><dt><span class="sect1">What are state machines?</span></dt><dt><span class="sect1">Concepts</span></dt><dd><dl><dt><span class="sect2">State machine, state, transition, event </span></dt><dt><span class="sect2">Submachines, orthogonal regions, pseudostates </span></dt><dt><span class="sect2"><a href="ch02s02.html#d0e284">
History </a></span></dt><dt><span class="sect2"><a href="ch02s02.html#d0e298">Completion transitions / anonymous
transitions</a></span></dt><dt><span class="sect2"> Internal transitions </span></dt><dt><span class="sect2"><a href="ch02s02.html#d0e316">
- Conflicting transitions </a></span></dt></dl></dd><dt><span class="sect1">State machine glossary</span></dt></dl></dd><dt><span class="chapter">3. Tutorial</span></dt><dd><dl><dt><span class="sect1">Design</span></dt><dt><span class="sect1">Basic front-end</span></dt><dd><dl><dt><span class="sect2">A simple example</span></dt><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2">Orthogonal regions, terminate state, event deferring</span></dt><dt><span class
="sect2">History</span></dt><dt><span class="sect2">Completion (anonymous) transitions</span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">more row types</span></dt><dt><span class="sect2">Explicit entry / entry and exit pseudo-state / fork</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Event Hierarchy</span></dt><dt><span class="sect2">Customizing a state machine / Getting more speed</span></dt><dt><span class="sect2">Choosing the initial event</span></dt><dt><span class="sect2"> Containing state machine (deprecated)</span></dt></dl></dd><dt><span class="sect1"><a href="ch03s03.html">Functor front
-end</a></span></dt><dd><dl><dt><span class="sect2"> Transition table </span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Anonymous transitions</span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e2566">Internal
- transitions</a></span></dt></dl></dd><dt><span class="sect1">eUML (experimental)</span></dt><dd><dl><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining events, actions and states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e3117">
- Attributes / Function call</a></span></dt><dt><span class="sect2">Orthogonal regions, flags, event deferring</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e3361">
+ Conflicting transitions </a></span></dt></dl></dd><dt><span class="sect1">State machine glossary</span></dt></dl></dd><dt><span class="chapter">3. Tutorial</span></dt><dd><dl><dt><span class="sect1">Design</span></dt><dt><span class="sect1">Basic front-end</span></dt><dd><dl><dt><span class="sect2">A simple example</span></dt><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2">Orthogonal regions, terminate state, event deferring</span></dt><dt><span class=
"sect2">History</span></dt><dt><span class="sect2">Completion (anonymous) transitions</span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">more row types</span></dt><dt><span class="sect2">Explicit entry / entry and exit pseudo-state / fork</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Event Hierarchy</span></dt><dt><span class="sect2">Customizing a state machine / Getting more speed</span></dt><dt><span class="sect2">Choosing the initial event</span></dt><dt><span class="sect2"> Containing state machine (deprecated)</span></dt></dl></dd><dt><span class="sect1"><a href="ch03s03.html">Functor front-
end</a></span></dt><dd><dl><dt><span class="sect2"> Transition table </span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Anonymous transitions</span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e2458">Internal
+ transitions</a></span></dt></dl></dd><dt><span class="sect1">eUML (experimental)</span></dt><dd><dl><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining events, actions and states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e2954">
+ Attributes / Function call</a></span></dt><dt><span class="sect2">Orthogonal regions, flags, event deferring</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e3166">
Customizing a state machine / Getting
- more speed</a></span></dt><dt><span class="sect2">Completion / Anonymous transitions</span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">Other state types</span></dt><dt><span class="sect2">Helper functions</span></dt><dt><span class="sect2">Phoenix-like STL support</span></dt></dl></dd><dt><span class="sect1">Back-end</span></dt><dd><dl><dt><span class="sect2">Creation </span></dt><dt><span class="sect2">Starting a state machine</span></dt><dt><span class="sect2">Event dispatching</span></dt><dt><span class="sect2">Active state(s)</span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3744">Base state ty
pe </a></span></dt><dt><span class="sect2">Visitor</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Getting a state</span></dt><dt><span class="sect2"> State machine constructor with arguments </span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3917">Trading run-time speed for
- better compile-time / multi-TU compilation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter">4. Performance / Compilers</span></dt><dd><dl><dt><span class="sect1">Speed</span></dt><dt><span class="sect1">Executable size</span></dt><dt><span class="sect1">Supported compilers</span></dt><dt><span class="sect1"> Limitations </span></dt><dt><span class="sect1"> Compilers corner </span></dt></dl></dd><dt><span class="chapter">5. Questions & Answers</span></dt><dt><span class="chapter">6. Internals</span></dt><dd><dl><dt><span class="sect1">Backend: Run To Completion</span></dt><dt><span class="sect1"><a href="ch06s02.html">Frontend / Backend
- interface</a></span></dt><dt><span class="sect1"> Generated state ids </span></dt><dt><span class="sect1">Metaprogramming tools</span></dt></dl></dd><dt><span class="chapter">7. Acknowledgements</span></dt><dd><dl><dt><span class="sect1">MSM v2</span></dt><dt><span class="sect1"> MSM v1</span></dt></dl></dd><dt><span class="chapter">8. Version history</span></dt><dd><dl><dt><span class="sect1">From V2.0 to V2.10</span></dt></dl></dd></dl></dd><dt><span class="part">II. Reference</span></dt><dd><dl><dt><span class="chapter">9. eUML operators and basic helpers</span></dt><dt><span class="chapter"><a href="ch10.html">10.
- Functional programming </a></span></dt><dt><span class="refentrytitle">Common headers</span><span class="refpurpose"> — The common types used by front- and back-ends</span></dt><dt><span class="refentrytitle">Back-end</span><span class="refpurpose"> — The back-end headers</span></dt><dt><span class="refentrytitle">Front-end</span><span class="refpurpose"> — The front-end headers</span></dt></dl></dd></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>9.1. Operators and state machine helpers</dt><dt>10.1. STL algorithms</dt><dt>10.2. STL algorithms</dt><dt>10.3. STL algorithms</dt><dt>10.4. STL container methods</dt><dt>10.5. STL list methods</dt><dt>10.6. <a href="ch10.html#d0e5535">STL assoc
iative container methods </a></dt><dt>10.7. STL pair</dt><dt>10.8. STL string</dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="pr01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> Preface</td></tr></table></div></body></html>
\ No newline at end of file
+ more speed</a></span></dt><dt><span class="sect2">Completion / Anonymous transitions</span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">Other state types</span></dt><dt><span class="sect2">Helper functions</span></dt><dt><span class="sect2">Phoenix-like STL support</span></dt></dl></dd><dt><span class="sect1">Back-end</span></dt><dd><dl><dt><span class="sect2">Creation </span></dt><dt><span class="sect2">Starting a state machine</span></dt><dt><span class="sect2">Event dispatching</span></dt><dt><span class="sect2">Active state(s)</span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3506">Base state ty
pe </a></span></dt><dt><span class="sect2">Visitor</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Getting a state</span></dt><dt><span class="sect2"> State machine constructor with arguments </span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3616">Trading run-time speed for
+ better compile-time / multi-TU compilation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter">4. Performance / Compilers</span></dt><dd><dl><dt><span class="sect1">Speed</span></dt><dt><span class="sect1">Executable size</span></dt><dt><span class="sect1">Supported compilers</span></dt><dt><span class="sect1"> Limitations </span></dt><dt><span class="sect1"> Compilers corner </span></dt></dl></dd><dt><span class="chapter">5. Questions & Answers</span></dt><dt><span class="chapter">6. Internals</span></dt><dd><dl><dt><span class="sect1">Backend: Run To Completion</span></dt><dt><span class="sect1"><a href="ch06s02.html">Frontend / Backend
+ interface</a></span></dt><dt><span class="sect1"> Generated state ids </span></dt><dt><span class="sect1">Metaprogramming tools</span></dt></dl></dd><dt><span class="chapter">7. Acknowledgements</span></dt><dd><dl><dt><span class="sect1">MSM v2</span></dt><dt><span class="sect1"> MSM v1</span></dt></dl></dd><dt><span class="chapter">8. Version history</span></dt><dd><dl><dt><span class="sect1">From V2.0 to V2.10</span></dt></dl></dd></dl></dd><dt><span class="part">II. Reference</span></dt><dd><dl><dt><span class="chapter">9. eUML operators and basic helpers</span></dt><dt><span class="chapter"><a href="ch10.html">10.
+ Functional programming </a></span></dt><dt><span class="refentrytitle">Common headers</span><span class="refpurpose"> — The common types used by front- and back-ends</span></dt><dt><span class="refentrytitle">Back-end</span><span class="refpurpose"> — The back-end headers</span></dt><dt><span class="refentrytitle">Front-end</span><span class="refpurpose"> — The front-end headers</span></dt></dl></dd></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>9.1. Operators and state machine helpers</dt><dt>10.1. STL algorithms</dt><dt>10.2. STL algorithms</dt><dt>10.3. STL algorithms</dt><dt>10.4. STL container methods</dt><dt>10.5. STL list methods</dt><dt>10.6. <a href="ch10.html#d0e5209">STL assoc
iative container methods </a></dt><dt>10.7. STL pair</dt><dt>10.8. STL string</dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="pr01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> Preface</td></tr></table></div></body></html>
\ No newline at end of file
Modified: sandbox/msm/libs/msm/doc/HTML/pt01.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/pt01.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/pt01.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -3,10 +3,10 @@
<title>Part I. User' guide</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) V2.10"><link rel="up" href="index.html" title="Meta State Machine (MSM) V2.10"><link rel="prev" href="pr01.html" title="Preface"><link rel="next" href="ch01.html" title="Chapter 1. Founding idea"></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">Part I. User' guide</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="pr01.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr></table><hr></div><div class="part" title="Part I. User' guide"><div class="titlepage"><div><div><h1 class="title"
><a name="d0e96"></a>Part I. User' guide</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter">1. Founding idea</span></dt><dt><span class="chapter">2. UML Short Guide</span></dt><dd><dl><dt><span class="sect1">What are state machines?</span></dt><dt><span class="sect1">Concepts</span></dt><dd><dl><dt><span class="sect2">State machine, state, transition, event </span></dt><dt><span class="sect2">Submachines, orthogonal regions, pseudostates </span></dt><dt><span class="sect2"><a href="ch02s02.html#d0e284">
History </a></span></dt><dt><span class="sect2"><a href="ch02s02.html#d0e298">Completion transitions / anonymous
transitions</a></span></dt><dt><span class="sect2"> Internal transitions </span></dt><dt><span class="sect2"><a href="ch02s02.html#d0e316">
- Conflicting transitions </a></span></dt></dl></dd><dt><span class="sect1">State machine glossary</span></dt></dl></dd><dt><span class="chapter">3. Tutorial</span></dt><dd><dl><dt><span class="sect1">Design</span></dt><dt><span class="sect1">Basic front-end</span></dt><dd><dl><dt><span class="sect2">A simple example</span></dt><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2">Orthogonal regions, terminate state, event deferring</span></dt><dt><span class
="sect2">History</span></dt><dt><span class="sect2">Completion (anonymous) transitions</span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">more row types</span></dt><dt><span class="sect2">Explicit entry / entry and exit pseudo-state / fork</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Event Hierarchy</span></dt><dt><span class="sect2">Customizing a state machine / Getting more speed</span></dt><dt><span class="sect2">Choosing the initial event</span></dt><dt><span class="sect2"> Containing state machine (deprecated)</span></dt></dl></dd><dt><span class="sect1"><a href="ch03s03.html">Functor front
-end</a></span></dt><dd><dl><dt><span class="sect2"> Transition table </span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Anonymous transitions</span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e2566">Internal
- transitions</a></span></dt></dl></dd><dt><span class="sect1">eUML (experimental)</span></dt><dd><dl><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining events, actions and states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e3117">
- Attributes / Function call</a></span></dt><dt><span class="sect2">Orthogonal regions, flags, event deferring</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e3361">
+ Conflicting transitions </a></span></dt></dl></dd><dt><span class="sect1">State machine glossary</span></dt></dl></dd><dt><span class="chapter">3. Tutorial</span></dt><dd><dl><dt><span class="sect1">Design</span></dt><dt><span class="sect1">Basic front-end</span></dt><dd><dl><dt><span class="sect2">A simple example</span></dt><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2">Orthogonal regions, terminate state, event deferring</span></dt><dt><span class=
"sect2">History</span></dt><dt><span class="sect2">Completion (anonymous) transitions</span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">more row types</span></dt><dt><span class="sect2">Explicit entry / entry and exit pseudo-state / fork</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Event Hierarchy</span></dt><dt><span class="sect2">Customizing a state machine / Getting more speed</span></dt><dt><span class="sect2">Choosing the initial event</span></dt><dt><span class="sect2"> Containing state machine (deprecated)</span></dt></dl></dd><dt><span class="sect1"><a href="ch03s03.html">Functor front-
end</a></span></dt><dd><dl><dt><span class="sect2"> Transition table </span></dt><dt><span class="sect2">Defining states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Anonymous transitions</span></dt><dt><span class="sect2"><a href="ch03s03.html#d0e2458">Internal
+ transitions</a></span></dt></dl></dd><dt><span class="sect1">eUML (experimental)</span></dt><dd><dl><dt><span class="sect2">Transition table</span></dt><dt><span class="sect2">Defining events, actions and states with entry/exit actions</span></dt><dt><span class="sect2">Defining a simple state machine</span></dt><dt><span class="sect2">Defining a submachine</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e2954">
+ Attributes / Function call</a></span></dt><dt><span class="sect2">Orthogonal regions, flags, event deferring</span></dt><dt><span class="sect2"><a href="ch03s04.html#d0e3166">
Customizing a state machine / Getting
- more speed</a></span></dt><dt><span class="sect2">Completion / Anonymous transitions</span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">Other state types</span></dt><dt><span class="sect2">Helper functions</span></dt><dt><span class="sect2">Phoenix-like STL support</span></dt></dl></dd><dt><span class="sect1">Back-end</span></dt><dd><dl><dt><span class="sect2">Creation </span></dt><dt><span class="sect2">Starting a state machine</span></dt><dt><span class="sect2">Event dispatching</span></dt><dt><span class="sect2">Active state(s)</span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3744">Base state ty
pe </a></span></dt><dt><span class="sect2">Visitor</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Getting a state</span></dt><dt><span class="sect2"> State machine constructor with arguments </span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3917">Trading run-time speed for
- better compile-time / multi-TU compilation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter">4. Performance / Compilers</span></dt><dd><dl><dt><span class="sect1">Speed</span></dt><dt><span class="sect1">Executable size</span></dt><dt><span class="sect1">Supported compilers</span></dt><dt><span class="sect1"> Limitations </span></dt><dt><span class="sect1"> Compilers corner </span></dt></dl></dd><dt><span class="chapter">5. Questions & Answers</span></dt><dt><span class="chapter">6. Internals</span></dt><dd><dl><dt><span class="sect1">Backend: Run To Completion</span></dt><dt><span class="sect1"><a href="ch06s02.html">Frontend / Backend
- interface</a></span></dt><dt><span class="sect1"> Generated state ids </span></dt><dt><span class="sect1">Metaprogramming tools</span></dt></dl></dd><dt><span class="chapter">7. Acknowledgements</span></dt><dd><dl><dt><span class="sect1">MSM v2</span></dt><dt><span class="sect1"> MSM v1</span></dt></dl></dd><dt><span class="chapter">8. Version history</span></dt><dd><dl><dt><span class="sect1">From V2.0 to V2.10</span></dt></dl></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pr01.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Preface </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 1. Founding idea</td></tr></table></div></body></html>
\ No newline at end of file
+ more speed</a></span></dt><dt><span class="sect2">Completion / Anonymous transitions</span></dt><dt><span class="sect2">Internal transitions</span></dt><dt><span class="sect2">Other state types</span></dt><dt><span class="sect2">Helper functions</span></dt><dt><span class="sect2">Phoenix-like STL support</span></dt></dl></dd><dt><span class="sect1">Back-end</span></dt><dd><dl><dt><span class="sect2">Creation </span></dt><dt><span class="sect2">Starting a state machine</span></dt><dt><span class="sect2">Event dispatching</span></dt><dt><span class="sect2">Active state(s)</span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3506">Base state ty
pe </a></span></dt><dt><span class="sect2">Visitor</span></dt><dt><span class="sect2">Flags</span></dt><dt><span class="sect2">Getting a state</span></dt><dt><span class="sect2"> State machine constructor with arguments </span></dt><dt><span class="sect2"><a href="ch03s05.html#d0e3616">Trading run-time speed for
+ better compile-time / multi-TU compilation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter">4. Performance / Compilers</span></dt><dd><dl><dt><span class="sect1">Speed</span></dt><dt><span class="sect1">Executable size</span></dt><dt><span class="sect1">Supported compilers</span></dt><dt><span class="sect1"> Limitations </span></dt><dt><span class="sect1"> Compilers corner </span></dt></dl></dd><dt><span class="chapter">5. Questions & Answers</span></dt><dt><span class="chapter">6. Internals</span></dt><dd><dl><dt><span class="sect1">Backend: Run To Completion</span></dt><dt><span class="sect1"><a href="ch06s02.html">Frontend / Backend
+ interface</a></span></dt><dt><span class="sect1"> Generated state ids </span></dt><dt><span class="sect1">Metaprogramming tools</span></dt></dl></dd><dt><span class="chapter">7. Acknowledgements</span></dt><dd><dl><dt><span class="sect1">MSM v2</span></dt><dt><span class="sect1"> MSM v1</span></dt></dl></dd><dt><span class="chapter">8. Version history</span></dt><dd><dl><dt><span class="sect1">From V2.0 to V2.10</span></dt></dl></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pr01.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Preface </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 1. Founding idea</td></tr></table></div></body></html>
\ No newline at end of file
Modified: sandbox/msm/libs/msm/doc/HTML/pt02.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/pt02.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/pt02.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,4 +1,4 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Part II. Reference</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) V2.10"><link rel="up" href="index.html" title="Meta State Machine (MSM) V2.10"><link rel="prev" href="ch08.html" title="Chapter 8. Version history"><link rel="next" href="ch09.html" title="Chapter 9. eUML operators and basic helpers"></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">Part II. Reference</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch08.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch09.html">Next</a></td></tr></table><hr></div><div class="part" title="Part II. Reference"><div
class="titlepage"><div><div><h1 class="title"><a name="d0e4603"></a>Part II. <span class="command"><strong><a name="Reference-begin"></a></strong></span>Reference</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter">9. eUML operators and basic helpers</span></dt><dt><span class="chapter"><a href="ch10.html">10.
+ <title>Part II. Reference</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) V2.10"><link rel="up" href="index.html" title="Meta State Machine (MSM) V2.10"><link rel="prev" href="ch08.html" title="Chapter 8. Version history"><link rel="next" href="ch09.html" title="Chapter 9. eUML operators and basic helpers"></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">Part II. Reference</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch08.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch09.html">Next</a></td></tr></table><hr></div><div class="part" title="Part II. Reference"><div
class="titlepage"><div><div><h1 class="title"><a name="d0e4277"></a>Part II. <span class="command"><strong><a name="Reference-begin"></a></strong></span>Reference</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter">9. eUML operators and basic helpers</span></dt><dt><span class="chapter"><a href="ch10.html">10.
Functional programming </a></span></dt><dt><span class="refentrytitle">Common headers</span><span class="refpurpose"> — The common types used by front- and back-ends</span></dt><dt><span class="refentrytitle">Back-end</span><span class="refpurpose"> — The back-end headers</span></dt><dt><span class="refentrytitle">Front-end</span><span class="refpurpose"> — The front-end headers</span></dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch08.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. Version history </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">
Chapter 9. eUML operators and basic helpers</td></tr></table></div></body></html>
\ No newline at end of file
Modified: sandbox/msm/libs/msm/doc/HTML/re01.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/re01.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/re01.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,8 +1,8 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Common headers</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) V2.10"><link rel="up" href="pt02.html" title="Part II. Reference"><link rel="prev" href="ch10.html" title="Chapter 10. Functional programming"><link rel="next" href="re02.html" title="Back-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">Common headers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10.html">Prev</a> </td><th width="60%" align="center">Part II. Reference</th><td width="20%" align="right"> <a accesskey="n" href="re02.html">Next</a></td></tr></table><hr></div><div class="refentry" title="Common headers"><a name="d0e6074"></a><div class="titlepage"></div><div clas
s="refnamediv"><h2>Name</h2><p>Common headers — The common types used by front- and back-ends</p></div><div class="refsect1" title="msm/common.hpp"><a name="d0e6080"></a><h2>msm/common.hpp</h2><p>This header provides one type, wrap, which is an empty type whose only reason
+ <title>Common headers</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) V2.10"><link rel="up" href="pt02.html" title="Part II. Reference"><link rel="prev" href="ch10.html" title="Chapter 10. Functional programming"><link rel="next" href="re02.html" title="Back-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">Common headers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10.html">Prev</a> </td><th width="60%" align="center">Part II. Reference</th><td width="20%" align="right"> <a accesskey="n" href="re02.html">Next</a></td></tr></table><hr></div><div class="refentry" title="Common headers"><a name="d0e5748"></a><div class="titlepage"></div><div clas
s="refnamediv"><h2>Name</h2><p>Common headers — The common types used by front- and back-ends</p></div><div class="refsect1" title="msm/common.hpp"><a name="d0e5754"></a><h2>msm/common.hpp</h2><p>This header provides one type, wrap, which is an empty type whose only reason
to exist is to be cheap to construct, so that it can be used with mpl::for_each,
- as shown in the Metaprogramming book, chapter 9.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class Dummy> wrap{};</span></span> {<br>}</pre></div><div class="refsect1" title="msm/row_tags.hpp"><a name="d0e6089"></a><h2>msm/row_tags.hpp</h2><p>This header contains the row type tags which front-ends can support partially
+ as shown in the Metaprogramming book, chapter 9.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class Dummy> wrap{};</span></span> {<br>}</pre></div><div class="refsect1" title="msm/row_tags.hpp"><a name="d0e5763"></a><h2>msm/row_tags.hpp</h2><p>This header contains the row type tags which front-ends can support partially
or totally. Please see the <span class="command"><strong><a class="command" href="ch06s02.html#internals-front-back-interface">Internals</a></strong></span> section for a description of the different
types.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 10.
Functional programming </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Back-end</td></tr></table></div></body></html>
\ No newline at end of file
Modified: sandbox/msm/libs/msm/doc/HTML/re02.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/re02.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/re02.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,79 +1,79 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Back-end</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) V2.10"><link rel="up" href="pt02.html" title="Part II. Reference"><link rel="prev" href="re01.html" title="Common headers"><link rel="next" href="re03.html" title="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">Back-end</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re01.html">Prev</a> </td><th width="60%" align="center">Part II. Reference</th><td width="20%" align="right"> <a accesskey="n" href="re03.html">Next</a></td></tr></table><hr></div><div class="refentry" title="Back-end"><a name="d0e6097"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>Back-end —
The back-end headers</p></div><div class="refsect1" title="msm/back/state_machine.hpp"><a name="d0e6103"></a><h2>msm/back/state_machine.hpp</h2><p> This header provides one type, state_machine, MSM's state machine engine
+ <title>Back-end</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) V2.10"><link rel="up" href="pt02.html" title="Part II. Reference"><link rel="prev" href="re01.html" title="Common headers"><link rel="next" href="re03.html" title="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">Back-end</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re01.html">Prev</a> </td><th width="60%" align="center">Part II. Reference</th><td width="20%" align="right"> <a accesskey="n" href="re03.html">Next</a></td></tr></table><hr></div><div class="refentry" title="Back-end"><a name="d0e5771"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>Back-end —
The back-end headers</p></div><div class="refsect1" title="msm/back/state_machine.hpp"><a name="d0e5777"></a><h2>msm/back/state_machine.hpp</h2><p> This header provides one type, state_machine, MSM's state machine engine
implementation.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class Derived,class HistoryPolicy=NoHistory,class
- CompilePolicy=favor_runtime_speed> state_machine</span></span> {<br>}</pre><div class="refsect2" title="Template arguments"><a name="d0e6112"></a><h3> Template arguments </h3><div class="refsect3" title="Derived"><a name="d0e6115"></a><h4> Derived </h4><p>The name of the front-end state machine definition. All three
- front-ends are possible.</p></div><div class="refsect3" title="HistoryPolicy"><a name="d0e6120"></a><h4> HistoryPolicy </h4><p>The desired history. This can be: AlwaysHistory, NoHistory,
- ShallowHistory. Default is NoHistory.</p></div><div class="refsect3" title="CompilePolicy"><a name="d0e6125"></a><h4> CompilePolicy </h4><p>The trade-off performance / compile-time. There are two predefined
+ CompilePolicy=favor_runtime_speed> state_machine</span></span> {<br>}</pre><div class="refsect2" title="Template arguments"><a name="d0e5786"></a><h3> Template arguments </h3><div class="refsect3" title="Derived"><a name="d0e5789"></a><h4> Derived </h4><p>The name of the front-end state machine definition. All three
+ front-ends are possible.</p></div><div class="refsect3" title="HistoryPolicy"><a name="d0e5794"></a><h4> HistoryPolicy </h4><p>The desired history. This can be: AlwaysHistory, NoHistory,
+ ShallowHistory. Default is NoHistory.</p></div><div class="refsect3" title="CompilePolicy"><a name="d0e5799"></a><h4> CompilePolicy </h4><p>The trade-off performance / compile-time. There are two predefined
policies, favor_runtime_speed and favor_compile_time. Default is
- favor_runtime_speed, best performance, longer compile-time. See <a class="link" href="ch03s05.html#backend-tradeof-rt-ct">the backend</a>.</p></div></div><div class="refsect2" title="methods"><a name="d0e6133"></a><h3> methods </h3><div class="refsect3" title="start"><a name="d0e6136"></a><h4>start</h4><p> The start methods must be called before any call to process_event. It
+ favor_runtime_speed, best performance, longer compile-time. See <a class="link" href="ch03s05.html#backend-tradeof-rt-ct">the backend</a>.</p></div></div><div class="refsect2" title="methods"><a name="d0e5807"></a><h3> methods </h3><div class="refsect3" title="start"><a name="d0e5810"></a><h4>start</h4><p> The start methods must be called before any call to process_event. It
activates the entry action of the initial state(s). This allows you to
- choose when a state machine can start. See <a class="link" href="ch03s05.html#backend-start">backend</a>.</p><code class="methodsynopsis"><span class="methodname">void start</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="process_event"><a name="d0e6149"></a><h4>process_event</h4><p>The event processing method implements the double-dispatch. Each call
+ choose when a state machine can start. See <a class="link" href="ch03s05.html#backend-start">backend</a>.</p><code class="methodsynopsis"><span class="methodname">void start</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="process_event"><a name="d0e5823"></a><h4>process_event</h4><p>The event processing method implements the double-dispatch. Each call
to this function with a new event type instantiates a new dispatch
algorithm and increases compile-time.</p><code class="methodsynopsis"><span class="methodname">template <class Event> HandledEnum
- process_event</span>(<span class="methodparam">Event const&</span>);</code></div><div class="refsect3" title="current_state"><a name="d0e6160"></a><h4>current_state</h4><p>Returns the ids of currently active states. You will typically need it
- only for debugging or logging purposes.</p><code class="methodsynopsis"><span class="methodname">const int* current_state const</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="get_state_by_id"><a name="d0e6170"></a><h4>get_state_by_id</h4><p>Returns the state whose id is given. As all states of a concrete state
+ process_event</span>(<span class="methodparam">Event const&</span>);</code></div><div class="refsect3" title="current_state"><a name="d0e5834"></a><h4>current_state</h4><p>Returns the ids of currently active states. You will typically need it
+ only for debugging or logging purposes.</p><code class="methodsynopsis"><span class="methodname">const int* current_state const</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="get_state_by_id"><a name="d0e5844"></a><h4>get_state_by_id</h4><p>Returns the state whose id is given. As all states of a concrete state
machine share a common base state, the return value is a base state. If
- the id corresponds to no state, a null pointer is returned.</p><code class="methodsynopsis"><span class="methodname">const BaseState* get_state_by_id const</span>(<span class="methodparam">int id</span>);</code></div><div class="refsect3" title="is_contained"><a name="d0e6181"></a><h4>is_contained</h4><p>Helper returning true if the state machine is contained as a
- submachine of another state machine.</p><code class="methodsynopsis"><span class="methodname">bool is_contained const</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="get_state"><a name="d0e6191"></a><h4>get_state</h4><p>Returns the required state of the state machine as a pointer. A
+ the id corresponds to no state, a null pointer is returned.</p><code class="methodsynopsis"><span class="methodname">const BaseState* get_state_by_id const</span>(<span class="methodparam">int id</span>);</code></div><div class="refsect3" title="is_contained"><a name="d0e5855"></a><h4>is_contained</h4><p>Helper returning true if the state machine is contained as a
+ submachine of another state machine.</p><code class="methodsynopsis"><span class="methodname">bool is_contained const</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="get_state"><a name="d0e5865"></a><h4>get_state</h4><p>Returns the required state of the state machine as a pointer. A
compile error will occur if the state is not to be found in the state
- machine.</p><code class="methodsynopsis"><span class="methodname">template <class State> State* get_state</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="get_state"><a name="d0e6201"></a><h4>get_state</h4><p>Returns the required state of the state machine as a reference. A
+ machine.</p><code class="methodsynopsis"><span class="methodname">template <class State> State* get_state</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="get_state"><a name="d0e5875"></a><h4>get_state</h4><p>Returns the required state of the state machine as a reference. A
compile error will occur if the state is not to be found in the state
- machine.</p><code class="methodsynopsis"><span class="methodname">template <class State> State& get_state</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="is_flag_active"><a name="d0e6211"></a><h4>is_flag_active</h4><p>Returns true if the given flag is currently active. A flag is active
+ machine.</p><code class="methodsynopsis"><span class="methodname">template <class State> State& get_state</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="is_flag_active"><a name="d0e5885"></a><h4>is_flag_active</h4><p>Returns true if the given flag is currently active. A flag is active
if the active state of one region is tagged with this flag (using OR as
BinaryOp) or active states of <span class="underline">all</span>
regions (using AND as BinaryOp)</p><code class="methodsynopsis"><span class="methodname">template <class Flag,class BinaryOp> bool
- is_flag_active</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="is_flag_active"><a name="d0e6224"></a><h4>is_flag_active</h4><p>Returns true if the given flag is currently active. A flag is active
- if the active state of one region is tagged with this flag.</p><code class="methodsynopsis"><span class="methodname">template <class Flag> bool is_flag_active</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="visit_current_states"><a name="d0e6234"></a><h4>visit_current_states</h4><p>Visits all active states and their substates. A state is visited using
+ is_flag_active</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="is_flag_active"><a name="d0e5898"></a><h4>is_flag_active</h4><p>Returns true if the given flag is currently active. A flag is active
+ if the active state of one region is tagged with this flag.</p><code class="methodsynopsis"><span class="methodname">template <class Flag> bool is_flag_active</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="visit_current_states"><a name="d0e5908"></a><h4>visit_current_states</h4><p>Visits all active states and their substates. A state is visited using
the <code class="code">accept</code> method without argument. The base class of all
- states must provide an <code class="code">accept_sig</code> type.</p><code class="methodsynopsis"><span class="methodname">void visit_current_states</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="visit_current_states"><a name="d0e6250"></a><h4>visit_current_states</h4><p>Visits all active states and their substates. A state is visited using
+ states must provide an <code class="code">accept_sig</code> type.</p><code class="methodsynopsis"><span class="methodname">void visit_current_states</span>(<span class="methodparam"></span>);</code></div><div class="refsect3" title="visit_current_states"><a name="d0e5924"></a><h4>visit_current_states</h4><p>Visits all active states and their substates. A state is visited using
the <code class="code">accept</code> method with arguments. The base class of all
states must provide an <code class="code">accept_sig</code> type defining the
- signature and thus the number and type of the parameters.</p><code class="methodsynopsis"><span class="methodname">void visit_current_states</span>(<span class="methodparam">any-type param1, any-type param2,...</span>);</code></div><div class="refsect3" title="defer_event"><a name="d0e6267"></a><h4>defer_event</h4><p> Defers the provided event. This method can be called only if at least
+ signature and thus the number and type of the parameters.</p><code class="methodsynopsis"><span class="methodname">void visit_current_states</span>(<span class="methodparam">any-type param1, any-type param2,...</span>);</code></div><div class="refsect3" title="defer_event"><a name="d0e5941"></a><h4>defer_event</h4><p> Defers the provided event. This method can be called only if at least
one state defers an event or if the state machine provides the
<code class="code">activate_deferred_events</code>(see <a class="link" href="examples/Orthogonal-deferred2.cpp" target="_top">example</a>) type
either directly or using the deferred_events configuration of eUML
- (<code class="code">configure_ << deferred_events</code>)</p><code class="methodsynopsis"><span class="methodname">template <class Event> void defer_event</span>(<span class="methodparam">Event const&</span>);</code></div></div><div class="refsect2" title="Types"><a name="d0e6287"></a><h3>Types</h3><div class="refsect3" title="nr_regions"><a name="d0e6290"></a><h4>nr_regions </h4><p>The number of orthogonal regions contained in the state machine</p></div><div class="refsect3" title="entry_pt"><a name="d0e6295"></a><h4>entry_pt</h4><p>This nested type provides the necessary typedef for entry point
+ (<code class="code">configure_ << deferred_events</code>)</p><code class="methodsynopsis"><span class="methodname">template <class Event> void defer_event</span>(<span class="methodparam">Event const&</span>);</code></div></div><div class="refsect2" title="Types"><a name="d0e5961"></a><h3>Types</h3><div class="refsect3" title="nr_regions"><a name="d0e5964"></a><h4>nr_regions </h4><p>The number of orthogonal regions contained in the state machine</p></div><div class="refsect3" title="entry_pt"><a name="d0e5969"></a><h4>entry_pt</h4><p>This nested type provides the necessary typedef for entry point
pseudostates.
<code class="code">state_machine<...>::entry_pt<state_name></code> is a
transition's valid target inside the containing state machine's
- transition table.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">entry_pt</span></span> {<br>}</pre></div><div class="refsect3" title="exit_pt"><a name="d0e6307"></a><h4>exit_pt</h4><p>This nested type provides the necessary typedef for exit point
+ transition table.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">entry_pt</span></span> {<br>}</pre></div><div class="refsect3" title="exit_pt"><a name="d0e5981"></a><h4>exit_pt</h4><p>This nested type provides the necessary typedef for exit point
pseudostates. <code class="code">state_machine<...>::exit_pt<state_name></code>
is a transition's valid source inside the containing state machine's
- transition table.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">exit_pt</span></span> {<br>}</pre></div><div class="refsect3" title="direct"><a name="d0e6319"></a><h4>direct</h4><p>This nested type provides the necessary typedef for an explicit entry
+ transition table.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">exit_pt</span></span> {<br>}</pre></div><div class="refsect3" title="direct"><a name="d0e5993"></a><h4>direct</h4><p>This nested type provides the necessary typedef for an explicit entry
inside a submachine.
<code class="code">state_machine<...>::direct<state_name></code> is a
transition's valid target inside the containing state machine's
- transition table.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">direct</span></span> {<br>}</pre></div><div class="refsect3" title="stt"><a name="d0e6331"></a><h4>stt</h4><p>Calling state_machine<frontend>::stt returns a mpl::vector
+ transition table.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">direct</span></span> {<br>}</pre></div><div class="refsect3" title="stt"><a name="d0e6005"></a><h4>stt</h4><p>Calling state_machine<frontend>::stt returns a mpl::vector
containing the transition table of the state machine. This type can then
- be used with generate_state_set or generate_event_set.</p></div></div></div><div class="refsect1" title="args.hpp"><a name="d0e6336"></a><h2>args.hpp</h2><p>This header provides one type, args. which provides the necessary types for a
- visitor implementation.</p></div><div class="refsect1" title="msm/back/history_policies.hpp"><a name="d0e6341"></a><h2><span class="command"><strong><a name="history-interface"></a></strong></span>msm/back/history_policies.hpp</h2><p>This header provides the out-of-the-box history policies supported by MSM.
- There are 3 such policies.</p><div class="refsect2" title="Every history policy must implement the following methods:"><a name="d0e6347"></a><h3>Every history policy must implement the following methods: </h3><div class="refsect3" title="set_initial_states"><a name="d0e6350"></a><h4> set_initial_states </h4><p> This method is called by msm::back::state_machine when constructed.
+ be used with generate_state_set or generate_event_set.</p></div></div></div><div class="refsect1" title="args.hpp"><a name="d0e6010"></a><h2>args.hpp</h2><p>This header provides one type, args. which provides the necessary types for a
+ visitor implementation.</p></div><div class="refsect1" title="msm/back/history_policies.hpp"><a name="d0e6015"></a><h2><span class="command"><strong><a name="history-interface"></a></strong></span>msm/back/history_policies.hpp</h2><p>This header provides the out-of-the-box history policies supported by MSM.
+ There are 3 such policies.</p><div class="refsect2" title="Every history policy must implement the following methods:"><a name="d0e6021"></a><h3>Every history policy must implement the following methods: </h3><div class="refsect3" title="set_initial_states"><a name="d0e6024"></a><h4> set_initial_states </h4><p> This method is called by msm::back::state_machine when constructed.
It gives the policy a chance to save the ids of all initial states
(passed as array).</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void set_initial_states(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>
<code>(</code>int* const<code>)</code>
- </code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect3" title="history_exit"><a name="d0e6364"></a><h4> history_exit </h4><p>This method is called by msm::back::state_machine when the submachine
+ </code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect3" title="history_exit"><a name="d0e6038"></a><h4> history_exit </h4><p>This method is called by msm::back::state_machine when the submachine
is exited. It gives the policy a chance to remember the ids of the last
active substates of this submachine (passed as array).</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void history_exit(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>
<code>(</code>int* const<code>)</code>
- </code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect3" title="history_entry"><a name="d0e6378"></a><h4> history_entry </h4><p>This method is called by msm::back::state_machine when the submachine
+ </code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect3" title="history_entry"><a name="d0e6052"></a><h4> history_entry </h4><p>This method is called by msm::back::state_machine when the submachine
is entered. It gives the policy a chance to set the active states
according to the policy's aim. The policy gets as parameter the event
which activated the submachine and returns an array of active states
ids.</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class Event> int* const history_exit(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>
<code>(</code>Event const&<code>)</code>
- </code>;</div><div class="funcprototype-spacer"> </div></div></div></div><div class="refsect2" title="Out-of-the-box policies:"><a name="d0e6392"></a><h3>Out-of-the-box policies: </h3><div class="refsect3" title="NoHistory"><a name="d0e6395"></a><h4>NoHistory</h4><p>This policy is the default used by state_machine. No active state of a
+ </code>;</div><div class="funcprototype-spacer"> </div></div></div></div><div class="refsect2" title="Out-of-the-box policies:"><a name="d0e6066"></a><h3>Out-of-the-box policies: </h3><div class="refsect3" title="NoHistory"><a name="d0e6069"></a><h4>NoHistory</h4><p>This policy is the default used by state_machine. No active state of a
submachine is remembered and at every new activation of the submachine,
- the initial state(s) are activated. </p></div><div class="refsect3" title="AlwaysHistory"><a name="d0e6400"></a><h4>AlwaysHistory</h4><p>This policy is a non-UML-standard extension. The active state(s) of a
+ the initial state(s) are activated. </p></div><div class="refsect3" title="AlwaysHistory"><a name="d0e6074"></a><h4>AlwaysHistory</h4><p>This policy is a non-UML-standard extension. The active state(s) of a
submachine is (are) always remembered at every new activation of the
- submachine. </p></div><div class="refsect3" title="ShallowHistory"><a name="d0e6405"></a><h4>ShallowHistory</h4><p>This policy activates the active state(s) of a submachine if the event
- is found in the policy's event list. </p></div></div></div><div class="refsect1" title="msm/back/default_compile_policy.hpp"><a name="d0e6410"></a><h2>msm/back/default_compile_policy.hpp</h2><p>This header contains the definition of favor_runtime_speed. This policy has
+ submachine. </p></div><div class="refsect3" title="ShallowHistory"><a name="d0e6079"></a><h4>ShallowHistory</h4><p>This policy activates the active state(s) of a submachine if the event
+ is found in the policy's event list. </p></div></div></div><div class="refsect1" title="msm/back/default_compile_policy.hpp"><a name="d0e6084"></a><h2>msm/back/default_compile_policy.hpp</h2><p>This header contains the definition of favor_runtime_speed. This policy has
two settings:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Submachines dispatch faster because their transitions are added
into their containing machine's transition table instead of simply
- forwarding events.</p></li><li class="listitem"><p>It solves transition conflicts at compile-time</p></li></ul></div></div><div class="refsect1" title="msm/back/favor_compile_time.hpp"><a name="d0e6422"></a><h2>msm/back/favor_compile_time.hpp</h2><p>This header contains the definition of favor_compile_time. This policy has two settings:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Submachines dispatch is slower because all events, even those with
+ forwarding events.</p></li><li class="listitem"><p>It solves transition conflicts at compile-time</p></li></ul></div></div><div class="refsect1" title="msm/back/favor_compile_time.hpp"><a name="d0e6096"></a><h2>msm/back/favor_compile_time.hpp</h2><p>This header contains the definition of favor_compile_time. This policy has two settings:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Submachines dispatch is slower because all events, even those with
no dispatch chance, are forwarded to submachines. In exchange, no
row is added into the containing machine's transition table, which
- reduces compile-time.</p></li><li class="listitem"><p>It solves transition conflicts at run-time.</p></li></ul></div></div><div class="refsect1" title="msm/back/metafunctions.hpp"><a name="d0e6434"></a><h2>msm/back/metafunctions.hpp </h2><p>This header contains metafunctions for use by the library. Three metafunctions
+ reduces compile-time.</p></li><li class="listitem"><p>It solves transition conflicts at run-time.</p></li></ul></div></div><div class="refsect1" title="msm/back/metafunctions.hpp"><a name="d0e6108"></a><h2>msm/back/metafunctions.hpp </h2><p>This header contains metafunctions for use by the library. Three metafunctions
can be useful for the user:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">generate_state_set< stt ></code>: generates the list of
all states referenced by the transition table stt. If stt is a
recursive table (generated by
@@ -86,22 +86,28 @@
finds recursively all events of the submachines. A non-recursive
table can be obtained with some_backend_fsm::stt.</p></li><li class="listitem"><p><code class="code">recursive_get_transition_table<fsm></code>: recursively
extends the transition table of the state machine fsm with tables
- from the submachines.</p></li></ul></div></div><div class="refsect1" title="msm/back/tools.hpp"><a name="d0e6461"></a><h2>msm/back/tools.hpp </h2><p> This header contains a few metaprogramming tools to get some information out
- of a state machine.</p><div class="refsect2" title="fill_state_names"><a name="d0e6466"></a><h3>fill_state_names </h3><div class="refsect3" title="attributes"><a name="d0e6469"></a><h4>attributes </h4><p> fill_state_names has for attribute:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">char const** m_names</code>: an already allocated
+ from the submachines.</p></li></ul></div></div><div class="refsect1" title="msm/back/tools.hpp"><a name="d0e6135"></a><h2>msm/back/tools.hpp </h2><p> This header contains a few metaprogramming tools to get some information out
+ of a state machine.</p><div class="refsect2" title="fill_state_names"><a name="d0e6140"></a><h3>fill_state_names </h3><div class="refsect3" title="attributes"><a name="d0e6143"></a><h4>attributes </h4><p> fill_state_names has for attribute:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">char const** m_names</code>: an already allocated
array of const char* where the typeid-generated names of a
- state machine states will be witten.</p></li></ul></div></div><div class="refsect3" title="constructor"><a name="d0e6480"></a><h4>constructor </h4><code class="constructorsynopsis"><span class="methodparam">char const** names_to_fill</span>(<span class="methodparam">char const** names_to_fill</span>);</code></div><div class="refsect3" title="usage"><a name="d0e6487"></a><h4>usage</h4><p> fill_state_names is made for use in a mpl::for_each iterating on a
+ state machine states will be witten.</p></li></ul></div></div><div class="refsect3" title="constructor"><a name="d0e6154"></a><h4>constructor </h4><code class="constructorsynopsis"><span class="methodparam">char const** names_to_fill</span>(<span class="methodparam">char const** names_to_fill</span>);</code></div><div class="refsect3" title="usage"><a name="d0e6161"></a><h4>usage</h4><p> fill_state_names is made for use in a mpl::for_each iterating on a
state list and writing inside a pre-allocated array the state names.
- Example:</p><p><code class="code">typedef some_fsm::stt Stt;</code></p><p><code class="code">typedef msm::back::generate_state_set<Stt>::type all_states;
- //states</code></p><p><code class="code">static char const* state_names[mpl::size<all_states>::value];
- // array to fill with names</code></p><p><code class="code">// fill the names of the states defined in the state
- machine</code></p><p><code class="code">mpl::for_each<all_states,boost::msm::wrap<mpl::placeholders::_1>
- ></code></p><p><code class="code">(msm::back::fill_state_names<Stt>(state_names));</code></p><p><code class="code">// display all active states</code></p><p><code class="code">for (unsigned int i=0;i<some_fsm::nr_regions::value;++i)
- {</code></p><p><code class="code">std::cout << " -> " <<
- state_names[my_fsm_instance.current_state()[i]] << std::endl;
- }</code></p></div></div><div class="refsect2" title="get_state_name"><a name="d0e6519"></a><h3>get_state_name </h3><div class="refsect3" title="attributes"><a name="d0e6522"></a><h4> attributes </h4><p>get_state_name has for attributes:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>std::string& m_name: the return value of the
- iteration</p></li><li class="listitem"><p>int m_state_id: the searched state's id</p></li></ul></div></div><div class="refsect3" title="constructor"><a name="d0e6534"></a><h4>constructor</h4><p>The constructor takes as argument a reference to the string to fill
- with the state name and the id which must be searched.</p><code class="constructorsynopsis"><span class="methodparam">std::string& name_to_fill, int state_id</span>(<span class="methodparam">std::string& name_to_fill, int state_id</span>);</code></div><div class="refsect3" title="usage"><a name="d0e6543"></a><h4> usage</h4><p>This type is made for the same search as in the previous example,
+ Example:</p><pre class="programlisting">typedef some_fsm::stt Stt;
+typedef msm::back::generate_state_set<Stt>::type all_states; //states
+static char const* state_names[mpl::size<all_states>::value];
+// array to fill with names
+// fill the names of the states defined in the state machine
+mpl::for_each<all_states,boost::msm::wrap<mpl::placeholders::_1> >
+ (msm::back::fill_state_names<Stt>(state_names));
+// display all active states
+for (unsigned int i=0;i<some_fsm::nr_regions::value;++i)
+{
+ std::cout << " -> "
+ << state_names[my_fsm_instance.current_state()[i]]
+ << std::endl;
+}</pre></div></div><div class="refsect2" title="get_state_name"><a name="d0e6168"></a><h3>get_state_name </h3><div class="refsect3" title="attributes"><a name="d0e6171"></a><h4> attributes </h4><p>get_state_name has for attributes:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>std::string& m_name: the return value of the
+ iteration</p></li><li class="listitem"><p>int m_state_id: the searched state's id</p></li></ul></div></div><div class="refsect3" title="constructor"><a name="d0e6183"></a><h4>constructor</h4><p>The constructor takes as argument a reference to the string to fill
+ with the state name and the id which must be searched.</p><code class="constructorsynopsis"><span class="methodparam">string& name_to_fill,int state_id</span>(<span class="methodparam">string& name_to_fill,int state_id</span>);</code></div><div class="refsect3" title="usage"><a name="d0e6192"></a><h4> usage</h4><p>This type is made for the same search as in the previous example,
using a mpl::for_each to iterate on states. After the iteration, the
- state name reference has been set.</p></div></div><div class="refsect2" title="display_type"><a name="d0e6548"></a><h3>display_type </h3><div class="refsect3" title="attributes"><a name="d0e6551"></a><h4> attributes </h4><p>none</p></div><div class="refsect3" title="usage"><a name="d0e6556"></a><h4> usage</h4><p>Reusing the state list from the previous example, we can output all
+ state name reference has been set.</p></div></div><div class="refsect2" title="display_type"><a name="d0e6197"></a><h3>display_type </h3><div class="refsect3" title="attributes"><a name="d0e6200"></a><h4> attributes </h4><p>none</p></div><div class="refsect3" title="usage"><a name="d0e6205"></a><h4> usage</h4><p>Reusing the state list from the previous example, we can output all
state names:</p><p><code class="code">mpl::for_each<all_states,boost::msm::wrap<mpl::placeholders::_1>
>(msm::back::display_type ());</code></p></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re01.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Common headers </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Front-end</td></tr></table></div></body></html>
\ No newline at end of file
Modified: sandbox/msm/libs/msm/doc/HTML/re03.html
==============================================================================
--- sandbox/msm/libs/msm/doc/HTML/re03.html (original)
+++ sandbox/msm/libs/msm/doc/HTML/re03.html 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -1,11 +1,11 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Front-end</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) V2.10"><link rel="up" href="pt02.html" title="Part II. Reference"><link rel="prev" href="re02.html" title="Back-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">Front-end</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re02.html">Prev</a> </td><th width="60%" align="center">Part II. Reference</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="refentry" title="Front-end"><a name="d0e6564"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>Front-end — The front-end headers</p></div><div class="refsect1" title="msm/front/common_states.hpp"><a name
="d0e6570"></a><h2>msm/front/common_states.hpp</h2><p>This header contains the predefined types to serve as base for states or state machines:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>default_base_state: non-polymorphic empty type.</p></li><li class="listitem"><p>polymorphic_state: type with a virtual destructor, which makes all
- states polymorphic.</p></li></ul></div></div><div class="refsect1" title="msm/front/completion_event.hpp"><a name="d0e6582"></a><h2>msm/front/completion_event.hpp</h2><p>This header contains one type, <code class="code">none</code>. This type has several
+ <title>Front-end</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) V2.10"><link rel="up" href="pt02.html" title="Part II. Reference"><link rel="prev" href="re02.html" title="Back-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">Front-end</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re02.html">Prev</a> </td><th width="60%" align="center">Part II. Reference</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="refentry" title="Front-end"><a name="d0e6213"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>Front-end — The front-end headers</p></div><div class="refsect1" title="msm/front/common_states.hpp"><a name
="d0e6219"></a><h2>msm/front/common_states.hpp</h2><p>This header contains the predefined types to serve as base for states or state machines:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>default_base_state: non-polymorphic empty type.</p></li><li class="listitem"><p>polymorphic_state: type with a virtual destructor, which makes all
+ states polymorphic.</p></li></ul></div></div><div class="refsect1" title="msm/front/completion_event.hpp"><a name="d0e6231"></a><h2>msm/front/completion_event.hpp</h2><p>This header contains one type, <code class="code">none</code>. This type has several
meanings inside a transition table:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>as action or guard: that there is no action or guard</p></li><li class="listitem"><p>as target state: that the transition is an internal
transition</p></li><li class="listitem"><p>as event: the transition is an anonymous (completion)
- transition</p></li></ul></div></div><div class="refsect1" title="msm/front/functor_row.hpp"><a name="d0e6600"></a><h2>msm/front/functor_row.hpp</h2><p>This header implements the functor front-end's transitions and helpers.</p><div class="refsect2" title="Row"><a name="d0e6605"></a><h3>Row</h3><div class="refsect3" title="definition"><a name="d0e6608"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class Source,class Event,class Target,class
- Action,class Guard> Row</span></span> {<br>}</pre></div><div class="refsect3" title="tags"><a name="d0e6615"></a><h4>tags</h4><p>row_type_tag is defined differently for every specialization:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>all 5 template parameters means a normal transition with
+ transition</p></li></ul></div></div><div class="refsect1" title="msm/front/functor_row.hpp"><a name="d0e6249"></a><h2>msm/front/functor_row.hpp</h2><p>This header implements the functor front-end's transitions and helpers.</p><div class="refsect2" title="Row"><a name="d0e6254"></a><h3>Row</h3><div class="refsect3" title="definition"><a name="d0e6257"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class Source,class Event,class Target,class
+ Action,class Guard> Row</span></span> {<br>}</pre></div><div class="refsect3" title="tags"><a name="d0e6264"></a><h4>tags</h4><p>row_type_tag is defined differently for every specialization:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>all 5 template parameters means a normal transition with
action and guard: <code class="code">typedef row_tag
row_type_tag;</code></p></li><li class="listitem"><p>Row<Source,Event,Target,none,none> a normal transition
without action or guard: <code class="code">typedef _row_tag
@@ -21,7 +21,7 @@
transition with action and guard: <code class="code">typedef irow_tag
row_type_tag;</code></p></li><li class="listitem"><p>Row<Source,Event,none,none,none> an internal transition
without action or guard: <code class="code">typedef _irow_tag
- row_type_tag;</code></p></li></ul></div></div><div class="refsect3" title="methods"><a name="d0e6661"></a><h4>methods</h4><p>Like any other front-end, Row implements the two necessary static
+ row_type_tag;</code></p></li></ul></div></div><div class="refsect3" title="methods"><a name="d0e6310"></a><h4>methods</h4><p>Like any other front-end, Row implements the two necessary static
functions for action and guard call. Each function receives as parameter
the (deepest-level) state machine processsing the event, the event
itself, the source and target states and all the states contained in a
@@ -33,8 +33,8 @@
class AllStates> static bool guard_call(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>
<code>(</code>Fsm& fsm,Event const&
evt,SourceState&,TargetState,AllStates&<code>)</code>
- </code>;</div><div class="funcprototype-spacer"> </div></div></div></div><div class="refsect2" title="Internal"><a name="d0e6684"></a><h3>Internal</h3><div class="refsect3" title="definition"><a name="d0e6687"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class Event,class Action,class Guard>
- Internal</span></span> {<br>}</pre></div><div class="refsect3" title="tags"><a name="d0e6694"></a><h4>tags</h4><p>row_type_tag is defined differently for every specialization:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>all 3 template parameters means an internal transition
+ </code>;</div><div class="funcprototype-spacer"> </div></div></div></div><div class="refsect2" title="Internal"><a name="d0e6333"></a><h3>Internal</h3><div class="refsect3" title="definition"><a name="d0e6336"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class Event,class Action,class Guard>
+ Internal</span></span> {<br>}</pre></div><div class="refsect3" title="tags"><a name="d0e6343"></a><h4>tags</h4><p>row_type_tag is defined differently for every specialization:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>all 3 template parameters means an internal transition
with action and guard: <code class="code">typedef sm_i_row_tag
row_type_tag;</code></p></li><li class="listitem"><p>Internal<Event,none,none> an internal transition
without action or guard: <code class="code">typedef sm__i_row_tag
@@ -42,7 +42,7 @@
without guard: <code class="code">typedef sm_a_i_row_tag
row_type_tag;</code></p></li><li class="listitem"><p>Internal<Event,none,Guard> an internal transition
without action: <code class="code">typedef sm_g_i_row_tag
- row_type_tag;</code></p></li></ul></div></div><div class="refsect3" title="methods"><a name="d0e6720"></a><h4>methods</h4><p>Like any other front-end, Internal implements the two necessary static
+ row_type_tag;</code></p></li></ul></div></div><div class="refsect3" title="methods"><a name="d0e6369"></a><h4>methods</h4><p>Like any other front-end, Internal implements the two necessary static
functions for action and guard call. Each function receives as parameter
the (deepest-level) state machine processsing the event, the event
itself, the source and target states and all the states contained in a
@@ -54,9 +54,9 @@
class AllStates> static bool guard_call(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>
<code>(</code>Fsm& fsm,Event const&
evt,SourceState&,TargetState,AllStates&<code>)</code>
- </code>;</div><div class="funcprototype-spacer"> </div></div></div></div><div class="refsect2" title="ActionSequence_"><a name="d0e6743"></a><h3>ActionSequence_</h3><p>This functor calls every element of the template Sequence (which are also
+ </code>;</div><div class="funcprototype-spacer"> </div></div></div></div><div class="refsect2" title="ActionSequence_"><a name="d0e6392"></a><h3>ActionSequence_</h3><p>This functor calls every element of the template Sequence (which are also
callable functors) in turn. It is also the underlying implementation of the
- eUML sequence grammar (action1,action2,...).</p><div class="refsect3" title="definition"><a name="d0e6748"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class Sequence> ActionSequence_</span></span> {<br>}</pre></div><div class="refsect3" title="methods"><a name="d0e6755"></a><h4>methods</h4><p>This helper functor is made for use in a transition table and in a
+ eUML sequence grammar (action1,action2,...).</p><div class="refsect3" title="definition"><a name="d0e6397"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class Sequence> ActionSequence_</span></span> {<br>}</pre></div><div class="refsect3" title="methods"><a name="d0e6404"></a><h4>methods</h4><p>This helper functor is made for use in a transition table and in a
state behavior and therefore implements an operator() with 3 and with 4
arguments:</p><p>
</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class Evt,class Fsm,class
@@ -65,13 +65,13 @@
</p><p>
</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class Evt,class Fsm,class State>
operator()(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Evt const&, Fsm&, State&</code>;</div><div class="funcprototype-spacer"> </div></div><p>
- </p></div></div><div class="refsect2" title="Defer"><a name="d0e6778"></a><h3>Defer</h3><div class="refsect3" title="definition"><a name="d0e6781"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">Defer</span></span> {<br>}</pre></div><div class="refsect3" title="methods"><a name="d0e6788"></a><h4>methods</h4><p>This helper functor is made for use in a transition table and
+ </p></div></div><div class="refsect2" title="Defer"><a name="d0e6427"></a><h3>Defer</h3><div class="refsect3" title="definition"><a name="d0e6430"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">Defer</span></span> {<br>}</pre></div><div class="refsect3" title="methods"><a name="d0e6437"></a><h4>methods</h4><p>This helper functor is made for use in a transition table and
therefore implements an operator() with 4 arguments:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class Evt,class Fsm,class SourceState,class
TargetState> operator()(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Evt const&, Fsm& , SourceState&,
- TargetState&</code>;</div><div class="funcprototype-spacer"> </div></div></div></div></div><div class="refsect1" title="msm/front/internal_row.hpp"><a name="d0e6799"></a><h2>msm/front/internal_row.hpp</h2><p>This header implements the internal transition rows for use inside an
+ TargetState&</code>;</div><div class="funcprototype-spacer"> </div></div></div></div></div><div class="refsect1" title="msm/front/internal_row.hpp"><a name="d0e6448"></a><h2>msm/front/internal_row.hpp</h2><p>This header implements the internal transition rows for use inside an
internal_transition_table. All these row types have no source or target state,
as the backend will recognize internal transitions from this
- internal_transition_table.</p><div class="refsect2" title="methods"><a name="d0e6804"></a><h3>methods</h3><p>Like any other front-end, the following transition row types implements
+ internal_transition_table.</p><div class="refsect2" title="methods"><a name="d0e6453"></a><h3>methods</h3><p>Like any other front-end, the following transition row types implements
the two necessary static functions for action and guard call. Each function
receives as parameter the (deepest-level) state machine processsing the
event, the event itself, the source and target states and all the states
@@ -83,30 +83,30 @@
class AllStates> static bool guard_call(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>
<code>(</code>Fsm& fsm,Event const&
evt,SourceState&,TargetState,AllStates&<code>)</code>
- </code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect2" title="a_internal"><a name="d0e6827"></a><h3>a_internal</h3><div class="refsect3" title="definition"><a name="d0e6830"></a><h4>definition</h4><p>This is an internal transition with an action called during the
+ </code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect2" title="a_internal"><a name="d0e6476"></a><h3>a_internal</h3><div class="refsect3" title="definition"><a name="d0e6479"></a><h4>definition</h4><p>This is an internal transition with an action called during the
transition.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Event, class CalledForAction, void
(CalledForAction::*action)(Event const&)>
- a_internal</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6839"></a><h4>template parameters</h4><p>
+ a_internal</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6488"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the internal
transition.</p></li><li class="listitem"><p>CalledForAction: the type on which the action method will
be called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
provides.</p></li></ul></div><p>
- </p></div></div><div class="refsect2" title="g_internal"><a name="d0e6855"></a><h3>g_internal</h3><p>This is an internal transition with a guard called before the transition
- and allowing the transition if returning true.</p><div class="refsect3" title="definition"><a name="d0e6860"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Event, class CalledForGuard, bool
+ </p></div></div><div class="refsect2" title="g_internal"><a name="d0e6504"></a><h3>g_internal</h3><p>This is an internal transition with a guard called before the transition
+ and allowing the transition if returning true.</p><div class="refsect3" title="definition"><a name="d0e6509"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Event, class CalledForGuard, bool
(CalledForGuard::*guard)(Event const&)>
- g_internal</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6867"></a><h4>template parameters</h4><p>
+ g_internal</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6516"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the internal
transition.</p></li><li class="listitem"><p>CalledForGuard: the type on which the guard method will be
called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
provides.</p></li></ul></div><p>
- </p></div></div><div class="refsect2" title="internal"><a name="d0e6883"></a><h3>internal</h3><p>This is an internal transition with a guard called before the transition
+ </p></div></div><div class="refsect2" title="internal"><a name="d0e6532"></a><h3>internal</h3><p>This is an internal transition with a guard called before the transition
and allowing the transition if returning true. It also calls an action
- called during the transition.</p><div class="refsect3" title="definition"><a name="d0e6888"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Event, class CalledForAction, void
+ called during the transition.</p><div class="refsect3" title="definition"><a name="d0e6537"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Event, class CalledForAction, void
(CalledForAction::*action)(Event const&), class
CalledForGuard, bool (CalledForGuard::*guard)(Event const&)>
- internal</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6895"></a><h4>template parameters</h4><p>
+ internal</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6544"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the internal transition</p></li><li class="listitem"><p>CalledForAction: the type on which the action method will
be called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
@@ -114,15 +114,15 @@
called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
provides.</p></li></ul></div><p>
- </p></div></div><div class="refsect2" title="_internal"><a name="d0e6917"></a><h3>_internal</h3><p>This is an internal transition without action or guard. This is equivalent
- to an explicit "ignore event".</p><div class="refsect3" title="definition"><a name="d0e6922"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Event > _internal</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6929"></a><h4>template parameters</h4><p>
+ </p></div></div><div class="refsect2" title="_internal"><a name="d0e6566"></a><h3>_internal</h3><p>This is an internal transition without action or guard. This is equivalent
+ to an explicit "ignore event".</p><div class="refsect3" title="definition"><a name="d0e6571"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Event > _internal</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6578"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the internal
transition.</p></li></ul></div><p>
- </p></div></div></div><div class="refsect1" title="msm/front/row2.hpp"><a name="d0e6939"></a><h2>msm/front/row2.hpp</h2><p>This header contains the variants of row2, which are an extension of the
+ </p></div></div></div><div class="refsect1" title="msm/front/row2.hpp"><a name="d0e6588"></a><h2>msm/front/row2.hpp</h2><p>This header contains the variants of row2, which are an extension of the
standard row transitions for use in the transition table. They offer the
possibility to define action and guard not only in the state machine, but in any
state of the state machine. They can also be used in internal transition tables
- through their irow2 variants.</p><div class="refsect2" title="methods"><a name="d0e6944"></a><h3>methods</h3><p>Like any other front-end, the following transition row types implements
+ through their irow2 variants.</p><div class="refsect2" title="methods"><a name="d0e6593"></a><h3>methods</h3><p>Like any other front-end, the following transition row types implements
the two necessary static functions for action and guard call. Each function
receives as parameter the (deepest-level) state machine processsing the
event, the event itself, the source and target states and all the states
@@ -134,28 +134,28 @@
class AllStates> static bool guard_call(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>
<code>(</code>Fsm& fsm,Event const&
evt,SourceState&,TargetState,AllStates&<code>)</code>
- </code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect2" title="_row2"><a name="d0e6967"></a><h3>_row2</h3><p>This is a transition without action or guard. The state machine only
- changes active state.</p><div class="refsect3" title="definition"><a name="d0e6972"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class Target >
- _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6979"></a><h4>template parameters</h4><p>
+ </code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect2" title="_row2"><a name="d0e6616"></a><h3>_row2</h3><p>This is a transition without action or guard. The state machine only
+ changes active state.</p><div class="refsect3" title="definition"><a name="d0e6621"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class Target >
+ _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6628"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>Target: the target state of the transition.</p></li></ul></div><p>
- </p></div></div><div class="refsect2" title="a_row2"><a name="d0e6995"></a><h3>a_row2</h3><p>This is a transition with action and without guard.</p><div class="refsect3" title="definition"><a name="d0e7000"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class Target,
- class CalledForAction, void (CalledForAction::*action)(Event
- const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e7007"></a><h4>template parameters</h4><p>
+ </p></div></div><div class="refsect2" title="a_row2"><a name="d0e6644"></a><h3>a_row2</h3><p>This is a transition with action and without guard.</p><div class="refsect3" title="definition"><a name="d0e6649"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class Target,
+ </span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForAction, void
+ (CalledForAction::*action)(Event const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6660"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>Target: the target state of the transition.</p></li><li class="listitem"><p>CalledForAction: the type on which the action method will
be called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
provides.</p></li></ul></div><p>
- </p></div></div><div class="refsect2" title="g_row2"><a name="d0e7029"></a><h3>g_row2</h3><p>This is a transition with guard and without action.</p><div class="refsect3" title="definition"><a name="d0e7034"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class Target,
- class CalledForGuard, bool (CalledForGuard::*guard)(Event
- const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e7041"></a><h4>template parameters</h4><p>
+ </p></div></div><div class="refsect2" title="g_row2"><a name="d0e6682"></a><h3>g_row2</h3><p>This is a transition with guard and without action.</p><div class="refsect3" title="definition"><a name="d0e6687"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class Target,
+ </span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForGuard, bool (CalledForGuard::*guard)(Event
+ const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6698"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>Target: the target state of the transition.</p></li><li class="listitem"><p>CalledForGuard: the type on which the guard method will be
called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
provides.</p></li></ul></div><p>
- </p></div></div><div class="refsect2" title="row2"><a name="d0e7063"></a><h3>row2</h3><p>This is a transition with guard and action.</p><div class="refsect3" title="definition"><a name="d0e7068"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class Target,
- class CalledForAction, void (CalledForAction::*action)(Event
- const&), class CalledForGuard, bool
- (CalledForGuard::*guard)(Event const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e7075"></a><h4>template parameters</h4><p>
+ </p></div></div><div class="refsect2" title="row2"><a name="d0e6720"></a><h3>row2</h3><p>This is a transition with guard and action.</p><div class="refsect3" title="definition"><a name="d0e6725"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class Target,
+ </span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForAction, void
+ (CalledForAction::*action)(Event const&), </span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForGuard, bool (CalledForGuard::*guard)(Event
+ const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6740"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>Target: the target state of the transition.</p></li><li class="listitem"><p>CalledForAction: the type on which the action method will
be called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
@@ -163,27 +163,24 @@
called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
provides.</p></li></ul></div><p>
- </p></div></div><div class="refsect2" title="a_irow2"><a name="d0e7103"></a><h3>a_irow2</h3><p>This is an internal transition for use inside a transition table, with
- action and without guard.</p><div class="refsect3" title="definition"><a name="d0e7108"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class
- CalledForAction, void (CalledForAction::*action)(Event
- const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e7115"></a><h4>template parameters</h4><p>
+ </p></div></div><div class="refsect2" title="a_irow2"><a name="d0e6768"></a><h3>a_irow2</h3><p>This is an internal transition for use inside a transition table, with
+ action and without guard.</p><div class="refsect3" title="definition"><a name="d0e6773"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, </span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForAction, void
+ (CalledForAction::*action)(Event const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6784"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>CalledForAction: the type on which the action method will
be called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
provides.</p></li></ul></div><p>
- </p></div></div><div class="refsect2" title="g_irow2"><a name="d0e7134"></a><h3>g_irow2</h3><p>This is an internal transition for use inside a transition table, with
- guard and without action.</p><div class="refsect3" title="definition"><a name="d0e7139"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class
- CalledForGuard, bool (CalledForGuard::*guard)(Event const&)
- > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e7146"></a><h4>template parameters</h4><p>
+ </p></div></div><div class="refsect2" title="g_irow2"><a name="d0e6803"></a><h3>g_irow2</h3><p>This is an internal transition for use inside a transition table, with
+ guard and without action.</p><div class="refsect3" title="definition"><a name="d0e6808"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, </span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForGuard, bool (CalledForGuard::*guard)(Event
+ const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6819"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>CalledForGuard: the type on which the guard method will be
called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
provides.</p></li></ul></div><p>
- </p></div></div><div class="refsect2" title="irow2"><a name="d0e7165"></a><h3>irow2</h3><p>This is an internal transition for use inside a transition table, with
- guard and action.</p><div class="refsect3" title="definition"><a name="d0e7170"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, class
- CalledForAction, void (CalledForAction::*action)(Event
- const&), class CalledForGuard, bool
- (CalledForGuard::*guard)(Event const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e7177"></a><h4>template parameters</h4><p>
+ </p></div></div><div class="refsect2" title="irow2"><a name="d0e6838"></a><h3>irow2</h3><p>This is an internal transition for use inside a transition table, with
+ guard and action.</p><div class="refsect3" title="definition"><a name="d0e6843"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template< class Source, class Event, </span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForAction, void
+ (CalledForAction::*action)(Event const&), </span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForGuard, bool (CalledForGuard::*guard)(Event
+ const&) > _row2</span></span> {<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6858"></a><h4>template parameters</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>CalledForAction: the type on which the action method will
be called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
@@ -191,16 +188,16 @@
called. It can be either a state of the containing state
machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
provides.</p></li></ul></div><p>
- </p></div></div></div><div class="refsect1" title="msm/front/state_machine_def.hpp"><a name="d0e7202"></a><h2>msm/front/state_machine_def.hpp</h2><p>This header provides the implementation of the <span class="command"><strong><a class="command" href="ch03s02.html#basic-front-end">basic front-end</a></strong></span>. It contains one
- type, <code class="code">state_machine_def</code></p><div class="refsect2" title="state_machine_def definition"><a name="d0e7212"></a><h3>state_machine_def definition</h3><p>This type is the basic class for a basic (or possibly any other)
+ </p></div></div></div><div class="refsect1" title="msm/front/state_machine_def.hpp"><a name="d0e6883"></a><h2>msm/front/state_machine_def.hpp</h2><p>This header provides the implementation of the <span class="command"><strong><a class="command" href="ch03s02.html#basic-front-end">basic front-end</a></strong></span>. It contains one
+ type, <code class="code">state_machine_def</code></p><div class="refsect2" title="state_machine_def definition"><a name="d0e6893"></a><h3>state_machine_def definition</h3><p>This type is the basic class for a basic (or possibly any other)
front-end. It provides the standard row types (which includes internal
transitions) and a default implementation of the required methods and
typedefs.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class Derived,class BaseState =
- default_base_state> state_machine_def</span></span> {<br>}</pre><div class="refsect3" title="typedefs"><a name="d0e7221"></a><h4>typedefs</h4><p>
+ default_base_state> state_machine_def</span></span> {<br>}</pre><div class="refsect3" title="typedefs"><a name="d0e6902"></a><h4>typedefs</h4><p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>flag_list: by default, no flag is set in the state
machine</p></li><li class="listitem"><p>deferred_events: by default, no event is deferred.</p></li><li class="listitem"><p>configuration: by default, no configuration customization
is done.</p></li></ul></div><p>
- </p></div><div class="refsect3" title="row methods"><a name="d0e7237"></a><h4>row methods</h4><p>Like any other front-end, the following transition row types
+ </p></div><div class="refsect3" title="row methods"><a name="d0e6918"></a><h4>row methods</h4><p>Like any other front-end, the following transition row types
implements the two necessary static functions for action and guard call.
Each function receives as parameter the (deepest-level) state machine
processsing the event, the event itself, the source and target states
@@ -212,30 +209,30 @@
class AllStates> static bool guard_call(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>
<code>(</code>Fsm& fsm,Event const&
evt,SourceState&,TargetState,AllStates&<code>)</code>
- </code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect3" title="a_row"><a name="d0e7260"></a><h4>a_row</h4><p>This is a transition with action and without guard.</p><p><code class="classname">template< class Source, class Event, class Target,
+ </code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect3" title="a_row"><a name="d0e6941"></a><h4>a_row</h4><p>This is a transition with action and without guard.</p><p><code class="classname">template< class Source, class Event, class Target,
void (Derived::*action)(Event const&) > a_row</code></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>Target: the target state of the transition.</p></li><li class="listitem"><p>action: a pointer to the method provided by the concrete
- front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="g_row"><a name="d0e7285"></a><h4>g_row</h4><p>This is a transition with guard and without action.</p><p><code class="classname">template< class Source, class Event, class Target,
+ front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="g_row"><a name="d0e6966"></a><h4>g_row</h4><p>This is a transition with guard and without action.</p><p><code class="classname">template< class Source, class Event, class Target,
bool (Derived::*guard)(Event const&) > g_row</code></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>Target: the target state of the transition.</p></li><li class="listitem"><p>guard: a pointer to the method provided by the concrete
- front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="row"><a name="d0e7310"></a><h4>row</h4><p>This is a transition with guard and action.</p><p><code class="classname">template< class Source, class Event, class Target,
+ front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="row"><a name="d0e6991"></a><h4>row</h4><p>This is a transition with guard and action.</p><p><code class="classname">template< class Source, class Event, class Target,
void (Derived::*action)(Event const&), bool
(Derived::*guard)(Event const&) > row</code></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>Target: the target state of the transition.</p></li><li class="listitem"><p>action: a pointer to the method provided by the concrete
front-end (represented by <code class="code">Derived</code>).</p></li><li class="listitem"><p>guard: a pointer to the method provided by the concrete
- front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="_row"><a name="d0e7341"></a><h4>_row</h4><p>This is a transition without action or guard. The state machine only
+ front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="_row"><a name="d0e7022"></a><h4>_row</h4><p>This is a transition without action or guard. The state machine only
changes active state.</p><p><code class="classname">template< class Source, class Event, class Target >
- _row</code></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>Target: the target state of the transition.</p></li></ul></div></div><div class="refsect3" title="a_irow"><a name="d0e7360"></a><h4>a_irow</h4><p>This is an internal transition for use inside a transition table, with
+ _row</code></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>Target: the target state of the transition.</p></li></ul></div></div><div class="refsect3" title="a_irow"><a name="d0e7041"></a><h4>a_irow</h4><p>This is an internal transition for use inside a transition table, with
action and without guard.</p><p><code class="classname">template< class Source, class Event, void
(Derived::*action)(Event const&) > a_irow</code></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>action: a pointer to the method provided by the concrete
- front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="g_irow"><a name="d0e7382"></a><h4>g_irow</h4><p>This is an internal transition for use inside a transition table, with
+ front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="g_irow"><a name="d0e7063"></a><h4>g_irow</h4><p>This is an internal transition for use inside a transition table, with
guard and without action.</p><p><code class="classname">template< class Source, class Event, bool
(Derived::*guard)(Event const&) > g_irow</code></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>guard: a pointer to the method provided by the concrete
- front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="irow"><a name="d0e7404"></a><h4>irow</h4><p>This is an internal transition for use inside a transition table, with
+ front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="irow"><a name="d0e7085"></a><h4>irow</h4><p>This is an internal transition for use inside a transition table, with
guard and action.</p><p><code class="classname">template< class Source, class Event, void
(Derived::*action)(Event const&), bool
(Derived::*guard)(Event const&) > irow</code></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li><li class="listitem"><p>action: a pointer to the method provided by the concrete
front-end (represented by <code class="code">Derived</code>).</p></li><li class="listitem"><p>guard: a pointer to the method provided by the concrete
- front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="_irow"><a name="d0e7432"></a><h4>_irow</h4><p>This is an internal transition without action or guard. As it does
+ front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="_irow"><a name="d0e7113"></a><h4>_irow</h4><p>This is an internal transition without action or guard. As it does
nothing, it means "ignore event".</p><p><code class="classname">template< class Source, class Event >
- _irow</code></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li></ul></div></div><div class="refsect3" title="methods"><a name="d0e7448"></a><h4>methods</h4><p><code class="code">state_machine_def</code> provides a default implementation in
+ _irow</code></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the transition.</p></li><li class="listitem"><p>Source: the source state of the transition.</p></li></ul></div></div><div class="refsect3" title="methods"><a name="d0e7129"></a><h4>methods</h4><p><code class="code">state_machine_def</code> provides a default implementation in
case of an event which cannot be processed by a state machine (no
transition found). The implementation is using a
<code class="code">BOOST_ASSERT</code> so that the error will only be noticed in
@@ -259,38 +256,38 @@
<code>(</code>Event const& ,Fsm&,
std::exception&<code>)</code>
</code>;</div><div class="funcprototype-spacer"> </div></div><p>
- </p></div></div></div><div class="refsect1" title="msm/front/states.hpp"><a name="d0e7492"></a><h2>msm/front/states.hpp </h2><p>This header provides the different states (except state machines) for the
- basic front-end (or mixed with other front-ends).</p><div class="refsect2" title="types"><a name="d0e7497"></a><h3>types</h3><p>This header provides the following types:</p><div class="refsect3" title="no_sm_ptr"><a name="d0e7502"></a><h4>no_sm_ptr</h4><p>deprecated: default policy for states. It means that states do not
- need to save a pointer to their containing state machine.</p></div><div class="refsect3" title="sm_ptr"><a name="d0e7507"></a><h4>sm_ptr</h4><p>deprecated: state policy. It means that states need to save a pointer
+ </p></div></div></div><div class="refsect1" title="msm/front/states.hpp"><a name="d0e7173"></a><h2>msm/front/states.hpp </h2><p>This header provides the different states (except state machines) for the
+ basic front-end (or mixed with other front-ends).</p><div class="refsect2" title="types"><a name="d0e7178"></a><h3>types</h3><p>This header provides the following types:</p><div class="refsect3" title="no_sm_ptr"><a name="d0e7183"></a><h4>no_sm_ptr</h4><p>deprecated: default policy for states. It means that states do not
+ need to save a pointer to their containing state machine.</p></div><div class="refsect3" title="sm_ptr"><a name="d0e7188"></a><h4>sm_ptr</h4><p>deprecated: state policy. It means that states need to save a pointer
to their containing state machine. When seeing this flag, the back-end
- will call set_sm_ptr(fsm*) and give itself as argument.</p></div><div class="refsect3" title="state"><a name="d0e7512"></a><h4>state</h4><p>Basic type for simple states. Inherit from this type to define a
+ will call set_sm_ptr(fsm*) and give itself as argument.</p></div><div class="refsect3" title="state"><a name="d0e7193"></a><h4>state</h4><p>Basic type for simple states. Inherit from this type to define a
simple state. The first argument is needed if you want your state (and
all others used in a concrete state machine) to inherit a basic type for
logging or providing a common behavior.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template<class Base = default_base_state,class
- SMPtrPolicy = no_sm_ptr> state</span></span> {<br>}</pre></div><div class="refsect3" title="terminate_state"><a name="d0e7521"></a><h4>terminate_state</h4><p>Basic type for terminate states. Inherit from this type to define a
+ SMPtrPolicy = no_sm_ptr> state</span></span> {<br>}</pre></div><div class="refsect3" title="terminate_state"><a name="d0e7202"></a><h4>terminate_state</h4><p>Basic type for terminate states. Inherit from this type to define a
terminate state. The first argument is needed if you want your state
(and all others used in a concrete state machine) to inherit a basic
type for logging or providing a common behavior.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template<class Base = default_base_state,class
- SMPtrPolicy = no_sm_ptr> terminate_state</span></span> {<br>}</pre></div><div class="refsect3" title="interrupt_state"><a name="d0e7530"></a><h4>interrupt_state</h4><p>Basic type for interrupt states. Interrupt states prevent any further
+ SMPtrPolicy = no_sm_ptr> terminate_state</span></span> {<br>}</pre></div><div class="refsect3" title="interrupt_state"><a name="d0e7211"></a><h4>interrupt_state</h4><p>Basic type for interrupt states. Interrupt states prevent any further
event handling until EndInterruptEvent is sent. Inherit from this type
to define a terminate state. The first argument is the name of the event
ending the interrupt. The second argument is needed if you want your
state (and all others used in a concrete state machine) to inherit a
basic type for logging or providing a common behavior.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template<class EndInterruptEvent,class Base =
- default_base_state,class SMPtrPolicy = no_sm_ptr>
- interrupt_state</span></span> {<br>}</pre></div><div class="refsect3" title="explicit_entry"><a name="d0e7539"></a><h4>explicit_entry</h4><p>Inherit from this type <span class="underline">in
+ default_base_state,</span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class SMPtrPolicy = no_sm_ptr>
+ interrupt_state</span></span> {<br>}</pre></div><div class="refsect3" title="explicit_entry"><a name="d0e7224"></a><h4>explicit_entry</h4><p>Inherit from this type <span class="underline">in
addition</span> to the desired state type to enable this state
for direct entering. The template parameter gives the region id of the
state (regions are numbered in the order of the
- <code class="code">initial_state</code> typedef).</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <int ZoneIndex=-1> explicit_entry</span></span> {<br>}</pre></div><div class="refsect3" title="entry_pseudo_state"><a name="d0e7554"></a><h4>entry_pseudo_state</h4><p>Basic type for entry pseudo states. Entry pseudo states are an
+ <code class="code">initial_state</code> typedef).</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <int ZoneIndex=-1> explicit_entry</span></span> {<br>}</pre></div><div class="refsect3" title="entry_pseudo_state"><a name="d0e7239"></a><h4>entry_pseudo_state</h4><p>Basic type for entry pseudo states. Entry pseudo states are an
predefined entry into a submachine and connect two transitions. The
first argument is the id of the region entered by this state (regions
are numbered in the order of the <code class="code">initial_state</code> typedef).
The second argument is needed if you want your state (and all others
used in a concrete state machine) to inherit a basic type for logging or
providing a common behavior.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template<int RegionIndex=-1,class Base =
- default_base_state,class SMPtrPolicy = no_sm_ptr>
- entry_pseudo_state</span></span> {<br>}</pre></div><div class="refsect3" title="exit_pseudo_state"><a name="d0e7566"></a><h4>exit_pseudo_state</h4><p>Basic type for exit pseudo states. Exit pseudo states are an
+ default_base_state,</span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class SMPtrPolicy = no_sm_ptr>
+ entry_pseudo_state</span></span> {<br>}</pre></div><div class="refsect3" title="exit_pseudo_state"><a name="d0e7255"></a><h4>exit_pseudo_state</h4><p>Basic type for exit pseudo states. Exit pseudo states are an
predefined exit from a submachine and connect two transitions. The first
argument is the name of the event which will be "thrown" out of the exit
point. This event does not need to be the same as the one sent by the
@@ -298,65 +295,78 @@
needed if you want your state (and all others used in a concrete state
machine) to inherit a basic type for logging or providing a common
behavior.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template<class Event,class Base =
- default_base_state,class SMPtrPolicy = no_sm_ptr>
- exit_pseudo_state</span></span> {<br>}</pre></div></div></div><div class="refsect1" title="msm/front/euml/euml.hpp"><a name="d0e7575"></a><h2>msm/front/euml/euml.hpp</h2><p>This header includes all of eUML except the STL functors.</p></div><div class="refsect1" title="msm/front/euml/stl.hpp"><a name="d0e7580"></a><h2>msm/front/euml/stl.hpp</h2><p>This header includes all the functors for STL support in eUML. These <span class="command"><strong><a class="command" href="ch10.html#eUML-STL-all">tables</a></strong></span> show a full description.</p></div><div class="refsect1" title="msm/front/euml/algorithm.hpp"><a name="d0e7588"></a><h2>msm/front/euml/algorithm.hpp</h2><p>This header includes all the functors for STL algorithms support in eUML.
+ default_base_state,</span></span> {<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class SMPtrPolicy = no_sm_ptr>
+ exit_pseudo_state</span></span> {<br>}</pre></div></div></div><div class="refsect1" title="msm/front/euml/euml.hpp"><a name="d0e7268"></a><h2>msm/front/euml/euml.hpp</h2><p>This header includes all of eUML except the STL functors.</p></div><div class="refsect1" title="msm/front/euml/stl.hpp"><a name="d0e7273"></a><h2>msm/front/euml/stl.hpp</h2><p>This header includes all the functors for STL support in eUML. These <span class="command"><strong><a class="command" href="ch10.html#eUML-STL-all">tables</a></strong></span> show a full description.</p></div><div class="refsect1" title="msm/front/euml/algorithm.hpp"><a name="d0e7281"></a><h2>msm/front/euml/algorithm.hpp</h2><p>This header includes all the functors for STL algorithms support in eUML.
These <span class="command"><strong><a class="command" href="ch10.html#eUML-STL-all">tables</a></strong></span> show a full
- description.</p></div><div class="refsect1" title="msm/front/euml/iteration.hpp"><a name="d0e7596"></a><h2>msm/front/euml/iteration.hpp</h2><p>This header includes iteration functors for STL support in eUML. This <span class="command"><strong><a class="command" href="ch10.html#eUML-STL-iteration">tables</a></strong></span> shows a full
- description.</p></div><div class="refsect1" title="msm/front/euml/querying.hpp"><a name="d0e7604"></a><h2>msm/front/euml/querying.hpp</h2><p>This header includes querying functors for STL support in eUML. This <span class="command"><strong><a class="command" href="ch10.html#eUML-STL-querying">tables</a></strong></span> shows a full
- description.</p></div><div class="refsect1" title="msm/front/euml/transformation.hpp"><a name="d0e7612"></a><h2>msm/front/euml/transformation.hpp</h2><p>This header includes transformation functors for STL support in eUML. This
+ description.</p></div><div class="refsect1" title="msm/front/euml/iteration.hpp"><a name="d0e7289"></a><h2>msm/front/euml/iteration.hpp</h2><p>This header includes iteration functors for STL support in eUML. This <span class="command"><strong><a class="command" href="ch10.html#eUML-STL-iteration">tables</a></strong></span> shows a full
+ description.</p></div><div class="refsect1" title="msm/front/euml/querying.hpp"><a name="d0e7297"></a><h2>msm/front/euml/querying.hpp</h2><p>This header includes querying functors for STL support in eUML. This <span class="command"><strong><a class="command" href="ch10.html#eUML-STL-querying">tables</a></strong></span> shows a full
+ description.</p></div><div class="refsect1" title="msm/front/euml/transformation.hpp"><a name="d0e7305"></a><h2>msm/front/euml/transformation.hpp</h2><p>This header includes transformation functors for STL support in eUML. This
<span class="command"><strong><a class="command" href="ch10.html#eUML-STL-transformation">tables</a></strong></span> shows a full
- description.</p></div><div class="refsect1" title="msm/front/euml/container.hpp"><a name="d0e7620"></a><h2>msm/front/euml/container.hpp</h2><p>This header includes container functors for STL support in eUML (functors
+ description.</p></div><div class="refsect1" title="msm/front/euml/container.hpp"><a name="d0e7313"></a><h2>msm/front/euml/container.hpp</h2><p>This header includes container functors for STL support in eUML (functors
calling container methods). This <span class="command"><strong><a class="command" href="ch10.html#eUML-STL-container">tables</a></strong></span> shows a full description. It also provides npos for
- strings.</p><div class="refsect2" title="Npos_<container type>"><a name="d0e7628"></a><h3>Npos_<container type></h3><p>Functor returning npos for transition or state behaviors. Like all
+ strings.</p><div class="refsect2" title="Npos_<container type>"><a name="d0e7321"></a><h3>Npos_<container type></h3><p>Functor returning npos for transition or state behaviors. Like all
constants, only the functor form exists, so parenthesis are necessary.
Example:</p><p><code class="code">string_find_(event_(m_song),Char_<'S'>(),Size_t_<0>()) !=
Npos_<string>() // compare result of string::find with
- npos</code></p></div></div><div class="refsect1" title="msm/front/euml/stt_grammar.hpp"><a name="d0e7636"></a><h2>msm/front/euml/stt_grammar.hpp</h2><p>This header provides the transition table grammars. This includes internal
- transition tables.</p><div class="refsect2" title="functions"><a name="d0e7641"></a><h3>functions</h3><div class="refsect3" title="build_stt"><a name="d0e7644"></a><h4>build_stt</h4><p>The function build_stt evaluates the grammar-conform expression as
+ npos</code></p></div></div><div class="refsect1" title="msm/front/euml/stt_grammar.hpp"><a name="d0e7329"></a><h2>msm/front/euml/stt_grammar.hpp</h2><p>This header provides the transition table grammars. This includes internal
+ transition tables.</p><div class="refsect2" title="functions"><a name="d0e7334"></a><h3>functions</h3><div class="refsect3" title="build_stt"><a name="d0e7337"></a><h4>build_stt</h4><p>The function build_stt evaluates the grammar-conform expression as
parameter. It returns a transition table, which is a mpl::vector of
transitions (rows) or, if the expression is ill-formed (does not match
the grammar), the type <code class="code">invalid_type</code>, which will lead to a
compile-time static assertion when this transition table is passed to a
state machine. </p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template<class Expr> [mpl::vector<...> /
- msm::front::euml::invalid_type] build_stt(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Expr const& expr</code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect3" title="build_internal_stt"><a name="d0e7658"></a><h4>build_internal_stt</h4><p>The function build_internal_stt evaluates the grammar-conform
+ msm::front::euml::invalid_type] build_stt(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Expr const& expr</code>;</div><div class="funcprototype-spacer"> </div></div></div><div class="refsect3" title="build_internal_stt"><a name="d0e7351"></a><h4>build_internal_stt</h4><p>The function build_internal_stt evaluates the grammar-conform
expression as parameter. It returns a transition table, which is a
mpl::vector of transitions (rows) or, if the expression is ill-formed
(does not match the grammar), the type <code class="code">invalid_type</code>, which
will lead to a compile-time static assertion when this transition table
is passed to a state machine. </p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template<class Expr> [mpl::vector<...> /
- msm::front::euml::invalid_type] build_internal_stt(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Expr const& expr</code>;</div><div class="funcprototype-spacer"> </div></div></div></div><div class="refsect2" title="grammars"><a name="d0e7672"></a><h3>grammars</h3><div class="refsect3" title="transition table"><a name="d0e7675"></a><h4><span class="command"><strong><a name="reference-stt-grammar"></a>transition
- table</strong></span></h4><p>The transition table accepts the following grammar:</p><p><code class="code">Stt := Row | (Stt ',' Stt)</code></p><p><code class="code">Row := (Target '==' (SourcePlusEvent)) /* first
- syntax*/</code></p><p><code class="code"> | ( (SourcePlusEvent) '==' Target ) /* second
- syntax*/</code></p><p><code class="code"> | (SourcePlusEvent) /* internal transitions */</code></p><p><code class="code">SourcePlusEvent := (BuildSource '+' BuildEvent)/* standard
- transition*/ </code></p><p><code class="code"> | (BuildSource) /* anonymous transition */</code></p><p><code class="code">BuildSource := state_tag | (state_tag '/' Action) | (state_tag
- '[' Guard ']') | (state_tag '[' Guard ']' '/' Action)</code></p><p><code class="code">BuildEvent := event_tag | (event_tag '/' Action) | (event_tag
- '[' Guard ']') | (event_tag '[' Guard ']' '/' Action)</code>
- </p><p>The grammars Action and Guard are defined in state_grammar.hpp and
+ msm::front::euml::invalid_type] build_internal_stt(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Expr const& expr</code>;</div><div class="funcprototype-spacer"> </div></div></div></div><div class="refsect2" title="grammars"><a name="d0e7365"></a><h3>grammars</h3><div class="refsect3" title="transition table"><a name="d0e7368"></a><h4><span class="command"><strong><a name="reference-stt-grammar"></a>transition
+ table</strong></span></h4><p>The transition table accepts the following grammar:</p><pre class="programlisting">Stt := Row | (Stt ',' Stt)
+Row := (Target '==' (SourcePlusEvent)) /* first syntax*/
+ | ( (SourcePlusEvent) '==' Target ) /* second syntax*/
+ | (SourcePlusEvent) /* internal transitions */
+SourcePlusEvent := (BuildSource '+' BuildEvent)/* standard transition*/
+ | (BuildSource) /* anonymous transition */
+BuildSource := state_tag | (state_tag '/' Action) | (state_tag '[' Guard ']')
+ | (state_tag '[' Guard ']' '/' Action)
+BuildEvent := event_tag | (event_tag '/' Action) | (event_tag '[' Guard ']')
+ | (event_tag '[' Guard ']' '/' Action)</pre><p>The grammars Action and Guard are defined in state_grammar.hpp and
guard_grammar.hpp respectively. state_tag and event_tag are inherited
from euml_state (or other state variants) and euml_event respectively.
- For example, following declarations are possible:</p><p><code class="code">target == source + event [guard] / action,</code></p><p><code class="code">source + event [guard] / action == target,</code></p><p><code class="code">source + event [guard] / (action1,action2) ==
- target,</code></p><p><code class="code">target == source + event [guard] /
- (action1,action2),</code></p><p><code class="code">target == source + event,</code></p><p><code class="code">source + event == target,</code></p><p><code class="code">target == source + event [guard],</code></p><p><code class="code">source + event [guard] == target,</code></p><p><code class="code">target == source + event / action,</code></p><p><code class="code">source + event /action == target,</code></p><p><code class="code">source / action == target, /*anonymous
- transition*/</code></p><p><code class="code">target == source / action, /*anonymous
- transition*/</code></p><p><code class="code">source + event /action, /* internal transition*/</code></p></div><div class="refsect3" title="internal transition table"><a name="d0e7747"></a><h4>internal transition table</h4><p>The internal transition table accepts the following grammar:</p><p><code class="code">IStt := BuildEvent | (IStt ',' IStt)</code></p><p>BuildEvent being defined for both internal and standard transition
- tables.</p></div></div></div><div class="refsect1" title="msm/front/euml/guard_grammar.hpp"><a name="d0e7757"></a><h2>msm/front/euml/guard_grammar.hpp</h2><p>This header contains the <code class="code">Guard</code> grammar used in the previous
- section. This grammar is long but pretty simple:</p><p><code class="code">Guard := action_tag | (Guard '&&' Guard) | (Guard '||' Guard) |
- ... /* operators*/ </code></p><p><code class="code">| (if_then_else_(Guard,Guard,Guard)) | (function
- (Action,...Action))</code></p><p>Most C++ operators are supported (address-of is not). With
+ For example, following declarations are possible:</p><pre class="programlisting">target == source + event [guard] / action,
+source + event [guard] / action == target,
+source + event [guard] / (action1,action2) == target,
+target == source + event [guard] / (action1,action2),
+target == source + event,
+source + event == target,
+target == source + event [guard],
+source + event [guard] == target,
+target == source + event / action,
+source + event /action == target,
+source / action == target, /*anonymous transition*/
+target == source / action, /*anonymous transition*/
+source + event /action, /* internal transition*/</pre></div><div class="refsect3" title="internal transition table"><a name="d0e7380"></a><h4>internal transition table</h4><p>The internal transition table accepts the following grammar:</p><pre class="programlisting">IStt := BuildEvent | (IStt ',' IStt)</pre><p>BuildEvent being defined for both internal and standard transition
+ tables.</p></div></div></div><div class="refsect1" title="msm/front/euml/guard_grammar.hpp"><a name="d0e7389"></a><h2>msm/front/euml/guard_grammar.hpp</h2><p>This header contains the <code class="code">Guard</code> grammar used in the previous
+ section. This grammar is long but pretty simple:</p><pre class="programlisting">Guard := action_tag | (Guard '&&' Guard)
+ | (Guard '||' Guard) | ... /* operators*/
+ | (if_then_else_(Guard,Guard,Guard)) | (function (Action,...Action))</pre><p>Most C++ operators are supported (address-of is not). With
<code class="code">function</code> is meant any eUML predefined function or any self-made
(using <code class="code">MSM_EUML_METHOD</code> or <code class="code">MSM_EUML_FUNCTION</code>). Action
- is a grammar defined in state_grammar.hpp.</p></div><div class="refsect1" title="msm/front/euml/state_grammar.hpp"><a name="d0e7782"></a><h2>msm/front/euml/state_grammar.hpp</h2><p>This header provides the grammar for actions and the different grammars and
- functions to build states using eUML.</p><div class="refsect2" title="action grammar"><a name="d0e7787"></a><h3>action grammar</h3><p>Like the guard grammar, this grammar supports relevant C++ operators and
- eUML functions:</p><p><code class="code">Action := action_tag | (Action '+' Action) | ('--' Action) | ... /*
- operators*/ </code></p><p><code class="code">| if_then_else_(Guard,Action,Action) | if_then_(Action) |
- while_(Guard,Action) | do_while_(Guard,Action) |
- for_(Action,Guard,Action,Action) | (function
- (Action,...Action))</code></p><p><code class="code">ActionSequence := Action | (Action ',' Action)</code></p><p>Relevant operators are: ++ (post/pre), -- (post/pre), dereferencing, +
+ is a grammar defined in state_grammar.hpp.</p></div><div class="refsect1" title="msm/front/euml/state_grammar.hpp"><a name="d0e7410"></a><h2>msm/front/euml/state_grammar.hpp</h2><p>This header provides the grammar for actions and the different grammars and
+ functions to build states using eUML.</p><div class="refsect2" title="action grammar"><a name="d0e7415"></a><h3>action grammar</h3><p>Like the guard grammar, this grammar supports relevant C++ operators and
+ eUML functions:</p><pre class="programlisting">Action := action_tag | (Action '+' Action)
+ | ('--' Action) | ... /* operators*/
+ | if_then_else_(Guard,Action,Action) | if_then_(Action)
+ | while_(Guard,Action)
+ | do_while_(Guard,Action) | for_(Action,Guard,Action,Action)
+ | (function(Action,...Action))
+ActionSequence := Action | (Action ',' Action)</pre><p>Relevant operators are: ++ (post/pre), -- (post/pre), dereferencing, +
(unary/binary), - (unary/binary), *, /, %, &(bitwise), | (bitwise),
- ^(bitwise), +=, -=, *=, /=, %=, <<=, >>=, <<, >>, =, [].</p></div><div class="refsect2" title="attributes"><a name="d0e7803"></a><h3>attributes</h3><p>This grammar is used to add attributes to states (or state machines) or
+ ^(bitwise), +=, -=, *=, /=, %=, <<=, >>=, <<, >>, =, [].</p></div><div class="refsect2" title="attributes"><a name="d0e7424"></a><h3>attributes</h3><p>This grammar is used to add attributes to states (or state machines) or
events: It evaluates to a fusion::map. You can use two forms:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">attributes_ << no_attributes_</code></p></li><li class="listitem"><p><code class="code">attributes_ << attribute_1 << ... <<
attribute_n</code></p></li></ul></div><p>Attributes can be of any default-constructible type (fusion
- requirement).</p></div><div class="refsect2" title="configure"><a name="d0e7819"></a><h3>configure</h3><p>This grammar also has two forms:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">configure_ << no_configure_</code></p></li><li class="listitem"><p><code class="code">configure_ << type_1 << ... <<
+ requirement).</p></div><div class="refsect2" title="configure"><a name="d0e7440"></a><h3>configure</h3><p>This grammar also has two forms:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">configure_ << no_configure_</code></p></li><li class="listitem"><p><code class="code">configure_ << type_1 << ... <<
type_n</code></p></li></ul></div><p>This grammar is used to create inside one syntax:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>flags: <code class="code">configure_ << some_flag</code> where
some_flag inherits from <code class="code">euml_flag<some_flag></code> or
is defined using BOOST_MSM_EUML_FLAG.</p></li><li class="listitem"><p>deferred events: <code class="code">configure_ << some_event</code>
@@ -368,12 +378,12 @@
some_config inherits from
<code class="code">euml_config<some_config></code>. At the moment,
three predefined objects exist (in msm//front/euml/common.hpp):</p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>no_exception: disable catching exceptions</p></li><li class="listitem"><p>no_msg_queue: disable message queue</p></li><li class="listitem"><p>deferred_events: manually enable handling of
- deferred events</p></li></ul></div></li></ul></div></div><div class="refsect2" title="initial states"><a name="d0e7873"></a><h3>initial states</h3><p>The grammar to define initial states for a state machine is: <code class="code">init_
+ deferred events</p></li></ul></div></li></ul></div></div><div class="refsect2" title="initial states"><a name="d0e7494"></a><h3>initial states</h3><p>The grammar to define initial states for a state machine is: <code class="code">init_
<< state_1 << ... << state_n</code> where
state_1...state_n inherit from euml_state or is defined using
BOOST_MSM_EUML_STATE, BOOST_MSM_EUML_INTERRUPT_STATE,
BOOST_MSM_EUML_TERMINATE_STATE, BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE,
- BOOST_MSM_EUML_ENTRY_STATE or BOOST_MSM_EUML_EXIT_STATE.</p></div><div class="refsect2" title="functions"><a name="d0e7881"></a><h3>functions</h3><div class="refsect3" title="build_sm"><a name="d0e7884"></a><h4>build_sm</h4><p>This function has several overloads. The return type is not relevant
+ BOOST_MSM_EUML_ENTRY_STATE or BOOST_MSM_EUML_EXIT_STATE.</p></div><div class="refsect2" title="functions"><a name="d0e7502"></a><h3>functions</h3><div class="refsect3" title="build_sm"><a name="d0e7505"></a><h4>build_sm</h4><p>This function has several overloads. The return type is not relevant
to you as only decltype (return type) is what one needs.</p><p>Defines a state machine without entry or exit:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,class Stt,class Init>
func_state_machine<...> build_sm(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Stt ,Init</code>;</div><div class="funcprototype-spacer"> </div></div><p>Defines a state machine with entry behavior:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,class Stt,class Init,class
Expr1> func_state_machine<...> build_sm(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Stt ,Init,Expr1 const&</code>;</div><div class="funcprototype-spacer"> </div></div><p>Defines a state machine with entry and exit behaviors:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,class Stt,class Init,class
@@ -392,7 +402,7 @@
Base> func_state_machine<...> build_sm(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Stt ,Init,Expr1 const&, Expr2 const&, Attributes
const&, Configure const&, Base</code>;</div><div class="funcprototype-spacer"> </div></div><p>Notice that this function requires the extra parameter class
StateNameTag to disambiguate state machines having the same parameters
- but still being different.</p></div><div class="refsect3" title="build_state"><a name="d0e7939"></a><h4>build_state</h4><p>This function has several overloads. The return type is not relevant
+ but still being different.</p></div><div class="refsect3" title="build_state"><a name="d0e7560"></a><h4>build_state</h4><p>This function has several overloads. The return type is not relevant
to you as only decltype (return type) is what one needs.</p><p>Defines a simple state without entry or exit:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">func_state<class StateNameTag,...> build_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code></code>;</div><div class="funcprototype-spacer"> </div></div><p>Defines a simple state with entry behavior:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,class Expr1>
func_state<...> build_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Expr1 const&</code>;</div><div class="funcprototype-spacer"> </div></div><p>Defines a simple state with entry and exit behaviors:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,class Expr1, class Expr2>
func_state<...> build_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Expr1 const&,Expr2 const&</code>;</div><div class="funcprototype-spacer"> </div></div><p>Defines a simple state with entry, exit behaviors and
@@ -408,7 +418,7 @@
func_state<...> build_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Expr1 const&, Expr2 const&, Attributes const&,
Configure const&, Base</code>;</div><div class="funcprototype-spacer"> </div></div><p>Notice that this function requires the extra parameter class
StateNameTag to disambiguate states having the same parameters but still
- being different.</p></div><div class="refsect3" title="build_terminate_state"><a name="d0e7993"></a><h4>build_terminate_state</h4><p>This function has the same overloads as build_state.</p></div><div class="refsect3" title="build_interrupt_state"><a name="d0e7998"></a><h4>build_interrupt_state</h4><p>This function has several overloads. The return type is not relevant
+ being different.</p></div><div class="refsect3" title="build_terminate_state"><a name="d0e7614"></a><h4>build_terminate_state</h4><p>This function has the same overloads as build_state.</p></div><div class="refsect3" title="build_interrupt_state"><a name="d0e7619"></a><h4>build_interrupt_state</h4><p>This function has several overloads. The return type is not relevant
to you as only decltype (return type) is what one needs.</p><p>Defines an interrupt state without entry or exit:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,class EndInterruptEvent>
func_state<...> build_interrupt_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>EndInterruptEvent const&</code>;</div><div class="funcprototype-spacer"> </div></div><p>Defines an interrupt state with entry behavior:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,class
EndInterruptEvent,class Expr1> func_state<...>
@@ -433,7 +443,7 @@
const&, Attributes const&, Configure const&,
Base</code>;</div><div class="funcprototype-spacer"> </div></div><p>Notice that this function requires the extra parameter class
StateNameTag to disambiguate states having the same parameters but still
- being different.</p></div><div class="refsect3" title="build_entry_state"><a name="d0e8053"></a><h4>build_entry_state</h4><p>This function has several overloads. The return type is not relevant
+ being different.</p></div><div class="refsect3" title="build_entry_state"><a name="d0e7674"></a><h4>build_entry_state</h4><p>This function has several overloads. The return type is not relevant
to you as only decltype (return type) is what one needs.</p><p>Defines an entry pseudo state without entry or exit:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,int RegionIndex>
entry_func_state<...> build_entry_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code></code>;</div><div class="funcprototype-spacer"> </div></div><p>Defines an entry pseudo state with entry behavior:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,int RegionIndex,class
Expr1> entry_func_state<...> build_entry_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Expr1 const&</code>;</div><div class="funcprototype-spacer"> </div></div><p>Defines an entry pseudo state with entry and exit behaviors:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,int RegionIndex,class
@@ -452,7 +462,7 @@
Base> entry_func_state<...> build_entry_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Expr1 const&, Expr2 const&, Attributes const&,
Configure const&, Base</code>;</div><div class="funcprototype-spacer"> </div></div><p>Notice that this function requires the extra parameter class
StateNameTag to disambiguate states having the same parameters but still
- being different.</p></div><div class="refsect3" title="build_exit_state"><a name="d0e8107"></a><h4>build_exit_state</h4><p>This function has several overloads. The return type is not relevant
+ being different.</p></div><div class="refsect3" title="build_exit_state"><a name="d0e7728"></a><h4>build_exit_state</h4><p>This function has several overloads. The return type is not relevant
to you as only decltype (return type) is what one needs.</p><p>Defines an exit pseudo state without entry or exit:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,class Event>
exit_func_state<...> build_exit_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Event const&</code>;</div><div class="funcprototype-spacer"> </div></div><p>Defines an exit pseudo state with entry behavior:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,class Event,class Expr1>
exit_func_state<...> build_exit_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Event const&,Expr1 const&</code>;</div><div class="funcprototype-spacer"> </div></div><p>Defines an exit pseudo state with entry and exit behaviors:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template <class StateNameTag,class Event,class Expr1,
@@ -471,154 +481,189 @@
exit_func_state<...> build_exit_state(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>Event const&,Expr1 const&, Expr2 const&,
Attributes const&, Configure const&, Base</code>;</div><div class="funcprototype-spacer"> </div></div><p>Notice that this function requires the extra parameter class
StateNameTag to disambiguate states having the same parameters but still
- being different.</p></div><div class="refsect3" title="build_explicit_entry_state"><a name="d0e8162"></a><h4>build_explicit_entry_state</h4><p>This function has the same overloads as build_entry_state and
- explicit_entry_func_state as return type.</p></div></div></div><div class="refsect1" title="msm/front/euml/common.hpp"><a name="d0e8167"></a><h2>msm/front/euml/common.hpp</h2><div class="refsect2" title="types"><a name="d0e8170"></a><h3>types</h3><div class="refsect3" title="euml_event"><a name="d0e8173"></a><h4>euml_event</h4><p>The basic type for events with eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class EventName> euml_event;</span></span> {<br>}</pre><p><code class="code">struct play : euml_event<play>{};</code></p></div><div class="refsect3" title="euml_state"><a name="d0e8185"></a><h4>euml_state</h4><p>The basic type for states with eUML. You will usually not use this
+ being different.</p></div><div class="refsect3" title="build_explicit_entry_state"><a name="d0e7783"></a><h4>build_explicit_entry_state</h4><p>This function has the same overloads as build_entry_state and
+ explicit_entry_func_state as return type.</p></div></div></div><div class="refsect1" title="msm/front/euml/common.hpp"><a name="d0e7788"></a><h2>msm/front/euml/common.hpp</h2><div class="refsect2" title="types"><a name="d0e7791"></a><h3>types</h3><div class="refsect3" title="euml_event"><a name="d0e7794"></a><h4>euml_event</h4><p>The basic type for events with eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class EventName> euml_event;</span></span> {<br>}</pre><pre class="programlisting">struct play : euml_event<play>{};</pre></div><div class="refsect3" title="euml_state"><a name="d0e7805"></a><h4>euml_state</h4><p>The basic type for states with eUML. You will usually not use this
type directly as it is easier to use BOOST_MSM_EUML_STATE,
BOOST_MSM_EUML_INTERRUPT_STATE, BOOST_MSM_EUML_TERMINATE_STATE,
BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE, BOOST_MSM_EUML_ENTRY_STATE or
BOOST_MSM_EUML_EXIT_STATE.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class StateName> euml_state;</span></span> {<br>}</pre><p>You can however use this type directly if you want to provide your
state with extra functions or provide entry or exit behaviors without
- functors, for example:</p><p><code class="code">struct Empty : public msm::front::state<> , public
- euml_state<Empty> {</code></p><p><code class="code">void foo() {...}</code></p><p><code class="code">template <class Event,class Fsm></code></p><p><code class="code">void on_entry(Event const& evt,Fsm& fsm)
- {...}</code></p><p><code class="code">};</code></p></div><div class="refsect3" title="euml_flag"><a name="d0e8211"></a><h4>euml_flag</h4><p>The basic type for flags with eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class FlagName> euml_flag;</span></span> {<br>}</pre><p><code class="code">struct PlayingPaused:
- euml_flag<PlayingPaused>{};</code></p></div><div class="refsect3" title="euml_action"><a name="d0e8223"></a><h4>euml_action</h4><p>The basic type for state or transition behaviors and guards with
- eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class AcionName> euml_action;</span></span> {<br>}</pre><p><code class="code">struct close_drawer : euml_action<close_drawer>
- {</code></p><p><code class="code">template <class Fsm,class Evt,class SourceState,class
- TargetState></code></p><p><code class="code">void operator()(Evt const& , Fsm&, SourceState&
- ,TargetState& ) {...}</code></p><p><code class="code">};</code></p><p>Or, as state entry or exit behavior:</p><p><code class="code">struct Playing_Entry : euml_action<Playing_Entry>
- {</code></p><p><code class="code">template <class Event,class Fsm,class State></code></p><p><code class="code">void operator()(Event const&,Fsm& fsm,State& )
- {...}</code></p><p><code class="code">};</code></p></div><div class="refsect3" title="euml_config"><a name="d0e8258"></a><h4>euml_config</h4><p>The basic type for configuration possibilities with eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class ConfigName> euml_config;</span></span> {<br>}</pre><p>You normally do not use this type directly but instead the instances
+ functors, for example:</p><pre class="programlisting">struct Empty : public msm::front::state<> , public euml_state<Empty>
+{
+ void foo() {...}
+ template <class Event,class Fsm>
+ void on_entry(Event const& evt,Fsm& fsm){...}
+};</pre></div><div class="refsect3" title="euml_flag"><a name="d0e7818"></a><h4>euml_flag</h4><p>The basic type for flags with eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class FlagName> euml_flag;</span></span> {<br>}</pre><pre class="programlisting">struct PlayingPaused: euml_flag<PlayingPaused>{};</pre></div><div class="refsect3" title="euml_action"><a name="d0e7829"></a><h4>euml_action</h4><p>The basic type for state or transition behaviors and guards with
+ eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class AcionName> euml_action;</span></span> {<br>}</pre><pre class="programlisting">struct close_drawer : euml_action<close_drawer>
+{
+ template <class Fsm,class Evt,class SourceState,class TargetState>
+ void operator()(Evt const& , Fsm&, SourceState& ,TargetState& ) {...}
+};</pre><p>Or, as state entry or exit behavior:</p><pre class="programlisting">struct Playing_Entry : euml_action<Playing_Entry>
+{
+ template <class Event,class Fsm,class State>
+ void operator()(Event const&,Fsm& fsm,State& ){...}
+};</pre></div><div class="refsect3" title="euml_config"><a name="d0e7844"></a><h4>euml_config</h4><p>The basic type for configuration possibilities with eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template <class ConfigName> euml_config;</span></span> {<br>}</pre><p>You normally do not use this type directly but instead the instances
of predefined configuration:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>no_exception: disable catching exceptions</p></li><li class="listitem"><p>no_msg_queue: disable message queue. The message queue
allows you to send an event for procesing while in an event
processing.</p></li><li class="listitem"><p>deferred_events: manually enable handling of deferred
- events</p></li></ul></div></div><div class="refsect3" title="invalid_type"><a name="d0e8279"></a><h4>invalid_type</h4><p>Type returned by grammar parsers if the grammar is invalid. Seeing
- this type will result in a static assertion.</p></div><div class="refsect3" title="no_action"><a name="d0e8284"></a><h4>no_action</h4><p>Placeholder type for use in entry/exit or transition behaviors, which
- does absolutely nothing.</p></div><div class="refsect3" title="source_"><a name="d0e8289"></a><h4>source_</h4><p>Generic object or function for the source state of a given transition:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>as object: returns by reference the source state of a
+ events</p></li></ul></div></div><div class="refsect3" title="invalid_type"><a name="d0e7865"></a><h4>invalid_type</h4><p>Type returned by grammar parsers if the grammar is invalid. Seeing
+ this type will result in a static assertion.</p></div><div class="refsect3" title="no_action"><a name="d0e7870"></a><h4>no_action</h4><p>Placeholder type for use in entry/exit or transition behaviors, which
+ does absolutely nothing.</p></div><div class="refsect3" title="source_"><a name="d0e7875"></a><h4>source_</h4><p>Generic object or function for the source state of a given transition:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>as object: returns by reference the source state of a
transition, usually to be used by another function (usually
- one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example: <code class="code">some_user_function_(source_)</code></p></li><li class="listitem"><p>as function: returns by reference the attribute passed as
- parameter.</p><p>Example: <code class="code">source_(m_counter)++</code></p></li></ul></div></div><div class="refsect3" title="target_"><a name="d0e8309"></a><h4>target_</h4><p>Generic object or function for the target state of a given transition:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>as object: returns by reference the target state of a
+ one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
+ </p><pre class="programlisting">some_user_function_(source_)</pre></li><li class="listitem"><p>as function: returns by reference the attribute passed as
+ parameter.</p><p>Example:
+ </p><pre class="programlisting">source_(m_counter)++</pre></li></ul></div></div><div class="refsect3" title="target_"><a name="d0e7895"></a><h4>target_</h4><p>Generic object or function for the target state of a given transition:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>as object: returns by reference the target state of a
transition, usually to be used by another function (usually
- one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example: <code class="code">some_user_function_(target_)</code></p></li><li class="listitem"><p>as function: returns by reference the attribute passed as
- parameter.</p><p>Example: <code class="code">target_(m_counter)++</code></p></li></ul></div></div><div class="refsect3" title="state_"><a name="d0e8329"></a><h4>state_</h4><p>Generic object or function for the state of a given entry / exit
+ one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
+ </p><pre class="programlisting">some_user_function_(target_)</pre></li><li class="listitem"><p>as function: returns by reference the attribute passed as
+ parameter.</p><p>Example:
+ </p><pre class="programlisting">target_(m_counter)++</pre></li></ul></div></div><div class="refsect3" title="state_"><a name="d0e7915"></a><h4>state_</h4><p>Generic object or function for the state of a given entry / exit
behavior. state_ means source_ while in the context of an exit behavior
and target_ in the context of an entry behavior:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>as object: returns by reference the current state, usually
to be used by another function (usually one created by
- MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example: <code class="code">some_user_function_(state_) // calls
- some_user_function on the current state</code></p></li><li class="listitem"><p>as function: returns by reference the attribute passed as
- parameter.</p><p>Example: <code class="code">state_(m_counter)++</code></p></li></ul></div></div><div class="refsect3" title="event_"><a name="d0e8349"></a><h4>event_</h4><p>Generic object or function for the event triggering a given transition
+ MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
+ </p><pre class="programlisting">some_user_function_(state_) // calls some_user_function on the current state</pre></li><li class="listitem"><p>as function: returns by reference the attribute passed as
+ parameter.</p><p>Example:
+ </p><pre class="programlisting">state_(m_counter)++</pre></li></ul></div></div><div class="refsect3" title="event_"><a name="d0e7935"></a><h4>event_</h4><p>Generic object or function for the event triggering a given transition
(valid in a transition behavior, as well as in state entry/exit behaviors):</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>as object: returns by reference the event of a transition,
usually to be used by another function (usually one created
- by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example: <code class="code">some_user_function_(event_)</code></p></li><li class="listitem"><p>as function: returns by reference the attribute passed as
- parameter.</p><p>Example: <code class="code">event_(m_counter)++</code></p></li></ul></div></div><div class="refsect3" title="fsm_"><a name="d0e8369"></a><h4>fsm_</h4><p>Generic object or function for the state machine containing a given transition:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>as object: returns by reference the event of a transition,
+ by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
+ </p><pre class="programlisting">some_user_function_(event_)</pre></li><li class="listitem"><p>as function: returns by reference the attribute passed as
+ parameter.</p><p>Example:
+ </p><pre class="programlisting">event_(m_counter)++</pre></li></ul></div></div><div class="refsect3" title="fsm_"><a name="d0e7955"></a><h4>fsm_</h4><p>Generic object or function for the state machine containing a given transition:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>as object: returns by reference the event of a transition,
usually to be used by another function (usually one created
- by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example: <code class="code">some_user_function_(fsm_)</code></p></li><li class="listitem"><p>as function: returns by reference the attribute passed as
- parameter.</p><p>Example: <code class="code">fsm_(m_counter)++</code></p></li></ul></div></div><div class="refsect3" title="substate_"><a name="d0e8389"></a><h4>substate_</h4><p>Generic object or function returning a state of a given state machine:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>with 1 parameter: returns by reference the state passed as
+ by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
+ </p><pre class="programlisting">some_user_function_(fsm_)</pre></li><li class="listitem"><p>as function: returns by reference the attribute passed as
+ parameter.</p><p>Example:
+ </p><pre class="programlisting">fsm_(m_counter)++</pre></li></ul></div></div><div class="refsect3" title="substate_"><a name="d0e7975"></a><h4>substate_</h4><p>Generic object or function returning a state of a given state machine:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>with 1 parameter: returns by reference the state passed as
parameter, usually to be used by another function (usually
one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
- <code class="code">some_user_function_(substate_(my_state))</code></p></li><li class="listitem"><p>with 2 parameters: returns by reference the state passed
+ </p><pre class="programlisting">some_user_function_(substate_(my_state))</pre></li><li class="listitem"><p>with 2 parameters: returns by reference the state passed
as first parameter from the state machine passed as second
parameter, usually to be used by another function (usually
one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION). This
makes sense when used in combination with attribute_.</p><p>Example (equivalent to the previous example):
- <code class="code">some_user_function_(substate_(my_state,fsm_))</code></p></li></ul></div></div><div class="refsect3" title="attribute_"><a name="d0e8409"></a><h4>attribute_</h4><p>Generic object or function returning the attribute passed (by name) as
+ </p><pre class="programlisting">some_user_function_(substate_(my_state,fsm_))</pre></li></ul></div></div><div class="refsect3" title="attribute_"><a name="d0e7995"></a><h4>attribute_</h4><p>Generic object or function returning the attribute passed (by name) as
second parameter of the thing passed as first (a state, event or state
- machine). Example: </p><p><code class="code">attribute_(substate_(my_state),cd_name_attribute)++</code></p></div><div class="refsect3" title="True_"><a name="d0e8417"></a><h4>True_</h4><p>Functor returning true for transition or state behaviors. Like all
+ machine). Example: </p><p>
+ </p><pre class="programlisting">attribute_(substate_(my_state),cd_name_attribute)++</pre><p>
+ </p></div><div class="refsect3" title="True_"><a name="d0e8005"></a><h4>True_</h4><p>Functor returning true for transition or state behaviors. Like all
constants, only the functor form exists, so parenthesis are necessary.
- Example:</p><p><code class="code">if_then_(True_(),/* some action always called*/)</code></p></div><div class="refsect3" title="False_"><a name="d0e8425"></a><h4>False_</h4><p>Functor returning false for transition or state behaviors. Like all
+ Example:</p><p>
+ </p><pre class="programlisting">if_then_(True_(),/* some action always called*/)</pre><p>
+ </p></div><div class="refsect3" title="False_"><a name="d0e8015"></a><h4>False_</h4><p>Functor returning false for transition or state behaviors. Like all
constants, only the functor form exists, so parenthesis are necessary.
- Example:</p><p><code class="code">if_then_(False_(),/* some action never called */)</code></p></div><div class="refsect3" title="Int_<int value>"><a name="d0e8433"></a><h4>Int_<int value></h4><p>Functor returning an integer value for transition or state behaviors.
+ Example:</p><p>
+ </p><pre class="programlisting">if_then_(False_(),/* some action never called */)</pre><p>
+ </p></div><div class="refsect3" title="Int_<int value>"><a name="d0e8025"></a><h4>Int_<int value></h4><p>Functor returning an integer value for transition or state behaviors.
Like all constants, only the functor form exists, so parenthesis are
- necessary. Example:</p><p><code class="code">target_(m_ringing_cpt) = Int_<RINGING_TIME>() // RINGING_TIME
- is a constant</code></p></div><div class="refsect3" title="Char_<char value>"><a name="d0e8441"></a><h4>Char_<char value></h4><p>Functor returning a char value for transition or state behaviors. Like
+ necessary. Example:</p><p>
+ </p><pre class="programlisting">target_(m_ringing_cpt) = Int_<RINGING_TIME>() // RINGING_TIME is a constant</pre><p>
+ </p></div><div class="refsect3" title="Char_<char value>"><a name="d0e8035"></a><h4>Char_<char value></h4><p>Functor returning a char value for transition or state behaviors. Like
all constants, only the functor form exists, so parenthesis are
- necessary. Example:</p><p><code class="code">[string_find_(event_(m_song),Char_<'S'>(),Size_t_<0>()) !=
- Npos_<string>()] // look for 'S' in event.m_song</code></p></div><div class="refsect3" title="Size_t_<size_t value>"><a name="d0e8449"></a><h4>Size_t_<size_t value></h4><p>Functor returning a size_t value for transition or state behaviors.
+ necessary. Example:</p><p>
+ </p><pre class="programlisting">// look for 'S' in event.m_song
+[string_find_(event_(m_song),Char_<'S'>(),Size_t_<0>()) != Npos_<string>()]</pre><p>
+ </p></div><div class="refsect3" title="Size_t_<size_t value>"><a name="d0e8045"></a><h4>Size_t_<size_t value></h4><p>Functor returning a size_t value for transition or state behaviors.
Like all constants, only the functor form exists, so parenthesis are
- necessary. Example:</p><p><code class="code">substr_(event_(m_song),Size_t_<1>()) // returns a substring
- of event.m_song</code></p></div><div class="refsect3" title="String_ < mpl::string >"><a name="d0e8457"></a><h4>String_ < mpl::string ></h4><p>Functor returning a string for transition or state behaviors. Like all
+ necessary. Example:</p><p>
+ </p><pre class="programlisting">substr_(event_(m_song),Size_t_<1>()) // returns a substring of event.m_song</pre><p>
+ </p></div><div class="refsect3" title="String_ < mpl::string >"><a name="d0e8055"></a><h4>String_ < mpl::string ></h4><p>Functor returning a string for transition or state behaviors. Like all
constants, only the functor form exists, so parenthesis are necessary.
- Requires boost >= 1.40 for mpl::string.</p><p>Example:</p><p><code class="code">push_back_(fsm_(m_src_container), String_<mpl::string<'Let
- ','it ','be'> >()) // adds "Let it be" to
- fsm.m_src_container</code></p></div><div class="refsect3" title="Predicate_ < some_stl_compatible_functor >"><a name="d0e8467"></a><h4>Predicate_ < some_stl_compatible_functor ></h4><p>This functor eUML-enables a STL functor (for use in an algorithm).
+ Requires boost >= 1.40 for mpl::string.</p><p>Example:</p><p>
+ </p><pre class="programlisting">// adds "Let it be" to fsm.m_src_container
+push_back_(fsm_(m_src_container), String_<mpl::string<'Let','it ','be'> >())</pre><p>
+ </p></div><div class="refsect3" title="Predicate_ < some_stl_compatible_functor >"><a name="d0e8067"></a><h4>Predicate_ < some_stl_compatible_functor ></h4><p>This functor eUML-enables a STL functor (for use in an algorithm).
This is necessary because all what is in the transition table must be a
- eUML terminal.</p><p>Example:</p><p><code class="code">accumulate_(begin_(fsm_(m_vec)),end_(fsm_(m_vec)),Int_<1>(),Predicate_<std::plus<int>
- >()) == Int_<1>())</code></p><p><code class="code">/* equivalent to:
- std::accumulate(fsm.m_vec.begin(),fsm.m_vec.end(),1,
- std::plus<int>()) == 1 */</code></p></div><div class="refsect3" title="process_"><a name="d0e8480"></a><h4>process_</h4><p>This function sends an event to up to 4 state machines by calling
+ eUML terminal.</p><p>Example:</p><pre class="programlisting">//equivalent to:
+//std::accumulate(fsm.m_vec.begin(),fsm.m_vec.end(),1,std::plus<int>())== 1
+accumulate_(begin_(fsm_(m_vec)),end_(fsm_(m_vec)),Int_<1>(),
+ Predicate_<std::plus<int> >()) == Int_<1>())</pre></div><div class="refsect3" title="process_"><a name="d0e8076"></a><h4>process_</h4><p>This function sends an event to up to 4 state machines by calling
<code class="code">process_event</code> on them:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">process_(some_event)</code> : processes an event in
the current (containing) state machine.</p></li><li class="listitem"><p><code class="code">process_(some_event [,fsm1...fsm4] )</code> :
processes the same event in the 1-4 state machines passed as
- argument.</p></li></ul></div></div><div class="refsect3" title="process2_"><a name="d0e8499"></a><h4>process2_</h4><p>This function sends an event to up to 3 state machines by calling
+ argument.</p></li></ul></div></div><div class="refsect3" title="process2_"><a name="d0e8095"></a><h4>process2_</h4><p>This function sends an event to up to 3 state machines by calling
<code class="code">process_event</code> on them and copy-constructing the event
from the data passed as second parameter:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">process2_(some_event, some_data)</code> : processes
an event in the current (containing) state machine.</p></li><li class="listitem"><p><code class="code">process2_(some_event, some_data [,fsm1...fsm3]
)</code> : processes the same event in the 1-3 state
- machines passed as argument.</p></li></ul></div><p>Example: </p><p><code class="code">process2_(NotFound,event_(m_song)) // processes NotFound on
- current state machine, copy-constructed with
- event.m_song</code></p><p>With the following definitions:</p><p><code class="code">BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song)
- //declaration of m_sonf</code></p><p><code class="code">NotFound (const string& data) // copy-constructor of
- NotFound</code></p></div><div class="refsect3" title="is_flag_"><a name="d0e8531"></a><h4>is_flag_</h4><p>This function tells if a flag is active by calling
+ machines passed as argument.</p></li></ul></div><p>Example: </p><p>
+ </p><pre class="programlisting">// processes NotFound on current state machine,
+// copy-constructed with event.m_song
+process2_(NotFound,event_(m_song))</pre><p>
+ </p><p>With the following definitions:</p><pre class="programlisting">BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song)//declaration of m_song
+NotFound (const string& data) // copy-constructor of NotFound</pre></div><div class="refsect3" title="is_flag_"><a name="d0e8125"></a><h4>is_flag_</h4><p>This function tells if a flag is active by calling
<code class="code">is_flag_active</code> on the current state machine or one
passed as parameter:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">is_flag_(some_flag)</code> : calls
<code class="code">is_flag_active</code> on the current (containing)
state machine.</p></li><li class="listitem"><p><code class="code">is_flag_(some_flag, some_fsm)</code> :calls
<code class="code">is_flag_active</code> on the state machine.passed
- as argument.</p></li></ul></div></div><div class="refsect3" title="defer_"><a name="d0e8556"></a><h4>defer_</h4><p>This object defers the current event by calling
+ as argument.</p></li></ul></div></div><div class="refsect3" title="defer_"><a name="d0e8150"></a><h4>defer_</h4><p>This object defers the current event by calling
<code class="code">defer_event</code> on the current state machine.
- Example:</p><p><code class="code">Empty() + play() / defer_</code></p></div><div class="refsect3" title="explicit_(submachine-name,state-name)"><a name="d0e8567"></a><h4>explicit_(submachine-name,state-name)</h4><p>Used as transition's target, causes an explicit entry into the given
+ Example:</p><pre class="programlisting">Empty() + play() / defer_</pre></div><div class="refsect3" title="explicit_(submachine-name,state-name)"><a name="d0e8160"></a><h4>explicit_(submachine-name,state-name)</h4><p>Used as transition's target, causes an explicit entry into the given
state from the given submachine. Several explicit_ as targets, separated
by commas, means a fork. The state must have been declared as such using
- BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE.</p></div><div class="refsect3" title="entry_pt_(submachine-name,state-name)"><a name="d0e8572"></a><h4>entry_pt_(submachine-name,state-name)</h4><p>Used as transition's target from a containing state machine, causes
+ BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE.</p></div><div class="refsect3" title="entry_pt_(submachine-name,state-name)"><a name="d0e8165"></a><h4>entry_pt_(submachine-name,state-name)</h4><p>Used as transition's target from a containing state machine, causes
submachine-name to be entered using the given entry pseudo-state. This
state must have been declared as pseudo entry using
- BOOST_MSM_EUML_ENTRY_STATE.</p></div><div class="refsect3" title="exit_pt_(submachine-name,state-name)"><a name="d0e8577"></a><h4>exit_pt_(submachine-name,state-name)</h4><p>Used as transition's source from a containing state machine, causes
+ BOOST_MSM_EUML_ENTRY_STATE.</p></div><div class="refsect3" title="exit_pt_(submachine-name,state-name)"><a name="d0e8170"></a><h4>exit_pt_(submachine-name,state-name)</h4><p>Used as transition's source from a containing state machine, causes
submachine-name to be left using the given exit pseudo-state. This state
must have been declared as pseudo exit using
- BOOST_MSM_EUML_EXIT_STATE.</p></div><div class="refsect3" title="MSM_EUML_FUNCTION"><a name="d0e8582"></a><h4>MSM_EUML_FUNCTION</h4><p>This macro creates a eUML function and a functor for use with the
+ BOOST_MSM_EUML_EXIT_STATE.</p></div><div class="refsect3" title="MSM_EUML_FUNCTION"><a name="d0e8175"></a><h4>MSM_EUML_FUNCTION</h4><p>This macro creates a eUML function and a functor for use with the
functor front-end, based on a free function:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>first parameter: the name of the functor</p></li><li class="listitem"><p>second parameter: the underlying function</p></li><li class="listitem"><p>third parameter: the eUML function name</p></li><li class="listitem"><p>fourth parameter: the return type if used in a transition
behavior</p></li><li class="listitem"><p>fifth parameter: the return type if used in a state
behavior (entry/exit)</p></li></ul></div><p> Note that the function itself can take up to 5
- arguments.</p><p>Example:</p><p><code class="code">MSM_EUML_FUNCTION(BinarySearch_ , std::binary_search ,
- binary_search_ , bool , bool )</code></p><p>Can be used like:</p><p><code class="code">binary_search_(begin_(fsm_(m_var)),end_(fsm_(m_var)),Int_<9>())</code></p></div><div class="refsect3" title="MSM_EUML_METHOD"><a name="d0e8614"></a><h4>MSM_EUML_METHOD</h4><p>This macro creates a eUML function and a functor for use with the
+ arguments.</p><p>Example:</p><p>
+ </p><pre class="programlisting">MSM_EUML_FUNCTION(BinarySearch_,std::binary_search,binary_search_,bool,bool)</pre><p>
+ </p><p>Can be used like:</p><p>
+ </p><pre class="programlisting">binary_search_(begin_(fsm_(m_var)),end_(fsm_(m_var)),Int_<9>())</pre><p>
+ </p></div><div class="refsect3" title="MSM_EUML_METHOD"><a name="d0e8211"></a><h4>MSM_EUML_METHOD</h4><p>This macro creates a eUML function and a functor for use with the
functor front-end, based on a method:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>first parameter: the name of the functor</p></li><li class="listitem"><p>second parameter: the underlying function</p></li><li class="listitem"><p>third parameter: the eUML function name</p></li><li class="listitem"><p>fourth parameter: the return type if used in a transition
behavior</p></li><li class="listitem"><p>fifth parameter: the return type if used in a state
behavior (entry/exit)</p></li></ul></div><p> Note that the method itself can take up to 4 arguments
(5 like for a free function - 1 for the object on which the method is
- called).</p><p>Example:</p><p><code class="code">struct Empty : public msm::front::state<> , public
- euml_state<Empty> {</code></p><p><code class="code">void activate_empty() {std::cout << "switching to Empty "
- << std::endl;}</code></p><p><code class="code">... };</code></p><p><code class="code">MSM_EUML_METHOD(ActivateEmpty_ , activate_empty ,
- activate_empty_ , void , void )</code></p><p>Can be used like:</p><p><code class="code">Empty == Open + open_close / (close_drawer ,
- activate_empty_(target_))</code></p></div><div class="refsect3" title="BOOST_MSM_EUML_ACTION(action-instance-name)"><a name="d0e8655"></a><h4>BOOST_MSM_EUML_ACTION(action-instance-name)</h4><p>This macro declares a behavior type and a const instance for use in
+ called).</p><p>Example:</p><pre class="programlisting">struct Empty : public msm::front::state<> , public euml_state<Empty>
+{
+ void activate_empty() {std::cout << "switching to Empty " << std::endl;}
+...
+};
+MSM_EUML_METHOD(ActivateEmpty_,activate_empty,activate_empty_,void,void)</pre><p>Can be used like:</p><p>
+ </p><pre class="programlisting">Empty == Open + open_close / (close_drawer , activate_empty_(target_))</pre><p>
+ </p></div><div class="refsect3" title="BOOST_MSM_EUML_ACTION(action-instance-name)"><a name="d0e8244"></a><h4>BOOST_MSM_EUML_ACTION(action-instance-name)</h4><p>This macro declares a behavior type and a const instance for use in
state or transition behaviors. The action implementation itself follows
- the macro declaration, for example:</p><p><code class="code">BOOST_MSM_EUML_ACTION(good_disk_format){</code></p><p><code class="code">template <class Fsm,class Evt,class SourceState,class
- TargetState></code></p><p><code class="code">void/bool operator()(Evt const&
- evt,Fsm&,SourceState& ,TargetState& ){...}</code></p><p><code class="code">};</code></p></div><div class="refsect3" title="BOOST_MSM_EUML_FLAG(flag-instance-name)"><a name="d0e8672"></a><h4>BOOST_MSM_EUML_FLAG(flag-instance-name)</h4><p>This macro declares a flag type and a const instance for use in
- behaviors.</p></div><div class="refsect3" title="BOOST_MSM_EUML_FLAG_NAME(flag-instance-name)"><a name="d0e8677"></a><h4>BOOST_MSM_EUML_FLAG_NAME(flag-instance-name)</h4><p>This macro returns the name of the flag type generated by
+ the macro declaration, for example:</p><pre class="programlisting">BOOST_MSM_EUML_ACTION(good_disk_format)
+{
+ template <class Fsm,class Evt,class SourceState,class TargetState>
+ void/bool operator()(Evt const& evt,Fsm&,SourceState& ,TargetState& ){...}
+};</pre></div><div class="refsect3" title="BOOST_MSM_EUML_FLAG(flag-instance-name)"><a name="d0e8251"></a><h4>BOOST_MSM_EUML_FLAG(flag-instance-name)</h4><p>This macro declares a flag type and a const instance for use in
+ behaviors.</p></div><div class="refsect3" title="BOOST_MSM_EUML_FLAG_NAME(flag-instance-name)"><a name="d0e8256"></a><h4>BOOST_MSM_EUML_FLAG_NAME(flag-instance-name)</h4><p>This macro returns the name of the flag type generated by
BOOST_MSM_EUML_FLAG. You need this where the type is required (usually
- with the back-end method is_flag_active). For example:</p><p><code class="code">fsm.is_flag_active<BOOST_MSM_EUML_FLAG_NAME(CDLoaded)>()</code></p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_ATTRIBUTE(event-type,event-name)"><a name="d0e8685"></a><h4>BOOST_MSM_EUML_DECLARE_ATTRIBUTE(event-type,event-name)</h4><p>This macro declares an attribute called event-name of type event-type.
+ with the back-end method is_flag_active). For example:</p><pre class="programlisting">fsm.is_flag_active<BOOST_MSM_EUML_FLAG_NAME(CDLoaded)>()</pre></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_ATTRIBUTE(event-type,event-name)"><a name="d0e8263"></a><h4>BOOST_MSM_EUML_DECLARE_ATTRIBUTE(event-type,event-name)</h4><p>This macro declares an attribute called event-name of type event-type.
This attribute can then be made part of an attribute list using
- BOOST_MSM_EUML_ATTRIBUTES.</p></div><div class="refsect3" title="BOOST_MSM_EUML_ATTRIBUTES(attributes-expression,attributes-name)"><a name="d0e8690"></a><h4>BOOST_MSM_EUML_ATTRIBUTES(attributes-expression,attributes-name)</h4><p>This macro declares an attribute list called attributes-name based on
+ BOOST_MSM_EUML_ATTRIBUTES.</p></div><div class="refsect3" title="BOOST_MSM_EUML_ATTRIBUTES(attributes-expression,attributes-name)"><a name="d0e8268"></a><h4>BOOST_MSM_EUML_ATTRIBUTES(attributes-expression,attributes-name)</h4><p>This macro declares an attribute list called attributes-name based on
the expression as first argument. These attributes can then be made part
of an event using BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES, of a state as
3rd parameter of BOOST_MSM_EUML_STATE or of a state machine as 5th
- parameter of BOOST_MSM_EUML_DECLARE_STATE_MACHINE.</p><p>Attributes are added using left-shift, for example:</p><p>
- <code class="code">BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song) // m_song is
- of type std::string</code></p><p><code class="code">BOOST_MSM_EUML_ATTRIBUTES((attributes_ << m_song ),
- FoundDef) // contains one attribute, m_song</code>
- </p></div><div class="refsect3" title="BOOST_MSM_EUML_EVENT(event-instance name)"><a name="d0e8705"></a><h4>BOOST_MSM_EUML_EVENT(event-instance name)</h4><p>This macro defines an event type (event-instance-name_helper) and
+ parameter of BOOST_MSM_EUML_DECLARE_STATE_MACHINE.</p><p>Attributes are added using left-shift, for example:</p><pre class="programlisting">// m_song is of type std::string
+BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song)
+// contains one attribute, m_song
+BOOST_MSM_EUML_ATTRIBUTES((attributes_ << m_song ), FoundDef)</pre></div><div class="refsect3" title="BOOST_MSM_EUML_EVENT(event-instance name)"><a name="d0e8277"></a><h4>BOOST_MSM_EUML_EVENT(event-instance name)</h4><p>This macro defines an event type (event-instance-name_helper) and
declares a const instance of this event type called event-instance-name
- for use in a transition table or state behaviors.</p></div><div class="refsect3" title="BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(event-instance-name,attributes)"><a name="d0e8710"></a><h4>BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(event-instance-name,attributes)</h4><p>This macro defines an event type (event-instance-name_helper) and
+ for use in a transition table or state behaviors.</p></div><div class="refsect3" title="BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(event-instance-name,attributes)"><a name="d0e8282"></a><h4>BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(event-instance-name,attributes)</h4><p>This macro defines an event type (event-instance-name_helper) and
declares a const instance of this event type called event-instance-name
for use in a transition table or state behaviors. The event will have as
attributes the ones passed by the second argument:</p><p><code class="code">BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(Found,FoundDef)</code>
</p><p>The created event instance supports operator()(attributes) so that
- <code class="code">my_back_end.process_event(Found(some_string))</code> is
- possible.</p></div><div class="refsect3" title="BOOST_MSM_EUML_EVENT_NAME(event-instance-name)"><a name="d0e8724"></a><h4>BOOST_MSM_EUML_EVENT_NAME(event-instance-name)</h4><p>This macro returns the name of the event type generated by
+ </p><pre class="programlisting">my_back_end.process_event(Found(some_string))</pre><p>
+ is possible.</p></div><div class="refsect3" title="BOOST_MSM_EUML_EVENT_NAME(event-instance-name)"><a name="d0e8296"></a><h4>BOOST_MSM_EUML_EVENT_NAME(event-instance-name)</h4><p>This macro returns the name of the event type generated by
BOOST_MSM_EUML_EVENT or BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES. You need
this where the type is required (usually inside a back-end definition).
- For example:</p><p><code class="code">typedef
- msm::back::state_machine<Playing_,msm::back::ShallowHistory<mpl::vector<BOOST_MSM_EUML_EVENT_NAME(end_pause)>
- > > Playing_type;</code></p></div><div class="refsect3" title="BOOST_MSM_EUML_STATE(build-expression,state-instance-name)"><a name="d0e8732"></a><h4>BOOST_MSM_EUML_STATE(build-expression,state-instance-name)</h4><p>This macro defines a state type (state-instance-name_helper) and
+ For example:</p><p>
+ </p><pre class="programlisting">typedef msm::back::state_machine<Playing_,
+msm::back::ShallowHistory<mpl::vector<BOOST_MSM_EUML_EVENT_NAME(end_pause)
+> > > Playing_type;</pre><p>
+ </p></div><div class="refsect3" title="BOOST_MSM_EUML_STATE(build-expression,state-instance-name)"><a name="d0e8306"></a><h4>BOOST_MSM_EUML_STATE(build-expression,state-instance-name)</h4><p>This macro defines a state type (state-instance-name_helper) and
declares a const instance of this state type called state-instance-name
for use in a transition table or state behaviors.</p><p>There are several possibilitites for the expression syntax:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>(): state without entry or exit action.</p></li><li class="listitem"><p>(Expr1): state with entry but no exit action.</p></li><li class="listitem"><p>(Expr1,Expr2): state with entry and exit action.</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes): state with entry and exit
action, defining some attributes.</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure): state with entry and
@@ -627,7 +672,7 @@
events).</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure,Base): state with entry
and exit action, defining some attributes, flags and
deferred events (plain msm deferred events) and a
- non-default base state (as defined in standard MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_INTERRUPT_STATE(build-expression,state-instance-name)"><a name="d0e8758"></a><h4>BOOST_MSM_EUML_INTERRUPT_STATE(build-expression,state-instance-name)</h4><p>This macro defines an interrupt state type
+ non-default base state (as defined in standard MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_INTERRUPT_STATE(build-expression,state-instance-name)"><a name="d0e8332"></a><h4>BOOST_MSM_EUML_INTERRUPT_STATE(build-expression,state-instance-name)</h4><p>This macro defines an interrupt state type
(state-instance-name_helper) and declares a const instance of this state
type called state-instance-name for use in a transition table or state
behaviors.</p><p>There are several possibilitites for the expression syntax. In all of
@@ -644,7 +689,7 @@
interrupt state with entry and exit action, defining some
attributes, flags and deferred events (plain msm deferred
events) and a non-default base state (as defined in standard
- MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_TERMINATE_STATE(build-expression,state-instance-name)"><a name="d0e8784"></a><h4>BOOST_MSM_EUML_TERMINATE_STATE(build-expression,state-instance-name)</h4><p>This macro defines a terminate pseudo-state type
+ MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_TERMINATE_STATE(build-expression,state-instance-name)"><a name="d0e8358"></a><h4>BOOST_MSM_EUML_TERMINATE_STATE(build-expression,state-instance-name)</h4><p>This macro defines a terminate pseudo-state type
(state-instance-name_helper) and declares a const instance of this state
type called state-instance-name for use in a transition table or state
behaviors.</p><p>There are several possibilitites for the expression syntax:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>(): terminate pseudo-state without entry or exit
@@ -658,7 +703,7 @@
pseudo-state with entry and exit action, defining some
attributes, flags and deferred events (plain msm deferred
events) and a non-default base state (as defined in standard
- MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_EXIT_STATE(build-expression,state-instance-name)"><a name="d0e8810"></a><h4>BOOST_MSM_EUML_EXIT_STATE(build-expression,state-instance-name)</h4><p>This macro defines an exit pseudo-state type
+ MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_EXIT_STATE(build-expression,state-instance-name)"><a name="d0e8384"></a><h4>BOOST_MSM_EUML_EXIT_STATE(build-expression,state-instance-name)</h4><p>This macro defines an exit pseudo-state type
(state-instance-name_helper) and declares a const instance of this state
type called state-instance-name for use in a transition table or state
behaviors.</p><p>There are several possibilitites for the expression syntax:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>(forwarded_event):exit pseudo-state without entry or exit
@@ -674,7 +719,7 @@
attributes, flags and deferred events (plain msm deferred
events) and a non-default base state (as defined in standard
MSM).</p></li></ul></div><p>Note that the forwarded_event must be constructible from the event
- sent by the submachine containing the exit point.</p></div><div class="refsect3" title="BOOST_MSM_EUML_ENTRY_STATE(int region-index,build-expression,state-instance-name)"><a name="d0e8838"></a><h4>BOOST_MSM_EUML_ENTRY_STATE(int
+ sent by the submachine containing the exit point.</p></div><div class="refsect3" title="BOOST_MSM_EUML_ENTRY_STATE(int region-index,build-expression,state-instance-name)"><a name="d0e8412"></a><h4>BOOST_MSM_EUML_ENTRY_STATE(int
region-index,build-expression,state-instance-name)</h4><p>This macro defines an entry pseudo-state type
(state-instance-name_helper) and declares a const instance of this state
type called state-instance-name for use in a transition table or state
@@ -689,7 +734,7 @@
pseudo-state with entry and exit action, defining some
attributes, flags and deferred events (plain msm deferred
events) and a non-default base state (as defined in standard
- MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE(int region-index,build-expression,state-instance-name)"><a name="d0e8864"></a><h4>BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE(int
+ MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE(int region-index,build-expression,state-instance-name)"><a name="d0e8438"></a><h4>BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE(int
region-index,build-expression,state-instance-name)</h4><p>This macro defines a submachine's substate type
(state-instance-name_helper), which can be explicitly entered and also
declares a const instance of this state type called state-instance-name
@@ -700,25 +745,34 @@
events).</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure,Base): state with entry
and exit action, defining some attributes, flags and
deferred events (plain msm deferred events) and a
- non-default base state (as defined in standard MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_STATE_NAME(state-instance-name)"><a name="d0e8890"></a><h4>BOOST_MSM_EUML_STATE_NAME(state-instance-name)</h4><p>This macro returns the name of the state type generated by
+ non-default base state (as defined in standard MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_STATE_NAME(state-instance-name)"><a name="d0e8464"></a><h4>BOOST_MSM_EUML_STATE_NAME(state-instance-name)</h4><p>This macro returns the name of the state type generated by
BOOST_MSM_EUML_STATE or other state macros. You need this where the type
- is required (usually using a backend function). For example:</p><p><code class="code">fsm.get_state<BOOST_MSM_EUML_STATE_NAME(StringFind)&>().some_state_function();</code></p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_STATE(build-expression,state-instance-name)"><a name="d0e8898"></a><h4>BOOST_MSM_EUML_DECLARE_STATE(build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_STATE but does not provide an instance, simply a
- type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_INTERRUPT_STATE(build-expression,state-instance-name)"><a name="d0e8903"></a><h4>BOOST_MSM_EUML_DECLARE_INTERRUPT_STATE(build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_INTERRUPT_STATE but does not provide an instance,
- simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_TERMINATE_STATE(build-expression,state-instance-name)"><a name="d0e8908"></a><h4>BOOST_MSM_EUML_DECLARE_TERMINATE_STATE(build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_TERMINATE_STATE but does not provide an instance,
- simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_EXIT_STATE(build-expression,state-instance-name)"><a name="d0e8913"></a><h4>BOOST_MSM_EUML_DECLARE_EXIT_STATE(build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_EXIT_STATE but does not provide an instance,
- simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_ENTRY_STATE(int region-index,build-expression,state-instance-name)"><a name="d0e8918"></a><h4>BOOST_MSM_EUML_DECLARE_ENTRY_STATE(int
+ is required (usually using a backend function). For example:</p><p>
+ </p><pre class="programlisting">fsm.get_state<BOOST_MSM_EUML_STATE_NAME(StringFind)&>().some_state_function();</pre><p>
+ </p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_STATE(build-expression,state-instance-name)"><a name="d0e8474"></a><h4>BOOST_MSM_EUML_DECLARE_STATE(build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_STATE but does not provide an instance, simply a
+ type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_INTERRUPT_STATE(build-expression,state-instance-name)"><a name="d0e8479"></a><h4>BOOST_MSM_EUML_DECLARE_INTERRUPT_STATE(build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_INTERRUPT_STATE but does not provide an instance,
+ simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_TERMINATE_STATE(build-expression,state-instance-name)"><a name="d0e8484"></a><h4>BOOST_MSM_EUML_DECLARE_TERMINATE_STATE(build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_TERMINATE_STATE but does not provide an instance,
+ simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_EXIT_STATE(build-expression,state-instance-name)"><a name="d0e8489"></a><h4>BOOST_MSM_EUML_DECLARE_EXIT_STATE(build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_EXIT_STATE but does not provide an instance,
+ simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_ENTRY_STATE(int region-index,build-expression,state-instance-name)"><a name="d0e8494"></a><h4>BOOST_MSM_EUML_DECLARE_ENTRY_STATE(int
region-index,build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_ENTRY_STATE but does not provide an instance,
- simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_EXPLICIT_ENTRY_STATE(int region-index,build-expression,state-instance-name)"><a name="d0e8923"></a><h4>BOOST_MSM_EUML_DECLARE_EXPLICIT_ENTRY_STATE(int
+ simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_EXPLICIT_ENTRY_STATE(int region-index,build-expression,state-instance-name)"><a name="d0e8499"></a><h4>BOOST_MSM_EUML_DECLARE_EXPLICIT_ENTRY_STATE(int
region-index,build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE but does not provide an
- instance, simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_TRANSITION_TABLE(expression, table-instance-name)"><a name="d0e8928"></a><h4>BOOST_MSM_EUML_TRANSITION_TABLE(expression,
+ instance, simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_TRANSITION_TABLE(expression, table-instance-name)"><a name="d0e8504"></a><h4>BOOST_MSM_EUML_TRANSITION_TABLE(expression,
table-instance-name)</h4><p>This macro declares a transition table type and also declares a const
instance of the table which can then be used in a state machine
declaration (see BOOST_MSM_EUML_DECLARE_STATE_MACHINE).The expression
must follow the <span class="command"><strong><a class="command" href="re03.html#reference-stt-grammar">transition
- table grammar</a></strong></span>.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_TRANSITION_TABLE(iexpression,table-instance-name)"><a name="d0e8936"></a><h4>BOOST_MSM_EUML_DECLARE_TRANSITION_TABLE(iexpression,table-instance-name)</h4><p>Like BOOST_MSM_EUML_TRANSITION_TABLE but does not provide an instance,
- simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expression, table-instance-name)"><a name="d0e8941"></a><h4>BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expression,
+ table grammar</a></strong></span>.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_TRANSITION_TABLE(iexpression,table-instance-name)"><a name="d0e8512"></a><h4>BOOST_MSM_EUML_DECLARE_TRANSITION_TABLE(iexpression,table-instance-name)</h4><p>Like BOOST_MSM_EUML_TRANSITION_TABLE but does not provide an instance,
+ simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expression, table-instance-name)"><a name="d0e8517"></a><h4>BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expression,
table-instance-name)</h4><p>This macro declares a transition table type and also declares a const
instance of the table.The expression must follow the <span class="command"><strong><a class="command" href="re03.html#reference-stt-grammar">transition table
- grammar</a></strong></span>. For the moment, this macro is not used.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE(iexpression,table-instance-name)"><a name="d0e8949"></a><h4>BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE(iexpression,table-instance-name)</h4><p>Like BOOST_MSM_EUML_TRANSITION_TABLE but does not provide an instance,
+ grammar</a></strong></span>. For the moment, this macro is not used.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE(iexpression,table-instance-name)"><a name="d0e8525"></a><h4>BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE(iexpression,table-instance-name)</h4><p>Like BOOST_MSM_EUML_TRANSITION_TABLE but does not provide an instance,
simply a type declaration. This is currently the only way to declare an
- internal transition table with eUML. For example:</p><p><code class="code">BOOST_MSM_EUML_DECLARE_STATE((Open_Entry,Open_Exit),Open_def)</code></p><p><code class="code">struct Open_impl : public Open_def{</code></p><p><code class="code">BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE((</code></p><p><code class="code">open_close [internal_guard1] / internal_action1 ,</code></p><p><code class="code">open_close [internal_guard2] / internal_action2</code></p><p><code class="code">))</code></p><p><code class="code">};</code></p></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top">Back-end </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40
%" align="right" valign="top"> </td></tr></table></div></body></html>
\ No newline at end of file
+ internal transition table with eUML. For example:</p><pre class="programlisting">BOOST_MSM_EUML_DECLARE_STATE((Open_Entry,Open_Exit),Open_def)
+struct Open_impl : public Open_def
+{
+ BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE((
+ open_close [internal_guard1] / internal_action1 ,
+ open_close [internal_guard2] / internal_action2
+ ))
+}; </pre></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top">Back-end </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
\ No newline at end of file
Modified: sandbox/msm/libs/msm/doc/PDF/msm.pdf
==============================================================================
Binary files. No diff available.
Modified: sandbox/msm/libs/msm/doc/src/msm.xml
==============================================================================
--- sandbox/msm/libs/msm/doc/src/msm.xml (original)
+++ sandbox/msm/libs/msm/doc/src/msm.xml 2010-04-07 10:00:44 EDT (Wed, 07 Apr 2010)
@@ -753,24 +753,21 @@
</itemizedlist></para>
<para>The signature for an action methods is void method_name (event
const&), for example:</para>
- <para><code>void stop_playback(stop const&)</code></para>
+ <programlisting>void stop_playback(stop const&)</programlisting>
<para>Action methods return nothing and take the argument as const reference. Of
course nothing forbids you from using the same action for several
events:</para>
- <para><code>template <class Event> void stop_playback(Event
- const&)</code></para>
+ <programlisting>template <class Event> void stop_playback(Eventconst&)</programlisting>
<para>Guards have as only difference the return value, which is a
boolean:</para>
- <para><code>bool good_disk_format(cd_detected const& evt)</code></para>
+ <programlisting>bool good_disk_format(cd_detected const& evt)</programlisting>
<para>The transition table is actually a MPL vector (or list), which brings the
limitation that the default maximum size of the table is 20. If you need
more transitions, overriding this default behavior is necessary, so you need
to add before any header:</para>
- <para><code>#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS </code></para>
- <para><code>#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 // or whatever you need
- </code></para>
- <para><code>#define BOOST_MPL_LIMIT_MAP_SIZE 30 // or whatever you need
- </code></para>
+ <programlisting>#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 //or whatever you need
+#define BOOST_MPL_LIMIT_MAP_SIZE 30 //or whatever you need </programlisting>
<para>The other limitation is that the MPL types are defined only up to 50
entries. For the moment, the only solution to achieve more is to add headers
to the MPL (luckily, this is not very complicated).</para>
@@ -784,14 +781,17 @@
states:</para>
<para>struct Empty : public msm::front::state<> {};</para>
<para>They can optionally provide entry and exit behaviors:</para>
- <para><code>struct Empty : public msm::front::state<> {</code></para>
- <para><code>template <class Event, class Fsm> </code></para>
- <para><code>void on_entry(Event const&, Fsm& ) {std::cout <<
- "entering: Empty" << std::endl;} </code></para>
- <para><code>template <class Event, class Fsm> </code></para>
- <para><code>void on_exit(Event const&, Fsm& ) {std::cout <<
- "leaving: Empty" << std::endl;} </code></para>
- <para><code>};</code></para>
+ <programlisting>
+struct Empty : public msm::front::state<>
+{
+ template <class Event, class Fsm>
+ void on_entry(Event const&, Fsm& )
+ {std::cout <<"entering: Empty" << std::endl;}
+ template <class Event, class Fsm>
+ void on_exit(Event const&, Fsm& )
+ {std::cout <<"leaving: Empty" << std::endl;}
+};
+ </programlisting>
<para>Notice how the entry and exit behaviors are templatized on the event and
state machine. Being generic facilitates reuse. There are more state types
(terminate, interrupt, pseudo states, etc.) corresponding to the UML
@@ -803,17 +803,21 @@
<para>Declaring a state machine is straightforward and is done with a high
signal / noise ratio. In our player example, we declare the state machine
as:</para>
- <para><code>struct player_ : public msm::front::state_machine_def<player_>{
- /* see below */}</code></para>
+ <programlisting>struct player_ : public msm::front::state_machine_def<player_>{
+ /* see below */}</programlisting>
<para>This declares a state machine using the basic front-end. We now declare
inside the state machine structure the initial state:</para>
- <para><code>typedef Empty initial_state;</code></para>
+ <para>
+ <programlisting>typedef Empty initial_state;</programlisting>
+ </para>
<para>And that is about all of what is absolutely needed. In the example, the
states are declared inside the state machine for readability but this is not
a requirements, states can be declared wherever you like.</para>
<para>All what is left to do is to pick a back-end (which is quite simple as
there is only one at the moment):</para>
- <para><code>typedef msm::back::state_machine<player_> player;</code></para>
+ <para>
+ <programlisting>typedef msm::back::state_machine<player_> player;</programlisting>
+ </para>
<para>You now have a ready-to-use state machine with entry/exit actions, guards,
transition actions, a message queue so that processing an event can generate
another event. The state machine also adapted itself to your need and
@@ -826,14 +830,18 @@
exist until state machine destruction. MSM is using Boost.Fusion behind the
hood. This unfortunately means that if you define more than 10 states, you
will need to extend the default:</para>
- <para><code>#define FUSION_MAX_VECTOR_SIZE 20 // or whatever you need
- </code></para>
+ <para>
+ <programlisting>#define FUSION_MAX_VECTOR_SIZE 20 // or whatever you need
+ </programlisting>
+ </para>
<para>When an unexpected event is fired, the <code>no_transition(event, state
machine, state id)</code> method of the state machine is called . By
default, this method simply asserts when called. It is possible to overwrite
the <code>no_transition</code> method to define a different handling:</para>
- <para><code>template <class Fsm,class Event> void no_transition(Event
- const& e, Fsm& ,int state){...}</code></para>
+ <para>
+ <programlisting>template <class Fsm,class Event>
+void no_transition(Event const& e, Fsm& ,int state){...}</programlisting>
+ </para>
<para><emphasis role="underline">Note</emphasis>: you might have noticed that
the tutorial calls <code>start()</code> on the state machine just after
creation. The start method will initiate the state machine, meaning it will
@@ -856,12 +864,13 @@
is also provided.</para>
<para>A submachine really is a state machine itself, so we declare Playing as
such, choosing a front-end and a back-end:</para>
- <para><code>struct Playing_ : public
- msm::front::state_machine_def<Playing_>{...} </code></para>
- <para><code>typedef msm::back::state_machine<Playing_> Playing;</code></para>
+ <para>
+ <programlisting>struct Playing_ : public msm::front::state_machine_def<Playing_>{...}
+typedef msm::back::state_machine<Playing_> Playing;</programlisting>
+ </para>
<para>Like for any state machine, one also needs a transition table and an
initial state:</para>
- <para>struct transition_table : mpl::vector<<informaltable>
+ <para> struct transition_table : mpl::vector<<informaltable>
<tbody>
<tr>
<td>//</td>
@@ -937,7 +946,9 @@
</tr>
</tbody>
</informaltable></para>
- <para><code>typedef Song1 initial_state; </code></para>
+ <para>
+ <programlisting>typedef Song1 initial_state; </programlisting>
+ </para>
<para>This is about all you need to do. MSM will now automatically recognize
Playing as a submachine and all events handled by Playing (NextSong and
PreviousSong) will now be automatically forwarded to Playing whenever this
@@ -975,7 +986,9 @@
<para>Adding an orthogonal region is easy, one only needs to declare more states
in the <code>initial_state</code> typedef. So, adding a new region with
AllOk as the region's initial state is:</para>
- <para><code>typedef mpl::vector<Empty,AllOk> initial_state;</code></para>
+ <para>
+ <programlisting>typedef mpl::vector<Empty,AllOk> initial_state;</programlisting>
+ </para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/Orthogonal-deferred.jpg" width="60%"
@@ -1005,13 +1018,13 @@
<para>UML defines event deferring as a state property. To accommodate this, MSM
lets you specify this in states by providing a <code>deferred_events</code>
type:</para>
- <para><code>struct Empty : public msm::front::state<> </code></para>
- <para><code>{ </code></para>
- <para><code>// if the play event is fired while in this state, defer it until a
- state </code></para>
- <para><code>// handles or rejects it</code></para>
- <para><code> typedef mpl::vector<play> deferred_events;</code></para>
- <para><code>...};</code></para>
+ <programlisting>struct Empty : public msm::front::state<>
+{
+ // if the play event is fired while in this state, defer it until a state
+ // handles or rejects it
+ typedef mpl::vector<play> deferred_events;
+...
+}; </programlisting>
<para>Please have a look at the <link
xlink:href="examples/Orthogonal-deferred.cpp">complete
example</link>.</para>
@@ -1028,15 +1041,17 @@
<para>First, as there is no state where MSM can automatically find out the usage
of this feature, we need to require deferred events capability explicitly,
by adding a type in the state machine definition:</para>
- <para><code>struct player_ : public
- msm::front::state_machine_def<player_></code></para>
- <para><code>{ </code></para>
- <para><code>typedef int activate_deferred_events;</code></para>
- <para><code>...};</code></para>
+ <programlisting>struct player_ : public msm::front::state_machine_def<player_>
+{
+ typedef int activate_deferred_events;
+...
+}; </programlisting>
<para>We can now defer an event in any transition of the transition table by
using as action the predefined <code>msm::front::Defer</code> functor, for
example:</para>
- <para><code>Row < Empty , play , none , Defer , none ></code></para>
+ <para>
+ <programlisting>Row < Empty , play , none , Defer , none ></programlisting>
+ </para>
<para>This is an internal transition row(see <command
xlink:href="#internal-transitions">internal transitions</command>) but
you can ignore this for the moment. It just means that we are not leaving
@@ -1050,9 +1065,9 @@
example, we could model an "if (condition2) move to Playing else if
(condition1) defer play event":</para>
<para>
- <code>Row < Empty , play , none , Defer , condition1 >,</code></para>
- <para><code>g_row < Empty , play , Playing , &player_::condition2
- ></code></para>
+ <programlisting>Row < Empty , play , none , Defer , condition1 >,
+g_row < Empty , play , Playing , &player_::condition2 ></programlisting>
+ </para>
<para>Please have a look at <link xlink:href="examples/Orthogonal-deferred2.cpp"
>this possible implementation</link>.</para>
</sect2>
@@ -1068,8 +1083,12 @@
can it be done? Of course, you could add a bit of programming logic and
generate extra events to make the second song start if coming from Pause.
Something like: </para>
- <para><code>if (Event == end_pause) { for (int i=0;i< song number;++i) {
- player.process_event(NextSong()); } } </code></para>
+ <para>
+ <programlisting>if (Event == end_pause)
+{
+ for (int i=0;i< song number;++i) {player.process_event(NextSong()); }
+} </programlisting>
+ </para>
<para>Not much to like in this example, isn't it? To solve this problem, you
define what is called a shallow or a deep history. A shallow history
reactivates the last active substate of a submachine when this submachine
@@ -1096,12 +1115,14 @@
allows you to reuse the same state machine definition with different history
policies in different contexts.</para>
<para>Concretely, your frontend stays unchanged:</para>
- <para><code>struct Playing_ : public
- msm::front::state_machine_def<Playing_></code></para>
+ <para>
+ <programlisting>struct Playing_ : public msm::front::state_machine_def<Playing_></programlisting>
+ </para>
<para>You then add the policy to the backend as second parameter:</para>
- <para><code>typedef
- msm::back::state_machine<Playing_,msm::back::ShallowHistory<mpl::vector<end_pause>
- > > Playing;</code></para>
+ <para>
+ <programlisting>typedef msm::back::state_machine<Playing_,
+ msm::back::ShallowHistory<mpl::vector<end_pause> > > Playing;</programlisting>
+ </para>
<para>This states that a shallow history must be activated if the Playing state
machine gets activated by the end_pause event and only this one (or any
other event added to the mpl::vector). If the state machine was in the
@@ -1152,8 +1173,9 @@
sounds as MSMâs execution speed is very high anyway.</para>
<para>To define such a transition, use ânoneâ as event in the transition table,
for example:</para>
- <para><code>row < State3 , none , State4 , &p::State3ToState4 ,
- &p::always_true ></code></para>
+ <para>
+ <programlisting>row < State3 , none , State4 , &p::State3ToState4 , &p::always_true ></programlisting>
+ </para>
<para><link xlink:href="examples/AnonymousTutorial.cpp">An implementation</link>
of the state machine diagram is also provided.</para>
</sect2>
@@ -1174,8 +1196,9 @@
a_row, g_row, _row and row, we now add a_irow, g_irow, _irow and irow which
are like normal transitions but define no target state. For, example an
internal transition with a guard condition could be:</para>
- <para><code>g_irow < Empty /*state*/ , cd_detected
- /*event*/,&p::internal_guard /* guard */ ></code></para>
+ <para>
+ <programlisting>g_irow < Empty /*state*/,cd_detected/*event*/,&p::internal_guard/* guard */></programlisting>
+ </para>
<para>These new row types can be placed anywhere in the transition table so that
you can still have your state machine structure grouped together. The only
difference of behavior with the UML standard is the missing notion of higher
@@ -1185,12 +1208,12 @@
<para>It is also possible to do it the UML-conform way by declaring a transition
table called <code>internal transition_table</code> inside the state itself
and using internal row types. For example:</para>
- <para><code>struct Empty : public msm::front::state<> {</code></para>
- <para><code>struct internal_transition_table : mpl::vector<</code></para>
- <para><code>a_internal < cd_detected , Empty, &Empty::internal_action
- ></code></para>
- <para><code>> {};</code></para>
- <para><code>};</code></para>
+ <programlisting>struct Empty : public msm::front::state<>
+{
+ struct internal_transition_table : mpl::vector<
+ a_internal < cd_detected , Empty, &Empty::internal_action >
+ > {};
+};</programlisting>
<para>This declares an internal transition table called
internal_transition_table and reacting on the event cd_detected by calling
internal_action on Empty. Let us note a few points:<itemizedlist>
@@ -1291,8 +1314,10 @@
They come, like normal transitions in four flavors: <code>a_row2, g_row2,
_row2 and row2</code>. For example, a transition calling an action from
the state Empty could be:</para>
- <para><code>a_row2 < Stopped , open_close , Open , Empty /*action source*/ ,
- &Empty::open_drawer /*action*/></code></para>
+ <para>
+ <programlisting>a_row2<Stopped,open_close,Open,Empty
+ /*action source*/,&Empty::open_drawer/*action*/></programlisting>
+ </para>
<para>The same capabilities are also available for internal transitions so that
we have: <code>a_irow2, g_irow2, _irow2 and row2</code>. For transitions
defined as part of the <code>internal_transition_table</code>, you can use
@@ -1369,15 +1394,19 @@
it a state and mark it as explicit, giving as template parameters the
region id (the region id starts with 0 and corresponds to the first
initial state of the initial_state type sequence).</para>
- <para><code>struct SubState2 : public msm::front::state<> , public
- msm::front::explicit_entry<0></code></para>
+ <para>
+ <programlisting>struct SubState2 : public msm::front::state<> ,
+ public msm::front::explicit_entry<0></programlisting>
+ </para>
<para>And define the submachine as:</para>
- <para><code>typedef msm::back::state_machine<SubFsm2_>
- SubFsm2;</code></para>
+ <para>
+ <programlisting>typedef msm::back::state_machine<SubFsm2_> SubFsm2;</programlisting>
+ </para>
<para>You can then use it as target in a transition with State1 as
source:</para>
- <para><code>_row < State1, Event2, SubFsm2::direct<
- SubFsm2_::SubState2> ></code></para>
+ <para>
+ <programlisting>_row < State1, Event2, SubFsm2::direct< SubFsm2_::SubState2> ></programlisting>
+ </para>
<para>The syntax deserves some explanation. SubFsm2_ is a front end.
SubState2 is a nested state, therefore the SubFsm2_::SubState2 syntax.
The containing machine (containing State1 and SubFsm2) refers to the
@@ -1391,8 +1420,9 @@
need to add in the state machine containing the explicit states a simple
typedef giving a sequence of states to be explicitly created
like:</para>
- <para><code>typedef mpl::vector<SubState2,SubState2b>
- explicit_creation;</code></para>
+ <para>
+ <programlisting>typedef mpl::vector<SubState2,SubState2b> explicit_creation;</programlisting>
+ </para>
</sect3>
<sect3>
<title>Fork</title>
@@ -1400,44 +1430,56 @@
entry into states of different regions, we do not change the state
definition compared to the explicit entry and specify as target a list
of explicit entry states:</para>
- <para><code>_row < State1, Event3, mpl::vector<SubFsm2::direct<
- SubFsm2_::SubState2>, SubFsm2::direct <SubFsm2_::SubState2b>
- ></code></para>
+ <para>
+ <programlisting>_row < State1, Event3,
+ mpl::vector<SubFsm2::direct<SubFsm2_::SubState2>,
+ SubFsm2::direct <SubFsm2_::SubState2b>
+ ></programlisting>
+ </para>
<para>With SubState2 defined as before and SubState2b defined as being in
the second region (Caution: MSM does not check that the region is
correct):</para>
- <para><code>struct SubState2b : public msm::front::state<> , public
- msm::front::explicit_entry<1></code></para>
+ <para>
+ <programlisting>struct SubState2b : public msm::front::state<> ,
+ public msm::front::explicit_entry<1></programlisting>
+ </para>
</sect3>
<sect3>
<title>Entry pseudo states</title>
<para> To define an entry pseudo state, you need derive from the
corresponding class and give the region id:</para>
- <para><code>struct PseudoEntry1 : public
- msm::front::entry_pseudo_state<0></code></para>
+ <para>
+ <programlisting>struct PseudoEntry1 : public msm::front::entry_pseudo_state<0></programlisting>
+ </para>
<para>And add the corresponding transition in the top-level state machine's
transition table:</para>
- <para><code>_row < State1, Event4,
- SubFsm2::entry_pt<SubFsm2_::PseudoEntry1> ></code></para>
+ <para>
+ <programlisting>_row < State1, Event4, SubFsm2::entry_pt<SubFsm2_::PseudoEntry1> ></programlisting>
+ </para>
<para>And another in the SubFsm2_ submachine definition (remember that UML
defines an entry point as a connection between two transitions), for
example this time with an action method:</para>
- <para><code>_row < PseudoEntry1, Event4, SubState3,
- &SubFsm2_::entry_action ></code></para>
+ <para>
+ <programlisting>_row < PseudoEntry1, Event4, SubState3,&SubFsm2_::entry_action ></programlisting>
+ </para>
</sect3>
<sect3>
<title> Exit pseudo states </title>
<para>And finally, exit pseudo states are to be used almost the same way,
but defined differently: it takes as template argument the event to be
forwarded (no region id is necessary):</para>
- <para><code>struct PseudoExit1 : public
- exit_pseudo_state<event6></code></para>
+ <para>
+ <programlisting>struct PseudoExit1 : public exit_pseudo_state<event6></programlisting>
+ </para>
<para>And you need, like for entry pseudo states, two transitions, one in
the submachine:</para>
- <para><code>_row < SubState3, Event5, PseudoExit1 ></code></para>
+ <para>
+ <programlisting>_row < SubState3, Event5, PseudoExit1 ></programlisting>
+ </para>
<para>And one in the containing state machine:</para>
- <para><code>_row < SubFsm2::exit_pt<SubFsm2_::PseudoExit1>, Event6,
- State2 ></code></para>
+ <para>
+ <programlisting>_row < SubFsm2::exit_pt<SubFsm2_::PseudoExit1>, Event6,State2 ></programlisting>
+ </para>
<para><emphasis role="underline">Important note 1:</emphasis> UML defines
transiting to an entry pseudo state and having either no second
transition or one with a guard as an error but defines no error
@@ -1456,8 +1498,13 @@
transition. In our case, event6 is convertible from event5. Notice that
the forwarded event must be named in the exit point definition. For
example, we could define event6 as simply as:</para>
- <para><code>struct event6 { event6(){} template <class Event>
- event6(Event const&){} };//convertible from any event</code>
+ <para>
+ <programlisting>struct event6
+{
+ event6(){}
+ template <class Event>
+ event6(Event const&){}
+}; //convertible from any event</programlisting>
</para>
</sect3>
</sect2>
@@ -1470,12 +1517,10 @@
Booleans.</para>
<para>If you look into the Boost.Statechart documentation you'll find this
code:</para>
- <para><code>if ( ( state_downcast< const NumLockOff * >() != 0 ) &&
- </code></para>
- <para><code>( state_downcast< const CapsLockOff * >() != 0 ) &&
- </code></para>
- <para><code>( state_downcast< const ScrollLockOff * >() != 0 ) )
- </code></para>
+ <programlisting>if ( ( state_downcast< const NumLockOff * >() != 0 ) &&
+ ( state_downcast< const CapsLockOff * >() != 0 ) &&
+ ( state_downcast< const ScrollLockOff * >() != 0 ) )
+ </programlisting>
<para>While correct and found in many UML books, this can be error-prone and a
potential time-bomb when your state machine grows and you add new states or
orthogonal regions.</para>
@@ -1485,31 +1530,33 @@
Software Engineering and move one level of abstraction higher.</para>
<para>In our player example, let's say we need to know if the player has a
loaded CD. We could do the same:</para>
- <para><code>if ( ( state_downcast< const Stopped * >() != 0 ) &&
- </code></para>
- <para><code>( state_downcast< const Open * >() != 0 ) &&
- </code></para>
- <para><code>( state_downcast< const Paused * >() != 0 )
- &&</code></para>
- <para><code>( state_downcast< const Playing * >() != 0 )</code></para>
- <para><code> ) </code></para>
+ <programlisting>if ( ( state_downcast< const Stopped * >() != 0 ) &&
+ ( state_downcast< const Open * >() != 0 ) &&
+ ( state_downcast< const Paused * >() != 0 ) &&
+ ( state_downcast< const Playing * >() != 0 )) </programlisting>
<para>Or flag these 4 states as CDLoaded-able. You add a flag_list type into
each flagged state:</para>
- <para><code>typedef mpl::vector1<CDLoaded> flag_list;</code></para>
+ <para>
+ <programlisting>typedef mpl::vector1<CDLoaded> flag_list;</programlisting>
+ </para>
<para>You can even define a list of flags, for example in Playing:</para>
- <para><code>typedef mpl::vector2<PlayingPaused,CDLoaded>
- flag_list;</code></para>
+ <para>
+ <programlisting>typedef mpl::vector2<PlayingPaused,CDLoaded> flag_list;</programlisting>
+ </para>
<para>This means that Playing supports both properties. To check if your player
has a loaded CD, check if your flag is active in the current state:</para>
- <para><code>player p; if (p.is_flag_active<CDLoaded>()) ... </code></para>
+ <para>
+ <programlisting>player p; if (p.is_flag_active<CDLoaded>()) ... </programlisting>
+ </para>
<para>And what if you have orthogonal regions? How to decide if a state machine
is in a flagged state? By default, you keep the same code and the current
states will be OR'ed, meaning if one of the active states has the flag, then
is_flag_active returns true. Of course, in some cases, you might want that
all of the active states are flagged for the state to be active. You can
also AND the active states:</para>
- <para><code>if (p.is_flag_active<CDLoaded,player::Flag_AND>())
- ...</code></para>
+ <para>
+ <programlisting>if (p.is_flag_active<CDLoaded,player::Flag_AND>()) ...</programlisting>
+ </para>
<para>The following diagram displays the flag situation in the tutorial.</para>
<para><inlinemediaobject>
<imageobject>
@@ -1536,8 +1583,8 @@
write 4 x 10 transitions and the compile-time would suffer. To solve this
problem, MSM supports the triggering of a transition on a subclass event.
For example, if we define digits as: </para>
- <para><code>struct digit {};</code></para>
- <para><code>struct char_0 : public digit {}; </code></para>
+ <programlisting>struct digit {};
+struct char_0 : public digit {}; </programlisting>
<para>And to the same for other digits, we can now fire char_0, char_1 events
and this will cause a transition with "digit" as trigger to be taken.</para>
<para>An <link xlink:href="examples/ParsingDigits.cpp">example</link> with
@@ -1587,15 +1634,15 @@
xlink:href="#basic-defer">here</link>, is to manually activate deferred
events, using <code>activate_deferred_events</code>. For example, the
following state machine sets all three configuration types:</para>
- <para><code>struct player_ : public msm::front::state_machine_def<player_>
- {</code></para>
- <para><code>// no need for exception handling or message queue</code></para>
- <para><code>typedef int no_exception_thrown;</code></para>
- <para><code>typedef int no_message_queue;</code></para>
- <para><code>// also manually enable deferred events</code></para>
- <para><code>typedef int activate_deferred_events</code></para>
- <para><code>...// rest of implementation</code></para>
- <para><code>};</code></para>
+ <programlisting>struct player_ : public msm::front::state_machine_def<player_>
+{
+ // no need for exception handling or message queue
+ typedef int no_exception_thrown;
+ typedef int no_message_queue;
+ // also manually enable deferred events
+ typedef int activate_deferred_events
+ ...// rest of implementation
+};</programlisting>
</sect2>
<sect2>
<title>Choosing the initial event</title>
@@ -1608,11 +1655,11 @@
configuration mechanism in the form of a typedef. If the state machine's
front-end definition provides an initial_event typedef set to another event,
this event will be used. For example:</para>
- <para><code>struct my_initial_event{};</code></para>
- <para><code>struct player_ : public
- msm::front::state_machine_def<player_>{</code></para>
- <para><code>...</code></para>
- <para><code>typedef my_initial_event initial_event; };</code></para>
+ <programlisting>struct my_initial_event{};
+struct player_ : public msm::front::state_machine_def<player_>{
+...
+typedef my_initial_event initial_event;
+};</programlisting>
</sect2>
<sect2>
<title> Containing state machine (deprecated)</title>
@@ -1626,7 +1673,7 @@
creation and access. But sometimes you needed a way for a state to get
access to its containing state machine. Basically, a state needs to change
its declaration to:</para>
- <para><code>struct Stopped : public msm::front::state<sm_ptr></code></para>
+ <programlisting>struct Stopped : public msm::front::state<sm_ptr></programlisting>
<para>And to provide a set_sm_ptr function: <code>void set_sm_ptr(player*
pl)</code></para>
<para>to get a pointer to the containing state machine. The same applies to
@@ -1867,16 +1914,15 @@
nothing (for example actions and guards), write "none". Actions and guards
are no more methods but functors getting as arguments the detected event,
the state machine, source and target state:</para>
- <para><code>struct store_cd_info { </code></para>
- <para><code>template <class Fsm,class Evt,class SourceState,class
- TargetState> </code></para>
- <para><code>void operator()(Evt const&, Fsm& fsm, SourceState&,
- TargetState& ) </code></para>
- <para><code> {</code></para>
- <para><code> cout << "player::store_cd_info" << endl;
- fsm.process_event(play()); </code></para>
- <para><code> } </code></para>
- <para><code>}; </code></para>
+ <programlisting>struct store_cd_info
+{
+ template <class Fsm,class Evt,class SourceState,class TargetState>
+ void operator()(Evt const&, Fsm& fsm, SourceState&,TargetState& )
+ {
+ cout << "player::store_cd_info" << endl;
+ fsm.process_event(play());
+ }
+}; </programlisting>
<para>The advantage of functors compared to functions are that functors are
generic and reusable. They also allow passing more parameters than just
events. The guard functors are the same but have an operator() returning a
@@ -1893,17 +1939,16 @@
action by an action sequence and the guard by a more complex functor.</para>
<para>We decide we now want to execute two actions in the first transition
(Stopped -> Playing). We only need to change the action start_playback to
- <code>ActionSequence_< mpl::vector<some_action, start_playback> >
- </code> and now will execute some_action and start_playback every time the
- transition is taken. ActionSequence_ is a functor calling each action of the
- mpl::vector in sequence.</para>
+ <programlisting>ActionSequence_< mpl::vector<some_action, start_playback> ></programlisting>and
+ now will execute some_action and start_playback every time the transition is
+ taken. ActionSequence_ is a functor calling each action of the mpl::vector
+ in sequence.</para>
<para>We also want to replace good_disk_format by a condition of the type:
âgood_disk_format && (some_condition || some_other_condition)â. We
can achieve this using And_ and Or_ functors:
- <code>And_<good_disk_format,Or_< some_condition ,
- some_other_condition> ></code>. It even starts looking like functional
- programming. MSM ships with functors for operators, state machine usage, STL
- algorithms or container methods.</para>
+ <programlisting>And_<good_disk_format,Or_< some_condition , some_other_condition> ></programlisting>It
+ even starts looking like functional programming. MSM ships with functors for
+ operators, state machine usage, STL algorithms or container methods.</para>
</sect2>
<sect2>
<title>Defining states with entry/exit actions</title>
@@ -1918,15 +1963,15 @@
actions are also provided as functors as these are generated by eUML and
both front-ends are equivalent. For example, we can define a state
as:</para>
- <para><code>struct Empty_Entry { </code></para>
- <para><code>template <class Event,class Fsm,class State> </code></para>
- <para><code>void operator()(Event const&,Fsm&,State&) </code></para>
- <para><code> {</code></para>
- <para><code> ... </code></para>
- <para><code> } </code></para>
- <para><code>}; // same for Empty_Exit</code></para>
- <para><code>struct Empty : public
- msm::front::euml::func_state<Empty_Entry,Empty_Exit>{};</code></para>
+ <programlisting>struct Empty_Entry
+{
+ template <class Event,class Fsm,class State>
+ void operator()(Event const&,Fsm&,State&)
+ {
+ ...
+ }
+}; // same for Empty_Exit
+struct Empty : public msm::front::euml::func_state<Empty_Entry,Empty_Exit>{};</programlisting>
<para>This also means that you can, like in the transition table, write entry /
exit actions made of more complicated action combinations. The previous
example can therefore <link xlink:href="examples/SimpleWithFunctors2.cpp">be
@@ -1951,10 +1996,10 @@
required. We can also use <code>none</code> instead of an event to mark an
anonymous transition. For example, the following transition makes an
immediate transition from State1 to State2:</para>
- <para>Row < State1 , none , State2 ></para>
+ <programlisting>Row < State1 , none , State2 ></programlisting>
<para>The following transition does the same but calling an action in the
process:</para>
- <para>Row < State1 , none , State2 , State1ToState2, none ></para>
+ <programlisting>Row < State1 , none , State2 , State1ToState2, none ></programlisting>
<para>The following diagram shows an example and its <link
xlink:href="examples/AnonymousTutorialWithFunctors.cpp"
>implementation</link>:</para>
@@ -2028,17 +2073,24 @@
g++ >= 4.3).</para>
<para>Examples will be provided in the next paragraphs. You need to include eUML
basic features: </para>
- <para><code>#include <msm/front/euml/euml.hpp></code></para>
+ <para>
+ <programlisting>#include <msm/front/euml/euml.hpp></programlisting>
+ </para>
<para>To add STL support (at possible cost of longer compilation times), include: </para>
- <para><code>#include <msm/front/euml/stl.hpp></code></para>
+ <para>
+ <programlisting>#include <msm/front/euml/stl.hpp></programlisting>
+ </para>
<para>eUML is defined in the namespace <code>msm::front::euml</code>.</para>
<sect2>
<title>Transition table</title>
<para>A transition can be defined using eUML as: </para>
- <para><code>source + event [guard] / action == target</code>
+ <para>
+ <programlisting>source + event [guard] / action == target</programlisting>
</para>
<para>or as</para>
- <para><code>target == source + event [guard] / action</code></para>
+ <para>
+ <programlisting>target == source + event [guard] / action</programlisting>
+ </para>
<para>The first version looks like a drawn transition in a diagram, the second
one seems natural to a C++ developer.</para>
<para>The simple transition table written with the <command
@@ -2164,7 +2216,9 @@
<para>Events must be proto-enabled. To achieve this, they must inherit from
a proto terminal (euml_event<event-name>). eUML also provides a macro
to make this easier:</para>
- <para><code>BOOST_MSM_EUML_EVENT(play)</code></para>
+ <para>
+ <programlisting>BOOST_MSM_EUML_EVENT(play)</programlisting>
+ </para>
<para>This declares an event type and an instance of this type called
<code>play</code>, which is now ready to use in state or transition
behaviors.</para>
@@ -2187,13 +2241,12 @@
like previous functors, with the difference that they also must be
proto-enabled. This can be done by inheriting from euml_action<
functor-name >. eUML also provides a macro:</para>
- <para><code>BOOST_MSM_EUML_ACTION(some_condition)</code></para>
- <para><code>{ </code></para>
- <para><code>template <class Fsm,class Evt,class SourceState,class
- TargetState></code></para>
- <para><code>bool operator()(Evt const& ,Fsm& ,SourceState&
- ,TargetState& ) { return true; } </code></para>
- <para><code>}; </code></para>
+ <programlisting>BOOST_MSM_EUML_ACTION(some_condition)
+{
+ template <class Fsm,class Evt,class SourceState,class TargetState>
+ bool operator()(Evt const& ,Fsm& ,SourceState&,TargetState& )
+ { return true; }
+}; </programlisting>
<para>Like for events, this macro declares a functor type and an instance
for use in transition or state behaviors.</para>
<para>It is possible to use the same action grammar from the transition
@@ -2203,24 +2256,24 @@
<para>The state functors have a slightly different signature as there is no
source and target state but only a current state (entry/exit actions are
transition-independent), for example:</para>
- <para><code>BOOST_MSM_EUML_ACTION(Empty_Entry)</code></para>
- <para><code>{ </code></para>
- <para><code>template <class Evt,class Fsm,class State></code></para>
- <para><code>void operator()(Evt const& ,Fsm& ,State& ) { ... }
- </code></para>
- <para><code>}; </code></para>
+ <programlisting>BOOST_MSM_EUML_ACTION(Empty_Entry)
+{
+ template <class Evt,class Fsm,class State>
+ void operator()(Evt const& ,Fsm& ,State& ) { ... }
+}; </programlisting>
</sect3>
<sect3>
<title>States</title>
<para>There is also a macro for states. This macro has 2 arguments, first
the expression defining the state, then the state (instance)
name:</para>
- <para><code>BOOST_MSM_EUML_STATE((),Paused)</code></para>
+ <programlisting>BOOST_MSM_EUML_STATE((),Paused)</programlisting>
<para>This defines a simple state without entry or exit action. You can
provide in the expression parameter the state behaviors (entry and exit)
using the action grammar, like in the transition table:</para>
- <para><code>BOOST_MSM_EUML_STATE(((Empty_Entry,Dummy_Entry)/*2 entry
- actions*/,Empty_Exit/*1 exit action*/ ),Empty)</code></para>
+ <programlisting>BOOST_MSM_EUML_STATE(((Empty_Entry,Dummy_Entry)/*2 entryactions*/,
+ Empty_Exit/*1 exit action*/ ),
+ Empty)</programlisting>
<para>This means that Empty is defined as a state with an entry action made
of two sub-actions, Empty_Entry and Dummy_Entry (enclosed inside
parenthesis), and an exit action, Empty_Exit.</para>
@@ -2262,34 +2315,29 @@
states some special behavior. In this case, you will have to do the
macro's job by hand, which is not very complicated. The state will need
to inherit from <code>msm::front::state<></code>, like any state, and
- from <code>euml_statestate-name></code> to be proto-enabled. You will
- then need to declare an instance for use in the transition table. For
- example:</para>
- <para><code>struct Empty_impl : public msm::front::state<> , public
- euml_state<Empty_impl> {</code></para>
- <para><code>void activate_empty() {std::cout << "switching to Empty "
- << std::endl;}</code></para>
- <para><code>template <class Event,class Fsm></code></para>
- <para><code>void on_entry(Event const& evt,Fsm&
- fsm){...}</code></para>
- <para><code>template <class Event,class Fsm> </code></para>
- <para><code>void on_exit(Event const& evt,Fsm&
- fsm){...}</code></para>
- <para><code>};</code></para>
- <para><code>//instance for use in the transition table</code></para>
- <para><code>Empty_impl const Empty;</code></para>
+ from <code>euml_state<state-name></code> to be proto-enabled. You
+ will then need to declare an instance for use in the transition table.
+ For example:</para>
+ <programlisting>struct Empty_impl : public msm::front::state<> , public euml_state<Empty_impl>
+{
+ void activate_empty() {std::cout << "switching to Empty " << std::endl;}
+ template <class Event,class Fsm>
+ void on_entry(Event const& evt,Fsm&fsm){...}
+ template <class Event,class Fsm>
+ void on_exit(Event const& evt,Fsm&fsm){...}
+};
+//instance for use in the transition table
+Empty_impl const Empty;</programlisting>
<para>Notice also that we defined a method named activate_empty. We would
like to call it inside a behavior. This can be done using the
BOOST_MSM_EUML_METHOD macro. </para>
- <para><code>BOOST_MSM_EUML_METHOD(ActivateEmpty_ , activate_empty ,
- activate_empty_ , void , void )</code></para>
+ <programlisting>BOOST_MSM_EUML_METHOD(ActivateEmpty_,activate_empty,activate_empty_,void,void)</programlisting>
<para>The first parameter is the name of the underlying functor, which you
could use with the functor front-end, the second is the state method
name, the third is the eUML-generated function, the fourth and fifth the
return value when used inside a transition or a state behavior. You can
now use this inside a transition:</para>
- <para><code>Empty == Open + open_close /
- (close_drawer,activate_empty_(target_))</code></para>
+ <programlisting>Empty == Open + open_close / (close_drawer,activate_empty_(target_))</programlisting>
</sect3>
</sect2>
<sect2>
@@ -2357,8 +2405,8 @@
</tbody>
</informaltable>
</para>
- <para><code>BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,init_
- << Empty ),player_)</code></para>
+ <programlisting>BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,init_ << Empty ),
+ player_)</programlisting>
<para>Please have a look at the player tutorial written using eUML's <link
xlink:href="examples/SimpleTutorialEuml2.cpp">first</link> and <link
xlink:href="examples/SimpleTutorialEuml.cpp">second</link> syntax. The
@@ -2380,13 +2428,12 @@
a type is what the back-end requires. This means that you will need to
declare yourself an instance to reference your submachine into another state
machine, for example:</para>
- <para><code>BOOST_MSM_EUML_DECLARE_STATE_MACHINE(...,Playing_)</code></para>
- <para><code>typedef msm::back::state_machine<Playing_>
- Playing_type;</code></para>
- <para><code>Playing_type const Playing;</code></para>
+ <programlisting>BOOST_MSM_EUML_DECLARE_STATE_MACHINE(...,Playing_)
+typedef msm::back::state_machine<Playing_> Playing_type;
+Playing_type const Playing;</programlisting>
<para>We can now use this instance inside the transition table of the containing
state machine:</para>
- <para><code>Paused == Playing + pause / pause_playback</code></para>
+ <programlisting>Paused == Playing + pause / pause_playback</programlisting>
</sect2>
<sect2>
<title>
@@ -2402,29 +2449,29 @@
xlink:href="examples/SimpleTutorialEuml.cpp">second</link> syntaxes, you
will find a BOOST_MSM_EUML_DECLARE_ATTRIBUTE and a BOOST_MSM_EUML_ATTRIBUTES
macro. The first one declares possible attributes:</para>
- <para><code>BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)</code></para>
- <para><code>BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)</code></para>
+ <programlisting>BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,cd_name)
+BOOST_MSM_EUML_DECLARE_ATTRIBUTE(DiskTypeEnum,cd_type)</programlisting>
<para>This declares two attributes: cd_name of type std::string and cd_type of
type DiskTypeEnum. These attributes are not part of any event or state in
particular, we just declared a name and a type. Now, we can add attributes
to our cd_detected event using the second one:</para>
- <para><code>BOOST_MSM_EUML_ATTRIBUTES((attributes_ << cd_name <<
- cd_type ), cd_detected_attributes)</code></para>
+ <programlisting>BOOST_MSM_EUML_ATTRIBUTES((attributes_ << cd_name << cd_type ),
+ cd_detected_attributes)</programlisting>
<para>This declares an attribute list which is not linked to anything in
particular yet. It can be attached to a state or an event. For example, if
we want the event cd_detected to have these defined attributes we
write:</para>
- <para><code>BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(cd_detected,cd_detected_attributes)</code></para>
+ <programlisting>BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(cd_detected,cd_detected_attributes)</programlisting>
<para>For states, we use the BOOST_MSM_EUML_STATE macro, which has an expression
form where one can provide attributes. For example:</para>
- <para><code>BOOST_MSM_EUML_STATE((no_action /*entry*/,no_action/*exit*/,
- attributes_ << cd_detected_attributes),some_state)</code></para>
+ <programlisting>BOOST_MSM_EUML_STATE((no_action /*entry*/,no_action/*exit*/,
+ attributes_ << cd_detected_attributes),
+ some_state)</programlisting>
<para>OK, great, we now have a way to add attributes to a class, which we could
have done more easily, so what is the point? The point is that we can now
reference these attributes directly, at compile-time, in the transition
table. For example, in the example, you will find this transition:</para>
- <para><code>Stopped == Empty + cd_detected [good_disk_format &&
- (event_(cd_type)==Int_<DISK_CD>())] </code></para>
+ <programlisting>Stopped==Empty+cd_detected[good_disk_format&&(event_(cd_type)==Int_<DISK_CD>())] </programlisting>
<para>Read event_(cd_type) as event_->cd_type with event_ a type generic for
events, whatever the concrete event is (in this particular case, it happens
to be a cd_detected as the transition shows).</para>
@@ -2483,8 +2530,7 @@
This is done using the MSM_EUML_METHOD / MSM_EUML_FUNCTION macros. The first
creates a functor to a method, the second to a free function. In the
tutorial, we write:</para>
- <para><code>MSM_EUML_METHOD(ActivateEmpty_ , activate_empty , activate_empty_ ,
- void , void )</code></para>
+ <programlisting>MSM_EUML_METHOD(ActivateEmpty_,activate_empty,activate_empty_,void,void)</programlisting>
<para>The first parameter is the functor name, for use with the functor
front-end. The second is the name of the method to call. The third is the
function name for use with eUML, the fourth is the return type of the
@@ -2494,8 +2540,7 @@
method of "something", and this "something" is one of the five previously
shown generic helpers. We can now use this in a transition, for
example:</para>
- <para><code>Empty == Open + open_close /
- (close_drawer,activate_empty_(target_))</code></para>
+ <programlisting>Empty == Open + open_close / (close_drawer,activate_empty_(target_))</programlisting>
<para>The action is now defined as a sequence of two actions: close_drawer and
activate_empty, which is called on the target itself. The target being Empty
(the state defined left), this really will call Empty::activate_empty().
@@ -2513,26 +2558,27 @@
<para>Defining orthogonal regions really means providing more initial states. To
add more initial states, âshift leftâ some, for example, if we had another
initial state named AllOk :</para>
- <para><code>BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,init_
- << Empty << AllOk ),player_)</code></para>
+ <programlisting>BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,
+ init_ << Empty << AllOk ),
+ player_)</programlisting>
<para>You remember from the <command xlink:href="#eUML-build-state"
>BOOST_MSM_EUML_STATE </command> and <command
xlink:href="#eUML-build-sm"
>BOOST_MSM_EUML_DECLARE_STATE_MACHINE</command> signatures that just
after attributes, we can define flags, like in the basic MSM front-end. To
do this, we have another "shift-left" grammar, for example:</para>
- <para><code>BOOST_MSM_EUML_STATE((no_action,no_action, attributes_ <<
- no_attributes_, </code></para>
- <para><code>/* flags */ configure_<< PlayingPaused << CDLoaded
- ),Paused)</code></para>
+ <programlisting>BOOST_MSM_EUML_STATE((no_action,no_action, attributes_ <<no_attributes_,
+ /* flags */ configure_<< PlayingPaused << CDLoaded),
+ Paused)</programlisting>
<para>We now defined that Paused will get two flags, PlayingPaused and CDLoaded,
defined, with another macro:</para>
- <para><code>BOOST_MSM_EUML_FLAG(CDLoaded)</code></para>
+ <programlisting>BOOST_MSM_EUML_FLAG(CDLoaded)</programlisting>
<para>This corresponds to the following basic front-end definition of
Paused:</para>
- <para><code>struct Paused : public msm::front::state<> </code></para>
- <para><code>{ typedef mpl::vector2<PlayingPaused,CDLoaded> flag_list; };
- </code></para>
+ <programlisting>struct Paused : public msm::front::state<>
+{
+ typedef mpl::vector2<PlayingPaused,CDLoaded> flag_list;
+};</programlisting>
<para>Under the hood, what you get really is a mpl::vector2.</para>
<para><emphasis role="underline">Note</emphasis>: As we use the version of
BOOST_MSM_EUML_STATE's expression with 4 arguments, we need to tell eUML
@@ -2543,22 +2589,20 @@
for state and transition behaviors. For example, in the <link
xlink:href="examples/iPodEuml.cpp">iPod implementation with eUML</link>,
you find the following transition:</para>
- <para><code>ForwardPressed == NoForward + EastPressed
- [!is_flag_(NoFastFwd)]</code></para>
+ <programlisting>ForwardPressed == NoForward + EastPressed[!is_flag_(NoFastFwd)]</programlisting>
<para>The function also has an optional second parameter which is the state
machine on which the function is called. By default, fsm_ is used (the
current state machine) but you could provide a functor returning a reference
to another state machine.</para>
<para>eUML also supports defining deferred events in the state (state machine)
definition. To this aim, we can reuse the flag grammar. For example:</para>
- <para><code>BOOST_MSM_EUML_STATE((Empty_Entry,Empty_Exit, attributes_ <<
- no_attributes_, </code></para>
- <para><code>/* deferred */ configure_<< play ),Empty) </code></para>
+ <programlisting>BOOST_MSM_EUML_STATE((Empty_Entry,Empty_Exit, attributes_ << no_attributes_,
+ /* deferred */ configure_<< play ),Empty) </programlisting>
<para>The configure_ left shift is also responsible for deferring events. Shift
inside configure_ a flag and the state will get a flag, shift an event and
it will get a deferred event. This replaces the basic front-end
definition:</para>
- <para><code>typedef mpl::vector<play> deferred_events;</code></para>
+ <programlisting>typedef mpl::vector<play> deferred_events;</programlisting>
<para>In <link xlink:href="examples/OrthogonalDeferredEuml.cpp">this
tutorial</link>, player is defining a second orthogonal region with
AllOk as initial state. The <code>Empty</code> and <code>Open</code> states
@@ -2571,22 +2615,25 @@
also possible with eUML through the use of the defer_ order, as shown in
<link xlink:href="examples/OrthogonalDeferredEuml.cpp">this
tutorial</link>. You will find the following transition:</para>
- <para><code>Open + play / defer_</code></para>
+ <programlisting>Open + play / defer_</programlisting>
<para>This is an <command xlink:href="#eUML-internal">internal
transition</command>. Ignore it for the moment. Interesting is, that
when the event <code>play</code> is fired and <code>Open</code> is active,
the event will be deferred. Now add a guard and you can conditionally defer
the event, for example:</para>
- <para><code>Open + play [ some_condition ] / defer_</code></para>
+ <programlisting>Open + play [ some_condition ] / defer_</programlisting>
<para>This is similar to what we did with the functor front-end. This means that
we have the same constraints. Using defer_ instead of a state declaration,
we need to tell MSM that we have deferred events in this state machine. We
do this (again) using a configure_ declaration in the state machine
definition in which we shift the deferred_events configuration flag:</para>
- <para><code>BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,init_
- << Empty << AllOk,</code></para>
- <para><code>Entry_Action, Exit_Action, attributes_ << no_attributes_,
- configure_<< deferred_events ),player_)</code></para>
+ <programlisting>BOOST_MSM_EUML_DECLARE_STATE_MACHINE((transition_table,
+ init_ << Empty << AllOk,
+ Entry_Action,
+ Exit_Action,
+ attributes_ << no_attributes_,
+ configure_<< deferred_events ),
+ player_)</programlisting>
<para>A <link xlink:href="examples/OrthogonalDeferredEuml2.cpp">tutorial</link>
illustrates this possibility.</para>
</sect2>
@@ -2622,8 +2669,8 @@
provided a guard allows it. As there is no event, to define such a
transition, simply omit the â+â part of the transition (the event), for
example: </para>
- <para><code>State3 == State4 [always_true] / State3ToState4</code></para>
- <para><code>State4 [always_true] / State3ToState4 == State3</code></para>
+ <programlisting>State3 == State4 [always_true] / State3ToState4
+State4 [always_true] / State3ToState4 == State3</programlisting>
<para>Please have a look at <link
xlink:href="examples/AnonymousTutorialEuml.cpp">this example</link>,
which implements the <command xlink:href="#anonymous-transitions">previously
@@ -2638,20 +2685,20 @@
target state, which eUML will interpret as an internal
transition, for example this defines a transition internal to
Open, on the event open_close:</para>
- <para><code>Open + open_close [internal_guard1] /
- internal_action1</code></para>
+ <programlisting>Open + open_close [internal_guard1] / internal_action1</programlisting>
<para><link xlink:href="examples/EumlInternal.cpp">A full
example</link> is also provided.</para>
</listitem>
<listitem>
<para>in a state's <code>internal_transition_table</code>. For
example:</para>
- <para><code>BOOST_MSM_EUML_DECLARE_STATE((Open_Entry,Open_Exit),Open_def)</code></para>
- <para><code>struct Open_impl : public Open_def</code></para>
- <para><code>BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE((</code></para>
- <para><code>open_close [internal_guard1] /
- internal_action1</code></para>
- <para><code>))</code></para>
+ <programlisting>BOOST_MSM_EUML_DECLARE_STATE((Open_Entry,Open_Exit),Open_def)
+struct Open_impl : public Open_def
+{
+ BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE((
+ open_close [internal_guard1] / internal_action1
+ ))
+};</programlisting>
<para>Notice how we do not need to repeat that the transition
originates from Open as we already are in Open's context. </para>
<para>The <link xlink:href="examples/EumlInternalDistributed.cpp"
@@ -2720,16 +2767,17 @@
<code>explicit_</code>, <code>exit_pt_</code> and
<code>entry_pt_</code>. For example, a direct entry into the substate
SubState2 from SubFsm2 could be:</para>
- <para><code>explicit_(SubFsm2,SubState2) == State1 + event2</code></para>
+ <programlisting>explicit_(SubFsm2,SubState2) == State1 + event2</programlisting>
<para>Forks being a list on direct entries, eUML supports a logical syntax
(state1, state2, ...), for example:</para>
- <para><code>(explicit_(SubFsm2,SubState2), explicit_(SubFsm2,SubState2b),
- explicit_(SubFsm2,SubState2c)) == State1 + event3 </code></para>
+ <programlisting>(explicit_(SubFsm2,SubState2),
+ explicit_(SubFsm2,SubState2b),
+ explicit_(SubFsm2,SubState2c)) == State1 + event3 </programlisting>
<para>An entry point is entered using the same syntax as explicit entries:
- <code>entry_pt_(SubFsm2,PseudoEntry1) == State1 + event4</code></para>
+ <programlisting>entry_pt_(SubFsm2,PseudoEntry1) == State1 + event4</programlisting></para>
<para>For exit points, it is again the same syntax except that exit points are
- used as source of the transition: <code>State2 ==
- exit_pt_(SubFsm2,PseudoExit1) + event6 </code></para>
+ used as source of the transition:
+ <programlisting>State2 == exit_pt_(SubFsm2,PseudoExit1) + event6 </programlisting></para>
<para>The <link xlink:href="examples/DirectEntryEuml.cpp">entry tutorial</link>
is also available with eUML.</para>
</sect2>
@@ -2822,13 +2870,13 @@
</listitem>
</itemizedlist></para>
<para>This can be quite fun. For example, </para>
- <para><code>/( if_then_else_(--fsm_(m_SongIndex) > Int_<0>(),/*if
- clause*/</code></para>
- <para><code>show_playing_song(), /*then clause*/</code></para>
- <para><code>(fsm_(m_SongIndex)=Int_<1>(),process_(EndPlay())) /*else clause*/
- ) )</code> means:</para>
- <para>if (fsm.SongIndex > 0, call show_playing_song else {fsm.SongIndex=1;
- process EndPlay on fsm;}</para>
+ <programlisting>/( if_then_else_(--fsm_(m_SongIndex) > Int_<0>(),/*if clause*/
+ show_playing_song, /*then clause*/
+ (fsm_(m_SongIndex)=Int_<1>(),process_(EndPlay))/*else clause*/
+ )
+ )</programlisting>
+ <para>means: if (fsm.SongIndex > 0, call show_playing_song else
+ {fsm.SongIndex=1; process EndPlay on fsm;}</para>
<para>A few examples are using these features:<itemizedlist>
<listitem>
<para>the iPod example introduced at the BoostCon09 <link
@@ -2884,17 +2932,17 @@
possibility is not reserved to eUML but also to the functor-based
front-end). The file structure of this Phoenix-like library matches the one
of Boost.Phoenix. All functors for STL algorithms are to be found in:</para>
- <para><code>#include <msm/front/euml/algorithm.hpp></code></para>
+ <programlisting>#include <msm/front/euml/algorithm.hpp></programlisting>
<para>The algorithms are also divided into sub-headers, matching the phoenix
structure for simplicity:</para>
- <para><code>#include < msm/front/euml/iteration.hpp> </code></para>
- <para><code>#include < msm/front/euml/transformation.hpp> </code></para>
- <para><code>#include < msm/front/euml/querying.hpp> </code></para>
+ <programlisting>#include < msm/front/euml/iteration.hpp>
+#include < msm/front/euml/transformation.hpp>
+#include < msm/front/euml/querying.hpp> </programlisting>
<para>Container methods can be found in:</para>
- <para><code>#include < msm/front/euml/container.hpp></code></para>
+ <programlisting>#include < msm/front/euml/container.hpp></programlisting>
<para>Or one can simply include the whole STL support (you will also need to
include euml.hpp):</para>
- <para><code>#include < msm/front/euml/stl.hpp></code></para>
+ <programlisting>#include < msm/front/euml/stl.hpp></programlisting>
<para>A few examples (to be found in <link
xlink:href="examples/iPodSearchEuml.cpp">this tutorial</link>):<itemizedlist>
<listitem>
@@ -2931,9 +2979,8 @@
<title>Creation </title>
<para>MSM being divided between front and back-end, one needs to first define a
front-end. Then, to create a real state machine, the back-end must be
- declared: <code>typedef msm::back::state_machine<my_front_end>
- my_fsm;</code>
- </para>
+ declared:
+ <programlisting>typedef msm::back::state_machine<my_front_end> my_fsm;</programlisting></para>
<para>We now have a fully functional state machine type. The next sections will
describe what can be done with it.</para>
</sect2>
@@ -2961,8 +3008,8 @@
so actions cannot modify events for obvious side-effect reasons. To dispatch
an event of type some_event, you can simply create one on the fly or
instantiate if before processing: </para>
- <para><code>my_fsm fsm; fsm.process_event(some_event());</code></para>
- <para><code>some_event e1; fsm.process_event(e1)</code></para>
+ <programlisting>my_fsm fsm; fsm.process_event(some_event());
+some_event e1; fsm.process_event(e1)</programlisting>
<para>Creating an event on the fly will be optimized by the compiler so the
performance will not degrade.</para>
</sect2>
@@ -2994,9 +3041,9 @@
interrupt_states for which it is the second argument, the first
one being the event ending the interrupt), for example,
my_base_state being your new base state for all states in a
- given state machine: <code>struct Empty : public
- msm::front::state<my_base_state></code> Now,
- my_base_state is your new base state. If it has a virtual
+ given state machine:
+ <programlisting>struct Empty : public msm::front::state<my_base_state></programlisting>
+ Now, my_base_state is your new base state. If it has a virtual
function, your states become polymorphic. MSM also provides a
default polymorphic base type,
<code>msm::front::polymorphic_state</code>
@@ -3005,9 +3052,7 @@
<listitem>
<para>Add the user-defined base state in the state machine frontend
definition, as a second template argument, for example:
- <code>struct player_ : public
- msm::front::state_machine<player_,my_base_state>
- </code></para>
+ <programlisting>struct player_ : public msm::front::state_machine<player_,my_base_state> </programlisting></para>
</listitem>
</itemizedlist></para>
<para>You can also ask for a state with a given id (which you might have gotten
@@ -3030,33 +3075,33 @@
to provide an empty default accept in your base state in order in order not
to force all your states to implement accept. For example your base state
could be:</para>
- <para><code>struct my_visitable_state{</code></para>
- <para><code>// signature of the accept function</code></para>
- <para><code>typedef args<void> accept_sig;</code></para>
- <para><code>// we also want polymorphic states</code></para>
- <para><code>virtual ~my_visitable_state() {}</code></para>
- <para><code>// default implementation for states who do not need to be
- visited</code></para>
- <para><code>void accept() const {}</code></para>
- <para><code>};</code></para>
+ <programlisting>struct my_visitable_state
+{
+ // signature of the accept function
+ typedef args<void> accept_sig;
+ // we also want polymorphic states
+ virtual ~my_visitable_state() {}
+ // default implementation for states who do not need to be visited
+ void accept() const {}
+};</programlisting>
<para>This makes your states polymorphic and visitable. In this case, accept is
made const and takes no argument. It could also be:</para>
- <para><code>struct SomeVisitor {â¦};</code></para>
- <para><code>struct my_visitable_state{</code></para>
- <para><code>// signature of the accept function</code></para>
- <para><code>typedef args<void,SomeVisitor&> accept_sig;</code></para>
- <para><code>// we also want polymorphic states</code></para>
- <para><code>virtual ~my_visitable_state() {}</code></para>
- <para><code>// default implementation for states who do not need to be
- visited</code></para>
- <para><code>void accept(SomeVisitor&) const {}</code></para>
- <para><code>};</code></para>
+ <programlisting>struct SomeVisitor {â¦};
+struct my_visitable_state
+{
+ // signature of the accept function
+ typedef args<void,SomeVisitor&> accept_sig;
+ // we also want polymorphic states
+ virtual ~my_visitable_state() {}
+ // default implementation for states who do not need to be visited
+ void accept(SomeVisitor&) const {}
+};</programlisting>
<para>And now, <code>accept</code> will take one argument (it could also be
non-const). By default, <code>accept</code> takes up to 2 arguments. To get
more, set #define BOOST_MSM_VISITOR_ARG_SIZE to another value before
including state_machine.hpp. For example:</para>
- <para><code>#define BOOST_MSM_VISITOR_ARG_SIZE 3</code></para>
- <para><code>#include <boost/msm/back/state_machine.hpp></code></para>
+ <programlisting>#define BOOST_MSM_VISITOR_ARG_SIZE 3
+#include <boost/msm/back/state_machine.hpp></programlisting>
<para>Note that accept will be called on ALL active states <emphasis
role="underline">and also automatically on sub-states of a
submachine</emphasis>.</para>
@@ -3065,8 +3110,7 @@
the accept function is to contain a parameter passed by reference, pass this
parameter with a boost:ref/cref to avoid undesired copies or slicing. So,
for example, in the above case, call:</para>
- <para><code>SomeVisitor vis; sm.visit_current_states(boost::ref(vis));
- </code></para>
+ <programlisting>SomeVisitor vis; sm.visit_current_states(boost::ref(vis));</programlisting>
<para>This <link xlink:href="examples/SM-2Arg.cpp">example</link> uses a
visiting function with 2 arguments.</para>
</sect2>
@@ -3074,14 +3118,13 @@
<title>Flags</title>
<para>Flags is a MSM-only concept, supported by all front-ends, which base
themselves on the functions: </para>
- <para><code>template <class Flag> bool is_flag_active()</code> and</para>
- <para><code>template <class Flag,class BinaryOp> bool is_flag_active()</code>
- </para>
+ <programlisting>template <class Flag> bool is_flag_active()
+template <class Flag,class BinaryOp> bool is_flag_active()</programlisting>
<para>These functions return true if the currently active state(s) support the
Flag property. The first variant ORs the result if there are several
orthogonal regions, the second one expects OR or AND, for example:</para>
- <para><code>my_fsm.is_flag_active<MyFlag>()</code></para>
- <para><code>my_fsm.is_flag_active<MyFlag,my_fsm_type::Flag_OR>()</code></para>
+ <programlisting>my_fsm.is_flag_active<MyFlag>()
+my_fsm.is_flag_active<MyFlag,my_fsm_type::Flag_OR>()</programlisting>
<para>Please refer to the front-ends sections for usage examples.</para>
</sect2>
<sect2>
@@ -3093,22 +3136,23 @@
example is if you want to write a coverage tool and know how many times a
state was visited. To get a state, use the get_state method giving the state
name, for example: </para>
- <para><code>player::Stopped* tempstate =
- p.get_state<player::Stopped*>();</code> or </para>
- <para><code>player::Stopped& tempstate2 =
- p.get_state<player::Stopped&>();</code> depending on your
- personal taste. </para>
+ <programlisting>player::Stopped* tempstate = p.get_state<player::Stopped*>();</programlisting>
+ <para> or </para>
+ <programlisting>player::Stopped& tempstate2 = p.get_state<player::Stopped&>();</programlisting>
+ <para>depending on your personal taste. </para>
</sect2>
<sect2>
<title> State machine constructor with arguments </title>
<para>You might want to define a state machine with a non-default constructor.
For example, you might want to write: </para>
- <para><code>struct player_ : public msm::front::state_machine_def<player_> {
- player_(int some_value){â¦} } </code></para>
+ <programlisting>struct player_ : public msm::front::state_machine_def<player_>
+{
+ player_(int some_value){â¦}
+}; </programlisting>
<para>This is possible, using the back-end as forwarding object: </para>
- <para><code>typedef msm::back::state_machine<player_ > player; player
- p(3);</code> The back-end will call the corresponding front-end
- constructor upon creation.</para>
+ <programlisting>typedef msm::back::state_machine<player_ > player; player p(3);</programlisting>
+ <para>The back-end will call the corresponding front-end constructor upon
+ creation.</para>
<para>You can pass arguments up to the value of the
BOOST_MSM_CONSTRUCTOR_ARG_SIZE macro (currently 5) arguments. Change this
value before including any header if you need to overwrite the default.
@@ -3151,8 +3195,8 @@
<para>add for each submachine a cpp file including your header and
calling a macro, which generates helper code, for
example:</para>
- <para><code>#include "mysubmachine.hpp"</code></para>
- <para><code>BOOST_MSM_BACK_GENERATE_PROCESS_EVENT(mysubmachine)</code></para>
+ <programlisting>#include "mysubmachine.hpp"
+BOOST_MSM_BACK_GENERATE_PROCESS_EVENT(mysubmachine)</programlisting>
</listitem>
<listitem>
<para>configure your compiler for multi-core compilation</para>
@@ -3313,19 +3357,20 @@
the course of the development that I wanted to list the most fun for readersâ
entertainment.</para>
<para><emphasis role="underline">VC8</emphasis>: </para>
- <para><code>template <class StateType> </code></para>
- <para><code>typename ::boost::enable_if< </code></para>
- <para><code>typename ::boost::mpl::and_<</code></para>
- <para><code>typename ::boost::mpl::not_<typename
- has_exit_pseudo_states<StateType>::type>::type, </code></para>
- <para><code>typename ::boost::mpl::not_<typename
- is_pseudo_exit<StateType>::type>::type >::type,BaseState*>::type
- </code></para>
+ <programlisting>template <class StateType>
+typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::not_<
+ typename has_exit_pseudo_states<StateType>::type
+ >::type,
+ typename ::boost::mpl::not_<
+ typename is_pseudo_exit<StateType>::type
+ >::type
+ >::type,
+ BaseState*>::type </programlisting>
<para>I get the following error:</para>
<para>error C2770: invalid explicit template argument(s) for '`global
- namespace'::boost::enable_if<is_pseudo_exit<StateType>::type,BaseState*>::type
- boost::msm::state_machine<Derived,HistoryPolicy,BaseState>::add_state<ContainingSM>::new_state_helper(boost::msm::dummy<__formal>)
- const' </para>
+ namespace'::boost::enable_if<...>::...' </para>
<para>If I now remove the first â::â in ::boost::mpl , the compiler shuts up. So in
this case, it is not possible to follow Boostâs guidelines.</para>
<para><emphasis role="underline">VC9</emphasis>:<itemizedlist>
@@ -3401,10 +3446,9 @@
<para><emphasis role="underline">Answer</emphasis>: MSM uses Boost.MPL under the hood
and this is the default maximum size. Please define the following 3 macros before
including any MSM headers: </para>
- <para><code>#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS </code></para>
- <para><code>#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 // or whatever you need
- </code></para>
- <para><code>#define BOOST_MPL_LIMIT_MAP_SIZE 30 // or whatever you need </code></para>
+ <programlisting>#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 // or whatever you need
+#define BOOST_MPL_LIMIT_MAP_SIZE 30 // or whatever you need </programlisting>
<para><emphasis role="underline">Question</emphasis>: Why do I get this error: âerror
C2977: 'boost::mpl::vector' : too many template argumentsâ? </para>
<para><emphasis role="underline">Answer</emphasis>: The first possibility is that you
@@ -3419,7 +3463,7 @@
<para><emphasis role="underline">Answer</emphasis>: MSM uses Boost.Fusion under the hood
and this is the default maximum size. Please define the following macro before
including any MSM headers: </para>
- <para><code>#define FUSION_MAX_VECTOR_SIZE 20 // or whatever you need </code></para>
+ <programlisting>#define FUSION_MAX_VECTOR_SIZE 20 // or whatever you need </programlisting>
</chapter>
<chapter>
<title>Internals</title>
@@ -5513,22 +5557,20 @@
<para> fill_state_names is made for use in a mpl::for_each iterating on a
state list and writing inside a pre-allocated array the state names.
Example:</para>
- <para><code>typedef some_fsm::stt Stt;</code></para>
- <para><code>typedef msm::back::generate_state_set<Stt>::type all_states;
- //states</code></para>
- <para><code>static char const* state_names[mpl::size<all_states>::value];
- // array to fill with names</code></para>
- <para><code>// fill the names of the states defined in the state
- machine</code></para>
- <para><code>mpl::for_each<all_states,boost::msm::wrap<mpl::placeholders::_1>
- ></code></para>
- <para><code>(msm::back::fill_state_names<Stt>(state_names));</code></para>
- <para><code>// display all active states</code></para>
- <para><code>for (unsigned int i=0;i<some_fsm::nr_regions::value;++i)
- {</code></para>
- <para><code>std::cout << " -> " <<
- state_names[my_fsm_instance.current_state()[i]] << std::endl;
- }</code></para>
+ <programlisting>typedef some_fsm::stt Stt;
+typedef msm::back::generate_state_set<Stt>::type all_states; //states
+static char const* state_names[mpl::size<all_states>::value];
+// array to fill with names
+// fill the names of the states defined in the state machine
+mpl::for_each<all_states,boost::msm::wrap<mpl::placeholders::_1> >
+ (msm::back::fill_state_names<Stt>(state_names));
+// display all active states
+for (unsigned int i=0;i<some_fsm::nr_regions::value;++i)
+{
+ std::cout << " -> "
+ << state_names[my_fsm_instance.current_state()[i]]
+ << std::endl;
+}</programlisting>
</refsect3>
</refsect2>
<refsect2>
@@ -5551,7 +5593,7 @@
with the state name and the id which must be searched.</para>
<constructorsynopsis>
<methodparam>
- <funcparams>std::string& name_to_fill, int state_id</funcparams>
+ <funcparams>string& name_to_fill,int state_id</funcparams>
</methodparam>
</constructorsynopsis>
</refsect3>
@@ -6076,8 +6118,13 @@
<classsynopsis>
<ooclass>
<classname>template< class Source, class Event, class Target,
- class CalledForAction, void (CalledForAction::*action)(Event
- const&) > _row2</classname>
+ </classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class CalledForAction, void
+ (CalledForAction::*action)(Event const&) > _row2</classname>
</ooclass>
</classsynopsis>
</refsect3>
@@ -6115,7 +6162,12 @@
<classsynopsis>
<ooclass>
<classname>template< class Source, class Event, class Target,
- class CalledForGuard, bool (CalledForGuard::*guard)(Event
+ </classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class CalledForGuard, bool (CalledForGuard::*guard)(Event
const&) > _row2</classname>
</ooclass>
</classsynopsis>
@@ -6154,9 +6206,19 @@
<classsynopsis>
<ooclass>
<classname>template< class Source, class Event, class Target,
- class CalledForAction, void (CalledForAction::*action)(Event
- const&), class CalledForGuard, bool
- (CalledForGuard::*guard)(Event const&) > _row2</classname>
+ </classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class CalledForAction, void
+ (CalledForAction::*action)(Event const&), </classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class CalledForGuard, bool (CalledForGuard::*guard)(Event
+ const&) > _row2</classname>
</ooclass>
</classsynopsis>
</refsect3>
@@ -6203,9 +6265,13 @@
<title>definition</title>
<classsynopsis>
<ooclass>
- <classname>template< class Source, class Event, class
- CalledForAction, void (CalledForAction::*action)(Event
- const&) > _row2</classname>
+ <classname>template< class Source, class Event, </classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class CalledForAction, void
+ (CalledForAction::*action)(Event const&) > _row2</classname>
</ooclass>
</classsynopsis>
</refsect3>
@@ -6240,9 +6306,13 @@
<title>definition</title>
<classsynopsis>
<ooclass>
- <classname>template< class Source, class Event, class
- CalledForGuard, bool (CalledForGuard::*guard)(Event const&)
- > _row2</classname>
+ <classname>template< class Source, class Event, </classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class CalledForGuard, bool (CalledForGuard::*guard)(Event
+ const&) > _row2</classname>
</ooclass>
</classsynopsis>
</refsect3>
@@ -6277,10 +6347,19 @@
<title>definition</title>
<classsynopsis>
<ooclass>
- <classname>template< class Source, class Event, class
- CalledForAction, void (CalledForAction::*action)(Event
- const&), class CalledForGuard, bool
- (CalledForGuard::*guard)(Event const&) > _row2</classname>
+ <classname>template< class Source, class Event, </classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class CalledForAction, void
+ (CalledForAction::*action)(Event const&), </classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class CalledForGuard, bool (CalledForGuard::*guard)(Event
+ const&) > _row2</classname>
</ooclass>
</classsynopsis>
</refsect3>
@@ -6649,7 +6728,12 @@
<classsynopsis>
<ooclass>
<classname>template<class EndInterruptEvent,class Base =
- default_base_state,class SMPtrPolicy = no_sm_ptr>
+ default_base_state,</classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class SMPtrPolicy = no_sm_ptr>
interrupt_state</classname>
</ooclass>
</classsynopsis>
@@ -6679,7 +6763,12 @@
<classsynopsis>
<ooclass>
<classname>template<int RegionIndex=-1,class Base =
- default_base_state,class SMPtrPolicy = no_sm_ptr>
+ default_base_state,</classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class SMPtrPolicy = no_sm_ptr>
entry_pseudo_state</classname>
</ooclass>
</classsynopsis>
@@ -6697,7 +6786,12 @@
<classsynopsis>
<ooclass>
<classname>template<class Event,class Base =
- default_base_state,class SMPtrPolicy = no_sm_ptr>
+ default_base_state,</classname>
+ </ooclass>
+ </classsynopsis>
+ <classsynopsis>
+ <ooclass>
+ <classname>class SMPtrPolicy = no_sm_ptr>
exit_pseudo_state</classname>
</ooclass>
</classsynopsis>
@@ -6798,46 +6892,38 @@
<title><command xml:id="reference-stt-grammar">transition
table</command></title>
<para>The transition table accepts the following grammar:</para>
- <para><code>Stt := Row | (Stt ',' Stt)</code></para>
- <para><code>Row := (Target '==' (SourcePlusEvent)) /* first
- syntax*/</code></para>
- <para><code> | ( (SourcePlusEvent) '==' Target ) /* second
- syntax*/</code></para>
- <para><code> | (SourcePlusEvent) /* internal transitions */</code></para>
- <para><code>SourcePlusEvent := (BuildSource '+' BuildEvent)/* standard
- transition*/ </code></para>
- <para><code> | (BuildSource) /* anonymous transition */</code></para>
- <para><code>BuildSource := state_tag | (state_tag '/' Action) | (state_tag
- '[' Guard ']') | (state_tag '[' Guard ']' '/' Action)</code></para>
- <para><code>BuildEvent := event_tag | (event_tag '/' Action) | (event_tag
- '[' Guard ']') | (event_tag '[' Guard ']' '/' Action)</code>
- </para>
+ <programlisting>Stt := Row | (Stt ',' Stt)
+Row := (Target '==' (SourcePlusEvent)) /* first syntax*/
+ | ( (SourcePlusEvent) '==' Target ) /* second syntax*/
+ | (SourcePlusEvent) /* internal transitions */
+SourcePlusEvent := (BuildSource '+' BuildEvent)/* standard transition*/
+ | (BuildSource) /* anonymous transition */
+BuildSource := state_tag | (state_tag '/' Action) | (state_tag '[' Guard ']')
+ | (state_tag '[' Guard ']' '/' Action)
+BuildEvent := event_tag | (event_tag '/' Action) | (event_tag '[' Guard ']')
+ | (event_tag '[' Guard ']' '/' Action)</programlisting>
<para>The grammars Action and Guard are defined in state_grammar.hpp and
guard_grammar.hpp respectively. state_tag and event_tag are inherited
from euml_state (or other state variants) and euml_event respectively.
For example, following declarations are possible:</para>
- <para><code>target == source + event [guard] / action,</code></para>
- <para><code>source + event [guard] / action == target,</code></para>
- <para><code>source + event [guard] / (action1,action2) ==
- target,</code></para>
- <para><code>target == source + event [guard] /
- (action1,action2),</code></para>
- <para><code>target == source + event,</code></para>
- <para><code>source + event == target,</code></para>
- <para><code>target == source + event [guard],</code></para>
- <para><code>source + event [guard] == target,</code></para>
- <para><code>target == source + event / action,</code></para>
- <para><code>source + event /action == target,</code></para>
- <para><code>source / action == target, /*anonymous
- transition*/</code></para>
- <para><code>target == source / action, /*anonymous
- transition*/</code></para>
- <para><code>source + event /action, /* internal transition*/</code></para>
+ <programlisting>target == source + event [guard] / action,
+source + event [guard] / action == target,
+source + event [guard] / (action1,action2) == target,
+target == source + event [guard] / (action1,action2),
+target == source + event,
+source + event == target,
+target == source + event [guard],
+source + event [guard] == target,
+target == source + event / action,
+source + event /action == target,
+source / action == target, /*anonymous transition*/
+target == source / action, /*anonymous transition*/
+source + event /action, /* internal transition*/</programlisting>
</refsect3>
<refsect3>
<title>internal transition table</title>
<para>The internal transition table accepts the following grammar:</para>
- <para><code>IStt := BuildEvent | (IStt ',' IStt)</code></para>
+ <programlisting>IStt := BuildEvent | (IStt ',' IStt)</programlisting>
<para>BuildEvent being defined for both internal and standard transition
tables.</para>
</refsect3>
@@ -6847,10 +6933,9 @@
<title>msm/front/euml/guard_grammar.hpp</title>
<para>This header contains the <code>Guard</code> grammar used in the previous
section. This grammar is long but pretty simple:</para>
- <para><code>Guard := action_tag | (Guard '&&' Guard) | (Guard '||' Guard) |
- ... /* operators*/ </code></para>
- <para><code>| (if_then_else_(Guard,Guard,Guard)) | (function
- (Action,...Action))</code></para>
+ <programlisting>Guard := action_tag | (Guard '&&' Guard)
+ | (Guard '||' Guard) | ... /* operators*/
+ | (if_then_else_(Guard,Guard,Guard)) | (function (Action,...Action))</programlisting>
<para>Most C++ operators are supported (address-of is not). With
<code>function</code> is meant any eUML predefined function or any self-made
(using <code>MSM_EUML_METHOD</code> or <code>MSM_EUML_FUNCTION</code>). Action
@@ -6864,13 +6949,13 @@
<title>action grammar</title>
<para>Like the guard grammar, this grammar supports relevant C++ operators and
eUML functions:</para>
- <para><code>Action := action_tag | (Action '+' Action) | ('--' Action) | ... /*
- operators*/ </code></para>
- <para><code>| if_then_else_(Guard,Action,Action) | if_then_(Action) |
- while_(Guard,Action) | do_while_(Guard,Action) |
- for_(Action,Guard,Action,Action) | (function
- (Action,...Action))</code></para>
- <para><code>ActionSequence := Action | (Action ',' Action)</code></para>
+ <programlisting>Action := action_tag | (Action '+' Action)
+ | ('--' Action) | ... /* operators*/
+ | if_then_else_(Guard,Action,Action) | if_then_(Action)
+ | while_(Guard,Action)
+ | do_while_(Guard,Action) | for_(Action,Guard,Action,Action)
+ | (function(Action,...Action))
+ActionSequence := Action | (Action ',' Action)</programlisting>
<para>Relevant operators are: ++ (post/pre), -- (post/pre), dereferencing, +
(unary/binary), - (unary/binary), *, /, %, &(bitwise), | (bitwise),
^(bitwise), +=, -=, *=, /=, %=, <<=, >>=, <<, >>, =, [].</para>
@@ -7301,7 +7386,7 @@
<classname>template <class EventName> euml_event;</classname>
</ooclass>
</classsynopsis>
- <para><code>struct play : euml_event<play>{};</code></para>
+ <programlisting>struct play : euml_event<play>{};</programlisting>
</refsect3>
<refsect3>
<title>euml_state</title>
@@ -7318,13 +7403,12 @@
<para>You can however use this type directly if you want to provide your
state with extra functions or provide entry or exit behaviors without
functors, for example:</para>
- <para><code>struct Empty : public msm::front::state<> , public
- euml_state<Empty> {</code></para>
- <para><code>void foo() {...}</code></para>
- <para><code>template <class Event,class Fsm></code></para>
- <para><code>void on_entry(Event const& evt,Fsm& fsm)
- {...}</code></para>
- <para><code>};</code></para>
+ <programlisting>struct Empty : public msm::front::state<> , public euml_state<Empty>
+{
+ void foo() {...}
+ template <class Event,class Fsm>
+ void on_entry(Event const& evt,Fsm& fsm){...}
+};</programlisting>
</refsect3>
<refsect3>
<title>euml_flag</title>
@@ -7334,8 +7418,7 @@
<classname>template <class FlagName> euml_flag;</classname>
</ooclass>
</classsynopsis>
- <para><code>struct PlayingPaused:
- euml_flag<PlayingPaused>{};</code></para>
+ <programlisting>struct PlayingPaused: euml_flag<PlayingPaused>{};</programlisting>
</refsect3>
<refsect3>
<title>euml_action</title>
@@ -7346,20 +7429,17 @@
<classname>template <class AcionName> euml_action;</classname>
</ooclass>
</classsynopsis>
- <para><code>struct close_drawer : euml_action<close_drawer>
- {</code></para>
- <para><code>template <class Fsm,class Evt,class SourceState,class
- TargetState></code></para>
- <para><code>void operator()(Evt const& , Fsm&, SourceState&
- ,TargetState& ) {...}</code></para>
- <para><code>};</code></para>
+ <programlisting>struct close_drawer : euml_action<close_drawer>
+{
+ template <class Fsm,class Evt,class SourceState,class TargetState>
+ void operator()(Evt const& , Fsm&, SourceState& ,TargetState& ) {...}
+};</programlisting>
<para>Or, as state entry or exit behavior:</para>
- <para><code>struct Playing_Entry : euml_action<Playing_Entry>
- {</code></para>
- <para><code>template <class Event,class Fsm,class State></code></para>
- <para><code>void operator()(Event const&,Fsm& fsm,State& )
- {...}</code></para>
- <para><code>};</code></para>
+ <programlisting>struct Playing_Entry : euml_action<Playing_Entry>
+{
+ template <class Event,class Fsm,class State>
+ void operator()(Event const&,Fsm& fsm,State& ){...}
+};</programlisting>
</refsect3>
<refsect3>
<title>euml_config</title>
@@ -7402,12 +7482,14 @@
<para>as object: returns by reference the source state of a
transition, usually to be used by another function (usually
one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</para>
- <para>Example: <code>some_user_function_(source_)</code></para>
+ <para>Example:
+ <programlisting>some_user_function_(source_)</programlisting></para>
</listitem>
<listitem>
<para>as function: returns by reference the attribute passed as
parameter.</para>
- <para>Example: <code>source_(m_counter)++</code></para>
+ <para>Example:
+ <programlisting>source_(m_counter)++</programlisting></para>
</listitem>
</itemizedlist></para>
</refsect3>
@@ -7418,12 +7500,14 @@
<para>as object: returns by reference the target state of a
transition, usually to be used by another function (usually
one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</para>
- <para>Example: <code>some_user_function_(target_)</code></para>
+ <para>Example:
+ <programlisting>some_user_function_(target_)</programlisting></para>
</listitem>
<listitem>
<para>as function: returns by reference the attribute passed as
parameter.</para>
- <para>Example: <code>target_(m_counter)++</code></para>
+ <para>Example:
+ <programlisting>target_(m_counter)++</programlisting></para>
</listitem>
</itemizedlist></para>
</refsect3>
@@ -7436,13 +7520,14 @@
<para>as object: returns by reference the current state, usually
to be used by another function (usually one created by
MSM_EUML_METHOD or MSM_EUML_FUNCTION).</para>
- <para>Example: <code>some_user_function_(state_) // calls
- some_user_function on the current state</code></para>
+ <para>Example:
+ <programlisting>some_user_function_(state_) // calls some_user_function on the current state</programlisting></para>
</listitem>
<listitem>
<para>as function: returns by reference the attribute passed as
parameter.</para>
- <para>Example: <code>state_(m_counter)++</code></para>
+ <para>Example:
+ <programlisting>state_(m_counter)++</programlisting></para>
</listitem>
</itemizedlist></para>
</refsect3>
@@ -7454,12 +7539,14 @@
<para>as object: returns by reference the event of a transition,
usually to be used by another function (usually one created
by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</para>
- <para>Example: <code>some_user_function_(event_)</code></para>
+ <para>Example:
+ <programlisting>some_user_function_(event_)</programlisting></para>
</listitem>
<listitem>
<para>as function: returns by reference the attribute passed as
parameter.</para>
- <para>Example: <code>event_(m_counter)++</code></para>
+ <para>Example:
+ <programlisting>event_(m_counter)++</programlisting></para>
</listitem>
</itemizedlist></para>
</refsect3>
@@ -7470,12 +7557,14 @@
<para>as object: returns by reference the event of a transition,
usually to be used by another function (usually one created
by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</para>
- <para>Example: <code>some_user_function_(fsm_)</code></para>
+ <para>Example:
+ <programlisting>some_user_function_(fsm_)</programlisting></para>
</listitem>
<listitem>
<para>as function: returns by reference the attribute passed as
parameter.</para>
- <para>Example: <code>fsm_(m_counter)++</code></para>
+ <para>Example:
+ <programlisting>fsm_(m_counter)++</programlisting></para>
</listitem>
</itemizedlist></para>
</refsect3>
@@ -7487,7 +7576,7 @@
parameter, usually to be used by another function (usually
one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</para>
<para>Example:
- <code>some_user_function_(substate_(my_state))</code></para>
+ <programlisting>some_user_function_(substate_(my_state))</programlisting></para>
</listitem>
<listitem>
<para>with 2 parameters: returns by reference the state passed
@@ -7496,7 +7585,7 @@
one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION). This
makes sense when used in combination with attribute_.</para>
<para>Example (equivalent to the previous example):
- <code>some_user_function_(substate_(my_state,fsm_))</code></para>
+ <programlisting>some_user_function_(substate_(my_state,fsm_))</programlisting></para>
</listitem>
</itemizedlist></para>
</refsect3>
@@ -7505,45 +7594,55 @@
<para>Generic object or function returning the attribute passed (by name) as
second parameter of the thing passed as first (a state, event or state
machine). Example: </para>
- <para><code>attribute_(substate_(my_state),cd_name_attribute)++</code></para>
+ <para>
+ <programlisting>attribute_(substate_(my_state),cd_name_attribute)++</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>True_</title>
<para>Functor returning true for transition or state behaviors. Like all
constants, only the functor form exists, so parenthesis are necessary.
Example:</para>
- <para><code>if_then_(True_(),/* some action always called*/)</code></para>
+ <para>
+ <programlisting>if_then_(True_(),/* some action always called*/)</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>False_</title>
<para>Functor returning false for transition or state behaviors. Like all
constants, only the functor form exists, so parenthesis are necessary.
Example:</para>
- <para><code>if_then_(False_(),/* some action never called */)</code></para>
+ <para>
+ <programlisting>if_then_(False_(),/* some action never called */)</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>Int_<int value></title>
<para>Functor returning an integer value for transition or state behaviors.
Like all constants, only the functor form exists, so parenthesis are
necessary. Example:</para>
- <para><code>target_(m_ringing_cpt) = Int_<RINGING_TIME>() // RINGING_TIME
- is a constant</code></para>
+ <para>
+ <programlisting>target_(m_ringing_cpt) = Int_<RINGING_TIME>() // RINGING_TIME is a constant</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>Char_<char value></title>
<para>Functor returning a char value for transition or state behaviors. Like
all constants, only the functor form exists, so parenthesis are
necessary. Example:</para>
- <para><code>[string_find_(event_(m_song),Char_<'S'>(),Size_t_<0>()) !=
- Npos_<string>()] // look for 'S' in event.m_song</code></para>
+ <para>
+ <programlisting>// look for 'S' in event.m_song
+[string_find_(event_(m_song),Char_<'S'>(),Size_t_<0>()) != Npos_<string>()]</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>Size_t_<size_t value></title>
<para>Functor returning a size_t value for transition or state behaviors.
Like all constants, only the functor form exists, so parenthesis are
necessary. Example:</para>
- <para><code>substr_(event_(m_song),Size_t_<1>()) // returns a substring
- of event.m_song</code></para>
+ <para>
+ <programlisting>substr_(event_(m_song),Size_t_<1>()) // returns a substring of event.m_song</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>String_ < mpl::string ></title>
@@ -7551,9 +7650,10 @@
constants, only the functor form exists, so parenthesis are necessary.
Requires boost >= 1.40 for mpl::string.</para>
<para>Example:</para>
- <para><code>push_back_(fsm_(m_src_container), String_<mpl::string<'Let
- ','it ','be'> >()) // adds "Let it be" to
- fsm.m_src_container</code></para>
+ <para>
+ <programlisting>// adds "Let it be" to fsm.m_src_container
+push_back_(fsm_(m_src_container), String_<mpl::string<'Let','it ','be'> >())</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>Predicate_ < some_stl_compatible_functor ></title>
@@ -7561,11 +7661,10 @@
This is necessary because all what is in the transition table must be a
eUML terminal.</para>
<para>Example:</para>
- <para><code>accumulate_(begin_(fsm_(m_vec)),end_(fsm_(m_vec)),Int_<1>(),Predicate_<std::plus<int>
- >()) == Int_<1>())</code></para>
- <para><code>/* equivalent to:
- std::accumulate(fsm.m_vec.begin(),fsm.m_vec.end(),1,
- std::plus<int>()) == 1 */</code></para>
+ <programlisting>//equivalent to:
+//std::accumulate(fsm.m_vec.begin(),fsm.m_vec.end(),1,std::plus<int>())== 1
+accumulate_(begin_(fsm_(m_vec)),end_(fsm_(m_vec)),Int_<1>(),
+ Predicate_<std::plus<int> >()) == Int_<1>())</programlisting>
</refsect3>
<refsect3>
<title>process_</title>
@@ -7598,14 +7697,14 @@
</listitem>
</itemizedlist></para>
<para>Example: </para>
- <para><code>process2_(NotFound,event_(m_song)) // processes NotFound on
- current state machine, copy-constructed with
- event.m_song</code></para>
+ <para>
+ <programlisting>// processes NotFound on current state machine,
+// copy-constructed with event.m_song
+process2_(NotFound,event_(m_song))</programlisting>
+ </para>
<para>With the following definitions:</para>
- <para><code>BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song)
- //declaration of m_sonf</code></para>
- <para><code>NotFound (const string& data) // copy-constructor of
- NotFound</code></para>
+ <programlisting>BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song)//declaration of m_song
+NotFound (const string& data) // copy-constructor of NotFound</programlisting>
</refsect3>
<refsect3>
<title>is_flag_</title>
@@ -7629,7 +7728,7 @@
<para>This object defers the current event by calling
<code>defer_event</code> on the current state machine.
Example:</para>
- <para><code>Empty() + play() / defer_</code></para>
+ <programlisting>Empty() + play() / defer_</programlisting>
</refsect3>
<refsect3>
<title>explicit_(submachine-name,state-name)</title>
@@ -7676,10 +7775,13 @@
</itemizedlist> Note that the function itself can take up to 5
arguments.</para>
<para>Example:</para>
- <para><code>MSM_EUML_FUNCTION(BinarySearch_ , std::binary_search ,
- binary_search_ , bool , bool )</code></para>
+ <para>
+ <programlisting>MSM_EUML_FUNCTION(BinarySearch_,std::binary_search,binary_search_,bool,bool)</programlisting>
+ </para>
<para>Can be used like:</para>
- <para><code>binary_search_(begin_(fsm_(m_var)),end_(fsm_(m_var)),Int_<9>())</code></para>
+ <para>
+ <programlisting>binary_search_(begin_(fsm_(m_var)),end_(fsm_(m_var)),Int_<9>())</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>MSM_EUML_METHOD</title>
@@ -7706,28 +7808,27 @@
(5 like for a free function - 1 for the object on which the method is
called).</para>
<para>Example:</para>
- <para><code>struct Empty : public msm::front::state<> , public
- euml_state<Empty> {</code></para>
- <para><code>void activate_empty() {std::cout << "switching to Empty "
- << std::endl;}</code></para>
- <para><code>... };</code></para>
- <para><code>MSM_EUML_METHOD(ActivateEmpty_ , activate_empty ,
- activate_empty_ , void , void )</code></para>
+ <programlisting>struct Empty : public msm::front::state<> , public euml_state<Empty>
+{
+ void activate_empty() {std::cout << "switching to Empty " << std::endl;}
+...
+};
+MSM_EUML_METHOD(ActivateEmpty_,activate_empty,activate_empty_,void,void)</programlisting>
<para>Can be used like:</para>
- <para><code>Empty == Open + open_close / (close_drawer ,
- activate_empty_(target_))</code></para>
+ <para>
+ <programlisting>Empty == Open + open_close / (close_drawer , activate_empty_(target_))</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>BOOST_MSM_EUML_ACTION(action-instance-name)</title>
<para>This macro declares a behavior type and a const instance for use in
state or transition behaviors. The action implementation itself follows
the macro declaration, for example:</para>
- <para><code>BOOST_MSM_EUML_ACTION(good_disk_format){</code></para>
- <para><code>template <class Fsm,class Evt,class SourceState,class
- TargetState></code></para>
- <para><code>void/bool operator()(Evt const&
- evt,Fsm&,SourceState& ,TargetState& ){...}</code></para>
- <para><code>};</code></para>
+ <programlisting>BOOST_MSM_EUML_ACTION(good_disk_format)
+{
+ template <class Fsm,class Evt,class SourceState,class TargetState>
+ void/bool operator()(Evt const& evt,Fsm&,SourceState& ,TargetState& ){...}
+};</programlisting>
</refsect3>
<refsect3>
<title>BOOST_MSM_EUML_FLAG(flag-instance-name)</title>
@@ -7739,7 +7840,7 @@
<para>This macro returns the name of the flag type generated by
BOOST_MSM_EUML_FLAG. You need this where the type is required (usually
with the back-end method is_flag_active). For example:</para>
- <para><code>fsm.is_flag_active<BOOST_MSM_EUML_FLAG_NAME(CDLoaded)>()</code></para>
+ <programlisting>fsm.is_flag_active<BOOST_MSM_EUML_FLAG_NAME(CDLoaded)>()</programlisting>
</refsect3>
<refsect3>
<title>BOOST_MSM_EUML_DECLARE_ATTRIBUTE(event-type,event-name)</title>
@@ -7755,12 +7856,10 @@
3rd parameter of BOOST_MSM_EUML_STATE or of a state machine as 5th
parameter of BOOST_MSM_EUML_DECLARE_STATE_MACHINE.</para>
<para>Attributes are added using left-shift, for example:</para>
- <para>
- <code>BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song) // m_song is
- of type std::string</code></para>
- <para><code>BOOST_MSM_EUML_ATTRIBUTES((attributes_ << m_song ),
- FoundDef) // contains one attribute, m_song</code>
- </para>
+ <programlisting>// m_song is of type std::string
+BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song)
+// contains one attribute, m_song
+BOOST_MSM_EUML_ATTRIBUTES((attributes_ << m_song ), FoundDef)</programlisting>
</refsect3>
<refsect3>
<title>BOOST_MSM_EUML_EVENT(event-instance name)</title>
@@ -7777,8 +7876,8 @@
<para><code>BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(Found,FoundDef)</code>
</para>
<para>The created event instance supports operator()(attributes) so that
- <code>my_back_end.process_event(Found(some_string))</code> is
- possible.</para>
+ <programlisting>my_back_end.process_event(Found(some_string))</programlisting>
+ is possible.</para>
</refsect3>
<refsect3>
<title>BOOST_MSM_EUML_EVENT_NAME(event-instance-name)</title>
@@ -7786,9 +7885,11 @@
BOOST_MSM_EUML_EVENT or BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES. You need
this where the type is required (usually inside a back-end definition).
For example:</para>
- <para><code>typedef
- msm::back::state_machine<Playing_,msm::back::ShallowHistory<mpl::vector<BOOST_MSM_EUML_EVENT_NAME(end_pause)>
- > > Playing_type;</code></para>
+ <para>
+ <programlisting>typedef msm::back::state_machine<Playing_,
+msm::back::ShallowHistory<mpl::vector<BOOST_MSM_EUML_EVENT_NAME(end_pause)
+> > > Playing_type;</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>BOOST_MSM_EUML_STATE(build-expression,state-instance-name)</title>
@@ -8022,7 +8123,9 @@
<para>This macro returns the name of the state type generated by
BOOST_MSM_EUML_STATE or other state macros. You need this where the type
is required (usually using a backend function). For example:</para>
- <para><code>fsm.get_state<BOOST_MSM_EUML_STATE_NAME(StringFind)&>().some_state_function();</code></para>
+ <para>
+ <programlisting>fsm.get_state<BOOST_MSM_EUML_STATE_NAME(StringFind)&>().some_state_function();</programlisting>
+ </para>
</refsect3>
<refsect3>
<title>BOOST_MSM_EUML_DECLARE_STATE(build-expression,state-instance-name)</title>
@@ -8083,13 +8186,14 @@
<para>Like BOOST_MSM_EUML_TRANSITION_TABLE but does not provide an instance,
simply a type declaration. This is currently the only way to declare an
internal transition table with eUML. For example:</para>
- <para><code>BOOST_MSM_EUML_DECLARE_STATE((Open_Entry,Open_Exit),Open_def)</code></para>
- <para><code>struct Open_impl : public Open_def{</code></para>
- <para><code>BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE((</code></para>
- <para><code>open_close [internal_guard1] / internal_action1 ,</code></para>
- <para><code>open_close [internal_guard2] / internal_action2</code></para>
- <para><code>))</code></para>
- <para><code>};</code></para>
+ <programlisting>BOOST_MSM_EUML_DECLARE_STATE((Open_Entry,Open_Exit),Open_def)
+struct Open_impl : public Open_def
+{
+ BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE((
+ open_close [internal_guard1] / internal_action1 ,
+ open_close [internal_guard2] / internal_action2
+ ))
+}; </programlisting>
</refsect3>
</refsect2>
</refsect1>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk