re03.html 132 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. <html><head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  3. <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)"><link rel="up" href="pt02.html" title="Part&nbsp;II.&nbsp;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>&nbsp;</td><th width="60%" align="center">Part&nbsp;II.&nbsp;Reference</th><td width="20%" align="right">&nbsp;</td></tr></table><hr></div><div class="refentry" title="Front-end"><a name="d0e5639"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>Front-end &#8212; The front-end headers</p></div><div class="refsect1" title="msm/front/common_states.hpp"><a name="d0e5645"></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
  4. states polymorphic.</p></li></ul></div></div><div class="refsect1" title="msm/front/completion_event.hpp"><a name="d0e5657"></a><h2>msm/front/completion_event.hpp</h2><p>This header contains one type, <code class="code">none</code>. This type has several
  5. 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
  6. transition</p></li><li class="listitem"><p>as event: the transition is an anonymous (completion)
  7. transition</p></li></ul></div></div><div class="refsect1" title="msm/front/functor_row.hpp"><a name="d0e5675"></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="d0e5680"></a><h3>Row</h3><div class="refsect3" title="definition"><a name="d0e5683"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template &lt;class Source,class Event,class Target,class
  8. Action,class Guard&gt; Row</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="tags"><a name="d0e5690"></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
  9. action and guard: <code class="code">typedef row_tag
  10. row_type_tag;</code></p></li><li class="listitem"><p>Row&lt;Source,Event,Target,none,none&gt; a normal transition
  11. without action or guard: <code class="code">typedef _row_tag
  12. row_type_tag;</code></p></li><li class="listitem"><p>Row&lt;Source,Event,Target,Action,none&gt; a normal
  13. transition without guard: <code class="code">typedef a_row_tag
  14. row_type_tag;</code></p></li><li class="listitem"><p>Row&lt;Source,Event,Target,none,Guard&gt; a normal transition
  15. without action: <code class="code">typedef g_row_tag
  16. row_type_tag;</code></p></li><li class="listitem"><p>Row&lt;Source,Event,none,Action,none&gt; an internal
  17. transition without guard: <code class="code">typedef a_irow_tag
  18. row_type_tag;</code></p></li><li class="listitem"><p>Row&lt;Source,Event,none,none,Guard&gt; an internal
  19. transition without action: <code class="code">typedef g_irow_tag
  20. row_type_tag;</code></p></li><li class="listitem"><p>Row&lt;Source,Event,none,none,Guard&gt; an internal
  21. transition with action and guard: <code class="code">typedef irow_tag
  22. row_type_tag;</code></p></li><li class="listitem"><p>Row&lt;Source,Event,none,none,none&gt; an internal transition
  23. without action or guard: <code class="code">typedef _irow_tag
  24. row_type_tag;</code></p></li></ul></div></div><div class="refsect3" title="methods"><a name="d0e5736"></a><h4>methods</h4><p>Like any other front-end, Row implements the two necessary static
  25. functions for action and guard call. Each function receives as parameter
  26. the (deepest-level) state machine processsing the event, the event
  27. itself, the source and target states and all the states contained in a
  28. 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 &lt;class Fsm,class SourceState,class TargetState,
  29. class AllStates&gt; static void action_call(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  30. <code>(</code>Fsm&amp; fsm,Event const&amp;
  31. evt,SourceState&amp;,TargetState,AllStates&amp;<code>)</code>
  32. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class Fsm,class SourceState,class TargetState,
  33. class AllStates&gt; static bool guard_call(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  34. <code>(</code>Fsm&amp; fsm,Event const&amp;
  35. evt,SourceState&amp;,TargetState,AllStates&amp;<code>)</code>
  36. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div></div></div><div class="refsect2" title="Internal"><a name="d0e5759"></a><h3>Internal</h3><div class="refsect3" title="definition"><a name="d0e5762"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template &lt;class Event,class Action,class Guard&gt;
  37. Internal</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="tags"><a name="d0e5769"></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
  38. with action and guard: <code class="code">typedef sm_i_row_tag
  39. row_type_tag;</code></p></li><li class="listitem"><p>Internal&lt;Event,none,none&gt; an internal transition
  40. without action or guard: <code class="code">typedef sm__i_row_tag
  41. row_type_tag;</code></p></li><li class="listitem"><p>Internal&lt;Event,Action,none&gt; an internal transition
  42. without guard: <code class="code">typedef sm_a_i_row_tag
  43. row_type_tag;</code></p></li><li class="listitem"><p>Internal&lt;Event,none,Guard&gt; an internal transition
  44. without action: <code class="code">typedef sm_g_i_row_tag
  45. row_type_tag;</code></p></li></ul></div></div><div class="refsect3" title="methods"><a name="d0e5795"></a><h4>methods</h4><p>Like any other front-end, Internal implements the two necessary static
  46. functions for action and guard call. Each function receives as parameter
  47. the (deepest-level) state machine processsing the event, the event
  48. itself, the source and target states and all the states contained in a
  49. 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 &lt;class Fsm,class SourceState,class TargetState,
  50. class AllStates&gt; static void action_call(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  51. <code>(</code>Fsm&amp; fsm,Event const&amp;
  52. evt,SourceState&amp;,TargetState,AllStates&amp;<code>)</code>
  53. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class Fsm,class SourceState,class TargetState,
  54. class AllStates&gt; static bool guard_call(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  55. <code>(</code>Fsm&amp; fsm,Event const&amp;
  56. evt,SourceState&amp;,TargetState,AllStates&amp;<code>)</code>
  57. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div></div></div><div class="refsect2" title="ActionSequence_"><a name="d0e5818"></a><h3>ActionSequence_</h3><p>This functor calls every element of the template Sequence (which are also
  58. callable functors) in turn. It is also the underlying implementation of the
  59. eUML sequence grammar (action1,action2,...).</p><div class="refsect3" title="definition"><a name="d0e5823"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template &lt;class Sequence&gt; ActionSequence_</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="methods"><a name="d0e5830"></a><h4>methods</h4><p>This helper functor is made for use in a transition table and in a
  60. state behavior and therefore implements an operator() with 3 and with 4
  61. arguments:</p><p>
  62. </p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class Evt,class Fsm,class
  63. SourceState,class TargetState&gt; operator()(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Evt const&amp; ,Fsm&amp; ,SourceState&amp;
  64. ,TargetState&amp; </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>
  65. </p><p>
  66. </p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class Evt,class Fsm,class State&gt;
  67. operator()(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Evt const&amp;, Fsm&amp;, State&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>
  68. </p></div></div><div class="refsect2" title="Defer"><a name="d0e5853"></a><h3>Defer</h3><div class="refsect3" title="definition"><a name="d0e5856"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">Defer</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="methods"><a name="d0e5863"></a><h4>methods</h4><p>This helper functor is made for use in a transition table and
  69. 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 &lt;class Evt,class Fsm,class SourceState,class
  70. TargetState&gt; operator()(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Evt const&amp;, Fsm&amp; , SourceState&amp;,
  71. TargetState&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div></div></div></div><div class="refsect1" title="msm/front/internal_row.hpp"><a name="d0e5874"></a><h2>msm/front/internal_row.hpp</h2><p>This header implements the internal transition rows for use inside an
  72. internal_transition_table. All these row types have no source or target state,
  73. as the backend will recognize internal transitions from this
  74. internal_transition_table.</p><div class="refsect2" title="methods"><a name="d0e5879"></a><h3>methods</h3><p>Like any other front-end, the following transition row types implements
  75. the two necessary static functions for action and guard call. Each function
  76. receives as parameter the (deepest-level) state machine processsing the
  77. event, the event itself, the source and target states and all the states
  78. contained in 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 &lt;class Fsm,class SourceState,class TargetState,
  79. class AllStates&gt; static void action_call(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  80. <code>(</code>Fsm&amp; fsm,Event const&amp;
  81. evt,SourceState&amp;,TargetState,AllStates&amp;<code>)</code>
  82. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class Fsm,class SourceState,class TargetState,
  83. class AllStates&gt; static bool guard_call(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  84. <code>(</code>Fsm&amp; fsm,Event const&amp;
  85. evt,SourceState&amp;,TargetState,AllStates&amp;<code>)</code>
  86. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div></div><div class="refsect2" title="a_internal"><a name="d0e5902"></a><h3>a_internal</h3><div class="refsect3" title="definition"><a name="d0e5905"></a><h4>definition</h4><p>This is an internal transition with an action called during the
  87. transition.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Event, class CalledForAction, void
  88. (CalledForAction::*action)(Event const&amp;)&gt;
  89. a_internal</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e5914"></a><h4>template parameters</h4><p>
  90. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the internal
  91. transition.</p></li><li class="listitem"><p>CalledForAction: the type on which the action method will
  92. be called. It can be either a state of the containing state
  93. machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
  94. provides.</p></li></ul></div><p>
  95. </p></div></div><div class="refsect2" title="g_internal"><a name="d0e5930"></a><h3>g_internal</h3><p>This is an internal transition with a guard called before the transition
  96. and allowing the transition if returning true.</p><div class="refsect3" title="definition"><a name="d0e5935"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Event, class CalledForGuard, bool
  97. (CalledForGuard::*guard)(Event const&amp;)&gt;
  98. g_internal</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e5942"></a><h4>template parameters</h4><p>
  99. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the internal
  100. transition.</p></li><li class="listitem"><p>CalledForGuard: the type on which the guard method will be
  101. called. It can be either a state of the containing state
  102. machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
  103. provides.</p></li></ul></div><p>
  104. </p></div></div><div class="refsect2" title="internal"><a name="d0e5958"></a><h3>internal</h3><p>This is an internal transition with a guard called before the transition
  105. and allowing the transition if returning true. It also calls an action
  106. called during the transition.</p><div class="refsect3" title="definition"><a name="d0e5963"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Event, class CalledForAction, void
  107. (CalledForAction::*action)(Event const&amp;), class
  108. CalledForGuard, bool (CalledForGuard::*guard)(Event const&amp;)&gt;
  109. internal</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e5970"></a><h4>template parameters</h4><p>
  110. </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
  111. be called. It can be either a state of the containing state
  112. machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
  113. provides.</p></li><li class="listitem"><p>CalledForGuard: the type on which the guard method will be
  114. called. It can be either a state of the containing state
  115. machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
  116. provides.</p></li></ul></div><p>
  117. </p></div></div><div class="refsect2" title="_internal"><a name="d0e5992"></a><h3>_internal</h3><p>This is an internal transition without action or guard. This is equivalent
  118. to an explicit "ignore event".</p><div class="refsect3" title="definition"><a name="d0e5997"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Event &gt; _internal</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6004"></a><h4>template parameters</h4><p>
  119. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Event: the event triggering the internal
  120. transition.</p></li></ul></div><p>
  121. </p></div></div></div><div class="refsect1" title="msm/front/row2.hpp"><a name="d0e6014"></a><h2>msm/front/row2.hpp</h2><p>This header contains the variants of row2, which are an extension of the
  122. standard row transitions for use in the transition table. They offer the
  123. possibility to define action and guard not only in the state machine, but in any
  124. state of the state machine. They can also be used in internal transition tables
  125. through their irow2 variants.</p><div class="refsect2" title="methods"><a name="d0e6019"></a><h3>methods</h3><p>Like any other front-end, the following transition row types implements
  126. the two necessary static functions for action and guard call. Each function
  127. receives as parameter the (deepest-level) state machine processsing the
  128. event, the event itself, the source and target states and all the states
  129. contained in 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 &lt;class Fsm,class SourceState,class TargetState,
  130. class AllStates&gt; static void action_call(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  131. <code>(</code>Fsm&amp; fsm,Event const&amp;
  132. evt,SourceState&amp;,TargetState,AllStates&amp;<code>)</code>
  133. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class Fsm,class SourceState,class TargetState,
  134. class AllStates&gt; static bool guard_call(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  135. <code>(</code>Fsm&amp; fsm,Event const&amp;
  136. evt,SourceState&amp;,TargetState,AllStates&amp;<code>)</code>
  137. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div></div><div class="refsect2" title="_row2"><a name="d0e6042"></a><h3>_row2</h3><p>This is a transition without action or guard. The state machine only
  138. changes active state.</p><div class="refsect3" title="definition"><a name="d0e6047"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Source, class Event, class Target &gt;
  139. _row2</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6054"></a><h4>template parameters</h4><p>
  140. </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>
  141. </p></div></div><div class="refsect2" title="a_row2"><a name="d0e6070"></a><h3>a_row2</h3><p>This is a transition with action and without guard.</p><div class="refsect3" title="definition"><a name="d0e6075"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Source, class Event, class Target,
  142. </span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForAction, void
  143. (CalledForAction::*action)(Event const&amp;) &gt; _row2</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6086"></a><h4>template parameters</h4><p>
  144. </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
  145. be called. It can be either a state of the containing state
  146. machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
  147. provides.</p></li></ul></div><p>
  148. </p></div></div><div class="refsect2" title="g_row2"><a name="d0e6108"></a><h3>g_row2</h3><p>This is a transition with guard and without action.</p><div class="refsect3" title="definition"><a name="d0e6113"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Source, class Event, class Target,
  149. </span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForGuard, bool (CalledForGuard::*guard)(Event
  150. const&amp;) &gt; _row2</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6124"></a><h4>template parameters</h4><p>
  151. </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
  152. called. It can be either a state of the containing state
  153. machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
  154. provides.</p></li></ul></div><p>
  155. </p></div></div><div class="refsect2" title="row2"><a name="d0e6146"></a><h3>row2</h3><p>This is a transition with guard and action.</p><div class="refsect3" title="definition"><a name="d0e6151"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Source, class Event, class Target,
  156. </span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForAction, void
  157. (CalledForAction::*action)(Event const&amp;), </span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForGuard, bool (CalledForGuard::*guard)(Event
  158. const&amp;) &gt; _row2</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6166"></a><h4>template parameters</h4><p>
  159. </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
  160. be called. It can be either a state of the containing state
  161. machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
  162. provides.</p></li><li class="listitem"><p>CalledForGuard: the type on which the guard method will be
  163. called. It can be either a state of the containing state
  164. machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
  165. provides.</p></li></ul></div><p>
  166. </p></div></div><div class="refsect2" title="a_irow2"><a name="d0e6194"></a><h3>a_irow2</h3><p>This is an internal transition for use inside a transition table, with
  167. action and without guard.</p><div class="refsect3" title="definition"><a name="d0e6199"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Source, class Event, </span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForAction, void
  168. (CalledForAction::*action)(Event const&amp;) &gt; _row2</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6210"></a><h4>template parameters</h4><p>
  169. </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
  170. be called. It can be either a state of the containing state
  171. machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
  172. provides.</p></li></ul></div><p>
  173. </p></div></div><div class="refsect2" title="g_irow2"><a name="d0e6229"></a><h3>g_irow2</h3><p>This is an internal transition for use inside a transition table, with
  174. guard and without action.</p><div class="refsect3" title="definition"><a name="d0e6234"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Source, class Event, </span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForGuard, bool (CalledForGuard::*guard)(Event
  175. const&amp;) &gt; _row2</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6245"></a><h4>template parameters</h4><p>
  176. </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
  177. called. It can be either a state of the containing state
  178. machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
  179. provides.</p></li></ul></div><p>
  180. </p></div></div><div class="refsect2" title="irow2"><a name="d0e6264"></a><h3>irow2</h3><p>This is an internal transition for use inside a transition table, with
  181. guard and action.</p><div class="refsect3" title="definition"><a name="d0e6269"></a><h4>definition</h4><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt; class Source, class Event, </span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForAction, void
  182. (CalledForAction::*action)(Event const&amp;), </span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class CalledForGuard, bool (CalledForGuard::*guard)(Event
  183. const&amp;) &gt; _row2</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="template parameters"><a name="d0e6284"></a><h4>template parameters</h4><p>
  184. </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
  185. be called. It can be either a state of the containing state
  186. machine or the state machine itself.</p></li><li class="listitem"><p>action: a pointer to the method which CalledForAction
  187. provides.</p></li><li class="listitem"><p>CalledForGuard: the type on which the guard method will be
  188. called. It can be either a state of the containing state
  189. machine or the state machine itself.</p></li><li class="listitem"><p>guard: a pointer to the method which CalledForGuard
  190. provides.</p></li></ul></div><p>
  191. </p></div></div></div><div class="refsect1" title="msm/front/state_machine_def.hpp"><a name="d0e6309"></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
  192. type, <code class="code">state_machine_def</code></p><div class="refsect2" title="state_machine_def definition"><a name="d0e6319"></a><h3>state_machine_def definition</h3><p>This type is the basic class for a basic (or possibly any other)
  193. front-end. It provides the standard row types (which includes internal
  194. transitions) and a default implementation of the required methods and
  195. typedefs.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template &lt;class Derived,class BaseState =
  196. default_base_state&gt; state_machine_def</span></span>&nbsp;{<br>}</pre><div class="refsect3" title="typedefs"><a name="d0e6328"></a><h4>typedefs</h4><p>
  197. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>flag_list: by default, no flag is set in the state
  198. 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
  199. is done.</p></li></ul></div><p>
  200. </p></div><div class="refsect3" title="row methods"><a name="d0e6344"></a><h4>row methods</h4><p>Like any other front-end, the following transition row types
  201. implements the two necessary static functions for action and guard call.
  202. Each function receives as parameter the (deepest-level) state machine
  203. processsing the event, the event itself, the source and target states
  204. and all the states contained in a state machine (ignored).</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class Fsm,class SourceState,class TargetState,
  205. class AllStates&gt; static void action_call(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  206. <code>(</code>Fsm&amp; fsm,Event const&amp;
  207. evt,SourceState&amp;,TargetState,AllStates&amp;<code>)</code>
  208. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class Fsm,class SourceState,class TargetState,
  209. class AllStates&gt; static bool guard_call(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  210. <code>(</code>Fsm&amp; fsm,Event const&amp;
  211. evt,SourceState&amp;,TargetState,AllStates&amp;<code>)</code>
  212. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div></div><div class="refsect3" title="a_row"><a name="d0e6367"></a><h4>a_row</h4><p>This is a transition with action and without guard.</p><p><code class="classname">template&lt; class Source, class Event, class Target,
  213. void (Derived::*action)(Event const&amp;) &gt; 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
  214. front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="g_row"><a name="d0e6392"></a><h4>g_row</h4><p>This is a transition with guard and without action.</p><p><code class="classname">template&lt; class Source, class Event, class Target,
  215. bool (Derived::*guard)(Event const&amp;) &gt; 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
  216. front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="row"><a name="d0e6417"></a><h4>row</h4><p>This is a transition with guard and action.</p><p><code class="classname">template&lt; class Source, class Event, class Target,
  217. void (Derived::*action)(Event const&amp;), bool
  218. (Derived::*guard)(Event const&amp;) &gt; 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
  219. 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
  220. front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="_row"><a name="d0e6448"></a><h4>_row</h4><p>This is a transition without action or guard. The state machine only
  221. changes active state.</p><p><code class="classname">template&lt; class Source, class Event, class Target &gt;
  222. _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="d0e6467"></a><h4>a_irow</h4><p>This is an internal transition for use inside a transition table, with
  223. action and without guard.</p><p><code class="classname">template&lt; class Source, class Event, void
  224. (Derived::*action)(Event const&amp;) &gt; 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
  225. front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="g_irow"><a name="d0e6489"></a><h4>g_irow</h4><p>This is an internal transition for use inside a transition table, with
  226. guard and without action.</p><p><code class="classname">template&lt; class Source, class Event, bool
  227. (Derived::*guard)(Event const&amp;) &gt; 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
  228. front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="irow"><a name="d0e6511"></a><h4>irow</h4><p>This is an internal transition for use inside a transition table, with
  229. guard and action.</p><p><code class="classname">template&lt; class Source, class Event, void
  230. (Derived::*action)(Event const&amp;), bool
  231. (Derived::*guard)(Event const&amp;) &gt; 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
  232. 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
  233. front-end (represented by <code class="code">Derived</code>).</p></li></ul></div></div><div class="refsect3" title="_irow"><a name="d0e6539"></a><h4>_irow</h4><p>This is an internal transition without action or guard. As it does
  234. nothing, it means "ignore event".</p><p><code class="classname">template&lt; class Source, class Event &gt;
  235. _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="d0e6555"></a><h4>methods</h4><p><code class="code">state_machine_def</code> provides a default implementation in
  236. case of an event which cannot be processed by a state machine (no
  237. transition found). The implementation is using a
  238. <code class="code">BOOST_ASSERT</code> so that the error will only be noticed in
  239. debug mode. Overwrite this method in your implementation to change the
  240. behavior.</p><p>
  241. </p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class Fsm,class Event&gt; static void
  242. no_transition(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  243. <code>(</code>Event const&amp; ,Fsm&amp;, int
  244. state<code>)</code>
  245. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>
  246. </p><p><code class="code">state_machine_def</code> provides a default implementation in
  247. case an exception is thrown by a state (entry/exit) or transition
  248. (action/guard) behavior. The implementation is using a
  249. <code class="code">BOOST_ASSERT</code> so that the error will only be noticed in
  250. debug mode. Overwrite this method in your implementation to change the
  251. behavior. This method will be called only if exception handling is not
  252. deactivated (default) by defining
  253. <code class="code">has_no_message_queue</code>.</p><p>
  254. </p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class Fsm,class Event&gt; static void
  255. exception_caught(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>
  256. <code>(</code>Event const&amp; ,Fsm&amp;,
  257. std::exception&amp;<code>)</code>
  258. </code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>
  259. </p></div></div></div><div class="refsect1" title="msm/front/states.hpp"><a name="d0e6599"></a><h2>msm/front/states.hpp </h2><p>This header provides the different states (except state machines) for the
  260. basic front-end (or mixed with other front-ends).</p><div class="refsect2" title="types"><a name="d0e6604"></a><h3>types</h3><p>This header provides the following types:</p><div class="refsect3" title="no_sm_ptr"><a name="d0e6609"></a><h4>no_sm_ptr</h4><p>deprecated: default policy for states. It means that states do not
  261. need to save a pointer to their containing state machine.</p></div><div class="refsect3" title="sm_ptr"><a name="d0e6614"></a><h4>sm_ptr</h4><p>deprecated: state policy. It means that states need to save a pointer
  262. to their containing state machine. When seeing this flag, the back-end
  263. will call set_sm_ptr(fsm*) and give itself as argument.</p></div><div class="refsect3" title="state"><a name="d0e6619"></a><h4>state</h4><p>Basic type for simple states. Inherit from this type to define a
  264. simple state. The first argument is needed if you want your state (and
  265. all others used in a concrete state machine) to inherit a basic type for
  266. logging or providing a common behavior.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt;class Base = default_base_state,class
  267. SMPtrPolicy = no_sm_ptr&gt; state</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="terminate_state"><a name="d0e6628"></a><h4>terminate_state</h4><p>Basic type for terminate states. Inherit from this type to define a
  268. terminate state. The first argument is needed if you want your state
  269. (and all others used in a concrete state machine) to inherit a basic
  270. type for logging or providing a common behavior.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt;class Base = default_base_state,class
  271. SMPtrPolicy = no_sm_ptr&gt; terminate_state</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="interrupt_state"><a name="d0e6637"></a><h4>interrupt_state</h4><p>Basic type for interrupt states. Interrupt states prevent any further
  272. event handling until EndInterruptEvent is sent. Inherit from this type
  273. to define a terminate state. The first argument is the name of the event
  274. ending the interrupt. The second argument is needed if you want your
  275. state (and all others used in a concrete state machine) to inherit a
  276. basic type for logging or providing a common behavior.</p><p>The EndInterruptEvent can also be a sequence of events:
  277. mpl::vector&lt;EndInterruptEvent,EndInterruptEvent2&gt;.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt;class EndInterruptEvent,class Base =
  278. default_base_state,</span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class SMPtrPolicy = no_sm_ptr&gt;
  279. interrupt_state</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="explicit_entry"><a name="d0e6652"></a><h4>explicit_entry</h4><p>Inherit from this type <span class="underline">in
  280. addition</span> to the desired state type to enable this state
  281. for direct entering. The template parameter gives the region id of the
  282. state (regions are numbered in the order of the
  283. <code class="code">initial_state</code> typedef).</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template &lt;int ZoneIndex=-1&gt; explicit_entry</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="entry_pseudo_state"><a name="d0e6667"></a><h4>entry_pseudo_state</h4><p>Basic type for entry pseudo states. Entry pseudo states are an
  284. predefined entry into a submachine and connect two transitions. The
  285. first argument is the id of the region entered by this state (regions
  286. are numbered in the order of the <code class="code">initial_state</code> typedef).
  287. The second argument is needed if you want your state (and all others
  288. used in a concrete state machine) to inherit a basic type for logging or
  289. providing a common behavior.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt;int RegionIndex=-1,class Base =
  290. default_base_state,</span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class SMPtrPolicy = no_sm_ptr&gt;
  291. entry_pseudo_state</span></span>&nbsp;{<br>}</pre></div><div class="refsect3" title="exit_pseudo_state"><a name="d0e6683"></a><h4>exit_pseudo_state</h4><p>Basic type for exit pseudo states. Exit pseudo states are an
  292. predefined exit from a submachine and connect two transitions. The first
  293. argument is the name of the event which will be "thrown" out of the exit
  294. point. This event does not need to be the same as the one sent by the
  295. inner region but must be convertible from it. The second argument is
  296. needed if you want your state (and all others used in a concrete state
  297. machine) to inherit a basic type for logging or providing a common
  298. behavior.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template&lt;class Event,class Base =
  299. default_base_state,</span></span>&nbsp;{<br>}</pre><pre class="classsynopsis"> <span class="ooclass"><span class="classname">class SMPtrPolicy = no_sm_ptr&gt;
  300. exit_pseudo_state</span></span>&nbsp;{<br>}</pre></div></div></div><div class="refsect1" title="msm/front/euml/euml.hpp"><a name="d0e6696"></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="d0e6701"></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="ch11.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="d0e6709"></a><h2>msm/front/euml/algorithm.hpp</h2><p>This header includes all the functors for STL algorithms support in eUML.
  301. These <span class="command"><strong><a class="command" href="ch11.html#eUML-STL-all">tables</a></strong></span> show a full
  302. description.</p></div><div class="refsect1" title="msm/front/euml/iteration.hpp"><a name="d0e6717"></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="ch11.html#eUML-STL-iteration">tables</a></strong></span> shows a full
  303. description.</p></div><div class="refsect1" title="msm/front/euml/querying.hpp"><a name="d0e6725"></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="ch11.html#eUML-STL-querying">tables</a></strong></span> shows a full
  304. description.</p></div><div class="refsect1" title="msm/front/euml/transformation.hpp"><a name="d0e6733"></a><h2>msm/front/euml/transformation.hpp</h2><p>This header includes transformation functors for STL support in eUML. This
  305. <span class="command"><strong><a class="command" href="ch11.html#eUML-STL-transformation">tables</a></strong></span> shows a full
  306. description.</p></div><div class="refsect1" title="msm/front/euml/container.hpp"><a name="d0e6741"></a><h2>msm/front/euml/container.hpp</h2><p>This header includes container functors for STL support in eUML (functors
  307. calling container methods). This <span class="command"><strong><a class="command" href="ch11.html#eUML-STL-container">tables</a></strong></span> shows a full description. It also provides npos for
  308. strings.</p><div class="refsect2" title="Npos_<container type&gt;"><a name="d0e6749"></a><h3>Npos_&lt;container type&gt;</h3><p>Functor returning npos for transition or state behaviors. Like all
  309. constants, only the functor form exists, so parenthesis are necessary.
  310. Example:</p><p><code class="code">string_find_(event_(m_song),Char_&lt;'S'&gt;(),Size_t_&lt;0&gt;()) !=
  311. Npos_&lt;string&gt;() // compare result of string::find with
  312. npos</code></p></div></div><div class="refsect1" title="msm/front/euml/stt_grammar.hpp"><a name="d0e6757"></a><h2>msm/front/euml/stt_grammar.hpp</h2><p>This header provides the transition table grammars. This includes internal
  313. transition tables.</p><div class="refsect2" title="functions"><a name="d0e6762"></a><h3>functions</h3><div class="refsect3" title="build_stt"><a name="d0e6765"></a><h4>build_stt</h4><p>The function build_stt evaluates the grammar-conform expression as
  314. parameter. It returns a transition table, which is a mpl::vector of
  315. transitions (rows) or, if the expression is ill-formed (does not match
  316. the grammar), the type <code class="code">invalid_type</code>, which will lead to a
  317. compile-time static assertion when this transition table is passed to a
  318. 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&lt;class Expr&gt; [mpl::vector&lt;...&gt; /
  319. msm::front::euml::invalid_type] build_stt(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr const&amp; expr</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div></div><div class="refsect3" title="build_internal_stt"><a name="d0e6779"></a><h4>build_internal_stt</h4><p>The function build_internal_stt evaluates the grammar-conform
  320. expression as parameter. It returns a transition table, which is a
  321. mpl::vector of transitions (rows) or, if the expression is ill-formed
  322. (does not match the grammar), the type <code class="code">invalid_type</code>, which
  323. will lead to a compile-time static assertion when this transition table
  324. 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&lt;class Expr&gt; [mpl::vector&lt;...&gt; /
  325. msm::front::euml::invalid_type] build_internal_stt(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr const&amp; expr</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div></div></div><div class="refsect2" title="grammars"><a name="d0e6793"></a><h3>grammars</h3><div class="refsect3" title="transition table"><a name="d0e6796"></a><h4><span class="command"><strong><a name="reference-stt-grammar"></a>transition
  326. table</strong></span></h4><p>The transition table accepts the following grammar:</p><pre class="programlisting">Stt := Row | (Stt ',' Stt)
  327. Row := (Target '==' (SourcePlusEvent)) /* first syntax*/
  328. | ( (SourcePlusEvent) '==' Target ) /* second syntax*/
  329. | (SourcePlusEvent) /* internal transitions */
  330. SourcePlusEvent := (BuildSource '+' BuildEvent)/* standard transition*/
  331. | (BuildSource) /* anonymous transition */
  332. BuildSource := state_tag | (state_tag '/' Action) | (state_tag '[' Guard ']')
  333. | (state_tag '[' Guard ']' '/' Action)
  334. BuildEvent := event_tag | (event_tag '/' Action) | (event_tag '[' Guard ']')
  335. | (event_tag '[' Guard ']' '/' Action)</pre><p>The grammars Action and Guard are defined in state_grammar.hpp and
  336. guard_grammar.hpp respectively. state_tag and event_tag are inherited
  337. from euml_state (or other state variants) and euml_event respectively.
  338. For example, following declarations are possible:</p><pre class="programlisting">target == source + event [guard] / action,
  339. source + event [guard] / action == target,
  340. source + event [guard] / (action1,action2) == target,
  341. target == source + event [guard] / (action1,action2),
  342. target == source + event,
  343. source + event == target,
  344. target == source + event [guard],
  345. source + event [guard] == target,
  346. target == source + event / action,
  347. source + event /action == target,
  348. source / action == target, /*anonymous transition*/
  349. target == source / action, /*anonymous transition*/
  350. source + event /action, /* internal transition*/</pre></div><div class="refsect3" title="internal transition table"><a name="d0e6808"></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
  351. tables.</p></div></div></div><div class="refsect1" title="msm/front/euml/guard_grammar.hpp"><a name="d0e6817"></a><h2>msm/front/euml/guard_grammar.hpp</h2><p>This header contains the <code class="code">Guard</code> grammar used in the previous
  352. section. This grammar is long but pretty simple:</p><pre class="programlisting">Guard := action_tag | (Guard '&amp;&amp;' Guard)
  353. | (Guard '||' Guard) | ... /* operators*/
  354. | (if_then_else_(Guard,Guard,Guard)) | (function (Action,...Action))</pre><p>Most C++ operators are supported (address-of is not). With
  355. <code class="code">function</code> is meant any eUML predefined function or any self-made
  356. (using <code class="code">MSM_EUML_METHOD</code> or <code class="code">MSM_EUML_FUNCTION</code>). Action
  357. is a grammar defined in state_grammar.hpp.</p></div><div class="refsect1" title="msm/front/euml/state_grammar.hpp"><a name="d0e6838"></a><h2>msm/front/euml/state_grammar.hpp</h2><p>This header provides the grammar for actions and the different grammars and
  358. functions to build states using eUML.</p><div class="refsect2" title="action grammar"><a name="d0e6843"></a><h3>action grammar</h3><p>Like the guard grammar, this grammar supports relevant C++ operators and
  359. eUML functions:</p><pre class="programlisting">Action := action_tag | (Action '+' Action)
  360. | ('--' Action) | ... /* operators*/
  361. | if_then_else_(Guard,Action,Action) | if_then_(Action)
  362. | while_(Guard,Action)
  363. | do_while_(Guard,Action) | for_(Action,Guard,Action,Action)
  364. | (function(Action,...Action))
  365. ActionSequence := Action | (Action ',' Action)</pre><p>Relevant operators are: ++ (post/pre), -- (post/pre), dereferencing, +
  366. (unary/binary), - (unary/binary), *, /, %, &amp;(bitwise), | (bitwise),
  367. ^(bitwise), +=, -=, *=, /=, %=, &lt;&lt;=, &gt;&gt;=, &lt;&lt;, &gt;&gt;, =, [].</p></div><div class="refsect2" title="attributes"><a name="d0e6852"></a><h3>attributes</h3><p>This grammar is used to add attributes to states (or state machines) or
  368. 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_ &lt;&lt; no_attributes_</code></p></li><li class="listitem"><p><code class="code">attributes_ &lt;&lt; attribute_1 &lt;&lt; ... &lt;&lt;
  369. attribute_n</code></p></li></ul></div><p>Attributes can be of any default-constructible type (fusion
  370. requirement).</p></div><div class="refsect2" title="configure"><a name="d0e6868"></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_ &lt;&lt; no_configure_</code></p></li><li class="listitem"><p><code class="code">configure_ &lt;&lt; type_1 &lt;&lt; ... &lt;&lt;
  371. 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_ &lt;&lt; some_flag</code> where
  372. some_flag inherits from <code class="code">euml_flag&lt;some_flag&gt;</code> or
  373. is defined using BOOST_MSM_EUML_FLAG.</p></li><li class="listitem"><p>deferred events: <code class="code">configure_ &lt;&lt; some_event</code>
  374. where some_event inherits from
  375. <code class="code">euml_event&lt;some_event&gt;</code> or is defined using
  376. BOOST_MSM_EUML_EVENT or
  377. BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES.</p></li><li class="listitem"><p>configuration (message queue, manual deferring, exception
  378. handling): <code class="code">configure_ &lt;&lt; some_config</code> where
  379. some_config inherits from
  380. <code class="code">euml_config&lt;some_config&gt;</code>. At the moment,
  381. 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
  382. deferred events</p></li></ul></div></li></ul></div></div><div class="refsect2" title="initial states"><a name="d0e6922"></a><h3>initial states</h3><p>The grammar to define initial states for a state machine is: <code class="code">init_
  383. &lt;&lt; state_1 &lt;&lt; ... &lt;&lt; state_n</code> where
  384. state_1...state_n inherit from euml_state or is defined using
  385. BOOST_MSM_EUML_STATE, BOOST_MSM_EUML_INTERRUPT_STATE,
  386. BOOST_MSM_EUML_TERMINATE_STATE, BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE,
  387. BOOST_MSM_EUML_ENTRY_STATE or BOOST_MSM_EUML_EXIT_STATE.</p></div><div class="refsect2" title="functions"><a name="d0e6930"></a><h3>functions</h3><div class="refsect3" title="build_sm"><a name="d0e6933"></a><h4>build_sm</h4><p>This function has several overloads. The return type is not relevant
  388. 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 &lt;class StateNameTag,class Stt,class Init&gt;
  389. func_state_machine&lt;...&gt; build_sm(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Stt ,Init</code>;</div><div class="funcprototype-spacer">&nbsp;</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 &lt;class StateNameTag,class Stt,class Init,class
  390. Expr1&gt; func_state_machine&lt;...&gt; build_sm(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Stt ,Init,Expr1 const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</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 &lt;class StateNameTag,class Stt,class Init,class
  391. Expr1, class Expr2&gt; func_state_machine&lt;...&gt;
  392. build_sm(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Stt ,Init,Expr1 const&amp;,Expr2 const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines a state machine with entry, exit behaviors and
  393. attributes:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class Stt,class Init,class
  394. Expr1, class Expr2, class Attributes&gt; func_state_machine&lt;...&gt;
  395. build_sm(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Stt ,Init,Expr1 const&amp;, Expr2 const&amp;, Attributes
  396. const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines a state machine with entry, exit behaviors, attributes and
  397. configuration (deferred events, flags):</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class Stt,class Init,class
  398. Expr1, class Expr2, class Attributes, class Configure&gt;
  399. func_state_machine&lt;...&gt; build_sm(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Stt ,Init,Expr1 const&amp;, Expr2 const&amp;, Attributes
  400. const&amp;, Configure const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines a state machine with entry, exit behaviors, attributes,
  401. configuration (deferred events, flags) and a base state:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class Stt,class Init,class
  402. Expr1, class Expr2, class Attributes, class Configure, class
  403. Base&gt; func_state_machine&lt;...&gt; build_sm(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Stt ,Init,Expr1 const&amp;, Expr2 const&amp;, Attributes
  404. const&amp;, Configure const&amp;, Base</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Notice that this function requires the extra parameter class
  405. StateNameTag to disambiguate state machines having the same parameters
  406. but still being different.</p></div><div class="refsect3" title="build_state"><a name="d0e6988"></a><h4>build_state</h4><p>This function has several overloads. The return type is not relevant
  407. 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&lt;class StateNameTag,...&gt; build_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code></code>;</div><div class="funcprototype-spacer">&nbsp;</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 &lt;class StateNameTag,class Expr1&gt;
  408. func_state&lt;...&gt; build_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr1 const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</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 &lt;class StateNameTag,class Expr1, class Expr2&gt;
  409. func_state&lt;...&gt; build_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr1 const&amp;,Expr2 const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines a simple state with entry, exit behaviors and
  410. attributes:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class Expr1, class Expr2,
  411. class Attributes&gt; func_state&lt;...&gt; build_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr1 const&amp;, Expr2 const&amp;, Attributes
  412. const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines a simple state with entry, exit behaviors, attributes and
  413. configuration (deferred events, flags):</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class Expr1, class Expr2,
  414. class Attributes, class Configure&gt; func_state&lt;...&gt;
  415. build_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr1 const&amp;, Expr2 const&amp;, Attributes const&amp;,
  416. Configure const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines a simple state with entry, exit behaviors, attributes,
  417. configuration (deferred events, flags) and a base state:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class Expr1, class Expr2,
  418. class Attributes, class Configure, class Base&gt;
  419. func_state&lt;...&gt; build_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr1 const&amp;, Expr2 const&amp;, Attributes const&amp;,
  420. Configure const&amp;, Base</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Notice that this function requires the extra parameter class
  421. StateNameTag to disambiguate states having the same parameters but still
  422. being different.</p></div><div class="refsect3" title="build_terminate_state"><a name="d0e7042"></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="d0e7047"></a><h4>build_interrupt_state</h4><p>This function has several overloads. The return type is not relevant
  423. 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 &lt;class StateNameTag,class EndInterruptEvent&gt;
  424. func_state&lt;...&gt; build_interrupt_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>EndInterruptEvent const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</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 &lt;class StateNameTag,class
  425. EndInterruptEvent,class Expr1&gt; func_state&lt;...&gt;
  426. build_interrupt_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>EndInterruptEvent const&amp;,Expr1 const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines an interrupt 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 &lt;class StateNameTag,class
  427. EndInterruptEvent,class Expr1, class Expr2&gt; func_state&lt;...&gt;
  428. build_interrupt_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>EndInterruptEvent const&amp;,Expr1 const&amp;,Expr2
  429. const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines an interrupt state with entry, exit behaviors and
  430. attributes:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class
  431. EndInterruptEvent,class Expr1, class Expr2, class Attributes&gt;
  432. func_state&lt;...&gt; build_interrupt_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>EndInterruptEvent const&amp;,Expr1 const&amp;, Expr2
  433. const&amp;, Attributes const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines an interrupt state with entry, exit behaviors, attributes and
  434. configuration (deferred events, flags):</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class
  435. EndInterruptEvent,class Expr1, class Expr2, class Attributes,
  436. class Configure&gt; func_state&lt;...&gt;
  437. build_interrupt_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>EndInterruptEvent const&amp;,Expr1 const&amp;, Expr2
  438. const&amp;, Attributes const&amp;, Configure
  439. const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines an interrupt state with entry, exit behaviors, attributes,
  440. configuration (deferred events, flags) and a base state:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class
  441. EndInterruptEvent,class Expr1, class Expr2, class Attributes,
  442. class Configure, class Base&gt; func_state&lt;...&gt;
  443. build_interrupt_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>EndInterruptEvent const&amp;,Expr1 const&amp;, Expr2
  444. const&amp;, Attributes const&amp;, Configure const&amp;,
  445. Base</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Notice that this function requires the extra parameter class
  446. StateNameTag to disambiguate states having the same parameters but still
  447. being different.</p></div><div class="refsect3" title="build_entry_state"><a name="d0e7102"></a><h4>build_entry_state</h4><p>This function has several overloads. The return type is not relevant
  448. 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 &lt;class StateNameTag,int RegionIndex&gt;
  449. entry_func_state&lt;...&gt; build_entry_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code></code>;</div><div class="funcprototype-spacer">&nbsp;</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 &lt;class StateNameTag,int RegionIndex,class
  450. Expr1&gt; entry_func_state&lt;...&gt; build_entry_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr1 const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</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 &lt;class StateNameTag,int RegionIndex,class
  451. Expr1, class Expr2&gt; entry_func_state&lt;...&gt;
  452. build_entry_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr1 const&amp;,Expr2 const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines an entry pseudo state with entry, exit behaviors and
  453. attributes:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,int RegionIndex,class
  454. Expr1, class Expr2, class Attributes&gt; entry_func_state&lt;...&gt;
  455. build_entry_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr1 const&amp;, Expr2 const&amp;, Attributes
  456. const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines an entry pseudo state with entry, exit behaviors, attributes
  457. and configuration (deferred events, flags):</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,int RegionIndex,class
  458. Expr1, class Expr2, class Attributes, class Configure&gt;
  459. entry_func_state&lt;...&gt; build_entry_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr1 const&amp;, Expr2 const&amp;, Attributes const&amp;,
  460. Configure const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines an entry pseudo state with entry, exit behaviors, attributes,
  461. configuration (deferred events, flags) and a base state:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,int RegionIndex,class
  462. Expr1, class Expr2, class Attributes, class Configure, class
  463. Base&gt; entry_func_state&lt;...&gt; build_entry_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Expr1 const&amp;, Expr2 const&amp;, Attributes const&amp;,
  464. Configure const&amp;, Base</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Notice that this function requires the extra parameter class
  465. StateNameTag to disambiguate states having the same parameters but still
  466. being different.</p></div><div class="refsect3" title="build_exit_state"><a name="d0e7156"></a><h4>build_exit_state</h4><p>This function has several overloads. The return type is not relevant
  467. 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 &lt;class StateNameTag,class Event&gt;
  468. exit_func_state&lt;...&gt; build_exit_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Event const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</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 &lt;class StateNameTag,class Event,class Expr1&gt;
  469. exit_func_state&lt;...&gt; build_exit_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Event const&amp;,Expr1 const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</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 &lt;class StateNameTag,class Event,class Expr1,
  470. class Expr2&gt; exit_func_state&lt;...&gt; build_exit_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Event const&amp;,Expr1 const&amp;,Expr2
  471. const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines an exit pseudo state with entry, exit behaviors and
  472. attributes:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class Event,class Expr1,
  473. class Expr2, class Attributes&gt; exit_func_state&lt;...&gt;
  474. build_exit_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Event const&amp;,Expr1 const&amp;, Expr2 const&amp;,
  475. Attributes const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines an exit pseudo state with entry, exit behaviors, attributes
  476. and configuration (deferred events, flags):</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class Event,class Expr1,
  477. class Expr2, class Attributes, class Configure&gt;
  478. exit_func_state&lt;...&gt; build_exit_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Event const&amp;,Expr1 const&amp;, Expr2 const&amp;,
  479. Attributes const&amp;, Configure const&amp;</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Defines an exit pseudo state with entry, exit behaviors, attributes,
  480. configuration (deferred events, flags) and a base state:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">template &lt;class StateNameTag,class Event,class Expr1,
  481. class Expr2, class Attributes, class Configure, class Base&gt;
  482. exit_func_state&lt;...&gt; build_exit_state(</code></td><td><code>)</code>;</td><td>&nbsp;</td></tr></table><div class="paramdef-list"><code>Event const&amp;,Expr1 const&amp;, Expr2 const&amp;,
  483. Attributes const&amp;, Configure const&amp;, Base</code>;</div><div class="funcprototype-spacer">&nbsp;</div></div><p>Notice that this function requires the extra parameter class
  484. StateNameTag to disambiguate states having the same parameters but still
  485. being different.</p></div><div class="refsect3" title="build_explicit_entry_state"><a name="d0e7211"></a><h4>build_explicit_entry_state</h4><p>This function has the same overloads as build_entry_state and
  486. explicit_entry_func_state as return type.</p></div></div></div><div class="refsect1" title="msm/front/euml/common.hpp"><a name="d0e7216"></a><h2>msm/front/euml/common.hpp</h2><div class="refsect2" title="types"><a name="d0e7219"></a><h3>types</h3><div class="refsect3" title="euml_event"><a name="d0e7222"></a><h4>euml_event</h4><p>The basic type for events with eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template &lt;class EventName&gt; euml_event;</span></span>&nbsp;{<br>}</pre><pre class="programlisting">struct play : euml_event&lt;play&gt;{};</pre></div><div class="refsect3" title="euml_state"><a name="d0e7233"></a><h4>euml_state</h4><p>The basic type for states with eUML. You will usually not use this
  487. type directly as it is easier to use BOOST_MSM_EUML_STATE,
  488. BOOST_MSM_EUML_INTERRUPT_STATE, BOOST_MSM_EUML_TERMINATE_STATE,
  489. BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE, BOOST_MSM_EUML_ENTRY_STATE or
  490. BOOST_MSM_EUML_EXIT_STATE.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template &lt;class StateName&gt; euml_state;</span></span>&nbsp;{<br>}</pre><p>You can however use this type directly if you want to provide your
  491. state with extra functions or provide entry or exit behaviors without
  492. functors, for example:</p><pre class="programlisting">struct Empty : public msm::front::state&lt;&gt; , public euml_state&lt;Empty&gt;
  493. {
  494. void foo() {...}
  495. template &lt;class Event,class Fsm&gt;
  496. void on_entry(Event const&amp; evt,Fsm&amp; fsm){...}
  497. };</pre></div><div class="refsect3" title="euml_flag"><a name="d0e7246"></a><h4>euml_flag</h4><p>The basic type for flags with eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template &lt;class FlagName&gt; euml_flag;</span></span>&nbsp;{<br>}</pre><pre class="programlisting">struct PlayingPaused: euml_flag&lt;PlayingPaused&gt;{};</pre></div><div class="refsect3" title="euml_action"><a name="d0e7257"></a><h4>euml_action</h4><p>The basic type for state or transition behaviors and guards with
  498. eUML.</p><pre class="classsynopsis"> <span class="ooclass"><span class="classname">template &lt;class AcionName&gt; euml_action;</span></span>&nbsp;{<br>}</pre><pre class="programlisting">struct close_drawer : euml_action&lt;close_drawer&gt;
  499. {
  500. template &lt;class Fsm,class Evt,class SourceState,class TargetState&gt;
  501. void operator()(Evt const&amp; , Fsm&amp;, SourceState&amp; ,TargetState&amp; ) {...}
  502. };</pre><p>Or, as state entry or exit behavior:</p><pre class="programlisting">struct Playing_Entry : euml_action&lt;Playing_Entry&gt;
  503. {
  504. template &lt;class Event,class Fsm,class State&gt;
  505. void operator()(Event const&amp;,Fsm&amp; fsm,State&amp; ){...}
  506. };</pre></div><div class="refsect3" title="euml_config"><a name="d0e7272"></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 &lt;class ConfigName&gt; euml_config;</span></span>&nbsp;{<br>}</pre><p>You normally do not use this type directly but instead the instances
  507. 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
  508. allows you to send an event for procesing while in an event
  509. processing.</p></li><li class="listitem"><p>deferred_events: manually enable handling of deferred
  510. events</p></li></ul></div></div><div class="refsect3" title="invalid_type"><a name="d0e7293"></a><h4>invalid_type</h4><p>Type returned by grammar parsers if the grammar is invalid. Seeing
  511. this type will result in a static assertion.</p></div><div class="refsect3" title="no_action"><a name="d0e7298"></a><h4>no_action</h4><p>Placeholder type for use in entry/exit or transition behaviors, which
  512. does absolutely nothing.</p></div><div class="refsect3" title="source_"><a name="d0e7303"></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
  513. transition, usually to be used by another function (usually
  514. one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
  515. </p><pre class="programlisting">some_user_function_(source_)</pre></li><li class="listitem"><p>as function: returns by reference the attribute passed as
  516. parameter.</p><p>Example:
  517. </p><pre class="programlisting">source_(m_counter)++</pre></li></ul></div></div><div class="refsect3" title="target_"><a name="d0e7323"></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
  518. transition, usually to be used by another function (usually
  519. one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
  520. </p><pre class="programlisting">some_user_function_(target_)</pre></li><li class="listitem"><p>as function: returns by reference the attribute passed as
  521. parameter.</p><p>Example:
  522. </p><pre class="programlisting">target_(m_counter)++</pre></li></ul></div></div><div class="refsect3" title="state_"><a name="d0e7343"></a><h4>state_</h4><p>Generic object or function for the state of a given entry / exit
  523. behavior. state_ means source_ while in the context of an exit behavior
  524. 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
  525. to be used by another function (usually one created by
  526. MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
  527. </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
  528. parameter.</p><p>Example:
  529. </p><pre class="programlisting">state_(m_counter)++</pre></li></ul></div></div><div class="refsect3" title="event_"><a name="d0e7363"></a><h4>event_</h4><p>Generic object or function for the event triggering a given transition
  530. (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,
  531. usually to be used by another function (usually one created
  532. by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
  533. </p><pre class="programlisting">some_user_function_(event_)</pre></li><li class="listitem"><p>as function: returns by reference the attribute passed as
  534. parameter.</p><p>Example:
  535. </p><pre class="programlisting">event_(m_counter)++</pre></li></ul></div></div><div class="refsect3" title="fsm_"><a name="d0e7383"></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,
  536. usually to be used by another function (usually one created
  537. by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
  538. </p><pre class="programlisting">some_user_function_(fsm_)</pre></li><li class="listitem"><p>as function: returns by reference the attribute passed as
  539. parameter.</p><p>Example:
  540. </p><pre class="programlisting">fsm_(m_counter)++</pre></li></ul></div></div><div class="refsect3" title="substate_"><a name="d0e7403"></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
  541. parameter, usually to be used by another function (usually
  542. one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION).</p><p>Example:
  543. </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
  544. as first parameter from the state machine passed as second
  545. parameter, usually to be used by another function (usually
  546. one created by MSM_EUML_METHOD or MSM_EUML_FUNCTION). This
  547. makes sense when used in combination with attribute_.</p><p>Example (equivalent to the previous example):
  548. </p><pre class="programlisting">some_user_function_(substate_(my_state,fsm_))</pre></li></ul></div></div><div class="refsect3" title="attribute_"><a name="d0e7423"></a><h4>attribute_</h4><p>Generic object or function returning the attribute passed (by name) as
  549. second parameter of the thing passed as first (a state, event or state
  550. machine). Example: </p><p>
  551. </p><pre class="programlisting">attribute_(substate_(my_state),cd_name_attribute)++</pre><p>
  552. </p></div><div class="refsect3" title="True_"><a name="d0e7433"></a><h4>True_</h4><p>Functor returning true for transition or state behaviors. Like all
  553. constants, only the functor form exists, so parenthesis are necessary.
  554. Example:</p><p>
  555. </p><pre class="programlisting">if_then_(True_(),/* some action always called*/)</pre><p>
  556. </p></div><div class="refsect3" title="False_"><a name="d0e7443"></a><h4>False_</h4><p>Functor returning false for transition or state behaviors. Like all
  557. constants, only the functor form exists, so parenthesis are necessary.
  558. Example:</p><p>
  559. </p><pre class="programlisting">if_then_(False_(),/* some action never called */)</pre><p>
  560. </p></div><div class="refsect3" title="Int_<int value&gt;"><a name="d0e7453"></a><h4>Int_&lt;int value&gt;</h4><p>Functor returning an integer value for transition or state behaviors.
  561. Like all constants, only the functor form exists, so parenthesis are
  562. necessary. Example:</p><p>
  563. </p><pre class="programlisting">target_(m_ringing_cpt) = Int_&lt;RINGING_TIME&gt;() // RINGING_TIME is a constant</pre><p>
  564. </p></div><div class="refsect3" title="Char_<char value&gt;"><a name="d0e7463"></a><h4>Char_&lt;char value&gt;</h4><p>Functor returning a char value for transition or state behaviors. Like
  565. all constants, only the functor form exists, so parenthesis are
  566. necessary. Example:</p><p>
  567. </p><pre class="programlisting">// look for 'S' in event.m_song
  568. [string_find_(event_(m_song),Char_&lt;'S'&gt;(),Size_t_&lt;0&gt;()) != Npos_&lt;string&gt;()]</pre><p>
  569. </p></div><div class="refsect3" title="Size_t_<size_t value&gt;"><a name="d0e7473"></a><h4>Size_t_&lt;size_t value&gt;</h4><p>Functor returning a size_t value for transition or state behaviors.
  570. Like all constants, only the functor form exists, so parenthesis are
  571. necessary. Example:</p><p>
  572. </p><pre class="programlisting">substr_(event_(m_song),Size_t_&lt;1&gt;()) // returns a substring of event.m_song</pre><p>
  573. </p></div><div class="refsect3" title="String_ < mpl::string &gt;"><a name="d0e7483"></a><h4>String_ &lt; mpl::string &gt;</h4><p>Functor returning a string for transition or state behaviors. Like all
  574. constants, only the functor form exists, so parenthesis are necessary.
  575. Requires boost &gt;= 1.40 for mpl::string.</p><p>Example:</p><p>
  576. </p><pre class="programlisting">// adds "Let it be" to fsm.m_src_container
  577. push_back_(fsm_(m_src_container), String_&lt;mpl::string&lt;'Let','it ','be'&gt; &gt;())</pre><p>
  578. </p></div><div class="refsect3" title="Predicate_ < some_stl_compatible_functor &gt;"><a name="d0e7495"></a><h4>Predicate_ &lt; some_stl_compatible_functor &gt;</h4><p>This functor eUML-enables a STL functor (for use in an algorithm).
  579. This is necessary because all what is in the transition table must be a
  580. eUML terminal.</p><p>Example:</p><pre class="programlisting">//equivalent to:
  581. //std::accumulate(fsm.m_vec.begin(),fsm.m_vec.end(),1,std::plus&lt;int&gt;())== 1
  582. accumulate_(begin_(fsm_(m_vec)),end_(fsm_(m_vec)),Int_&lt;1&gt;(),
  583. Predicate_&lt;std::plus&lt;int&gt; &gt;()) == Int_&lt;1&gt;())</pre></div><div class="refsect3" title="process_"><a name="d0e7504"></a><h4>process_</h4><p>This function sends an event to up to 4 state machines by calling
  584. <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
  585. the current (containing) state machine.</p></li><li class="listitem"><p><code class="code">process_(some_event [,fsm1...fsm4] )</code> :
  586. processes the same event in the 1-4 state machines passed as
  587. argument.</p></li></ul></div></div><div class="refsect3" title="process2_"><a name="d0e7523"></a><h4>process2_</h4><p>This function sends an event to up to 3 state machines by calling
  588. <code class="code">process_event</code> on them and copy-constructing the event
  589. 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
  590. an event in the current (containing) state machine.</p></li><li class="listitem"><p><code class="code">process2_(some_event, some_data [,fsm1...fsm3]
  591. )</code> : processes the same event in the 1-3 state
  592. machines passed as argument.</p></li></ul></div><p>Example: </p><p>
  593. </p><pre class="programlisting">// processes NotFound on current state machine,
  594. // copy-constructed with event.m_song
  595. process2_(NotFound,event_(m_song))</pre><p>
  596. </p><p>With the following definitions:</p><pre class="programlisting">BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song)//declaration of m_song
  597. NotFound (const string&amp; data) // copy-constructor of NotFound</pre></div><div class="refsect3" title="is_flag_"><a name="d0e7553"></a><h4>is_flag_</h4><p>This function tells if a flag is active by calling
  598. <code class="code">is_flag_active</code> on the current state machine or one
  599. 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
  600. <code class="code">is_flag_active</code> on the current (containing)
  601. state machine.</p></li><li class="listitem"><p><code class="code">is_flag_(some_flag, some_fsm)</code> :calls
  602. <code class="code">is_flag_active</code> on the state machine.passed
  603. as argument.</p></li></ul></div></div><div class="refsect3" title="defer_"><a name="d0e7578"></a><h4>defer_</h4><p>This object defers the current event by calling
  604. <code class="code">defer_event</code> on the current state machine.
  605. Example:</p><pre class="programlisting">Empty() + play() / defer_</pre></div><div class="refsect3" title="explicit_(submachine-name,state-name)"><a name="d0e7588"></a><h4>explicit_(submachine-name,state-name)</h4><p>Used as transition's target, causes an explicit entry into the given
  606. state from the given submachine. Several explicit_ as targets, separated
  607. by commas, means a fork. The state must have been declared as such using
  608. BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE.</p></div><div class="refsect3" title="entry_pt_(submachine-name,state-name)"><a name="d0e7593"></a><h4>entry_pt_(submachine-name,state-name)</h4><p>Used as transition's target from a containing state machine, causes
  609. submachine-name to be entered using the given entry pseudo-state. This
  610. state must have been declared as pseudo entry using
  611. BOOST_MSM_EUML_ENTRY_STATE.</p></div><div class="refsect3" title="exit_pt_(submachine-name,state-name)"><a name="d0e7598"></a><h4>exit_pt_(submachine-name,state-name)</h4><p>Used as transition's source from a containing state machine, causes
  612. submachine-name to be left using the given exit pseudo-state. This state
  613. must have been declared as pseudo exit using
  614. BOOST_MSM_EUML_EXIT_STATE.</p></div><div class="refsect3" title="MSM_EUML_FUNCTION"><a name="d0e7603"></a><h4>MSM_EUML_FUNCTION</h4><p>This macro creates a eUML function and a functor for use with the
  615. 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
  616. behavior</p></li><li class="listitem"><p>fifth parameter: the return type if used in a state
  617. behavior (entry/exit)</p></li></ul></div><p> Note that the function itself can take up to 5
  618. arguments.</p><p>Example:</p><p>
  619. </p><pre class="programlisting">MSM_EUML_FUNCTION(BinarySearch_,std::binary_search,binary_search_,bool,bool)</pre><p>
  620. </p><p>Can be used like:</p><p>
  621. </p><pre class="programlisting">binary_search_(begin_(fsm_(m_var)),end_(fsm_(m_var)),Int_&lt;9&gt;())</pre><p>
  622. </p></div><div class="refsect3" title="MSM_EUML_METHOD"><a name="d0e7639"></a><h4>MSM_EUML_METHOD</h4><p>This macro creates a eUML function and a functor for use with the
  623. 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
  624. behavior</p></li><li class="listitem"><p>fifth parameter: the return type if used in a state
  625. behavior (entry/exit)</p></li></ul></div><p> Note that the method itself can take up to 4 arguments
  626. (5 like for a free function - 1 for the object on which the method is
  627. called).</p><p>Example:</p><pre class="programlisting">struct Empty : public msm::front::state&lt;&gt; , public euml_state&lt;Empty&gt;
  628. {
  629. void activate_empty() {std::cout &lt;&lt; "switching to Empty " &lt;&lt; std::endl;}
  630. ...
  631. };
  632. MSM_EUML_METHOD(ActivateEmpty_,activate_empty,activate_empty_,void,void)</pre><p>Can be used like:</p><p>
  633. </p><pre class="programlisting">Empty == Open + open_close / (close_drawer , activate_empty_(target_))</pre><p>
  634. </p></div><div class="refsect3" title="BOOST_MSM_EUML_ACTION(action-instance-name)"><a name="d0e7672"></a><h4>BOOST_MSM_EUML_ACTION(action-instance-name)</h4><p>This macro declares a behavior type and a const instance for use in
  635. state or transition behaviors. The action implementation itself follows
  636. the macro declaration, for example:</p><pre class="programlisting">BOOST_MSM_EUML_ACTION(good_disk_format)
  637. {
  638. template &lt;class Fsm,class Evt,class SourceState,class TargetState&gt;
  639. void/bool operator()(Evt const&amp; evt,Fsm&amp;,SourceState&amp; ,TargetState&amp; ){...}
  640. };</pre></div><div class="refsect3" title="BOOST_MSM_EUML_FLAG(flag-instance-name)"><a name="d0e7679"></a><h4>BOOST_MSM_EUML_FLAG(flag-instance-name)</h4><p>This macro declares a flag type and a const instance for use in
  641. behaviors.</p></div><div class="refsect3" title="BOOST_MSM_EUML_FLAG_NAME(flag-instance-name)"><a name="d0e7684"></a><h4>BOOST_MSM_EUML_FLAG_NAME(flag-instance-name)</h4><p>This macro returns the name of the flag type generated by
  642. BOOST_MSM_EUML_FLAG. You need this where the type is required (usually
  643. with the back-end method is_flag_active). For example:</p><pre class="programlisting">fsm.is_flag_active&lt;BOOST_MSM_EUML_FLAG_NAME(CDLoaded)&gt;()</pre></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_ATTRIBUTE(event-type,event-name)"><a name="d0e7691"></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.
  644. This attribute can then be made part of an attribute list using
  645. BOOST_MSM_EUML_ATTRIBUTES.</p></div><div class="refsect3" title="BOOST_MSM_EUML_ATTRIBUTES(attributes-expression,attributes-name)"><a name="d0e7696"></a><h4>BOOST_MSM_EUML_ATTRIBUTES(attributes-expression,attributes-name)</h4><p>This macro declares an attribute list called attributes-name based on
  646. the expression as first argument. These attributes can then be made part
  647. of an event using BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES, of a state as
  648. 3rd parameter of BOOST_MSM_EUML_STATE or of a state machine as 5th
  649. 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
  650. BOOST_MSM_EUML_DECLARE_ATTRIBUTE(std::string,m_song)
  651. // contains one attribute, m_song
  652. BOOST_MSM_EUML_ATTRIBUTES((attributes_ &lt;&lt; m_song ), FoundDef)</pre></div><div class="refsect3" title="BOOST_MSM_EUML_EVENT(event-instance name)"><a name="d0e7705"></a><h4>BOOST_MSM_EUML_EVENT(event-instance name)</h4><p>This macro defines an event type (event-instance-name_helper) and
  653. declares a const instance of this event type called event-instance-name
  654. 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="d0e7710"></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
  655. declares a const instance of this event type called event-instance-name
  656. for use in a transition table or state behaviors. The event will have as
  657. attributes the ones passed by the second argument:</p><p><code class="code">BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(Found,FoundDef)</code>
  658. </p><p>The created event instance supports operator()(attributes) so that
  659. </p><pre class="programlisting">my_back_end.process_event(Found(some_string))</pre><p>
  660. is possible.</p></div><div class="refsect3" title="BOOST_MSM_EUML_EVENT_NAME(event-instance-name)"><a name="d0e7724"></a><h4>BOOST_MSM_EUML_EVENT_NAME(event-instance-name)</h4><p>This macro returns the name of the event type generated by
  661. BOOST_MSM_EUML_EVENT or BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES. You need
  662. this where the type is required (usually inside a back-end definition).
  663. For example:</p><p>
  664. </p><pre class="programlisting">typedef msm::back::state_machine&lt;Playing_,
  665. msm::back::ShallowHistory&lt;mpl::vector&lt;BOOST_MSM_EUML_EVENT_NAME(end_pause)
  666. &gt; &gt; &gt; Playing_type;</pre><p>
  667. </p></div><div class="refsect3" title="BOOST_MSM_EUML_STATE(build-expression,state-instance-name)"><a name="d0e7734"></a><h4>BOOST_MSM_EUML_STATE(build-expression,state-instance-name)</h4><p>This macro defines a state type (state-instance-name_helper) and
  668. declares a const instance of this state type called state-instance-name
  669. 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
  670. action, defining some attributes.</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure): state with entry and
  671. exit action, defining some attributes and flags (standard
  672. MSM flags) or deferred events (standard MSM deferred
  673. events).</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure,Base): state with entry
  674. and exit action, defining some attributes, flags and
  675. deferred events (plain msm deferred events) and a
  676. 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="d0e7760"></a><h4>BOOST_MSM_EUML_INTERRUPT_STATE(build-expression,state-instance-name)</h4><p>This macro defines an interrupt state type
  677. (state-instance-name_helper) and declares a const instance of this state
  678. type called state-instance-name for use in a transition table or state
  679. behaviors.</p><p>There are several possibilitites for the expression syntax. In all of
  680. them, the first argument is the name of the event (generated by one of
  681. the previous macros) ending the interrupt:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>(end_interrupt_event): interrupt state without entry or
  682. exit action.</p></li><li class="listitem"><p>(end_interrupt_event,Expr1): interrupt state with entry
  683. but no exit action.</p></li><li class="listitem"><p>(end_interrupt_event,Expr1,Expr2): interrupt state with
  684. entry and exit action.</p></li><li class="listitem"><p>(end_interrupt_event,Expr1,Expr2,Attributes): interrupt
  685. state with entry and exit action, defining some
  686. attributes.</p></li><li class="listitem"><p>(end_interrupt_event,Expr1,Expr2,Attributes,Configure):
  687. interrupt state with entry and exit action, defining some
  688. attributes and flags (standard MSM flags) or deferred events
  689. (standard MSM deferred events).</p></li><li class="listitem"><p>(end_interrupt_event,Expr1,Expr2,Attributes,Configure,Base):
  690. interrupt state with entry and exit action, defining some
  691. attributes, flags and deferred events (plain msm deferred
  692. events) and a non-default base state (as defined in standard
  693. MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_TERMINATE_STATE(build-expression,state-instance-name)"><a name="d0e7786"></a><h4>BOOST_MSM_EUML_TERMINATE_STATE(build-expression,state-instance-name)</h4><p>This macro defines a terminate pseudo-state type
  694. (state-instance-name_helper) and declares a const instance of this state
  695. type called state-instance-name for use in a transition table or state
  696. 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
  697. action.</p></li><li class="listitem"><p>(Expr1): terminate pseudo-state with entry but no exit
  698. action.</p></li><li class="listitem"><p>(Expr1,Expr2): terminate pseudo-state with entry and exit
  699. action.</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes): terminate pseudo-state with
  700. entry and exit action, defining some attributes.</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure): terminate pseudo-state
  701. with entry and exit action, defining some attributes and
  702. flags (standard MSM flags) or deferred events (standard MSM
  703. deferred events).</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure,Base): terminate
  704. pseudo-state with entry and exit action, defining some
  705. attributes, flags and deferred events (plain msm deferred
  706. events) and a non-default base state (as defined in standard
  707. MSM).</p></li></ul></div></div><div class="refsect3" title="BOOST_MSM_EUML_EXIT_STATE(build-expression,state-instance-name)"><a name="d0e7812"></a><h4>BOOST_MSM_EUML_EXIT_STATE(build-expression,state-instance-name)</h4><p>This macro defines an exit pseudo-state type
  708. (state-instance-name_helper) and declares a const instance of this state
  709. type called state-instance-name for use in a transition table or state
  710. 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
  711. action.</p></li><li class="listitem"><p>(forwarded_event,Expr1): exit pseudo-state with entry but
  712. no exit action.</p></li><li class="listitem"><p>(forwarded_event,Expr1,Expr2): exit pseudo-state with
  713. entry and exit action.</p></li><li class="listitem"><p>(forwarded_event,Expr1,Expr2,Attributes): exit
  714. pseudo-state with entry and exit action, defining some
  715. attributes.</p></li><li class="listitem"><p>(forwarded_event,Expr1,Expr2,Attributes,Configure): exit
  716. pseudo-state with entry and exit action, defining some
  717. attributes and flags (standard MSM flags) or deferred events
  718. (standard MSM deferred events).</p></li><li class="listitem"><p>(forwarded_event,Expr1,Expr2,Attributes,Configure,Base):
  719. exit pseudo-state with entry and exit action, defining some
  720. attributes, flags and deferred events (plain msm deferred
  721. events) and a non-default base state (as defined in standard
  722. MSM).</p></li></ul></div><p>Note that the forwarded_event must be constructible from the event
  723. 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="d0e7840"></a><h4>BOOST_MSM_EUML_ENTRY_STATE(int
  724. region-index,build-expression,state-instance-name)</h4><p>This macro defines an entry pseudo-state type
  725. (state-instance-name_helper) and declares a const instance of this state
  726. type called state-instance-name for use in a transition table or state
  727. behaviors.</p><p>There are several possibilitites for the expression syntax:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>(): entry pseudo-state without entry or exit
  728. action.</p></li><li class="listitem"><p>(Expr1): entry pseudo-state with entry but no exit
  729. action.</p></li><li class="listitem"><p>(Expr1,Expr2): entry pseudo-state with entry and exit
  730. action.</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes): entry pseudo-state with entry
  731. and exit action, defining some attributes.</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure): entry pseudo-state
  732. with entry and exit action, defining some attributes and
  733. flags (standard MSM flags) or deferred events (standard MSM
  734. deferred events).</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure,Base): entry
  735. pseudo-state with entry and exit action, defining some
  736. attributes, flags and deferred events (plain msm deferred
  737. events) and a non-default base state (as defined in standard
  738. 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="d0e7866"></a><h4>BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE(int
  739. region-index,build-expression,state-instance-name)</h4><p>This macro defines a submachine's substate type
  740. (state-instance-name_helper), which can be explicitly entered and also
  741. declares a const instance of this state type called state-instance-name
  742. 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
  743. action, defining some attributes.</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure): state with entry and
  744. exit action, defining some attributes and flags (standard
  745. MSM flags) or deferred events (standard MSM deferred
  746. events).</p></li><li class="listitem"><p>(Expr1,Expr2,Attributes,Configure,Base): state with entry
  747. and exit action, defining some attributes, flags and
  748. deferred events (plain msm deferred events) and a
  749. 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="d0e7892"></a><h4>BOOST_MSM_EUML_STATE_NAME(state-instance-name)</h4><p>This macro returns the name of the state type generated by
  750. BOOST_MSM_EUML_STATE or other state macros. You need this where the type
  751. is required (usually using a backend function). For example:</p><p>
  752. </p><pre class="programlisting">fsm.get_state&lt;BOOST_MSM_EUML_STATE_NAME(StringFind)&amp;&gt;().some_state_function();</pre><p>
  753. </p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_STATE(build-expression,state-instance-name)"><a name="d0e7902"></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
  754. type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_INTERRUPT_STATE(build-expression,state-instance-name)"><a name="d0e7907"></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,
  755. simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_TERMINATE_STATE(build-expression,state-instance-name)"><a name="d0e7912"></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,
  756. simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_EXIT_STATE(build-expression,state-instance-name)"><a name="d0e7917"></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,
  757. 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="d0e7922"></a><h4>BOOST_MSM_EUML_DECLARE_ENTRY_STATE(int
  758. region-index,build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_ENTRY_STATE but does not provide an instance,
  759. 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="d0e7927"></a><h4>BOOST_MSM_EUML_DECLARE_EXPLICIT_ENTRY_STATE(int
  760. region-index,build-expression,state-instance-name)</h4><p>Like BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE but does not provide an
  761. instance, simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_TRANSITION_TABLE(expression, table-instance-name)"><a name="d0e7932"></a><h4>BOOST_MSM_EUML_TRANSITION_TABLE(expression,
  762. table-instance-name)</h4><p>This macro declares a transition table type and also declares a const
  763. instance of the table which can then be used in a state machine
  764. declaration (see BOOST_MSM_EUML_DECLARE_STATE_MACHINE).The expression
  765. must follow the <span class="command"><strong><a class="command" href="re03.html#reference-stt-grammar">transition
  766. table grammar</a></strong></span>.</p></div><div class="refsect3" title="BOOST_MSM_EUML_DECLARE_TRANSITION_TABLE(iexpression,table-instance-name)"><a name="d0e7940"></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,
  767. simply a type declaration.</p></div><div class="refsect3" title="BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expression, table-instance-name)"><a name="d0e7945"></a><h4>BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expression,
  768. table-instance-name)</h4><p>This macro declares a transition table type and also declares a const
  769. instance of the table.The expression must follow the <span class="command"><strong><a class="command" href="re03.html#reference-stt-grammar">transition table
  770. 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="d0e7953"></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,
  771. simply a type declaration. This is currently the only way to declare an
  772. internal transition table with eUML. For example:</p><pre class="programlisting">BOOST_MSM_EUML_DECLARE_STATE((Open_Entry,Open_Exit),Open_def)
  773. struct Open_impl : public Open_def
  774. {
  775. BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE((
  776. open_close [internal_guard1] / internal_action1 ,
  777. open_close [internal_guard2] / internal_action2
  778. ))
  779. }; </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>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right">&nbsp;</td></tr><tr><td width="40%" align="left" valign="top">Back-end&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;</td></tr></table></div></body></html>