Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/statechart/doc/reference.html @ 33

Last change on this file since 33 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 126.6 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3<html>
4<head>
5  <meta http-equiv="Content-Language" content="en-us">
6  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
7  <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
8  <meta name="ProgId" content="FrontPage.Editor.Document">
9  <link rel="stylesheet" type="text/css" href="../../../boost.css">
10
11  <title>The Boost Statechart Library - Reference</title>
12</head>
13
14<body link="#0000FF" vlink="#800080">
15  <table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
16  "header">
17    <tr>
18      <td valign="top" width="300">
19        <h3><a href="../../../index.htm"><img alt="C++ Boost" src=
20        "../../../boost.png" border="0" width="277" height="86"></a></h3>
21      </td>
22
23      <td valign="top">
24        <h1 align="center">The Boost Statechart Library</h1>
25
26        <h2 align="center">Reference</h2>
27      </td>
28    </tr>
29  </table>
30  <hr>
31
32  <h2>Contents</h2>
33
34  <dl class="page-index">
35    <dt><a href="#Concepts">Concepts</a></dt>
36
37    <dd><a href="#Scheduler">Scheduler</a></dd>
38
39    <dd><a href="#FifoWorker">FifoWorker</a></dd>
40
41    <dd><a href="#ExceptionTranslator">ExceptionTranslator</a></dd>
42
43    <dd><a href="#StateBase">StateBase</a></dd>
44
45    <dd><a href="#SimpleState">SimpleState</a></dd>
46
47    <dd><a href="#State">State</a></dd>
48
49    <dd><a href="#Event">Event</a></dd>
50
51    <dt><a href="#state_machine.hpp">state_machine.hpp</a></dt>
52
53    <dd><a href="#ClassTemplatestate_machine">Class template
54    <code>state_machine</code></a></dd>
55
56    <dt><a href=
57    "#asynchronous_state_machine.hpp">asynchronous_state_machine.hpp</a></dt>
58
59    <dd><a href="#ClassTemplateasynchronous_state_machine">Class template
60    <code>asynchronous_state_machine</code></a></dd>
61
62    <dt><a href="#event_processor.hpp">event_processor.hpp</a></dt>
63
64    <dd><a href="#ClassTemplateevent_processor">Class template
65    <code>event_processor</code></a></dd>
66
67    <dt><a href="#fifo_scheduler.hpp">fifo_scheduler.hpp</a></dt>
68
69    <dd><a href="#ClassTemplatefifo_scheduler">Class template
70    <code>fifo_scheduler</code></a></dd>
71
72    <dt><a href="#exception_translator.hpp">exception_translator.hpp</a></dt>
73
74    <dd><a href="#ClassTemplateexception_translator">Class template
75    <code>exception_translator</code></a></dd>
76
77    <dt><a href=
78    "#null_exception_translator.hpp">null_exception_translator.hpp</a></dt>
79
80    <dd><a href="#Classnull_exception_translator">Class
81    <code>null_exception_translator</code></a></dd>
82
83    <dt>&nbsp;</dt>
84
85    <dt><a href="#simple_state.hpp">simple_state.hpp</a></dt>
86
87    <dd><a href="#Enumhistory_mode">Enum <code>history_mode</code></a></dd>
88
89    <dd><a href="#ClassTemplatesimple_state">Class template
90    <code>simple_state</code></a></dd>
91
92    <dt><a href="#state.hpp">state.hpp</a></dt>
93
94    <dd><a href="#ClassTemplatestate">Class template
95    <code>state</code></a></dd>
96
97    <dt><a href="#shallow_history.hpp">shallow_history.hpp</a></dt>
98
99    <dd><a href="#ClassTemplateshallow_history">Class template
100    <code>shallow_history</code></a></dd>
101
102    <dt><a href="#deep_history.hpp">deep_history.hpp</a></dt>
103
104    <dd><a href="#ClassTemplatedeep_history">Class template
105    <code>deep_history</code></a></dd>
106
107    <dt>&nbsp;</dt>
108
109    <dt><a href="#event_base.hpp">event_base.hpp</a></dt>
110
111    <dd><a href="#Classevent_base">Class <code>event_base</code></a></dd>
112
113    <dt><a href="#event.hpp">event.hpp</a></dt>
114
115    <dd><a href="#ClassTemplateevent">Class template
116    <code>event</code></a></dd>
117
118    <dt>&nbsp;</dt>
119
120    <dt><a href="#transition.hpp">transition.hpp</a></dt>
121
122    <dd><a href="#ClassTemplatetransition">Class template
123    <code>transition</code></a></dd>
124
125    <dt><a href="#in_state_reaction.hpp">in_state_reaction.hpp</a></dt>
126
127    <dd><a href="#ClassTemplatein_state_reaction">Class template
128    in_state_reaction</a></dd>
129
130    <dt><a href="#termination.hpp">termination.hpp</a></dt>
131
132    <dd><a href="#ClassTemplatetermination">Class template
133    <code>termination</code></a></dd>
134
135    <dt><a href="#deferral.hpp">deferral.hpp</a></dt>
136
137    <dd><a href="#ClassTemplatedeferral">Class template
138    <code>deferral</code></a></dd>
139
140    <dt><a href="#custom_reaction.hpp">custom_reaction.hpp</a></dt>
141
142    <dd><a href="#ClassTemplatecustom_reaction">Class template
143    <code>custom_reaction</code></a></dd>
144
145    <dt><a href="#result.hpp">result.hpp</a></dt>
146
147    <dd><a href="#Classresult">Class <code>result</code></a></dd>
148  </dl>
149  <hr>
150
151  <h1><a name="Concepts" id="Concepts">Concepts</a></h1>
152
153  <h2><a name="Scheduler" id="Scheduler">Scheduler</a> concept</h2>
154
155  <p>A Scheduler type defines the following:</p>
156
157  <ul>
158    <li>What is passed to the constructors of <code><a href=
159    "#ClassTemplateevent_processor">event_processor&lt;&gt;</a></code>
160    subtypes and how the lifetime of such objects is managed</li>
161
162    <li>Whether or not multiple <code>event_processor&lt;&gt;</code> subtype
163    objects can share the same queue and scheduler thread</li>
164
165    <li>How events are added to the schedulers' queue</li>
166
167    <li>Whether and how to wait for new events when the schedulers' queue
168    runs empty</li>
169
170    <li>Whether and what type of locking is used to ensure thread-safety</li>
171
172    <li>Whether it is possible to queue events for no longer existing
173    <code>event_processor&lt;&gt;</code> subtype objects and what happens
174    when such an event is processed</li>
175
176    <li>What happens when one of the serviced
177    <code>event_processor&lt;&gt;</code> subtype objects propagates an
178    exception</li>
179  </ul>
180
181  <p>For a Scheduler type <code>S</code> and an object <code>cpc</code> of
182  type <code>const S::processor_context</code> the following expressions must
183  be well-formed and have the indicated results:</p>
184
185  <table border="3" cellpadding="2" width="100%" summary="Scheduler concept">
186    <tr>
187      <td width="24%"><b>Expression</b></td>
188
189      <td width="25%"><b>Type</b></td>
190
191      <td width="48%"><b>Result</b></td>
192    </tr>
193
194    <tr>
195      <td width="24%"><code>cpc.my_scheduler()</code></td>
196
197      <td width="25%"><code>S &amp;</code></td>
198
199      <td width="48%">A reference to the scheduler</td>
200    </tr>
201
202    <tr>
203      <td width="24%"><code>cpc.my_handle()</code></td>
204
205      <td width="25%"><code>S::processor_handle</code></td>
206
207      <td width="48%">The handle identifying the
208      <code>event_processor&lt;&gt;</code> subtype object</td>
209    </tr>
210  </table>
211
212  <p>To protect against abuse, all members of
213  <code>S::processor_context</code> should be declared private. As a result,
214  <code>event_processor&lt;&gt;</code> must be a friend of
215  <code>S::processor_context</code>.</p>
216
217  <h2><a name="FifoWorker" id="FifoWorker">FifoWorker</a> concept</h2>
218
219  <p>A FifoWorker type defines the following:</p>
220
221  <ul>
222    <li>Whether and how to wait for new work items when the internal work
223    queue runs empty</li>
224
225    <li>Whether and what type of locking is used to ensure thread-safety</li>
226  </ul>
227
228  <p>For a FifoWorker type <code>F</code>, an object <code>f</code> of that
229  type, a <code>const</code> object <code>cf</code> of that type, a
230  parameterless function object <code>w</code> of arbitrary type and an
231  <code>unsigned long</code> value <code>n</code> the following
232  expressions/statements must be well-formed and have the indicated
233  results:</p>
234
235  <table border="3" cellpadding="2" width="100%" summary=
236  "FifoWorker concept">
237    <tr>
238      <td width="36%"><b>Expression/Statement</b></td>
239
240      <td width="10%"><b>Type</b></td>
241
242      <td width="52%"><b>Effects/Result</b></td>
243    </tr>
244
245    <tr>
246      <td width="36%"><code>F::work_item</code></td>
247
248      <td width="10%"><code>boost::function0&lt;<br>
249      &nbsp; void &gt;</code></td>
250
251      <td width="52%">&nbsp;</td>
252    </tr>
253
254    <tr>
255      <td width="36%"><code>F()</code> or <code>F( false )</code></td>
256
257      <td width="10%"><code>F</code></td>
258
259      <td width="52%">Constructs a <b>non-blocking</b> (see below) object of
260      the FifoWorker type. In single-threaded builds the second expression is
261      not well-formed</td>
262    </tr>
263
264    <tr>
265      <td width="36%"><code>F( true )</code></td>
266
267      <td width="10%"><code>F</code></td>
268
269      <td width="52%">Constructs a <b>blocking</b> (see below) object of the
270      FifoWorker type. Not well-formed in single-threaded builds</td>
271    </tr>
272
273    <tr>
274      <td width="36%"><code>f.queue_work_item( w );</code></td>
275
276      <td width="10%">&nbsp;</td>
277
278      <td width="52%">Constructs and queues an object of type
279      <code>F::work_item</code>, passing <code>w</code> as the only
280      argument</td>
281    </tr>
282
283    <tr>
284      <td width="36%"><code>f.terminate();</code></td>
285
286      <td width="10%">&nbsp;</td>
287
288      <td width="52%">Creates and queues an object of type
289      <code>F::work_item</code> that, when later executed in
290      <code>operator()()</code>, leads to a modification of internal state so
291      that <code>terminated()</code> henceforth returns
292      <code>true</code></td>
293    </tr>
294
295    <tr>
296      <td width="36%"><code>cf.terminated();</code></td>
297
298      <td width="10%"><code>bool</code></td>
299
300      <td width="52%"><code>true</code> if <code>terminate()</code> has been
301      called and the resulting work item has been executed in
302      <code>operator()()</code>. Returns <code>false</code> otherwise<br>
303      <br>
304      <b>Must only be called from the thread that also calls
305      <code>operator()()</code></b></td>
306    </tr>
307
308    <tr>
309      <td width="36%"><code>f( n );</code></td>
310
311      <td width="10%"><code>unsigned long</code></td>
312
313      <td width="52%">
314        Enters a loop that, with each cycle, dequeues and calls
315        <code>operator()()</code> on the oldest work item in the queue.
316
317        <p>The loop is left and the number of executed work items returned if
318        one or more of the following conditions are met:</p>
319
320        <ul>
321          <li><code>f.terminated() == true</code></li>
322
323          <li>The application is single-threaded and the internal queue is
324          empty</li>
325
326          <li>The application is multi-threaded and the internal queue is
327          empty and the worker was created as non-blocking</li>
328
329          <li><code>n != 0</code> and the number of work items that have been
330          processed since <code>operator()()</code> was called equals
331          <code>n</code></li>
332        </ul>
333
334        <p>If the queue is empty and none of the above conditions are met
335        then the thread calling <code>operator()()</code> is put into a wait
336        state until <code>f.queue_work_item()</code> is called from another
337        thread.<br>
338        <br>
339        <b>Must only be called from exactly one thread</b></p>
340      </td>
341    </tr>
342
343    <tr>
344      <td width="36%"><code>f();</code></td>
345
346      <td width="10%"><code>unsigned long</code></td>
347
348      <td width="52%">Has exactly the same semantics as <code>f( n );</code>
349      with <code>n == 0</code> (see above)</td>
350    </tr>
351  </table>
352
353  <h2><a name="ExceptionTranslator" id=
354  "ExceptionTranslator">ExceptionTranslator</a> concept</h2>
355
356  <p>An ExceptionTranslator type defines how C++ exceptions occurring during
357  state machine operation are translated to exception events.</p>
358
359  <p>For an ExceptionTranslator object <code>et</code>, a parameterless
360  function object <code>a</code> of arbitrary type returning <code><a href=
361  "#Classresult">result</a></code> and a function object <code>eh</code> of
362  arbitrary type taking a <code>const <a href=
363  "#Classevent_base">event_base</a> &amp;</code> parameter and returning
364  <code><a href="#Classresult">result</a></code> the following expression
365  must be well-formed and have the indicated results:</p>
366
367  <table border="3" cellpadding="2" width="100%" summary=
368  "ExceptionTranslator concept">
369    <tr>
370      <td width="299"><b>Expression</b></td>
371
372      <td width="101"><b>Type</b></td>
373
374      <td width="1129"><b>Effects/Result</b></td>
375    </tr>
376
377    <tr>
378      <td width="299"><code>et( a, eh );</code></td>
379
380      <td width="101"><code>result</code></td>
381
382      <td width="1129">
383        <ol>
384          <li>Attempts to execute <code>return a();</code></li>
385
386          <li>If <code>a()</code> propagates an exception, the exception is
387          caught</li>
388
389          <li>Inside the catch block calls <code>eh</code>, passing a
390          suitable stack-allocated model of the <a href="#Event">Event</a>
391          concept</li>
392
393          <li>Returns the result returned by <code>eh</code></li>
394        </ol>
395      </td>
396    </tr>
397  </table>
398
399  <h2><a name="StateBase" id="StateBase">StateBase</a> concept</h2>
400
401  <p>A StateBase type is the common base of all states of a given state
402  machine type. <code>state_machine&lt;&gt;::state_base_type</code> is a
403  model of the StateBase concept.</p>
404
405  <p>For a StateBase type <code>S</code> and a <code>const</code> object
406  <code>cs</code> of that type the following expressions must be well-formed
407  and have the indicated results:</p>
408
409  <table border="3" cellpadding="2" width="100%" summary="StateBase concept">
410    <tr>
411      <td width="26%"><b>Expression</b></td>
412
413      <td width="12%"><b>Type</b></td>
414
415      <td width="60%"><b>Result</b></td>
416    </tr>
417
418    <tr>
419      <td width="26%"><code>cs.outer_state_ptr()</code></td>
420
421      <td width="12%"><code>const S *</code></td>
422
423      <td width="60%"><code>0</code> if <code>cs</code> is an <a href=
424      "definitions.html#OutermostState">outermost state</a>, a pointer to the
425      direct outer state of <code>cs</code> otherwise</td>
426    </tr>
427
428    <tr>
429      <td width="25%"><code>cs.dynamic_type()</code></td>
430
431      <td width="12%"><code>S::id_type</code></td>
432
433      <td width="60%">A value unambiguously identifying the most-derived type
434      of <code>cs</code>. <code>S::id_type</code> values are comparable with
435      <code>operator==()</code> and <code>operator!=()</code>. An unspecified
436      collating order can be established with <code>std::less&lt; S::id_type
437      &gt;</code>. In contrast to <code>typeid( cs )</code>, this function is
438      available even on platforms that do not support C++ RTTI (or have been
439      configured to not support it)</td>
440    </tr>
441
442    <tr>
443      <td width="25%"><code>cs.custom_dynamic_type_ptr&lt;<br>
444      &nbsp; Type &gt;()</code></td>
445
446      <td width="12%"><code>const Type *</code></td>
447
448      <td width="60%">A pointer to the custom type identifier or
449      <code>0</code>. If <code>!= 0</code>, <code>Type</code> must match the
450      type of the previously set pointer. This function is only available if
451      <a href=
452      "configuration.html#ApplicationDefinedMacros">BOOST_STATECHART_USE_NATIVE_RTTI</a>
453      is not defined</td>
454    </tr>
455  </table>
456
457  <h2><a name="SimpleState" id="SimpleState">SimpleState</a> concept</h2>
458
459  <p>A SimpleState type defines one state of a particular state machine.</p>
460
461  <p>For a SimpleState type <code>S</code> and a pointer <code>pS</code>
462  pointing to an object of type <code>S</code> allocated with
463  <code>new</code> the following expressions/statements must be well-formed
464  and have the indicated effects/results:</p>
465
466  <table border="3" cellpadding="2" width="100%" summary=
467  "SimpleState concept">
468    <tr>
469      <td width="28%"><b>Expression/Statement</b></td>
470
471      <td width="29%"><b>Type</b></td>
472
473      <td width="42%"><b>Effects/Result/Notes</b></td>
474    </tr>
475
476    <tr>
477      <td width="28%"><code><a href=
478      "#ClassTemplatesimple_state">simple_state</a>&lt;<br>
479      &nbsp; S, C, I, h &gt; * pB =<br>
480      &nbsp;&nbsp;&nbsp; pS;</code></td>
481
482      <td width="29%">&nbsp;</td>
483
484      <td width="42%"><code>simple_state&lt; S, C, I, h &gt;</code> must be
485      an unambiguous public base of <code>S</code>. See <code><a href=
486      "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code>
487      documentation for the requirements and semantics of <code>C</code>,
488      <code>I</code> and <code>h</code></td>
489    </tr>
490
491    <tr>
492      <td width="28%"><code>new S()</code></td>
493
494      <td width="29%"><code>S *</code></td>
495
496      <td width="42%">Enters the state <code>S</code>. Certain functions must
497      not be called from <code>S::S()</code>, see <a href=
498      "#ClassTemplatesimple_state"><code>simple_state&lt;&gt;</code></a>
499      documentation for more information</td>
500    </tr>
501
502    <tr>
503      <td width="28%"><code>pS-&gt;exit();</code></td>
504
505      <td width="29%">&nbsp;</td>
506
507      <td width="42%">Exits the state <code>S</code> (first stage). The
508      definition of an <code>exit</code> member function within models of the
509      SimpleState concept is optional since <code>simple_state&lt;&gt;</code>
510      already defines the following public member: <code>void exit()
511      {}</code>. <code>exit()</code> is not called when a state is exited
512      while an exception is pending, see <code><a href=
513      "#simple_state::terminate">simple_state&lt;&gt;::terminate()</a></code>
514      for more information</td>
515    </tr>
516
517    <tr>
518      <td width="28%"><code>delete pS;</code></td>
519
520      <td width="29%">&nbsp;</td>
521
522      <td width="42%">Exits the state <code>S</code> (second stage)</td>
523    </tr>
524
525    <tr>
526      <td width="28%"><code>S::reactions</code></td>
527
528      <td width="29%">An <code>mpl::list&lt;&gt;</code> that is either empty
529      or contains instantiations of the <code><a href=
530      "#ClassTemplatecustom_reaction">custom_reaction</a></code>,
531      <code><a href=
532      "#ClassTemplatein_state_reaction">in_state_reaction</a></code>,
533      <code><a href="#ClassTemplatedeferral">deferral</a></code>,
534      <code><a href="#ClassTemplatetermination">termination</a></code> or
535      <code><a href="#ClassTemplatetransition">transition</a></code> class
536      templates. If there is only a single reaction then it can also be
537      <code>typedef</code>ed directly, without wrapping it into an
538      <code>mpl::list&lt;&gt;</code></td>
539
540      <td width="42%">The declaration of a <code>reactions</code> member
541      <code>typedef</code> within models of the SimpleState concept is
542      optional since <code>simple_state&lt;&gt;</code> already defines the
543      following public member: <code>typedef mpl::list&lt;&gt;
544      reactions;</code></td>
545    </tr>
546  </table>
547
548  <h2><a name="State" id="State">State</a> concept</h2>
549
550  <p>A State is a <b>refinement</b> of <a href="#SimpleState">SimpleState</a>
551  (that is, except for the default constructor a State type must also satisfy
552  SimpleState requirements). For a State type <code>S</code>, a pointer
553  <code>pS</code> of type <code>S *</code> pointing to an object of type
554  <code>S</code> allocated with <code>new</code>, and an object
555  <code>mc</code> of type <code>state&lt; S, C, I, h
556  &gt;</code><code>::my_context</code> the following expressions/statements
557  must be well-formed:</p>
558
559  <table border="3" cellpadding="2" width="100%" summary="State concept">
560    <tr>
561      <td width="28%"><b>Expression/Statement</b></td>
562
563      <td width="29%"><b>Type</b></td>
564
565      <td width="42%"><b>Effects/Result/Notes</b></td>
566    </tr>
567
568    <tr>
569      <td width="28%"><code><a href="#ClassTemplatestate">state</a>&lt; S, C,
570      I, h &gt; *<br>
571      &nbsp; pB = pS;</code></td>
572
573      <td width="29%">&nbsp;</td>
574
575      <td width="42%"><code>state&lt; S, C, I, h &gt;</code> must be an
576      unambiguous public base of <code>S</code>. See <code><a href=
577      "#ClassTemplatestate">state&lt;&gt;</a></code> documentation for the
578      requirements and semantics of <code>C</code>, <code>I</code> and
579      <code>h</code></td>
580    </tr>
581
582    <tr>
583      <td width="28%"><code>new S( mc )</code></td>
584
585      <td width="29%"><code>S *</code></td>
586
587      <td width="42%">Enters the state <code>S</code>. No restrictions exist
588      regarding the functions that can be called from <code>S::S()</code> (in
589      contrast to the constructors of models of the SimpleState concept).
590      <code>mc</code> must be forwarded to <code>state&lt; S, C, I, h
591      &gt;::state()</code></td>
592    </tr>
593  </table>
594
595  <h2><a name="Event" id="Event">Event</a> concept</h2>
596
597  <p>A Event type defines an event for which state machines can define
598  reactions.</p>
599
600  <p>For a Event type <code>E</code> and a pointer <code>pCE</code> of type
601  <code>const E *</code> pointing to an object of type <code>E</code>
602  allocated with <code>new</code> the following expressions/statements must
603  be well-formed and have the indicated effects/results:</p>
604
605  <table border="3" cellpadding="2" width="100%" summary="Event concept">
606    <tr>
607      <td width="28%"><b>Expression/Statement</b></td>
608
609      <td width="29%"><b>Type</b></td>
610
611      <td width="42%"><b>Effects/Result/Notes</b></td>
612    </tr>
613
614    <tr>
615      <td width="28%"><code>const <a href="#ClassTemplateevent">event</a>&lt;
616      E &gt; * pCB = pCE;</code></td>
617
618      <td width="29%">&nbsp;</td>
619
620      <td width="42%"><code>event&lt; E &gt;</code> must be an unambiguous
621      public base of <code>E</code></td>
622    </tr>
623
624    <tr>
625      <td width="28%"><code>new E( *pCE )</code></td>
626
627      <td width="29%"><code>E *</code></td>
628
629      <td width="42%">Makes a copy of <code>pE</code></td>
630    </tr>
631  </table>
632
633  <h1>Header &lt;boost/statechart/<a name="state_machine.hpp" id=
634  "state_machine.hpp">state_machine.hpp</a>&gt;</h1>
635
636  <h2><a name="ClassTemplatestate_machine" id=
637  "ClassTemplatestate_machine">Class template
638  <code>state_machine</code></a></h2>
639
640  <p>This is the base class template of all synchronous state machines.</p>
641
642  <h3>Class template <code>state_machine</code> parameters</h3>
643
644  <table border="3" cellpadding="2" width="100%" summary=
645  "state_machine parameters">
646    <tr>
647      <td width="15%"><b>Template parameter</b></td>
648
649      <td width="51%"><b>Requirements</b></td>
650
651      <td width="18%"><b>Semantics</b></td>
652
653      <td width="19%"><b>Default</b></td>
654    </tr>
655
656    <tr>
657      <td width="15%"><code>MostDerived</code></td>
658
659      <td width="51%">The most-derived subtype of this class template</td>
660
661      <td width="18%">&nbsp;</td>
662
663      <td width="19%">&nbsp;</td>
664    </tr>
665
666    <tr>
667      <td width="15%"><code>InitialState</code></td>
668
669      <td width="51%">A model of the <a href="#SimpleState">SimpleState</a>
670      or <a href="#State">State</a> concepts. The <code>Context</code>
671      argument passed to the <code><a href=
672      "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code> or
673      <code><a href="#ClassTemplatestate">state&lt;&gt;</a></code> base
674      of&nbsp; <code>InitialState</code> must be <code>MostDerived</code>.
675      That is, <code>InitialState</code> must be an <a href=
676      "definitions.html#OutermostState">outermost state</a> of this state
677      machine</td>
678
679      <td width="18%">The state that is entered when
680      <code>state_machine&lt;&gt;<br>
681      ::initiate()</code> is called</td>
682
683      <td width="19%">&nbsp;</td>
684    </tr>
685
686    <tr>
687      <td width="15%"><code>Allocator</code></td>
688
689      <td width="51%">A model of the standard Allocator concept</td>
690
691      <td width="18%"><code>Allocator::rebind&lt;&gt;::other</code> is used
692      to allocate and deallocate all <code>simple_state</code> subtype
693      objects and internal objects of dynamic storage duration</td>
694
695      <td width="19%"><code>std::allocator&lt; void &gt;</code></td>
696    </tr>
697
698    <tr>
699      <td width="15%"><code>ExceptionTranslator</code></td>
700
701      <td width="51%">A model of the ExceptionTranslator concept</td>
702
703      <td width="18%">see <a href=
704      "#ExceptionTranslator">ExceptionTranslator</a> concept</td>
705
706      <td width="19%"><code>null_exception_translator</code></td>
707    </tr>
708  </table>
709
710  <h3>Class template <code>state_machine</code> synopsis</h3>
711  <pre>
712namespace boost
713{
714namespace statechart
715{
716  template&lt;
717    class MostDerived,
718    class InitialState,
719    class Allocator = std::allocator&lt; void &gt;,
720    class ExceptionTranslator = null_exception_translator &gt;
721  class state_machine : noncopyable
722  {
723    public:
724      typedef MostDerived outermost_context_type;
725
726      void <a href="#initiate">initiate</a>();
727      void <a href="#terminate">terminate</a>();
728      bool <a href="#terminated">terminated</a>() const;
729
730      void <a href="#process_event">process_event</a>( const <a href=
731"#Classevent_base">event_base</a> &amp; );
732
733      template&lt; class Target &gt;
734      Target <a href="#state_cast">state_cast</a>() const;
735      template&lt; class Target &gt;
736      Target <a href="#state_downcast">state_downcast</a>() const;
737
738      // a model of the <a href="#StateBase">StateBase</a> concept
739      typedef <i>implementation-defined</i> state_base_type;
740      // a model of the standard Forward Iterator concept
741      typedef <i>implementation-defined</i> state_iterator;
742
743      state_iterator <a href="#state_begin">state_begin</a>() const;
744      state_iterator <a href="#state_end">state_end</a>() const;
745
746      void <a href="#unconsumed_event">unconsumed_event</a>( const <a href=
747"#Classevent_base">event_base</a> &amp; ) {}
748
749    protected:
750      <a href="#state_machine">state_machine</a>();
751      <a href="#state_machinedtor">~state_machine</a>();
752
753      void <a href="#post_event2">post_event</a>(
754        const intrusive_ptr&lt; const <a href=
755"#Classevent_base">event_base</a> &gt; &amp; );
756      void <a href="#post_event3">post_event</a>( const <a href=
757"#Classevent_base">event_base</a> &amp; );
758  };
759}
760}
761</pre>
762
763  <h3>Class template <code>state_machine</code> constructor and
764  destructor</h3>
765  <pre>
766<a name="state_machine" id="state_machine">state_machine</a>();
767</pre>
768
769  <p><b>Effects</b>: Constructs a non-running state machine</p>
770  <pre>
771<a name="state_machinedtor" id="state_machinedtor">~state_machine</a>();
772</pre>
773
774  <p><b>Effects</b>: Destructs the currently active outermost state and all
775  its direct and indirect inner states. Innermost states are destructed
776  first. Other states are destructed as soon as all their direct and indirect
777  inner states have been destructed. The inner states of each state are
778  destructed according to the number of their orthogonal region. The state in
779  the orthogonal region with the highest number is always destructed first,
780  then the state in the region with the second-highest number and so on<br>
781  <b>Note</b>: Does not attempt to call any <code>exit</code> member
782  functions</p>
783
784  <h3>Class template <code>state_machine</code> modifier functions</h3>
785  <pre>
786void <a name="initiate" id="initiate">initiate</a>();
787</pre>
788
789  <p><b>Effects</b>:</p>
790
791  <ol>
792    <li>Calls <code>terminate()</code></li>
793
794    <li>Constructs a function object <code>action</code> with a
795    parameter-less <code>operator()()</code> returning <code><a href=
796    "#Classresult">result</a></code> that
797
798      <ol type="a">
799        <li>enters (constructs) the state specified with the
800        <code>InitialState</code> template parameter</li>
801
802        <li>enters the tree formed by the direct and indirect inner initial
803        states of <code>InitialState</code> depth first. The inner states of
804        each state are entered according to the number of their orthogonal
805        region. The state in orthogonal region 0 is always entered first,
806        then the state in region 1 and so on</li>
807      </ol>
808    </li>
809
810    <li>Constructs a function object <code>exceptionEventHandler</code> with
811    an <code>operator()()</code> returning <code>result</code> and accepting
812    an exception event parameter that processes the passed exception event,
813    with the following differences to the processing of normal events:
814
815      <ul type="disc">
816        <li>From the moment when the exception has been thrown until right
817        after the execution of the exception event reaction, states that need
818        to be exited are only destructed but no <code>exit</code> member
819        functions are called</li>
820
821        <li><a href="definitions.html#Reaction">Reaction</a> search always
822        starts with the outermost <a href=
823        "definitions.html#UnstableState">unstable state</a></li>
824
825        <li>As for normal events, reaction search moves outward when the
826        current state cannot handle the event. However, if there is no outer
827        state (an <a href="definitions.html#OutermostState">outermost
828        state</a> has been reached) the reaction search is considered
829        unsuccessful. That is, exception events will never be dispatched to
830        orthogonal regions other than the one that caused the exception
831        event</li>
832
833        <li>Should an exception be thrown during exception event reaction
834        search or reaction execution then the exception is propagated out of
835        the <code>exceptionEventHandler</code> function object (that is,
836        <code>ExceptionTranslator</code> is <b>not</b> used to translate
837        exceptions thrown while processing an exception event)</li>
838
839        <li>If no reaction could be found for the exception event or if the
840        state machine is not stable after processing the exception event, the
841        original exception is rethrown. Otherwise, a <code><a href=
842        "#Classresult">result</a></code> object is returned equal to the one
843        returned by <code>simple_state&lt;&gt;::discard_event()</code></li>
844      </ul>
845    </li>
846
847    <li>Passes <code>action</code> and <code>exceptionEventHandler</code> to
848    <code>ExceptionTranslator::operator()()</code>. If
849    <code>ExceptionTranslator::operator()()</code> throws an exception, the
850    exception is propagated to the caller. If the caller catches the
851    exception, the currently active outermost state and all its direct and
852    indirect inner states are destructed. Innermost states are destructed
853    first. Other states are destructed as soon as all their direct and
854    indirect inner states have been destructed. The inner states of each
855    state are destructed according to the number of their orthogonal region.
856    The state in the orthogonal region with the highest number is always
857    destructed first, then the state in the region with the second-highest
858    number and so on. Continues with step 5 otherwise (the return value is
859    discarded)</li>
860
861    <li>Processes all posted events (see <code>process_event()</code>).
862    Returns to the caller if there are no more posted events</li>
863  </ol>
864
865  <p><b>Throws</b>: Any exceptions propagated from
866  <code>ExceptionTranslator::operator()()</code>. Exceptions never originate
867  in the library itself but only in code supplied through template
868  parameters:</p>
869
870  <ul>
871    <li><code>Allocator::rebind&lt;&gt;::other::allocate()</code></li>
872
873    <li>state constructors</li>
874
875    <li><code>react</code> member functions</li>
876
877    <li><code>exit</code> member functions</li>
878
879    <li>transition-actions</li>
880  </ul>
881  <pre>
882void <a name="terminate" id="terminate">terminate</a>();
883</pre>
884
885  <p><b>Effects</b>:</p>
886
887  <ol>
888    <li>Constructs a function object <code>action</code> with a
889    parameter-less <code>operator()()</code> returning <code><a href=
890    "#Classresult">result</a></code> that <a href=
891    "#simple_state::terminate">terminates</a> the currently active outermost
892    state, discards all remaining events and clears all history
893    information</li>
894
895    <li>Constructs a function object <code>exceptionEventHandler</code> with
896    an <code>operator()()</code> returning <code><a href=
897    "#Classresult">result</a></code> and accepting an exception event
898    parameter that processes the passed exception event, with the following
899    differences to the processing of normal events:
900
901      <ul type="disc">
902        <li>From the moment when the exception has been thrown until right
903        after the execution of the exception event reaction, states that need
904        to be exited are only destructed but no <code>exit</code> member
905        functions are called</li>
906
907        <li><a href="definitions.html#Reaction">Reaction</a> search always
908        starts with the outermost <a href=
909        "definitions.html#UnstableState">unstable state</a></li>
910
911        <li>As for normal events, reaction search moves outward when the
912        current state cannot handle the event. However, if there is no outer
913        state (an <a href="definitions.html#OutermostState">outermost
914        state</a> has been reached) the reaction search is considered
915        unsuccessful. That is, exception events will never be dispatched to
916        orthogonal regions other than the one that caused the exception
917        event</li>
918
919        <li>Should an exception be thrown during exception event reaction
920        search or reaction execution then the exception is propagated out of
921        the <code>exceptionEventHandler</code> function object (that is,
922        <code>ExceptionTranslator</code> is <b>not</b> used to translate
923        exceptions thrown while processing an exception event)</li>
924
925        <li>If no reaction could be found for the exception event or if the
926        state machine is not stable after processing the exception event, the
927        original exception is rethrown. Otherwise, a <code><a href=
928        "#Classresult">result</a></code> object is returned equal to the one
929        returned by <code>simple_state&lt;&gt;::discard_event()</code></li>
930      </ul>
931    </li>
932
933    <li>Passes <code>action</code> and <code>exceptionEventHandler</code> to
934    <code>ExceptionTranslator::operator()()</code>. If
935    <code>ExceptionTranslator::operator()()</code> throws an exception, the
936    exception is propagated to the caller. If the caller catches the
937    exception, the currently active outermost state and all its direct and
938    indirect inner states are destructed. Innermost states are destructed
939    first. Other states are destructed as soon as all their direct and
940    indirect inner states have been destructed. The inner states of each
941    state are destructed according to the number of their orthogonal region.
942    The state in the orthogonal region with the highest number is always
943    destructed first, then the state in the region with the second-highest
944    number and so on. Otherwise, returns to the caller</li>
945  </ol>
946
947  <p><b>Throws</b>: Any exceptions propagated from
948  <code>ExceptionTranslator::operator()</code>. Exceptions never originate in
949  the library itself but only in code supplied through template
950  parameters:</p>
951
952  <ul>
953    <li><code>Allocator::rebind&lt;&gt;::other::allocate()</code></li>
954
955    <li>state constructors</li>
956
957    <li><code>react</code> member functions</li>
958
959    <li><code>exit</code> member functions</li>
960
961    <li>transition-actions</li>
962  </ul>
963  <pre>
964void <a name="process_event" id=
965"process_event">process_event</a>( const <a href=
966"#Classevent_base">event_base</a> &amp; );
967</pre>
968
969  <p><b>Effects</b>:</p>
970
971  <ol>
972    <li>Selects the passed event as the current event (henceforth referred to
973    as <code>currentEvent</code>)</li>
974
975    <li>Starts a new <a href="definitions.html#Reaction">reaction</a>
976    search</li>
977
978    <li>Selects an arbitrary but in this reaction search not yet visited
979    state from all the currently active <a href=
980    "definitions.html#InnermostState">innermost states</a>. If no such state
981    exists then continues with step 10</li>
982
983    <li>Constructs a function object <code>action</code> with a
984    parameter-less <code>operator()()</code> returning <code><a href=
985    "#Classresult">result</a></code> that does the following:
986
987      <ol type="a">
988        <li>Searches a reaction suitable for <code>currentEvent</code>,
989        starting with the current innermost state and moving outward until a
990        state defining a reaction for the event is found. Returns
991        <code>simple_state&lt;&gt;::forward_event()</code> if no reaction has
992        been found</li>
993
994        <li>Executes the found reaction. If the reaction result is equal to
995        the return value of
996        <code>simple_state&lt;&gt;::forward_event()</code> then resumes the
997        reaction search (step a). Returns the reaction result otherwise</li>
998      </ol>
999    </li>
1000
1001    <li>Constructs a function object <code>exceptionEventHandler</code>
1002    returning <code><a href="#Classresult">result</a></code> and accepting an
1003    exception event parameter that processes the passed exception event, with
1004    the following differences to the processing of normal events:
1005
1006      <ul type="disc">
1007        <li>From the moment when the exception has been thrown until right
1008        after the execution of the exception event reaction, states that need
1009        to be exited are only destructed but no <code>exit</code> member
1010        functions are called</li>
1011
1012        <li>If the state machine is stable when the exception event is
1013        processed then exception event reaction search starts with the
1014        innermost state that was last visited during the last normal event
1015        reaction search (the exception event was generated as a result of
1016        this normal reaction search)</li>
1017
1018        <li>If the state machine is <a href=
1019        "definitions.html#UnstableStateMachine">unstable</a> when the
1020        exception event is processed then exception event reaction search
1021        starts with the outermost <a href=
1022        "definitions.html#UnstableState">unstable state</a></li>
1023
1024        <li>As for normal events, reaction search moves outward when the
1025        current state cannot handle the event. However, if there is no outer
1026        state (an <a href="definitions.html#OutermostState">outermost
1027        state</a> has been reached) the reaction search is considered
1028        unsuccessful. That is, exception events will never be dispatched to
1029        orthogonal regions other than the one that caused the exception
1030        event</li>
1031
1032        <li>Should an exception be thrown during exception event reaction
1033        search or reaction execution then the exception is propagated out of
1034        the <code>exceptionEventHandler</code> function object (that is,
1035        <code>ExceptionTranslator</code> is <b>not</b> used to translate
1036        exceptions thrown while processing an exception event)</li>
1037
1038        <li>If no reaction could be found for the exception event or if the
1039        state machine is not stable after processing the exception event, the
1040        original exception is rethrown. Otherwise, a <code><a href=
1041        "#Classresult">result</a></code> object is returned equal to the one
1042        returned by <code>simple_state&lt;&gt;::discard_event()</code></li>
1043      </ul>
1044    </li>
1045
1046    <li>Passes <code>action</code> and <code>exceptionEventHandler</code> to
1047    <code>ExceptionTranslator::operator()()</code>. If
1048    <code>ExceptionTranslator::operator()()</code> throws an exception, the
1049    exception is propagated to the caller. If the caller catches the
1050    exception, the currently active outermost state and all its direct and
1051    indirect inner states are destructed. Innermost states are destructed
1052    first. Other states are destructed as soon as all their direct and
1053    indirect inner states have been destructed. The inner states of each
1054    state are destructed according to the number of their orthogonal region.
1055    The state in the orthogonal region with the highest number is always
1056    destructed first, then the state in the region with the second-highest
1057    number and so on. Otherwise continues with step 7</li>
1058
1059    <li>If the return value of <code>ExceptionTranslator::operator()()</code>
1060    is equal to the one of <code>simple_state&lt;&gt;::forward_event()</code>
1061    then continues with step 3</li>
1062
1063    <li>If the return value of <code>ExceptionTranslator::operator()()</code>
1064    is equal to the one of <code>simple_state&lt;&gt;::defer_event()</code>
1065    then the return value of <code>currentEvent.<a href=
1066    "#intrusive_from_this">intrusive_from_this</a>()</code> is stored in a
1067    state-specific queue. Continues with step 11</li>
1068
1069    <li>If the return value of <code>ExceptionTranslator::operator()()</code>
1070    is equal to the one of <code>simple_state&lt;&gt;::discard_event()</code>
1071    then continues with step 11</li>
1072
1073    <li>Calls <code>static_cast&lt; MostDerived * &gt;( this
1074    )-&gt;unconsumed_event( currentEvent )</code>. If
1075    <code>unconsumed_event()</code> throws an exception, the exception is
1076    propagated to the caller. Such an exception never leads to the
1077    destruction of any states (in contrast to exceptions propagated from
1078    <code>ExceptionTranslator::operator()()</code>)</li>
1079
1080    <li>If the posted events queue is non-empty then dequeues the first
1081    event, selects it as <code>currentEvent</code> and continues with step 2.
1082    Returns to the caller otherwise</li>
1083  </ol>
1084
1085  <p><b>Throws</b>: Any exceptions propagated from
1086  <code>MostDerived::unconsumed_event()</code> or
1087  <code>ExceptionTranslator::operator()</code>. Exceptions never originate in
1088  the library itself but only in code supplied through template
1089  parameters:</p>
1090
1091  <ul>
1092    <li><code>Allocator::rebind&lt;&gt;::other::allocate()</code></li>
1093
1094    <li>state constructors</li>
1095
1096    <li><code>react</code> member functions</li>
1097
1098    <li><code>exit</code> member functions</li>
1099
1100    <li>transition-actions</li>
1101
1102    <li><code>MostDerived::unconsumed_event()</code></li>
1103  </ul>
1104  <pre>
1105void <a name="post_event2" id="post_event2">post_event</a>(
1106  const intrusive_ptr&lt; const <a href=
1107"#Classevent_base">event_base</a> &gt; &amp; );
1108</pre>
1109
1110  <p><b>Effects</b>: Pushes the passed event into the posted events queue<br>
1111  <b>Throws</b>: Any exceptions propagated from
1112  <code>Allocator::allocate()</code></p>
1113  <pre>
1114void <a name="post_event3" id="post_event3">post_event</a>( const <a href=
1115"#Classevent_base">event_base</a> &amp; evt );
1116</pre>
1117
1118  <p><b>Effects</b>: <code>post_event( evt.intrusive_from_this()
1119  );</code><br>
1120  <b>Throws</b>: Any exceptions propagated from
1121  <code>Allocator::allocate()</code></p>
1122  <pre>
1123void <a name="unconsumed_event" id=
1124"unconsumed_event">unconsumed_event</a>( const <a href=
1125"#Classevent_base">event_base</a> &amp; evt );
1126</pre>
1127
1128  <p><b>Effects</b>: None<br>
1129  <b>Note</b>: This function (or, if present, the equally named derived class
1130  member function) is called by <a href="#process_event">process_event</a>()
1131  whenever a dispatched event did not trigger a reaction, see <a href=
1132  "#process_event">process_event</a>() effects, point 10 for more
1133  information.</p>
1134
1135  <h3>Class template <code>state_machine</code> observer functions</h3>
1136  <pre>
1137bool <a name="terminated" id="terminated">terminated</a>() const;
1138</pre>
1139
1140  <p><b>Returns</b>: <code>true</code>, if the machine is terminated. Returns
1141  <code>false</code> otherwise<br>
1142  <b>Note</b>: Is equivalent to <code>state_begin() == state_end()</code></p>
1143  <pre>
1144template&lt; class Target &gt;
1145Target <a name="state_cast" id="state_cast">state_cast</a>() const;
1146</pre>
1147
1148  <p><b>Returns</b>: Depending on the form of <code>Target</code> either a
1149  reference or a pointer to <code>const</code> if at least one of the
1150  currently active states can successfully be <code>dynamic_cast</code> to
1151  <code>Target</code>. Returns <code>0</code> for pointer targets and throws
1152  <code>std::bad_cast</code> for reference targets otherwise.
1153  <code>Target</code> can take either of the following forms: <code>const
1154  Class *</code> or <code>const Class &amp;</code><br>
1155  <b>Throws</b>: <code>std::bad_cast</code> if <code>Target</code> is a
1156  reference type and none of the active states can be
1157  <code>dynamic_cast</code> to Target<br>
1158  <b>Note</b>: The search sequence is the same as for <code><a href=
1159  "#process_event">process_event</a>()</code></p>
1160  <pre>
1161template&lt; class Target &gt;
1162Target <a name="state_downcast" id=
1163"state_downcast">state_downcast</a>() const;
1164</pre>
1165
1166  <p><b>Requires</b>: For reference targets the compiler must support partial
1167  specialization of class templates, otherwise a compile-time error will
1168  result. The type denoted by <code>Target</code> must be a model of the
1169  <a href="#SimpleState">SimpleState</a> or <a href="#State">State</a>
1170  concepts<br>
1171  <b>Returns</b>: Depending on the form of <code>Target</code> either a
1172  reference or a pointer to <code>const</code> if <code>Target</code> is
1173  equal to the most-derived type of a currently active state. Returns
1174  <code>0</code> for pointer targets and throws <code>std::bad_cast</code>
1175  for reference targets otherwise. <code>Target</code> can take either of the
1176  following forms: <code>const Class *</code> or <code>const Class
1177  &amp;</code><br>
1178  <b>Throws</b>: <code>std::bad_cast</code> if <code>Target</code> is a
1179  reference type and none of the active states has a most derived type equal
1180  to <code>Target</code><br>
1181  <b>Note</b>: The search sequence is the same as for <code><a href=
1182  "#process_event">process_event</a>()</code></p>
1183  <pre>
1184state_iterator <a name="state_begin" id=
1185"state_begin">state_begin</a>() const;
1186</pre>
1187  <pre>
1188state_iterator <a name="state_end" id="state_end">state_end</a>() const;
1189</pre>
1190
1191  <p><b>Return</b>: Iterator objects, the range [<code>state_begin()</code>,
1192  <code>state_end()</code>) refers to all currently active <a href=
1193  "definitions.html#InnermostState">innermost states</a>. For an object
1194  <code>i</code> of type <code>state_iterator</code>, <code>*i</code> returns
1195  a <code>const state_base_type &amp;</code> and
1196  <code>i.operator-&gt;()</code> returns a <code>const state_base_type
1197  *</code><br>
1198  <b>Note</b>: The position of a given innermost state in the range is
1199  arbitrary. It may change with each call to a modifier function. Moreover,
1200  all iterators are invalidated whenever a modifier function is called</p>
1201
1202  <h1>Header &lt;boost/statechart/<br>
1203  <a name="asynchronous_state_machine.hpp" id=
1204  "asynchronous_state_machine.hpp">asynchronous_state_machine.hpp</a>&gt;</h1>
1205
1206  <h2><a name="ClassTemplateasynchronous_state_machine" id=
1207  "ClassTemplateasynchronous_state_machine">Class template
1208  <code>asynchronous_state_machine</code></a></h2>
1209
1210  <p>This is the base class template of all asynchronous state machines.</p>
1211
1212  <h3>Class template <code>asynchronous_state_machine</code> parameters</h3>
1213
1214  <table border="3" cellpadding="2" width="100%" summary=
1215  "asynchronous_state_machine parameters">
1216    <tr>
1217      <td width="15%"><b>Template parameter</b></td>
1218
1219      <td width="51%"><b>Requirements</b></td>
1220
1221      <td width="18%"><b>Semantics</b></td>
1222
1223      <td width="19%"><b>Default</b></td>
1224    </tr>
1225
1226    <tr>
1227      <td width="15%"><code>MostDerived</code></td>
1228
1229      <td width="51%">The most-derived subtype of this class template</td>
1230
1231      <td width="18%">&nbsp;</td>
1232
1233      <td width="19%">&nbsp;</td>
1234    </tr>
1235
1236    <tr>
1237      <td width="15%"><code>InitialState</code></td>
1238
1239      <td width="51%">A model of the <a href="#SimpleState">SimpleState</a>
1240      or <a href="#State">State</a> concepts. The <code>Context</code>
1241      argument passed to the <code><a href=
1242      "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code> or
1243      <code><a href="#ClassTemplatestate">state&lt;&gt;</a></code> base of
1244      <code>InitialState</code> must be <code>MostDerived</code>. That is,
1245      <code>InitialState</code> must be an <a href=
1246      "definitions.html#OutermostState">outermost state</a> of this state
1247      machine</td>
1248
1249      <td width="18%">The state that is entered when the state machine is
1250      initiated through the <code>Scheduler</code> object</td>
1251
1252      <td width="19%">&nbsp;</td>
1253    </tr>
1254
1255    <tr>
1256      <td width="15%"><code>Scheduler</code></td>
1257
1258      <td width="51%">A model of the Scheduler concept</td>
1259
1260      <td width="18%">see <a href="#Scheduler">Scheduler</a> concept</td>
1261
1262      <td width="19%"><code>fifo_scheduler&lt;&gt;</code></td>
1263    </tr>
1264
1265    <tr>
1266      <td width="15%"><code>Allocator</code></td>
1267
1268      <td width="51%">A model of the standard Allocator concept</td>
1269
1270      <td width="18%">&nbsp;</td>
1271
1272      <td width="19%"><code>std::allocator&lt; void &gt;</code></td>
1273    </tr>
1274
1275    <tr>
1276      <td width="15%"><code>ExceptionTranslator</code></td>
1277
1278      <td width="51%">A model of the ExceptionTranslator concept</td>
1279
1280      <td width="18%">see <a href=
1281      "#ExceptionTranslator">ExceptionTranslator</a> concept</td>
1282
1283      <td width="19%"><code>null_exception_translator</code></td>
1284    </tr>
1285  </table>
1286
1287  <h3>Class template <code>asynchronous_state_machine</code> synopsis</h3>
1288  <pre>
1289namespace boost
1290{
1291namespace statechart
1292{
1293  template&lt;
1294    class MostDerived,
1295    class InitialState,
1296    class Scheduler = fifo_scheduler&lt;&gt;,
1297    class Allocator = std::allocator&lt; void &gt;,
1298    class ExceptionTranslator = null_exception_translator &gt;
1299  class asynchronous_state_machine :
1300    public state_machine&lt;
1301      MostDerived, InitialState, Allocator, ExceptionTranslator &gt;,
1302    public event_processor&lt; Scheduler &gt;
1303  {
1304    protected:
1305      typedef asynchronous_state_machine my_base;
1306
1307      asynchronous_state_machine(
1308        typename event_processor&lt; Scheduler &gt;::my_context ctx );
1309      ~asynchronous_state_machine(); 
1310  };
1311}
1312}
1313</pre>
1314
1315  <h3>Class template <code>asynchronous_state_machine</code> constructor and
1316  destructor</h3>
1317  <pre>
1318asynchronous_state_machine(
1319  typename event_processor&lt; Scheduler &gt;::my_context ctx );
1320</pre>
1321
1322  <p><b>Effects</b>: Constructs a non-running asynchronous state machine<br>
1323  <b>Note</b>: Users cannot create
1324  <code>asynchronous_state_machine&lt;&gt;</code> subtype objects directly.
1325  This can only be done through an object of the <code>Scheduler</code>
1326  class</p>
1327  <pre>
1328~asynchronous_state_machine();
1329</pre>
1330
1331  <p><b>Effects</b>: Destructs the state machine<br>
1332  <b>Note</b>: Users cannot destruct
1333  <code>asynchronous_state_machine&lt;&gt;</code> subtype objects directly.
1334  This can only be done through an object of the <code>Scheduler</code>
1335  class</p>
1336
1337  <h1>Header &lt;boost/statechart/<a name="event_processor.hpp" id=
1338  "event_processor.hpp">event_processor.hpp</a>&gt;</h1>
1339
1340  <h2><a name="ClassTemplateevent_processor" id=
1341  "ClassTemplateevent_processor">Class template
1342  <code>event_processor</code></a></h2>
1343
1344  <p>This is the base class template of all types that process events.
1345  <code>asynchronous_state_machine&lt;&gt;</code> is just one possible event
1346  processor implementation.</p>
1347
1348  <h3>Class template <code>event_processor</code> parameters</h3>
1349
1350  <table border="3" cellpadding="2" width="100%" summary=
1351  "event_processor parameters">
1352    <tr>
1353      <td width="15%"><b>Template parameter</b></td>
1354
1355      <td width="51%"><b>Requirements</b></td>
1356
1357      <td width="18%"><b>Semantics</b></td>
1358
1359      <td width="19%"><b>Default</b></td>
1360    </tr>
1361
1362    <tr>
1363      <td width="15%"><code>Scheduler</code></td>
1364
1365      <td width="51%">A model of the Scheduler concept</td>
1366
1367      <td width="18%">see <a href="#Scheduler">Scheduler</a> concept</td>
1368
1369      <td width="19%">&nbsp;</td>
1370    </tr>
1371  </table>
1372
1373  <h3>Class template <code>event_processor</code> synopsis</h3>
1374  <pre>
1375namespace boost
1376{
1377namespace statechart
1378{
1379  template&lt; class Scheduler &gt;
1380  class event_processor
1381  {
1382    public:
1383      virtual <a href="#event_processordtor">~event_processor</a>();
1384
1385      Scheduler &amp; <a href="#my_scheduler">my_scheduler</a>() const;
1386
1387      typedef typename Scheduler::processor_handle
1388        processor_handle;
1389      processor_handle <a href="#my_handle">my_handle</a>() const;
1390
1391      void <a href="#event_processor::initiate">initiate</a>();
1392      void <a href=
1393"#event_processor::process_event">process_event</a>( const event_base &amp; evt );
1394      void <a href="#event_processor::terminate">terminate</a>();
1395
1396    protected:
1397      typedef const typename Scheduler::processor_context &amp;
1398        my_context;
1399      <a href="#event_processor">event_processor</a>( my_context ctx );
1400
1401    private:
1402      virtual void initiate_impl() = 0;
1403      virtual void process_event_impl(
1404        const event_base &amp; evt ) = 0;
1405      virtual void terminate_impl() = 0;
1406  };
1407}
1408}
1409</pre>
1410
1411  <h3>Class template <code>event_processor</code> constructor and
1412  destructor</h3>
1413  <pre>
1414<a name="event_processor" id=
1415"event_processor">event_processor</a>( my_context ctx );
1416</pre>
1417
1418  <p><b>Effects</b>: Constructs an event processor object and stores copies
1419  of the reference returned by <code>myContext.my_scheduler()</code> and the
1420  object returned by <code>myContext.my_handle()</code><br>
1421  <b>Note</b>: Users cannot create <code>event_processor&lt;&gt;</code>
1422  subtype objects directly. This can only be done through an object of the
1423  <code>Scheduler</code> class</p>
1424  <pre>
1425virtual <a name="event_processordtor" id=
1426"event_processordtor">~event_processor</a>();
1427</pre>
1428
1429  <p><b>Effects</b>: Destructs an event processor object<br>
1430  <b>Note</b>: Users cannot destruct <code>event_processor&lt;&gt;</code>
1431  subtype objects directly. This can only be done through an object of the
1432  <code>Scheduler</code> class</p>
1433
1434  <h3>Class template <code>event_processor</code> modifier functions</h3>
1435  <pre>
1436void <a name="event_processor::initiate" id=
1437"event_processor::initiate">initiate</a>();
1438</pre>
1439
1440  <p><b>Effects</b>: <code>initiate_impl();<br></code><b>Throws</b>: Any
1441  exceptions propagated from the implementation of
1442  <code>initiate_impl()</code></p>
1443  <pre>
1444void <a name="event_processor::process_event" id=
1445"event_processor::process_event">process_event</a>( const event_base &amp; evt );
1446</pre>
1447
1448  <p><b>Effects</b>: <code>process_event_impl( evt
1449  );<br></code><b>Throws</b>: Any exceptions propagated from the
1450  implementation of <code>process_event_impl()</code></p>
1451  <pre>
1452void <a name="event_processor::terminate" id=
1453"event_processor::terminate">terminate</a>();
1454</pre>
1455
1456  <p><b>Effects</b>: <code>terminate_impl();<br></code><b>Throws</b>: Any
1457  exceptions propagated from the implementation of
1458  <code>terminate_impl()</code></p>
1459
1460  <h3>Class template <code>event_processor</code> observer functions</h3>
1461  <pre>
1462Scheduler &amp; <a name="my_scheduler" id=
1463"my_scheduler">my_scheduler</a>() const;
1464</pre>
1465
1466  <p><b>Returns</b>: The <code>Scheduler</code> reference obtained in the
1467  constructor</p>
1468  <pre>
1469processor_handle <a name="my_handle" id="my_handle">my_handle</a>() const;
1470</pre>
1471
1472  <p><b>Returns</b>: The <code>processor_handle</code> object obtained in the
1473  constructor</p>
1474
1475  <h1>Header &lt;boost/statechart/<a name="fifo_scheduler.hpp" id=
1476  "fifo_scheduler.hpp">fifo_scheduler.hpp</a>&gt;</h1>
1477
1478  <h2><a name="ClassTemplatefifo_scheduler" id=
1479  "ClassTemplatefifo_scheduler">Class template
1480  <code>fifo_scheduler</code></a></h2>
1481
1482  <p>This class template is a model of the <a href="#Scheduler">Scheduler</a>
1483  concept.</p>
1484
1485  <h3>Class template <code>fifo_scheduler</code> parameters</h3>
1486
1487  <table border="3" cellpadding="2" width="100%" summary=
1488  "fifo_scheduler parameters">
1489    <tr>
1490      <td width="15%"><b>Template parameter</b></td>
1491
1492      <td width="28%"><b>Requirements</b></td>
1493
1494      <td width="26%"><b>Semantics</b></td>
1495
1496      <td width="29%"><b>Default</b></td>
1497    </tr>
1498
1499    <tr>
1500      <td width="15%"><code>FifoWorker</code></td>
1501
1502      <td width="28%">A model of the FifoWorker concept</td>
1503
1504      <td width="26%">see <a href="#FifoWorker">FifoWorker</a> concept</td>
1505
1506      <td width="29%"><code>fifo_worker&lt;&gt;</code></td>
1507    </tr>
1508
1509    <tr>
1510      <td width="15%"><code>Allocator</code></td>
1511
1512      <td width="28%">A model of the standard Allocator concept</td>
1513
1514      <td width="26%">&nbsp;</td>
1515
1516      <td width="29%"><code>std::allocator&lt; void &gt;</code></td>
1517    </tr>
1518  </table>
1519
1520  <h3>Class template <code>fifo_scheduler</code> synopsis</h3>
1521  <pre>
1522namespace boost
1523{
1524namespace statechart
1525{
1526  template&lt;
1527    class FifoWorker = fifo_worker&lt;&gt;,
1528    class Allocator = std::allocator&lt; void &gt; &gt;
1529  class fifo_scheduler : noncopyable
1530  {
1531    public:
1532      <a href=
1533"#fifo_scheduler::fifo_scheduler">fifo_scheduler</a>( bool waitOnEmptyQueue = false );
1534
1535      typedef <i>implementation-defined</i> processor_handle;
1536
1537      class processor_context : noncopyable
1538      {
1539        processor_context(
1540          fifo_scheduler &amp; scheduler,
1541          const processor_handle &amp; theHandle );
1542
1543        fifo_scheduler &amp; my_scheduler() const;
1544        const processor_handle &amp; my_handle() const;
1545
1546        friend class fifo_scheduler;
1547        friend class event_processor&lt; fifo_scheduler &gt;;
1548      };
1549
1550      template&lt; class Processor &gt;
1551      processor_handle <a href="#create_processor">create_processor</a>();
1552      template&lt; class Processor, typename Param1 &gt;
1553      processor_handle <a href=
1554"#create_processor1">create_processor</a>( Param1 param1 );
1555
1556      // More create_processor overloads
1557
1558      void <a href=
1559"#destroy_processor">destroy_processor</a>( processor_handle processor );
1560
1561      void <a href=
1562"#initiate_processor">initiate_processor</a>( processor_handle processor );
1563      void <a href=
1564"#terminate_processor">terminate_processor</a>( processor_handle processor );
1565
1566      typedef intrusive_ptr&lt; const event_base &gt; event_ptr_type;
1567
1568      void <a href="#queue_event">queue_event</a>(
1569        const processor_handle &amp; processor,
1570        const event_ptr_type &amp; pEvent );
1571
1572      typedef typename FifoWorker::work_item work_item;
1573
1574      void <a href=
1575"#queue_work_item">queue_work_item</a>( const work_item &amp; item );
1576
1577      void <a href="#fifo_scheduler::terminate">terminate</a>();
1578      bool <a href="#fifo_scheduler::terminated">terminated</a>() const;
1579
1580      unsigned long <a href="#operatorfuncall">operator()</a>(
1581        unsigned long maxEventCount = 0 );
1582  };
1583}
1584}
1585</pre>
1586
1587  <h3>Class template <code>fifo_scheduler</code> constructor</h3>
1588  <pre>
1589<a name="fifo_scheduler::fifo_scheduler" id=
1590"fifo_scheduler::fifo_scheduler">fifo_scheduler</a>( bool waitOnEmptyQueue = false );
1591</pre>
1592
1593  <p><b>Effects</b>: Constructs a <code>fifo_scheduler&lt;&gt;</code> object.
1594  In multi-threaded builds, <code>waitOnEmptyQueue</code> is forwarded to the
1595  constructor of a data member of type <code>FifoWorker</code>. In
1596  single-threaded builds, the <code>FifoWorker</code> data member is
1597  default-constructed<br>
1598  <b>Note</b>: In single-threaded builds the
1599  <code>fifo_scheduler&lt;&gt;</code> constructor does not accept any
1600  parameters and <code>operator()()</code> thus always returns to the caller
1601  when the event queue is empty</p>
1602
1603  <h3>Class template <code>fifo_scheduler</code> modifier functions</h3>
1604  <pre>
1605template&lt; class Processor &gt;
1606processor_handle <a name="create_processor" id=
1607"create_processor">create_processor</a>();
1608</pre>
1609
1610  <p><b>Requires</b>: The <code>Processor</code> type must be a direct or
1611  indirect subtype of the <a href=
1612  "#ClassTemplateevent_processor"><code>event_processor</code></a> class
1613  template<br>
1614  <b>Effects</b>: Creates and passes to
1615  <code>FifoWorker::queue_work_item()</code> an object of type
1616  <code>FifoWorker::work_item</code> that, when later executed in
1617  <code>FifoWorker::operator()()</code>, leads to a call to the constructor
1618  of <code>Processor</code>, passing an appropriate
1619  <code>processor_context</code> object as the only argument<br>
1620  <b>Returns</b>: A <code>processor_handle</code> object that henceforth
1621  identifies the created event processor object<br>
1622  <b>Throws</b>: Any exceptions propagated from
1623  <code>FifoWorker::work_item()</code> and
1624  <code>FifoWorker::queue_work_item()</code><br>
1625  <b>Caution</b>: The current implementation of this function makes an
1626  (indirect) call to global <code>operator new()</code>. Unless global
1627  <code>operator new()</code> is replaced, care must be taken when to call
1628  this function in applications with hard real-time requirements</p>
1629  <pre>
1630template&lt; class Processor, typename Param1 &gt;
1631processor_handle <a name="create_processor1" id=
1632"create_processor1">create_processor( Param1 param1 )</a>;
1633</pre>
1634
1635  <p><b>Requires</b>: The <code>Processor</code> type must be a direct or
1636  indirect subtype of the <a href=
1637  "#ClassTemplateevent_processor"><code>event_processor</code></a> class
1638  template<br>
1639  <b>Effects</b>: Creates and passes to
1640  <code>FifoWorker::queue_work_item()</code> an object of type
1641  <code>FifoWorker::work_item</code> that, when later executed in
1642  <code>FifoWorker::operator()()</code>, leads to a call to the constructor
1643  of <code>Processor</code>, passing an appropriate
1644  <code>processor_context</code> object and <code>param1</code> as
1645  arguments<br>
1646  <b>Returns</b>: A <code>processor_handle</code> object that henceforth
1647  identifies the created event processor object<br>
1648  <b>Throws</b>: Any exceptions propagated from
1649  <code>FifoWorker::work_item()</code> and
1650  <code>FifoWorker::queue_work_item()</code><b><br>
1651  Note</b>: <code>boost::ref()</code> and <code>boost::cref()</code> can be
1652  used to pass arguments by reference rather than by copy.
1653  <code>fifo_scheduler&lt;&gt;</code> has 5 additional
1654  <code>create_processor&lt;&gt;</code> overloads, allowing to pass up to 6
1655  custom arguments to the constructors of event processors<br>
1656  <b>Caution</b>: The current implementation of this and all other overloads
1657  make (indirect) calls to global <code>operator new()</code>. Unless global
1658  <code>operator new()</code> is replaced, care must be taken when to call
1659  these overloads in applications with hard real-time requirements</p>
1660  <pre>
1661void <a name="destroy_processor" id=
1662"destroy_processor">destroy_processor</a>( processor_handle processor );
1663</pre>
1664
1665  <p><b>Requires</b>: <code>processor</code> was obtained from a call to one
1666  of the <code>create_processor&lt;&gt;()</code> overloads on the same
1667  <code>fifo_scheduler&lt;&gt;</code> object<br>
1668  <b>Effects</b>: Creates and passes to
1669  <code>FifoWorker::queue_work_item()</code> an object of type
1670  <code>FifoWorker::work_item</code> that, when later executed in
1671  <code>FifoWorker::operator()()</code>, leads to a call to the destructor of
1672  the event processor object associated with <code>processor</code>. The
1673  object is silently discarded if the event processor object has been
1674  destructed before<br>
1675  <b>Throws</b>: Any exceptions propagated from
1676  <code>FifoWorker::work_item()</code> and
1677  <code>FifoWorker::queue_work_item()</code><br>
1678  <b>Caution</b>: The current implementation of this function leads to an
1679  (indirect) call to global <code>operator delete()</code> (the call is made
1680  when the last <code>processor_handle</code> object associated with the
1681  event processor object is destructed). Unless global <code>operator
1682  delete()</code> is replaced, care must be taken when to call this function
1683  in applications with hard real-time requirements</p>
1684  <pre>
1685void <a name="initiate_processor" id=
1686"initiate_processor">initiate_processor</a>( processor_handle processor );
1687</pre>
1688
1689  <p><b>Requires</b>: <code>processor</code> was obtained from a call to one
1690  of the <code>create_processor()</code> overloads on the same
1691  <code>fifo_scheduler&lt;&gt;</code> object<br>
1692  <b>Effects</b>: Creates and passes to
1693  <code>FifoWorker::queue_work_item()</code> an object of type
1694  <code>FifoWorker::work_item</code> that, when later executed in
1695  <code>FifoWorker::operator()()</code>, leads to a call to <code><a href=
1696  "#event_processor::initiate">initiate</a>()</code> on the event processor
1697  object associated with <code>processor</code>. The object is silently
1698  discarded if the event processor object has been destructed before<br>
1699  <b>Throws</b>: Any exceptions propagated from
1700  <code>FifoWorker::work_item()</code> and
1701  <code>FifoWorker::queue_work_item()</code></p>
1702  <pre>
1703void <a name="terminate_processor" id=
1704"terminate_processor">terminate_processor</a>( processor_handle processor );
1705</pre>
1706
1707  <p><b>Requires</b>: <code>processor</code> was obtained from a call to one
1708  of the <code>create_processor&lt;&gt;()</code> overloads on the same
1709  <code>fifo_scheduler&lt;&gt;</code> object<br>
1710  <b>Effects</b>: Creates and passes to
1711  <code>FifoWorker::queue_work_item()</code> an object of type
1712  <code>FifoWorker::work_item</code> that, when later executed in
1713  <code>FifoWorker::operator()()</code>, leads to a call to <code><a href=
1714  "#event_processor::terminate">terminate</a>()</code> on the event processor
1715  object associated with <code>processor</code>. The object is silently
1716  discarded if the event processor object has been destructed before<br>
1717  <b>Throws</b>: Any exceptions propagated from
1718  <code>FifoWorker::work_item()</code> and
1719  <code>FifoWorker::queue_work_item()</code></p>
1720  <pre>
1721void <a name="queue_event" id="queue_event">queue_event</a>(
1722  const processor_handle &amp; processor,
1723  const event_ptr_type &amp; pEvent );
1724</pre>
1725
1726  <p><b>Requires</b>: <code>pEvent.get() != 0</code> and
1727  <code>processor</code> was obtained from a call to one of the
1728  <code>create_processor&lt;&gt;()</code> overloads on the same
1729  <code>fifo_scheduler&lt;&gt;</code> object<br>
1730  <b>Effects</b>: Creates and passes to
1731  <code>FifoWorker::queue_work_item()</code> an object of type
1732  <code>FifoWorker::work_item</code> that, when later executed in
1733  <code>FifoWorker::operator()()</code>, leads to a call to <code><a href=
1734  "#event_processor::process_event">process_event</a>( *pEvent )</code> on
1735  the event processor object associated with <code>processor</code>. The
1736  object is silently discarded if the event processor object has been
1737  destructed before<br>
1738  <b>Throws</b>: Any exceptions propagated from
1739  <code>FifoWorker::work_item()</code> and
1740  <code>FifoWorker::queue_work_item()</code></p>
1741  <pre>
1742void <a name="queue_work_item" id=
1743"queue_work_item">queue_work_item</a>( const work_item &amp; item );
1744</pre>
1745
1746  <p><b>Effects</b>: <code>FifoWorker::queue_work_item( item );</code><br>
1747  <b>Throws</b>: Any exceptions propagated from the above call</p>
1748  <pre>
1749void <a name="fifo_scheduler::terminate" id=
1750"fifo_scheduler::terminate">terminate</a>();
1751</pre>
1752
1753  <p><b>Effects</b>: <code>FifoWorker::terminate()</code><br>
1754  <b>Throws</b>: Any exceptions propagated from the above call</p>
1755  <pre>
1756unsigned long <a name="operatorfuncall" id=
1757"operatorfuncall">operator()</a>( unsigned long maxEventCount = 0 );
1758</pre>
1759
1760  <p><b>Requires</b>: Must only be called from exactly one thread<b><br>
1761  Effects</b>: <code>FifoWorker::operator()( maxEventCount )</code><br>
1762  <b>Returns</b>: The return value of the above call<br>
1763  <b>Throws</b>: Any exceptions propagated from the above call</p>
1764
1765  <h3>Class template <code>fifo_scheduler</code> observer functions</h3>
1766  <pre>
1767bool <a name="fifo_scheduler::terminated" id=
1768"fifo_scheduler::terminated">terminated</a>() const;
1769</pre>
1770
1771  <p><b>Requires</b>: Must only be called from the thread that also calls
1772  <code>operator()()</code><br>
1773  <b>Returns</b>: <code>FifoWorker::terminated();</code></p>
1774
1775  <h1>Header &lt;boost/statechart/<a name="exception_translator.hpp" id=
1776  "exception_translator.hpp">exception_translator.hpp</a>&gt;</h1>
1777
1778  <h2><a name="ClassTemplateexception_translator" id=
1779  "ClassTemplateexception_translator">Class template
1780  <code>exception_translator</code></a></h2>
1781
1782  <p>This class template is a model of the <a href=
1783  "#ExceptionTranslator">ExceptionTranslator</a> concept.</p>
1784
1785  <h3>Class template <code>exception_translator</code> parameters</h3>
1786
1787  <table border="3" cellpadding="2" width="100%" summary=
1788  "exception_translator parameters">
1789    <tr>
1790      <td width="12%"><b>Template parameter</b></td>
1791
1792      <td width="30%"><b>Requirements</b></td>
1793
1794      <td width="35%"><b>Semantics</b></td>
1795
1796      <td width="24%"><b>Default</b></td>
1797    </tr>
1798
1799    <tr>
1800      <td width="12%"><code>ExceptionEvent</code></td>
1801
1802      <td width="30%">A model of the <a href="#Event">Event</a> concept</td>
1803
1804      <td width="35%">The type of event that is dispatched when an exception
1805      is propagated into the framework</td>
1806
1807      <td width="24%"><code>exception_thrown</code></td>
1808    </tr>
1809  </table>
1810
1811  <h3>Class template <code>exception_translator</code> synopsis &amp;
1812  semantics</h3>
1813  <pre>
1814namespace boost
1815{
1816namespace statechart
1817{
1818  class exception_thrown : public event&lt; exception_thrown &gt; {};
1819
1820  template&lt; class ExceptionEvent = exception_thrown &gt;
1821  class exception_translator
1822  {
1823    public:
1824      template&lt; class Action, class ExceptionEventHandler &gt;
1825      result operator()(
1826        Action action,
1827        ExceptionEventHandler eventHandler )
1828      {
1829        try
1830        {
1831          return action();
1832        }
1833        catch( ... )
1834        {
1835          return eventHandler( ExceptionEvent() );
1836        }
1837      }
1838  };
1839}
1840}
1841</pre>
1842
1843  <h1>Header &lt;boost/statechart/<br>
1844  <a name="null_exception_translator.hpp" id=
1845  "null_exception_translator.hpp">null_exception_translator.hpp</a>&gt;</h1>
1846
1847  <h2><a name="Classnull_exception_translator" id=
1848  "Classnull_exception_translator">Class
1849  <code>null_exception_translator</code></a></h2>
1850
1851  <p>This class is a model of the <a href=
1852  "#ExceptionTranslator">ExceptionTranslator</a> concept.</p>
1853
1854  <h3>Class <code>null_exception_translator</code> synopsis &amp;
1855  semantics</h3>
1856  <pre>
1857namespace boost
1858{
1859namespace statechart
1860{
1861  class null_exception_translator
1862  {
1863    public:
1864      template&lt; class Action, class ExceptionEventHandler &gt;
1865      result operator()(
1866        Action action, ExceptionEventHandler )
1867      {
1868        return action();
1869      }
1870  };
1871}
1872}
1873</pre>
1874
1875  <h1>Header &lt;boost/statechart/<a name="simple_state.hpp" id=
1876  "simple_state.hpp">simple_state.hpp</a>&gt;</h1>
1877
1878  <h2><a name="Enumhistory_mode" id="Enumhistory_mode">Enum
1879  <code>history_mode</code></a></h2>
1880
1881  <p>Defines the history type of a state.</p>
1882  <pre>
1883namespace boost
1884{
1885namespace statechart
1886{
1887  enum history_mode
1888  {
1889    has_no_history,
1890    has_shallow_history,
1891    has_deep_history,
1892    has_full_history // shallow &amp; deep
1893  };
1894}
1895}
1896</pre>
1897
1898  <h2><a name="ClassTemplatesimple_state" id=
1899  "ClassTemplatesimple_state">Class template
1900  <code>simple_state</code></a></h2>
1901
1902  <p>This is the base class template for all models of the <a href=
1903  "#SimpleState">SimpleState</a> concept. Such models must not call any of
1904  the following <code>simple_state&lt;&gt;</code> member functions from their
1905  constructors:</p>
1906  <pre>
1907void <b>post_event</b>(
1908  const intrusive_ptr&lt; const event_base &gt; &amp; );
1909void <b>post_event</b>( const event_base &amp; );
1910
1911template&lt;
1912  class HistoryContext,
1913  <i>implementation-defined-unsigned-integer-type
1914</i>    orthogonalPosition &gt;
1915void <b>clear_shallow_history</b>();
1916template&lt;
1917  class HistoryContext,
1918  <i>implementation-defined-unsigned-integer-type
1919</i>    orthogonalPosition &gt;
1920void <b>clear_deep_history</b>();
1921
1922outermost_context_type &amp; <b>outermost_context</b>();
1923const outermost_context_type &amp; <b>outermost_context</b>() const;
1924
1925template&lt; class OtherContext &gt;
1926OtherContext &amp; <b>context</b>();
1927template&lt; class OtherContext &gt;
1928const OtherContext &amp; <b>context</b>() const;
1929
1930template&lt; class Target &gt;
1931Target <b>state_cast</b>() const;
1932template&lt; class Target &gt;
1933Target <b>state_downcast</b>() const;
1934
1935state_iterator <b>state_begin</b>() const;
1936state_iterator <b>state_end</b>() const;
1937</pre>
1938
1939  <p>States that need to call any of these member functions from their
1940  constructors must derive from the <code><a href=
1941  "#ClassTemplatestate">state</a></code> class template.</p>
1942
1943  <h3>Class template <code>simple_state</code> parameters</h3>
1944
1945  <table border="3" cellpadding="2" width="100%" summary=
1946  "simple_state parameters">
1947    <tr>
1948      <td width="15%"><b>Template parameter</b></td>
1949
1950      <td width="51%"><b>Requirements</b></td>
1951
1952      <td width="18%"><b>Semantics</b></td>
1953
1954      <td width="19%"><b>Default</b></td>
1955    </tr>
1956
1957    <tr>
1958      <td width="15%"><code>MostDerived</code></td>
1959
1960      <td width="51%">The most-derived subtype of this class template</td>
1961
1962      <td width="18%">&nbsp;</td>
1963
1964      <td width="19%">&nbsp;</td>
1965    </tr>
1966
1967    <tr>
1968      <td width="15%"><code>Context</code></td>
1969
1970      <td width="51%">A most-derived direct or indirect subtype of the
1971      <code><a href="#ClassTemplatestate_machine">state_machine</a></code> or
1972      <code><a href=
1973      "#ClassTemplateasynchronous_state_machine">asynchronous_state_machine</a></code>
1974      class templates or a model of the <a href=
1975      "#SimpleState">SimpleState</a> or <a href="#State">State</a> concepts
1976      or an instantiation of the <code><a href=
1977      "#ClassTemplatesimple_state">simple_state&lt;&gt;::orthogonal</a></code>
1978      class template. Must be a complete type</td>
1979
1980      <td width="18%">Defines the states' position in the state
1981      hierarchy</td>
1982
1983      <td width="19%">&nbsp;</td>
1984    </tr>
1985
1986    <tr>
1987      <td width="15%"><code>InnerInitial</code></td>
1988
1989      <td width="51%">An <code>mpl::list&lt;&gt;</code> containing models of
1990      the <a href="#SimpleState">SimpleState</a> or <a href=
1991      "#State">State</a> concepts or instantiations of the <code><a href=
1992      "#ClassTemplateshallow_history">shallow_history</a></code> or
1993      <code><a href="#ClassTemplatedeep_history">deep_history</a></code>
1994      class templates. If there is only a single inner initial state that is
1995      not a template instantiation then it can also be passed directly,
1996      without wrapping it into an <code>mpl::list&lt;&gt;</code>. The
1997      <code>Context</code> argument passed to the <code><a href=
1998      "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code> or
1999      <code><a href="#ClassTemplatestate">state&lt;&gt;</a></code> base
2000      of&nbsp;each state in the list must correspond to the orthogonal region
2001      it belongs to. That is, the first state in the list must pass
2002      <code>MostDerived::orthogonal&lt; 0 &gt;</code>, the second
2003      <code>MostDerived::orthogonal&lt; 1 &gt;</code> and so forth.
2004      <code>MostDerived::orthogonal&lt; 0 &gt;</code> and
2005      <code>MostDerived</code> are synonymous</td>
2006
2007      <td width="18%">Defines the inner initial state for each orthogonal
2008      region. By default, a state does not have inner states</td>
2009
2010      <td width="19%"><i><code>unspecified</code></i></td>
2011    </tr>
2012
2013    <tr>
2014      <td width="15%"><code>historyMode</code></td>
2015
2016      <td width="51%">One of the values defined in the <code><a href=
2017      "#Enumhistory_mode">history_mode</a></code> enumeration</td>
2018
2019      <td width="18%">Defines whether the state saves shallow, deep or both
2020      histories upon exit</td>
2021
2022      <td width="19%"><code>has_no_history</code></td>
2023    </tr>
2024  </table>
2025
2026  <h3>Class template <code>simple_state</code> synopsis</h3>
2027  <pre>
2028namespace boost
2029{
2030namespace statechart
2031{
2032  template&lt;
2033    class MostDerived,
2034    class Context,
2035    class InnerInitial = <i>unspecified</i>,
2036    history_mode historyMode = has_no_history &gt;
2037  class simple_state : <i>implementation-defined</i>
2038  {
2039    public:
2040      // by default, a state has no reactions
2041      typedef mpl::list&lt;&gt; reactions;
2042
2043      // see template parameters
2044      template&lt; <i>implementation-defined-unsigned-integer-type
2045</i>        innerOrthogonalPosition &gt;
2046      struct orthogonal
2047      {
2048        // <i>implementation-defined</i>
2049      };
2050
2051      typedef typename Context::outermost_context_type
2052        outermost_context_type;
2053
2054      outermost_context_type &amp; <a href=
2055"#outermost_context">outermost_context</a>();
2056      const outermost_context_type &amp; <a href=
2057"#outermost_contextconst">outermost_context</a>() const;
2058
2059      template&lt; class OtherContext &gt;
2060      OtherContext &amp; <a href="#context">context</a>();
2061      template&lt; class OtherContext &gt;
2062      const OtherContext &amp; <a href="#contextconst">context</a>() const;
2063
2064      template&lt; class Target &gt;
2065      Target <a href="#simple_state::state_cast">state_cast</a>() const;
2066      template&lt; class Target &gt;
2067      Target <a href=
2068"#simple_state::state_downcast">state_downcast</a>() const;
2069
2070      // a model of the StateBase concept
2071      typedef <i>implementation-defined</i> state_base_type;
2072      // a model of the standard Forward Iterator concept
2073      typedef <i>implementation-defined</i> state_iterator;
2074
2075      state_iterator <a href=
2076"#simple_state::state_begin">state_begin</a>() const;
2077      state_iterator <a href=
2078"#simple_state::state_end">state_end</a>() const;
2079
2080      void <a href="#post_event0">post_event</a>(
2081        const intrusive_ptr&lt; const <a href=
2082"#Classevent_base">event_base</a> &gt; &amp; );
2083      void <a href="#post_event1">post_event</a>( const <a href=
2084"#Classevent_base">event_base</a> &amp; );
2085
2086      <a href="#Classresult">result</a> <a href=
2087"#discard_event">discard_event</a>();
2088      <a href="#Classresult">result</a> <a href=
2089"#forward_event">forward_event</a>();
2090      <a href="#Classresult">result</a> <a href=
2091"#defer_event">defer_event</a>();
2092      template&lt; class DestinationState &gt;
2093      <a href="#Classresult">result</a> <a href="#transit1">transit</a>();
2094      template&lt;
2095        class DestinationState,
2096        class TransitionContext,
2097        class Event &gt;
2098      <a href="#Classresult">result</a> <a href="#transit2">transit</a>(
2099        void ( TransitionContext::* )( const Event &amp; ),
2100        const Event &amp; );
2101      <a href="#Classresult">result</a> <a href=
2102"#simple_state::terminate">terminate</a>();
2103
2104      template&lt;
2105        class HistoryContext,
2106        <i>implementation-defined-unsigned-integer-type
2107</i>          orthogonalPosition &gt;
2108      void <a href="#clear_shallow_history">clear_shallow_history</a>();
2109      template&lt;
2110        class HistoryContext,
2111        <i>implementation-defined-unsigned-integer-type
2112</i>          orthogonalPosition &gt;
2113      void <a href="#clear_deep_history">clear_deep_history</a>();
2114
2115      static id_type <a href="#static_type">static_type</a>();
2116
2117      template&lt; class CustomId &gt;
2118      static const CustomId * <a href=
2119"#custom_static_type_ptr">custom_static_type_ptr</a>();
2120
2121      template&lt; class CustomId &gt;
2122      static void <a href=
2123"#custom_static_type_ptr1">custom_static_type_ptr</a>( const CustomId * );
2124
2125      // see <a href="#transit1">transit</a>() or <a href=
2126"#simple_state::terminate">terminate</a>() effects
2127      void exit() {}
2128
2129    protected:
2130      <a href="#simple_state">simple_state</a>();
2131      <a href="#simple_statedtor">~simple_state</a>();
2132  };
2133}
2134}
2135</pre>
2136
2137  <h3>Class template <code>simple_state</code> constructor and
2138  destructor</h3>
2139  <pre>
2140<a name="simple_state" id="simple_state">simple_state</a>();
2141</pre>
2142
2143  <p><b>Effects</b>: Constructs a state object</p>
2144  <pre>
2145<a name="simple_statedtor" id="simple_statedtor">~simple_state</a>();
2146</pre>
2147
2148  <p><b>Effects</b>: Pushes all events deferred by the state into the posted
2149  events queue</p>
2150
2151  <h3>Class template <code>simple_state</code> modifier functions</h3>
2152  <pre>
2153void <a name="post_event0" id="post_event0">post_event</a>(
2154  const intrusive_ptr&lt; const <a href=
2155"#Classevent_base">event_base</a> &gt; &amp; pEvt );
2156</pre>
2157
2158  <p><b>Requires</b>: If called from a constructor of a direct or indirect
2159  subtype then the most-derived type must directly or indirectly derive from
2160  the <code>state</code> class template<b>.</b> All direct and indirect
2161  callers must be exception-neutral<b><br>
2162  Effects</b>: <a href=
2163  "#outermost_context"><code>outermost_context</code></a><code>().<a href=
2164  "#post_event2">post_event</a>( pEvt );</code><br>
2165  <b>Throws</b>: Whatever the above call throws</p>
2166  <pre>
2167void <a name="post_event1" id="post_event1">post_event</a>( const <a href=
2168"#Classevent_base">event_base</a> &amp; evt );
2169</pre>
2170
2171  <p><b>Requires</b>: If called from a constructor of a direct or indirect
2172  subtype then the most-derived type must directly or indirectly derive from
2173  the <code>state</code> class template<b>.</b> All direct and indirect
2174  callers must be exception-neutral<b><br>
2175  Effects</b>: <a href=
2176  "#outermost_context"><code>outermost_context</code></a><code>().<a href=
2177  "#post_event3">post_event</a>( evt );</code><br>
2178  <b>Throws</b>: Whatever the above call throws</p>
2179  <pre>
2180<a href="#Classresult">result</a> <a name="discard_event" id=
2181"discard_event">discard_event</a>();
2182</pre>
2183
2184  <p><b>Requires</b>: Must only be called from within <code>react</code>
2185  member functions, which are called by <code><a href=
2186  "#ClassTemplatecustom_reaction">custom_reaction&lt;&gt;</a></code>
2187  instantiations. All direct and indirect callers must be
2188  exception-neutral<br>
2189  <b>Effects</b>: Instructs the state machine to discard the current event
2190  and to continue with the processing of the remaining events (see
2191  <code><a href=
2192  "#process_event">state_machine&lt;&gt;::process_event</a>()</code> for
2193  details)<br>
2194  <b>Returns</b>: A <code><a href="#Classresult">result</a></code> object.
2195  The user-supplied <code>react</code> member function must return this
2196  object to its caller</p>
2197  <pre>
2198<a href="#Classresult">result</a> <a name="forward_event" id=
2199"forward_event">forward_event</a>();
2200</pre>
2201
2202  <p><b>Requires</b>: Must only be called from within <code>react</code>
2203  member functions, which are called by <code><a href=
2204  "#ClassTemplatecustom_reaction">custom_reaction&lt;&gt;</a></code>
2205  instantiations. All direct and indirect callers must be
2206  exception-neutral<br>
2207  <b>Effects</b>: Instructs the state machine to forward the current event to
2208  the next state (see <code><a href=
2209  "#process_event">state_machine&lt;&gt;::process_event</a>()</code> for
2210  details)<br>
2211  <b>Returns</b>: A <code><a href="#Classresult">result</a></code> object.
2212  The user-supplied <code>react</code> member function must return this
2213  object to its caller</p>
2214  <pre>
2215<a href="#Classresult">result</a> <a name="defer_event" id=
2216"defer_event">defer_event</a>();
2217</pre>
2218
2219  <p><b>Requires</b>: Must only be called from within <code>react</code>
2220  member functions, which are called by <code><a href=
2221  "#ClassTemplatecustom_reaction">custom_reaction&lt;&gt;</a></code>
2222  instantiations. All direct and indirect callers must be
2223  exception-neutral<br>
2224  <b>Effects</b>: Instructs the state machine to defer the current event and
2225  to continue with the processing of the remaining events (see <code><a href=
2226  "#process_event">state_machine&lt;&gt;::process_event</a>()</code> for
2227  details)<br>
2228  <b>Returns</b>: A <code><a href="#Classresult">result</a></code> object.
2229  The user-supplied <code>react</code> member function must return this
2230  object to its caller<br>
2231  <b>Throws</b>: Any exceptions propagated from
2232  <code>Allocator::rebind&lt;&gt;::other::allocate()</code> (the template
2233  parameter passed to the base class of
2234  <code>outermost_context_type</code>)</p>
2235  <pre>
2236template&lt; class DestinationState &gt;
2237<a href="#Classresult">result</a> <a name="transit1" id=
2238"transit1">transit</a>();
2239</pre>
2240
2241  <p><b>Requires</b>: Must only be called from within <code>react</code>
2242  member functions, which are called by <code><a href=
2243  "#ClassTemplatecustom_reaction">custom_reaction&lt;&gt;</a></code>
2244  instantiations. All direct and indirect callers must be
2245  exception-neutral<br>
2246  <b>Effects</b>:</p>
2247
2248  <ol>
2249    <li>Exits all currently active direct and indirect inner states of the
2250    innermost common context of this state and <code>DestinationState</code>.
2251    Innermost states are exited first. Other states are exited as soon as all
2252    their direct and indirect inner states have been exited. The inner states
2253    of each state are exited according to the number of their orthogonal
2254    region. The state in the orthogonal region with the highest number is
2255    always exited first, then the state in the region with the second-highest
2256    number and so on.<br>
2257      The process of exiting a state consists of the following steps:
2258
2259      <ol>
2260        <li>If there is an exception pending that has not yet been handled
2261        successfully then only step 5 is executed</li>
2262
2263        <li>Calls the <code>exit</code> member function (see <a href=
2264        "#ClassTemplatesimple_state">synopsis</a>) of the most-derived state
2265        object. If <code>exit()</code> throws then steps 3 and 4 are not
2266        executed</li>
2267
2268        <li>If the state has shallow history then shallow history information
2269        is saved</li>
2270
2271        <li>If the state is an innermost state then deep history information
2272        is saved for all direct and indirect outer states that have deep
2273        history</li>
2274
2275        <li>The state object is destructed</li>
2276      </ol>
2277    </li>
2278
2279    <li>Enters (constructs) the state that is both a direct inner state of
2280    the innermost common context and either the <code>DestinationState</code>
2281    itself or a direct or indirect outer state of
2282    <code>DestinationState</code></li>
2283
2284    <li>Enters (constructs) the tree formed by the direct and indirect inner
2285    states of the previously entered state down to the
2286    <code>DestinationState</code> and beyond depth first. The inner states of
2287    each state are entered according to the number of their orthogonal
2288    region. The state in orthogonal region 0 is always entered first, then
2289    the state in region 1 and so on</li>
2290
2291    <li>Instructs the state machine to discard the current event and to
2292    continue with the processing of the remaining events (see <code><a href=
2293    "#process_event">state_machine&lt;&gt;::process_event</a>()</code> for
2294    details)</li>
2295  </ol>
2296
2297  <p><b>Returns</b>: A <code><a href="#Classresult">result</a></code> object.
2298  The user-supplied <code>react</code> member function must return this
2299  object to its caller<br>
2300  <b>Throws</b>: Any exceptions propagated from:</p>
2301
2302  <ul>
2303    <li><code>Allocator::rebind&lt;&gt;::other::allocate()</code> (the
2304    template parameter passed to the base class of
2305    <code>outermost_context_type</code>)</li>
2306
2307    <li>state constructors</li>
2308
2309    <li><code>exit</code> member functions</li>
2310  </ul>
2311
2312  <p><b>Caution</b>: Inevitably destructs this state before returning to the
2313  calling <code>react</code> member function, which must therefore not
2314  attempt to access anything except stack objects before returning to its
2315  caller</p>
2316  <pre>
2317template&lt;
2318  class DestinationState,
2319  class TransitionContext,
2320  class Event &gt;
2321<a href="#Classresult">result</a> <a name="transit2" id=
2322"transit2">transit</a>(
2323  void ( TransitionContext::* )( const Event &amp; ),
2324  const Event &amp; );
2325</pre>
2326
2327  <p><b>Requires</b>: Must only be called from within <code>react</code>
2328  member functions, which are called by <code><a href=
2329  "#ClassTemplatecustom_reaction">custom_reaction&lt;&gt;</a></code>
2330  instantiations. All direct and indirect callers must be
2331  exception-neutral<br>
2332  <b>Effects</b>:</p>
2333
2334  <ol>
2335    <li>Exits all currently active direct and indirect inner states of the
2336    innermost common context of this state and <code>DestinationState</code>.
2337    Innermost states are exited first. Other states are exited as soon as all
2338    their direct and indirect inner states have been exited. The inner states
2339    of each state are exited according to the number of their orthogonal
2340    region. The state in the orthogonal region with the highest number is
2341    always exited first, then the state in the region with the second-highest
2342    number and so on.<br>
2343      The process of exiting a state consists of the following steps:
2344
2345      <ol>
2346        <li>If there is an exception pending that has not yet been handled
2347        successfully then only step 5 is executed</li>
2348
2349        <li>Calls the <code>exit</code> member function (see <a href=
2350        "#ClassTemplatesimple_state">synopsis</a>) of the most-derived state
2351        object. If <code>exit()</code> throws then steps 3 and 4 are not
2352        executed</li>
2353
2354        <li>If the state has shallow history then shallow history information
2355        is saved</li>
2356
2357        <li>If the state is an innermost state then deep history information
2358        is saved for all direct and indirect outer states that have deep
2359        history</li>
2360
2361        <li>The state object is destructed</li>
2362      </ol>
2363    </li>
2364
2365    <li>Executes the passed transition action, forwarding the passed
2366    event</li>
2367
2368    <li>Enters (constructs) the state that is both a direct inner state of
2369    the innermost common context and either the <code>DestinationState</code>
2370    itself or a direct or indirect outer state of
2371    <code>DestinationState</code></li>
2372
2373    <li>Enters (constructs) the tree formed by the direct and indirect inner
2374    states of the previously entered state down to the
2375    <code>DestinationState</code> and beyond depth first. The inner states of
2376    each state are entered according to the number of their orthogonal
2377    region. The state in orthogonal region 0 is always entered first, then
2378    the state in region 1 and so on</li>
2379
2380    <li>Instructs the state machine to discard the current event and to
2381    continue with the processing of the remaining events (see <code><a href=
2382    "#process_event">state_machine&lt;&gt;::process_event</a>()</code> for
2383    details)</li>
2384  </ol>
2385
2386  <p><b>Returns</b>: A <code><a href="#Classresult">result</a></code> object.
2387  The user-supplied <code>react</code> member function must return this
2388  object to its caller<br>
2389  <b>Throws</b>: Any exceptions propagated from:</p>
2390
2391  <ul>
2392    <li><code>Allocator::rebind&lt;&gt;::other::allocate()</code> (the
2393    template parameter passed to the base class of
2394    <code>outermost_context_type</code>)</li>
2395
2396    <li>state constructors</li>
2397
2398    <li><code>exit</code> member functions</li>
2399
2400    <li>the transition action</li>
2401  </ul>
2402
2403  <p><b>Caution</b>: Inevitably destructs this state before returning to the
2404  calling <code>react</code> member function, which must therefore not
2405  attempt to access anything except stack objects before returning to its
2406  caller</p>
2407  <pre>
2408<a href="#Classresult">result</a> <a name="simple_state::terminate" id=
2409"simple_state::terminate">terminate</a>();
2410</pre>
2411
2412  <p><b>Requires</b>: Must only be called from within <code>react</code>
2413  member functions, which are called by <code><a href=
2414  "#ClassTemplatecustom_reaction">custom_reaction&lt;&gt;</a></code>
2415  instantiations. All direct and indirect callers must be
2416  exception-neutral<br>
2417  <b>Effects</b>: Exits this state and all its direct and indirect inner
2418  states. Innermost states are exited first. Other states are exited as soon
2419  as all their direct and indirect inner states have been exited. The inner
2420  states of each state are exited according to the number of their orthogonal
2421  region. The state in the orthogonal region with the highest number is
2422  always exited first, then the state in the region with the second-highest
2423  number and so on.<br>
2424  The process of exiting a state consists of the following steps:</p>
2425
2426  <ol>
2427    <li>If there is an exception pending that has not yet been handled
2428    successfully then only step 5 is executed</li>
2429
2430    <li>Calls the <code>exit</code> member function (see <a href=
2431    "#ClassTemplatesimple_state">synopsis</a>) of the most-derived state
2432    object. If <code>exit()</code> throws then steps 3 and 4 are not
2433    executed</li>
2434
2435    <li>If the state has shallow history then shallow history information is
2436    saved</li>
2437
2438    <li>If the state is an innermost state then deep history information is
2439    saved for all direct and indirect outer states that have deep
2440    history</li>
2441
2442    <li>The state object is destructed</li>
2443  </ol>
2444
2445  <p>Also instructs the state machine to discard the current event and to
2446  continue with the processing of the remaining events (see <code><a href=
2447  "#process_event">state_machine&lt;&gt;::process_event</a>()</code> for
2448  details)<br>
2449  <b>Returns</b>: A <code><a href="#Classresult">result</a></code> object.
2450  The user-supplied <code>react</code> member function must return this
2451  object to its caller<br>
2452  <b>Throws</b>: Any exceptions propagated from:</p>
2453
2454  <ul>
2455    <li><code>Allocator::rebind&lt;&gt;::other::allocate()</code> (the
2456    template parameter passed to the base class of
2457    <code>outermost_context_type</code>, used to allocate space to save
2458    history)</li>
2459
2460    <li><code>exit</code> member functions</li>
2461  </ul>
2462
2463  <p><b>Note</b>: If this state is the only currently active inner state of
2464  its direct outer state then the direct outer state is terminated also. The
2465  same applies recursively for all indirect outer states<br>
2466  <b>Caution</b>: Inevitably destructs this state before returning to the
2467  calling <code>react</code> member function, which must therefore not
2468  attempt to access anything except stack objects before returning to its
2469  caller</p>
2470  <pre>
2471template&lt;
2472  class HistoryContext,
2473  <i>implementation-defined-unsigned-integer-type
2474</i>    orthogonalPosition &gt;
2475void <a name="clear_shallow_history" id=
2476"clear_shallow_history">clear_shallow_history</a>();
2477</pre>
2478
2479  <p><b>Requires</b>: If called from a constructor of a direct or indirect
2480  subtype then the most-derived type must directly or indirectly derive from
2481  the <code>state</code> class template. The <code>historyMode</code>
2482  argument passed to the <code><a href=
2483  "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code> or
2484  <code><a href="#ClassTemplatestate">state&lt;&gt;</a></code> base
2485  of&nbsp;<code>HistoryContext</code> must be equal to
2486  <code>has_shallow_history</code> or <code>has_full_history</code><br>
2487  <b>Effects</b>: Clears the shallow history of the orthogonal region
2488  specified by <code>orthogonalPosition</code> of the state specified by
2489  <code>HistoryContext</code><br>
2490  <b>Throws</b>: Any exceptions propagated from
2491  <code>Allocator::rebind&lt;&gt;::other::allocate()</code> (the template
2492  parameter passed to the base class of
2493  <code>outermost_context_type</code>)</p>
2494  <pre>
2495template&lt;
2496  class HistoryContext,
2497  <i>implementation-defined-unsigned-integer-type
2498</i>    orthogonalPosition &gt;
2499void <a name="clear_deep_history" id=
2500"clear_deep_history">clear_deep_history</a>();
2501</pre>
2502
2503  <p><b>Requires</b>: If called from a constructor of a direct or indirect
2504  subtype then the most-derived type must directly or indirectly derive from
2505  the <code>state</code> class template. The <code>historyMode</code>
2506  argument passed to the <code><a href=
2507  "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code> or
2508  <code><a href="#ClassTemplatestate">state&lt;&gt;</a></code> base
2509  of&nbsp;<code>HistoryContext</code> must be equal to
2510  <code>has_deep_history</code> or <code>has_full_history</code><br>
2511  <b>Effects</b>: Clears the deep history of the orthogonal region specified
2512  by <code>orthogonalPosition</code> of the state specified by
2513  <code>HistoryContext</code><br>
2514  <b>Throws</b>: Any exceptions propagated from
2515  <code>Allocator::rebind&lt;&gt;::other::allocate()</code> (the template
2516  parameter passed to the base class of
2517  <code>outermost_context_type</code>)</p>
2518
2519  <h3>Class template <code>simple_state</code> observer functions</h3>
2520  <pre>
2521outermost_context_type &amp; <a name="outermost_context" id=
2522"outermost_context">outermost_context</a>();
2523</pre>
2524
2525  <p><b>Requires</b>: If called from a constructor of a direct or indirect
2526  subtype then the most-derived type must directly or indirectly derive from
2527  the <code>state</code> class template<b><br>
2528  Returns</b>: A reference to the outermost context, which is always the
2529  state machine this state belongs to</p>
2530  <pre>
2531const outermost_context_type &amp; <a name="outermost_contextconst" id=
2532"outermost_contextconst">outermost_context() const</a>;
2533</pre>
2534
2535  <p><b>Requires</b>: If called from a constructor of a direct or indirect
2536  subtype then the most-derived type must directly or indirectly derive from
2537  the <code>state</code> class template<b><br>
2538  Returns</b>: A reference to the const outermost context, which is always
2539  the state machine this state belongs to</p>
2540  <pre>
2541template&lt; class OtherContext &gt;
2542OtherContext &amp; <a name="context" id="context">context</a>();
2543</pre>
2544
2545  <p><b>Requires</b>: If called from a constructor of a direct or indirect
2546  subtype then the most-derived type must directly or indirectly derive from
2547  the <code>state</code> class template<b><br>
2548  Returns</b>: A reference to a direct or indirect context</p>
2549  <pre>
2550template&lt; class OtherContext &gt;
2551const OtherContext &amp; <a name="contextconst" id=
2552"contextconst">context() const</a>;
2553</pre>
2554
2555  <p><b>Requires</b>: If called from a constructor of a direct or indirect
2556  subtype then the most-derived type must directly or indirectly derive from
2557  the <code>state</code> class template<b><br>
2558  Returns</b>: A reference to a const direct or indirect context</p>
2559  <pre>
2560template&lt; class Target &gt;
2561Target <a name="simple_state::state_cast" id=
2562"simple_state::state_cast">state_cast</a>() const;
2563</pre>
2564
2565  <p><b>Requires</b>: If called from a constructor of a direct or indirect
2566  subtype then the most-derived type must directly or indirectly derive from
2567  the <code>state</code> class template<b><br>
2568  Returns</b>: Has exactly the same semantics as <code><a href=
2569  "#state_cast">state_machine&lt;&gt;::state_cast</a>&lt;&gt;()</code><br>
2570  <b>Throws</b>: Has exactly the same semantics as <code><a href=
2571  "#state_cast">state_machine&lt;&gt;::state_cast</a>&lt;&gt;()</code><b><br>
2572  Note</b>: The result is <b>unspecified</b> if this function is called when
2573  the machine is <a href=
2574  "definitions.html#UnstableStateMachine">unstable</a></p>
2575  <pre>
2576template&lt; class Target &gt;
2577Target <a name="simple_state::state_downcast" id=
2578"simple_state::state_downcast">state_downcast</a>() const;
2579</pre>
2580
2581  <p><b>Requires</b>: If called from a constructor of a direct or indirect
2582  subtype then the most-derived type must directly or indirectly derive from
2583  the <code>state</code> class template. Moreover, <code><a href=
2584  "#state_downcast">state_machine&lt;&gt;::state_downcast</a>&lt;&gt;()</code>
2585  requirements also apply<br>
2586  <b>Returns</b>: Has exactly the same semantics as <code><a href=
2587  "#state_downcast">state_machine&lt;&gt;::state_downcast</a>&lt;&gt;()</code><br>
2588
2589  <b>Throws</b>: Has exactly the same semantics as <code><a href=
2590  "#state_downcast">state_machine&lt;&gt;::state_downcast</a>&lt;&gt;()</code><b><br>
2591
2592  Note</b>: The result is <b>unspecified</b> if this function is called when
2593  the machine is <a href=
2594  "definitions.html#UnstableStateMachine">unstable</a></p>
2595  <pre>
2596state_iterator <a name="simple_state::state_begin" id=
2597"simple_state::state_begin">state_begin</a>() const;
2598</pre>
2599  <pre>
2600state_iterator <a name="simple_state::state_end" id=
2601"simple_state::state_end">state_end</a>() const;
2602</pre>
2603
2604  <p><b>Require</b>: If called from a constructor of a direct or indirect
2605  subtype then the most-derived type must directly or indirectly derive from
2606  the <code>state</code> class template<b><br>
2607  Return</b>: Have exactly the same semantics as <code><a href=
2608  "#state_begin">state_machine&lt;&gt;::state_begin</a>()</code> and
2609  <code><a href=
2610  "#state_end">state_machine&lt;&gt;::state_end</a>()</code><br>
2611  <b>Note</b>: The result is <b>unspecified</b> if these functions are called
2612  when the machine is <a href=
2613  "definitions.html#UnstableStateMachine">unstable</a></p>
2614
2615  <h3>Class template <code>simple_state</code> static functions</h3>
2616  <pre>
2617static id_type <a name="static_type" id="static_type">static_type</a>();
2618</pre>
2619
2620  <p><b>Returns</b>: A value unambiguously identifying the type of
2621  <code>MostDerived</code><br>
2622  <b>Note</b>: <code>id_type</code> values are comparable with
2623  <code>operator==()</code> and <code>operator!=()</code>. An unspecified
2624  collating order can be established with <code>std::less&lt; id_type
2625  &gt;</code></p>
2626  <pre>
2627template&lt; class CustomId &gt;
2628static const CustomId * <a name="custom_static_type_ptr" id=
2629"custom_static_type_ptr">custom_static_type_ptr</a>();
2630</pre>
2631
2632  <p><b>Requires</b>: If a custom type identifier has been set then
2633  <code>CustomId</code> must match the type of the previously set
2634  pointer<b><br>
2635  Returns</b>: The pointer to the custom type identifier for
2636  <code>MostDerived</code> or <code>0</code><br>
2637  <b>Note</b>: This function is not available if <a href=
2638  "configuration.html#ApplicationDefinedMacros"><code>BOOST_STATECHART_USE_NATIVE_RTTI</code></a>
2639  is defined</p>
2640  <pre>
2641template&lt; class CustomId &gt;
2642static void <a name="custom_static_type_ptr1" id=
2643"custom_static_type_ptr1">custom_static_type_ptr( const CustomId * )</a>;
2644</pre>
2645
2646  <p><b>Effects</b>: Sets the pointer to the custom type identifier for
2647  <code>MostDerived</code><br>
2648  <b>Note</b>: This function is not available if <a href=
2649  "configuration.html#ApplicationDefinedMacros"><code>BOOST_STATECHART_USE_NATIVE_RTTI</code></a>
2650  is defined</p>
2651
2652  <h1>Header &lt;boost/statechart/<a name="state.hpp" id=
2653  "state.hpp">state.hpp</a>&gt;</h1>
2654
2655  <h2><a name="ClassTemplatestate" id="ClassTemplatestate">Class template
2656  <code>state</code></a></h2>
2657
2658  <p>This is the base class template for all models of the <a href=
2659  "#State">State</a> concept. Such models typically need to call at least one
2660  of the following <code><a href=
2661  "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code> member
2662  functions from their constructors:</p>
2663  <pre>
2664void <b>post_event</b>(
2665  const intrusive_ptr&lt; const event_base &gt; &amp; );
2666void <b>post_event</b>( const event_base &amp; );
2667
2668template&lt;
2669  class HistoryContext,
2670  <i>implementation-defined-unsigned-integer-type
2671</i>    orthogonalPosition &gt;
2672void <b>clear_shallow_history</b>();
2673template&lt;
2674  class HistoryContext,
2675  <i>implementation-defined-unsigned-integer-type
2676</i>    orthogonalPosition &gt;
2677void <b>clear_deep_history</b>();
2678
2679outermost_context_type &amp; <b>outermost_context</b>();
2680const outermost_context_type &amp; <b>outermost_context</b>() const;
2681
2682template&lt; class OtherContext &gt;
2683OtherContext &amp; <b>context</b>();
2684template&lt; class OtherContext &gt;
2685const OtherContext &amp; <b>context</b>() const;
2686
2687template&lt; class Target &gt;
2688Target <b>state_cast</b>() const;
2689template&lt; class Target &gt;
2690Target <b>state_downcast</b>() const;
2691
2692state_iterator <b>state_begin</b>() const;
2693state_iterator <b>state_end</b>() const;
2694</pre>
2695
2696  <p>States that do not need to call any of these member functions from their
2697  constructors should rather derive from the <code><a href=
2698  "#ClassTemplatesimple_state">simple_state</a></code> class template, what
2699  saves the implementation of the forwarding constructor.</p>
2700
2701  <h3>Class template <code>state</code> synopsis</h3>
2702  <pre>
2703namespace boost
2704{
2705namespace statechart
2706{
2707  template&lt;
2708    class MostDerived,
2709    class Context,
2710    class InnerInitial = <i>unspecified</i>,
2711    history_mode historyMode = has_no_history &gt;
2712  class state : public simple_state&lt;
2713    MostDerived, Context, InnerInitial, historyMode &gt;
2714  {
2715    protected:
2716      struct my_context
2717      {
2718        // <i>implementation-defined</i>
2719      };
2720
2721      typedef state my_base;
2722
2723      state( my_context ctx );
2724      ~state();
2725  };
2726}
2727}
2728</pre>
2729
2730  <p>Direct and indirect subtypes of <code>state&lt;&gt;</code> must provide
2731  a constructor with the same signature as the <code>state&lt;&gt;</code>
2732  constructor, forwarding the context parameter.</p>
2733
2734  <h1>Header &lt;boost/statechart/<a name="shallow_history.hpp" id=
2735  "shallow_history.hpp">shallow_history.hpp</a>&gt;</h1>
2736
2737  <h2><a name="ClassTemplateshallow_history" id=
2738  "ClassTemplateshallow_history">Class template
2739  <code>shallow_history</code></a></h2>
2740
2741  <p>This class template is used to specify a shallow history transition
2742  target or a shallow history inner initial state.</p>
2743
2744  <h3>Class template <code>shallow_history</code> parameters</h3>
2745
2746  <table border="3" cellpadding="2" width="100%" summary=
2747  "shallow_history parameters">
2748    <tr>
2749      <td width="15%"><b>Template parameter</b></td>
2750
2751      <td width="45%"><b>Requirements</b></td>
2752
2753      <td width="24%"><b>Semantics</b></td>
2754    </tr>
2755
2756    <tr>
2757      <td width="15%"><code>DefaultState</code></td>
2758
2759      <td width="45%">A model of the <a href="#SimpleState">SimpleState</a>
2760      or <a href="#State">State</a> concepts. The type passed as
2761      <code>Context</code> argument to the <code><a href=
2762      "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code> or
2763      <code><a href="#ClassTemplatestate">state&lt;&gt;</a></code> base
2764      of&nbsp;<code>DefaultState</code> must itself pass
2765      <code>has_shallow_history</code> or <code>has_full_history</code> as
2766      <code>historyMode</code> argument to its <code><a href=
2767      "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code> or
2768      <code><a href="#ClassTemplatestate">state&lt;&gt;</a></code> base</td>
2769
2770      <td width="24%">The state that is entered if shallow history is not
2771      available</td>
2772    </tr>
2773  </table>
2774
2775  <h3>Class template <code>shallow_history</code> synopsis</h3>
2776  <pre>
2777namespace boost
2778{
2779namespace statechart
2780{
2781  template&lt; class DefaultState &gt;
2782  class shallow_history
2783  {
2784    // <i>implementation-defined</i>
2785  };
2786}
2787}
2788</pre>
2789
2790  <h1>Header &lt;boost/statechart/<a name="deep_history.hpp" id=
2791  "deep_history.hpp">deep_history.hpp</a>&gt;</h1>
2792
2793  <h2><a name="ClassTemplatedeep_history" id=
2794  "ClassTemplatedeep_history">Class template
2795  <code>deep_history</code></a></h2>
2796
2797  <p>This class template is used to specify a deep history transition target
2798  or a deep history inner initial state. The current deep history
2799  implementation has some <a href=
2800  "rationale.html#Limitations">limitations</a>.</p>
2801
2802  <h3>Class template <code>deep_history</code> parameters</h3>
2803
2804  <table border="3" cellpadding="2" width="100%" summary=
2805  "deep_history parameters">
2806    <tr>
2807      <td width="15%"><b>Template parameter</b></td>
2808
2809      <td width="45%"><b>Requirements</b></td>
2810
2811      <td width="24%"><b>Semantics</b></td>
2812    </tr>
2813
2814    <tr>
2815      <td width="15%"><code>DefaultState</code></td>
2816
2817      <td width="45%">A model of the <a href="#SimpleState">SimpleState</a>
2818      or <a href="#State">State</a> concepts. The type passed as
2819      <code>Context</code> argument to the <code><a href=
2820      "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code> or
2821      <code><a href="#ClassTemplatestate">state&lt;&gt;</a></code> base
2822      of&nbsp;<code>DefaultState</code> must itself pass
2823      <code>has_deep_history</code> or <code>has_full_history</code> as
2824      <code>historyMode</code> argument to its <code><a href=
2825      "#ClassTemplatesimple_state">simple_state&lt;&gt;</a></code> or
2826      <code><a href="#ClassTemplatestate">state&lt;&gt;</a></code> base</td>
2827
2828      <td width="24%">The state that is entered if deep history is not
2829      available</td>
2830    </tr>
2831  </table>
2832
2833  <h3>Class template <code>deep_history</code> synopsis</h3>
2834  <pre>
2835namespace boost
2836{
2837namespace statechart
2838{
2839  template&lt; class DefaultState &gt;
2840  class deep_history
2841  {
2842    // <i>implementation-defined</i>
2843  };
2844}
2845}
2846</pre>
2847
2848  <h1>Header &lt;boost/statechart/<a name="event_base.hpp" id=
2849  "event_base.hpp">event_base.hpp</a>&gt;</h1>
2850
2851  <h2><a name="Classevent_base" id="Classevent_base">Class
2852  <code>event_base</code></a></h2>
2853
2854  <p>This is the common base of all events.</p>
2855
2856  <h3>Class <code>event_base</code> synopsis</h3>
2857  <pre>
2858namespace boost
2859{
2860namespace statechart
2861{
2862  class event_base
2863  {
2864    public:
2865      intrusive_ptr&lt; const event_base &gt;
2866        <a href="#intrusive_from_this">intrusive_from_this</a>() const;
2867
2868      typedef <i>implementation-defined</i> id_type;
2869
2870      id_type <a href="#event_base::dynamic_type">dynamic_type</a>() const;
2871
2872      template&lt; typename CustomId &gt;
2873      const CustomId * <a href=
2874"#event_base::custom_dynamic_type_ptr">custom_dynamic_type_ptr</a>() const;
2875     
2876    protected:
2877      <a href="#event_base">event_base</a>( <i>unspecified-parameter </i>);
2878      virtual <a href="#event_basedtor">~event_base</a>();
2879  };
2880}
2881}
2882</pre>
2883
2884  <h3>Class <code>event_base</code> constructor and destructor</h3>
2885  <pre>
2886<a name="event_base" id=
2887"event_base">event_base</a>( <i>unspecified-parameter </i>);
2888</pre>
2889
2890  <p><b>Effects</b>: Constructs the common base portion of an event</p>
2891  <pre>
2892virtual <a name="event_basedtor" id="event_basedtor">~event_base</a>();
2893</pre>
2894
2895  <p><b>Effects</b>: Destructs the common base portion of an event</p>
2896
2897  <h3>Class <code>event_base</code> observer functions</h3>
2898  <pre>
2899intrusive_ptr&lt; const event_base &gt; <a name="intrusive_from_this" id=
2900"intrusive_from_this">intrusive_from_this</a>() const;
2901</pre>
2902
2903  <p><b>Returns</b>: Another <code>intrusive_ptr&lt; const event_base
2904  &gt;</code> referencing <code>this</code> <b>if</b> <code>this</code> is
2905  already referenced by an <code>intrusive_ptr&lt;&gt;</code>. Otherwise,
2906  returns an <code>intrusive_ptr&lt; const event_base &gt;</code> referencing
2907  a newly created copy of the most-derived object</p>
2908  <pre>
2909id_type <a name="event_base::dynamic_type" id=
2910"event_base::dynamic_type">dynamic_type</a>() const;
2911</pre>
2912
2913  <p><b>Returns</b>: A value unambiguously identifying the most-derived
2914  type<br>
2915  <b>Note</b>: <code>id_type</code> values are comparable with
2916  <code>operator==()</code> and <code>operator!=()</code>. An unspecified
2917  collating order can be established with <code>std::less&lt; id_type
2918  &gt;</code>. In contrast to <code>typeid( cs )</code>, this function is
2919  available even on platforms that do not support C++ RTTI (or have been
2920  configured to not support it)</p>
2921  <pre>
2922template&lt; typename CustomId &gt;
2923const CustomId * <a name="event_base::custom_dynamic_type_ptr" id=
2924"event_base::custom_dynamic_type_ptr">custom_dynamic_type_ptr</a>() const;
2925</pre>
2926
2927  <p><b>Requires</b>: If a custom type identifier has been set then
2928  <code>CustomId</code> must match the type of the previously set
2929  pointer<b><br>
2930  Returns</b>: A pointer to the custom type identifier or <code>0</code><br>
2931  <b>Note</b>: This function is not available if <a href=
2932  "configuration.html#ApplicationDefinedMacros"><code>BOOST_STATECHART_USE_NATIVE_RTTI</code></a>
2933  is defined</p>
2934
2935  <h1>Header &lt;boost/statechart/<a name="event.hpp" id=
2936  "event.hpp">event.hpp</a>&gt;</h1>
2937
2938  <h2><a name="ClassTemplateevent" id="ClassTemplateevent">Class template
2939  <code>event</code></a></h2>
2940
2941  <p>This is the base class template of all events.</p>
2942
2943  <h3>Class template <code>event</code> parameters</h3>
2944
2945  <table border="3" cellpadding="2" width="100%" summary="event parameters">
2946    <tr>
2947      <td width="15%"><b>Template parameter</b></td>
2948
2949      <td width="51%"><b>Requirements</b></td>
2950
2951      <td width="18%"><b>Semantics</b></td>
2952
2953      <td width="19%"><b>Default</b></td>
2954    </tr>
2955
2956    <tr>
2957      <td width="15%"><code>MostDerived</code></td>
2958
2959      <td width="51%">The most-derived subtype of this class template</td>
2960
2961      <td width="18%">&nbsp;</td>
2962
2963      <td width="19%">&nbsp;</td>
2964    </tr>
2965
2966    <tr>
2967      <td width="15%"><code>Allocator</code></td>
2968
2969      <td width="51%">A model of the standard Allocator concept</td>
2970
2971      <td width="18%"><code>Allocator::rebind&lt; MostDerived
2972      &gt;::other</code> is used to allocate and deallocate all event subtype
2973      objects of dynamic storage duration, see <code><a href=
2974      "#event::operatornew">operator new</a></code></td>
2975
2976      <td width="19%"><code>std::allocator&lt; void &gt;</code></td>
2977    </tr>
2978  </table>
2979
2980  <h3>Class template <code>event</code> synopsis</h3>
2981  <pre>
2982namespace boost
2983{
2984namespace statechart
2985{
2986  template&lt; class MostDerived, class Allocator = std::allocator&lt; void &gt; &gt;
2987  class event : <i>implementation-defined</i>
2988  {
2989    public:
2990      static void * <a href=
2991"#event::operatornew">operator new</a>( std::size_t size );
2992      static void <a href=
2993"#event::operatordelete">operator delete</a>( void * pEvent );
2994
2995      static id_type <a href="#event::static_type">static_type</a>();
2996
2997      template&lt; class CustomId &gt;
2998      static const CustomId * <a href=
2999"#event::custom_static_type_ptr">custom_static_type_ptr</a>();
3000
3001      template&lt; class CustomId &gt;
3002      static void <a href=
3003"#event::custom_static_type_ptr1">custom_static_type_ptr</a>( const CustomId * );
3004
3005    protected:
3006      <a href="#event::event">event</a>();
3007      virtual <a href="#eventdtor">~event</a>();
3008  };
3009}
3010}
3011</pre>
3012
3013  <h3>Class template <code>event</code> constructor and destructor</h3>
3014  <pre>
3015<a name="event::event" id="event::event">event</a>();
3016</pre>
3017
3018  <p><b>Effects</b>: Constructs an event</p>
3019  <pre>
3020virtual <a name="eventdtor" id="eventdtor">~event</a>();
3021</pre>
3022
3023  <p><b>Effects</b>: Destructs an event</p>
3024
3025  <h3>Class template <code>event</code> static functions</h3>
3026  <pre>
3027static void * <a name="event::operatornew" id=
3028"event::operatornew">operator new</a>( std::size_t size );
3029</pre>
3030
3031  <p><b>Effects</b>: <code>Allocator::rebind&lt; MostDerived
3032  &gt;::other().allocate( 1, static_cast&lt; MostDerived * &gt;( 0 )
3033  );</code><br>
3034  <b>Returns</b>: The return value of the above call<br>
3035  <b>Throws</b>: Whatever the above call throws</p>
3036  <pre>
3037static void <a name="event::operatordelete" id=
3038"event::operatordelete">operator delete</a>( void * pEvent );
3039</pre>
3040
3041  <p><b>Effects</b>: <code>Allocator::rebind&lt; MostDerived
3042  &gt;::other().deallocate( static_cast&lt; MostDerived * &gt;( pEvent ), 1
3043  );</code></p>
3044  <pre>
3045static id_type <a name="event::static_type" id=
3046"event::static_type">static_type</a>();
3047</pre>
3048
3049  <p><b>Returns</b>: A value unambiguously identifying the type of
3050  <code>MostDerived</code><br>
3051  <b>Note</b>: <code>id_type</code> values are comparable with
3052  <code>operator==()</code> and <code>operator!=()</code>. An unspecified
3053  collating order can be established with <code>std::less&lt; id_type
3054  &gt;</code></p>
3055  <pre>
3056template&lt; class CustomId &gt;
3057static const CustomId * <a name="event::custom_static_type_ptr" id=
3058"event::custom_static_type_ptr">custom_static_type_ptr</a>();
3059</pre>
3060
3061  <p><b>Requires</b>: If a custom type identifier has been set then
3062  <code>CustomId</code> must match the type of the previously set
3063  pointer<b><br>
3064  Returns</b>: The pointer to the custom type identifier for
3065  <code>MostDerived</code> or <code>0</code><br>
3066  <b>Note</b>: This function is not available if <a href=
3067  "configuration.html#ApplicationDefinedMacros"><code>BOOST_STATECHART_USE_NATIVE_RTTI</code></a>
3068  is defined</p>
3069  <pre>
3070template&lt; class CustomId &gt;
3071static void <a name="event::custom_static_type_ptr1" id=
3072"event::custom_static_type_ptr1">custom_static_type_ptr( const CustomId * )</a>;
3073</pre>
3074
3075  <p><b>Effects</b>: Sets the pointer to the custom type identifier for
3076  <code>MostDerived</code><br>
3077  <b>Note</b>: This function is not available if <a href=
3078  "configuration.html#ApplicationDefinedMacros"><code>BOOST_STATECHART_USE_NATIVE_RTTI</code></a>
3079  is defined</p>
3080
3081  <h1>Header &lt;boost/statechart/<a name="transition.hpp" id=
3082  "transition.hpp">transition.hpp</a>&gt;</h1>
3083
3084  <h2><a name="ClassTemplatetransition" id="ClassTemplatetransition">Class
3085  template <code>transition</code></a></h2>
3086
3087  <p>This class template is used to specify a transition reaction.
3088  Instantiations of this template can appear in the <code>reactions</code>
3089  member <code>typedef</code> in models of the <a href=
3090  "#SimpleState">SimpleState</a> and <a href="#State">State</a> concepts.</p>
3091
3092  <h3>Class template <code>transition</code> parameters</h3>
3093
3094  <table border="3" cellpadding="2" width="100%" summary=
3095  "transition parameters">
3096    <tr>
3097      <td width="15%"><b>Template parameter</b></td>
3098
3099      <td width="45%"><b>Requirements</b></td>
3100
3101      <td width="24%"><b>Semantics</b></td>
3102
3103      <td width="19%"><b>Default</b></td>
3104    </tr>
3105
3106    <tr>
3107      <td width="15%"><code>Event</code></td>
3108
3109      <td width="45%">A model of the <a href="#Event">Event</a> concept or
3110      the class <code><a href="#Classevent_base">event_base</a></code></td>
3111
3112      <td width="24%">The event triggering the transition. If <code><a href=
3113      "#Classevent_base">event_base</a></code> is specified, the transition
3114      is triggered by all models of the <a href="#Event">Event</a>
3115      concept</td>
3116
3117      <td width="19%">&nbsp;</td>
3118    </tr>
3119
3120    <tr>
3121      <td width="15%"><code>Destination</code></td>
3122
3123      <td width="45%">A model of the <a href="#SimpleState">SimpleState</a>
3124      or <a href="#State">State</a> concepts or an instantiation of the
3125      <code><a href=
3126      "#ClassTemplateshallow_history">shallow_history</a></code> or
3127      <code><a href="#ClassTemplatedeep_history">deep_history</a></code>
3128      class templates. The source state (the state for which this transition
3129      is defined) and <code>Destination</code> must have a common direct or
3130      indirect context</td>
3131
3132      <td width="24%">The destination state to make a transition to</td>
3133
3134      <td width="19%">&nbsp;</td>
3135    </tr>
3136
3137    <tr>
3138      <td width="15%"><code>TransitionContext</code></td>
3139
3140      <td width="45%">A common context of the source and
3141      <code>Destination</code> state</td>
3142
3143      <td width="24%">The state of which the transition action is a
3144      member</td>
3145
3146      <td width="19%"><i><code>unspecified</code></i></td>
3147    </tr>
3148
3149    <tr>
3150      <td width="15%"><code>pTransitionAction</code></td>
3151
3152      <td width="45%">A pointer to a member function of
3153      <code>TransitionContext</code>. The member function must accept a
3154      <code>const Event &amp;</code> parameter and return
3155      <code>void</code></td>
3156
3157      <td width="24%">The transition action that is executed during the
3158      transition. By default no transition action is executed</td>
3159
3160      <td width="19%"><i><code>unspecified</code></i></td>
3161    </tr>
3162  </table>
3163
3164  <h3>Class template <code>transition</code> synopsis</h3>
3165  <pre>
3166namespace boost
3167{
3168namespace statechart
3169{
3170  template&lt;
3171    class Event,
3172    class Destination,
3173    class TransitionContext = <i>unspecified</i>,
3174    void ( TransitionContext::*pTransitionAction )(
3175      const Event &amp; ) = <i>unspecified</i> &gt;
3176  class transition
3177  {
3178    // <i>implementation-defined</i>
3179  };
3180}
3181}
3182</pre>
3183
3184  <h3>Class template <code>transition</code> semantics</h3>
3185
3186  <p>When executed, one of the following calls to a member function of the
3187  state for which the reaction was defined is made:</p>
3188
3189  <ul>
3190    <li><code><a href="#transit1">transit&lt; Destination &gt;()</a></code>,
3191    if no transition action was specified</li>
3192
3193    <li><code><a href="#transit2">transit&lt; Destination &gt;(
3194    pTransitionAction, <i>currentEvent</i> )</a></code>, if a transition
3195    action was specified</li>
3196  </ul>
3197
3198  <h1>Header &lt;boost/statechart/<a name="in_state_reaction.hpp" id=
3199  "in_state_reaction.hpp">in_state_reaction.hpp</a>&gt;</h1>
3200
3201  <h2><a name="ClassTemplatein_state_reaction" id=
3202  "ClassTemplatein_state_reaction">Class template
3203  <code>in_state_reaction</code></a></h2>
3204
3205  <p>This class template is used to specify an in-state reaction.
3206  Instantiations of this template can appear in the <code>reactions</code>
3207  member <code>typedef</code> in models of the <a href=
3208  "#SimpleState">SimpleState</a> and <a href="#State">State</a> concepts.</p>
3209
3210  <h3>Class template <code>in_state_reaction</code> parameters</h3>
3211
3212  <table border="3" cellpadding="2" width="100%" summary=
3213  "in_state_reaction parameters">
3214    <tr>
3215      <td width="15%"><b>Template parameter</b></td>
3216
3217      <td width="45%"><b>Requirements</b></td>
3218
3219      <td width="24%"><b>Semantics</b></td>
3220    </tr>
3221
3222    <tr>
3223      <td width="15%"><code>Event</code></td>
3224
3225      <td width="45%">A model of the <a href="#Event">Event</a> concept or
3226      the class <code><a href="#Classevent_base">event_base</a></code></td>
3227
3228      <td width="24%">The event triggering the in-state reaction. If
3229      <code><a href="#Classevent_base">event_base</a></code> is specified,
3230      the in-state reaction is triggered by all models of the <a href=
3231      "#Event">Event</a> concept</td>
3232    </tr>
3233
3234    <tr>
3235      <td width="15%"><code>ReactionContext</code></td>
3236
3237      <td width="45%">Either the state defining the in-state reaction itself
3238      or one of it direct or indirect contexts</td>
3239
3240      <td width="24%">The state of which the action is a member</td>
3241    </tr>
3242
3243    <tr>
3244      <td width="15%"><code>pAction</code></td>
3245
3246      <td width="45%">A pointer to a member function of
3247      <code>ReactionContext</code>. The member function must accept a
3248      <code>const Event &amp;</code> parameter and return
3249      <code>void</code></td>
3250
3251      <td width="24%">The action that is executed during the in-state
3252      reaction</td>
3253    </tr>
3254  </table>
3255
3256  <h3>Class template <code>in_state_reaction</code> synopsis</h3>
3257  <pre>
3258namespace boost
3259{
3260namespace statechart
3261{
3262  template&lt;
3263    class Event,
3264    class ReactionContext,
3265    void ( ReactionContext::*pAction )( const Event &amp; ) &gt;
3266  class in_state_reaction
3267  {
3268    // <i>implementation-defined</i>
3269  };
3270}
3271}
3272</pre>
3273
3274  <h3>Class template <code>in_state_reaction</code> semantics</h3>
3275
3276  <p>When executed, <code>pAction</code> is called, passing the triggering
3277  event as the only argument. Afterwards, a call is made to the
3278  <code><a href="#discard_event">discard_event</a></code> member function of
3279  the state for which the reaction was defined.</p>
3280
3281  <h1>Header &lt;boost/statechart/<a name="termination.hpp" id=
3282  "termination.hpp">termination.hpp</a>&gt;</h1>
3283
3284  <h2><a name="ClassTemplatetermination" id="ClassTemplatetermination">Class
3285  template <code>termination</code></a></h2>
3286
3287  <p>This class template is used to specify a termination reaction.
3288  Instantiations of this template can appear in the <code>reactions</code>
3289  member <code>typedef</code> in models of the <a href=
3290  "#SimpleState">SimpleState</a> and <a href="#State">State</a> concepts.</p>
3291
3292  <h3>Class template <code>termination</code> parameters</h3>
3293
3294  <table border="3" cellpadding="2" width="100%" summary=
3295  "termination parameters">
3296    <tr>
3297      <td width="15%"><b>Template parameter</b></td>
3298
3299      <td width="45%"><b>Requirements</b></td>
3300
3301      <td width="24%"><b>Semantics</b></td>
3302    </tr>
3303
3304    <tr>
3305      <td width="15%"><code>Event</code></td>
3306
3307      <td width="45%">A model of the <a href="#Event">Event</a> concept or
3308      the class <code><a href="#Classevent_base">event_base</a></code></td>
3309
3310      <td width="24%">The event triggering the termination. If <code><a href=
3311      "#Classevent_base">event_base</a></code> is specified, the termination
3312      is triggered by all models of the <a href="#Event">Event</a>
3313      concept</td>
3314    </tr>
3315  </table>
3316
3317  <h3>Class template <code>termination</code> synopsis</h3>
3318  <pre>
3319namespace boost
3320{
3321namespace statechart
3322{
3323  template&lt; class Event &gt;
3324  class termination
3325  {
3326    // <i>implementation-defined</i>
3327  };
3328}
3329}
3330</pre>
3331
3332  <h3>Class template <code>termination</code> semantics</h3>
3333
3334  <p>When executed, a call is made to the <code><a href=
3335  "#simple_state::terminate">terminate</a></code> member function of the
3336  state for which the reaction was defined.</p>
3337
3338  <h1>Header &lt;boost/statechart/<a name="deferral.hpp" id=
3339  "deferral.hpp">deferral.hpp</a>&gt;</h1>
3340
3341  <h2><a name="ClassTemplatedeferral" id="ClassTemplatedeferral">Class
3342  template <code>deferral</code></a></h2>
3343
3344  <p>This class template is used to specify a deferral reaction.
3345  Instantiations of this template can appear in the <code>reactions</code>
3346  member <code>typedef</code> in models of the <a href=
3347  "#SimpleState">SimpleState</a> and <a href="#State">State</a> concepts.</p>
3348
3349  <h3>Class template <code>deferral</code> parameters</h3>
3350
3351  <table border="3" cellpadding="2" width="100%" summary=
3352  "deferral parameters">
3353    <tr>
3354      <td width="15%"><b>Template parameter</b></td>
3355
3356      <td width="45%"><b>Requirements</b></td>
3357
3358      <td width="24%"><b>Semantics</b></td>
3359    </tr>
3360
3361    <tr>
3362      <td width="15%"><code>Event</code></td>
3363
3364      <td width="45%">A model of the <a href="#Event">Event</a> concept or
3365      the class <code><a href="#Classevent_base">event_base</a></code></td>
3366
3367      <td width="24%">The event triggering the deferral. If <code><a href=
3368      "#Classevent_base">event_base</a></code> is specified, the deferral is
3369      triggered by all models of the <a href="#Event">Event</a> concept</td>
3370    </tr>
3371  </table>
3372
3373  <h3>Class template <code>deferral</code> synopsis</h3>
3374  <pre>
3375namespace boost
3376{
3377namespace statechart
3378{
3379  template&lt; class Event &gt;
3380  class deferral
3381  {
3382    // <i>implementation-defined</i>
3383  };
3384}
3385}
3386</pre>
3387
3388  <h3>Class template <code>deferral</code> semantics</h3>
3389
3390  <p>When executed, a call is made to the <a href=
3391  "#defer_event"><code>defer_event</code></a> member function of the state
3392  for which the reaction was defined.</p>
3393
3394  <h1>Header &lt;boost/statechart/<a name="custom_reaction.hpp" id=
3395  "custom_reaction.hpp">custom_reaction.hpp</a>&gt;</h1>
3396
3397  <h2><a name="ClassTemplatecustom_reaction" id=
3398  "ClassTemplatecustom_reaction">Class template
3399  <code>custom_reaction</code></a></h2>
3400
3401  <p>This class template is used to specify a custom reaction. Instantiations
3402  of this template can appear in the <code>reactions</code> member
3403  <code>typedef</code> in models of the <a href=
3404  "#SimpleState">SimpleState</a> and <a href="#State">State</a> concepts.</p>
3405
3406  <h3>Class template <code>custom_reaction</code> parameters</h3>
3407
3408  <table border="3" cellpadding="2" width="100%" summary=
3409  "custom_reaction parameters">
3410    <tr>
3411      <td width="17%"><b>Template parameter</b></td>
3412
3413      <td width="56%"><b>Requirements</b></td>
3414
3415      <td width="24%"><b>Semantics</b></td>
3416    </tr>
3417
3418    <tr>
3419      <td width="17%"><code>Event</code></td>
3420
3421      <td width="56%">A model of the <a href="#Event">Event</a> concept or
3422      the class <code><a href="#Classevent_base">event_base</a></code></td>
3423
3424      <td width="24%">The event triggering the custom reaction. If
3425      <code><a href="#Classevent_base">event_base</a></code> is specified,
3426      the custom reaction is triggered by all models of the <a href=
3427      "#Event">Event</a> concept</td>
3428    </tr>
3429  </table>
3430
3431  <h3>Class template <code>custom_reaction</code> synopsis</h3>
3432  <pre>
3433namespace boost
3434{
3435namespace statechart
3436{
3437  template&lt; class Event &gt;
3438  class custom_reaction
3439  {
3440    // <i>implementation-defined</i>
3441  };
3442}
3443}
3444</pre>
3445
3446  <h3>Class template <code>custom_reaction</code> semantics</h3>
3447
3448  <p>When executed, a call is made to the user-supplied <code>react</code>
3449  member function of the state for which the reaction was defined. The
3450  <code>react</code> member function must have the following signature:</p>
3451  <pre>
3452<a href="#Classresult">result</a> react( const Event &amp; );
3453</pre>
3454
3455  <p>and must call exactly one of the following reaction functions and return
3456  the obtained <code><a href="#Classresult">result</a></code> object:</p>
3457  <pre>
3458<a href="#Classresult">result</a> <a href=
3459"#discard_event">discard_event</a>();
3460<a href="#Classresult">result</a> <a href=
3461"#forward_event">forward_event</a>();
3462<a href="#Classresult">result</a> <a href="#defer_event">defer_event</a>();
3463template&lt; class DestinationState &gt;
3464<a href="#Classresult">result</a> <a href="#transit1">transit</a>();
3465template&lt;
3466  class DestinationState,
3467  class TransitionContext,
3468  class Event &gt;
3469<a href="#Classresult">result</a> <a href="#transit2">transit</a>(
3470  void ( TransitionContext::* )( const Event &amp; ),
3471  const Event &amp; );
3472<a href="#Classresult">result</a> <a href=
3473"#simple_state::terminate">terminate</a>();
3474</pre>
3475
3476  <h1>Header &lt;boost/statechart/<a name="result.hpp" id=
3477  "result.hpp">result.hpp</a>&gt;</h1>
3478
3479  <h2><a name="Classresult" id="Classresult">Class
3480  <code>result</code></a></h2>
3481
3482  <p>Defines the nature of the reaction taken in a user-supplied
3483  <code>react</code> member function (called when a <code><a href=
3484  "#ClassTemplatecustom_reaction">custom_reaction</a></code> is executed).
3485  Objects of this type are always obtained by calling one of the reaction
3486  functions and must be returned from the <code>react</code> member function
3487  immediately.</p>
3488  <pre>
3489namespace boost
3490{
3491namespace statechart
3492{
3493  class result
3494  {
3495    public:
3496      <a href="#result0">result</a>( const result &amp; other );
3497      <a href="#resultdtor">~result</a>();
3498
3499    private:
3500      // Result objects are not assignable
3501      result &amp; operator=( const result &amp; other );
3502  };
3503}
3504}
3505</pre>
3506
3507  <h3>Class <code>result</code> constructor and destructor</h3>
3508  <pre>
3509<a name="result0" id="result0">result</a>( const result &amp; other );
3510</pre>
3511
3512  <p><b>Requires</b>: <code>other</code> is <b>not</b> consumed<br>
3513  <b>Effects</b>: Copy-constructs a new <code>result</code> object and marks
3514  <code>other</code> as consumed. That is, <code>result</code> has
3515  destructive copy semantics</p>
3516  <pre>
3517<a name="resultdtor" id="resultdtor">~result</a>();
3518</pre>
3519
3520  <p><b>Requires</b>: <code>this</code> is marked as consumed<br>
3521  <b>Effects</b>: Destructs the result object</p>
3522  <hr>
3523
3524  <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
3525  "http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
3526  height="31" width="88"></a></p>
3527
3528  <p>Revised
3529  <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->09 April, 2007<!--webbot bot="Timestamp" endspan i-checksum="30014" --></p>
3530
3531  <p><i>Copyright &copy; 2003-<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y" startspan -->2007<!--webbot bot="Timestamp" endspan i-checksum="778" -->
3532   <a href="contact.html">Andreas Huber D&ouml;nni</a></i></p>
3533
3534  <p><i>Distributed under the Boost Software License, Version 1.0. (See
3535  accompanying file <a href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
3536  copy at <a href=
3537  "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
3538</body>
3539</html>
Note: See TracBrowser for help on using the repository browser.