| 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 name="GENERATOR" content="Microsoft FrontPage 6.0"> |
|---|
| 7 | <meta name="ProgId" content="FrontPage.Editor.Document"> |
|---|
| 8 | <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> |
|---|
| 9 | <link rel="stylesheet" type="text/css" href="../../../boost.css"> |
|---|
| 10 | |
|---|
| 11 | <title>The Boost Statechart Library - Definitions</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">UML to Boost.Statechart mapping summary</h2> |
|---|
| 27 | </td> |
|---|
| 28 | </tr> |
|---|
| 29 | </table> |
|---|
| 30 | <hr> |
|---|
| 31 | |
|---|
| 32 | <h2>Contents</h2> |
|---|
| 33 | |
|---|
| 34 | <dl class="page-index"> |
|---|
| 35 | <dt><a href="#StateMachine">State machine</a></dt> |
|---|
| 36 | |
|---|
| 37 | <dt><a href="#States">States</a></dt> |
|---|
| 38 | |
|---|
| 39 | <dd><a href="#NormalState">Normal state</a></dd> |
|---|
| 40 | |
|---|
| 41 | <dd><a href="#InitialPseudostate">Initial pseudostate</a></dd> |
|---|
| 42 | |
|---|
| 43 | <dd><a href="#FinalPseudostate">Final pseudostate</a></dd> |
|---|
| 44 | |
|---|
| 45 | <dd><a href="#ShallowHistoryPseudostate">Shallow history |
|---|
| 46 | pseudostate</a></dd> |
|---|
| 47 | |
|---|
| 48 | <dd><a href="#DeepHistoryPseudostate">Deep history pseudostate</a></dd> |
|---|
| 49 | |
|---|
| 50 | <dd><a href="#JunctionPoint">Junction point</a></dd> |
|---|
| 51 | |
|---|
| 52 | <dd><a href="#DynamicChoicePoint">Dynamic choice point</a></dd> |
|---|
| 53 | |
|---|
| 54 | <dd><a href="#JoinAndForkBars">Join and fork bars</a></dd> |
|---|
| 55 | |
|---|
| 56 | <dt><a href="#Events">Events</a></dt> |
|---|
| 57 | |
|---|
| 58 | <dd><a href="#CallEvent">Call event</a></dd> |
|---|
| 59 | |
|---|
| 60 | <dd><a href="#SignalEvent">Signal event</a></dd> |
|---|
| 61 | |
|---|
| 62 | <dd><a href="#TimeEvent">Time event</a></dd> |
|---|
| 63 | |
|---|
| 64 | <dd><a href="#ChangeEvent">Change event</a></dd> |
|---|
| 65 | |
|---|
| 66 | <dt><a href="#Reactions">Reactions</a></dt> |
|---|
| 67 | |
|---|
| 68 | <dd><a href="#Guard">Guard</a></dd> |
|---|
| 69 | |
|---|
| 70 | <dd><a href="#Transition">Transition</a></dd> |
|---|
| 71 | |
|---|
| 72 | <dd><a href="#Deferral">Deferral</a></dd> |
|---|
| 73 | |
|---|
| 74 | <dd><a href="#InternalTransition">Internal transition (in-state |
|---|
| 75 | reaction)</a></dd> |
|---|
| 76 | |
|---|
| 77 | <dt><a href="#Actions">Actions</a></dt> |
|---|
| 78 | |
|---|
| 79 | <dd><a href="#EntryAction">Entry action</a></dd> |
|---|
| 80 | |
|---|
| 81 | <dd><a href="#ExitAction">Exit action</a></dd> |
|---|
| 82 | |
|---|
| 83 | <dd><a href="#TransitionAction">Transition action</a></dd> |
|---|
| 84 | |
|---|
| 85 | <dd><a href="#DoActivity">Do activity</a></dd> |
|---|
| 86 | </dl> |
|---|
| 87 | <hr> |
|---|
| 88 | |
|---|
| 89 | <h2><a name="StateMachine" id="StateMachine">State machine</a></h2> |
|---|
| 90 | |
|---|
| 91 | <ul> |
|---|
| 92 | <li>A state machine is defined by deriving a class from either the |
|---|
| 93 | <code><a href= |
|---|
| 94 | "reference.html#ClassTemplatestate_machine">state_machine</a></code> or |
|---|
| 95 | the <code><a href= |
|---|
| 96 | "reference.html#ClassTemplateasynchronous_state_machine">asynchronous_state_machine</a></code> |
|---|
| 97 | class templates; <a href= |
|---|
| 98 | "tutorial.html#DefiningStatesAndEvents">example</a></li> |
|---|
| 99 | </ul> |
|---|
| 100 | |
|---|
| 101 | <h2><a name="States" id="States">States</a></h2> |
|---|
| 102 | |
|---|
| 103 | <h3><a name="NormalState" id="NormalState">Normal state</a></h3> |
|---|
| 104 | |
|---|
| 105 | <ul> |
|---|
| 106 | <li>A state is defined by deriving a class from either the <code><a href= |
|---|
| 107 | "reference.html#ClassTemplatesimple_state">simple_state</a></code> or |
|---|
| 108 | <code><a href="reference.html#ClassTemplatestate">state</a></code> class |
|---|
| 109 | templates; <a href= |
|---|
| 110 | "tutorial.html#DefiningStatesAndEvents">example</a></li> |
|---|
| 111 | |
|---|
| 112 | <li>The position of a state in the state hierarchy is defined by what is |
|---|
| 113 | passed as the <code>Context</code> template parameter. <a href= |
|---|
| 114 | "definitions.html#OutermostState">Outermost states</a> pass the |
|---|
| 115 | <code><a href= |
|---|
| 116 | "reference.html#ClassTemplatestate_machine">state_machine<></a></code> |
|---|
| 117 | or <code><a href= |
|---|
| 118 | "reference.html#ClassTemplateasynchronous_state_machine">asynchronous_state_machine<></a></code> |
|---|
| 119 | subtype they belong to, inner states pass their direct outer state; |
|---|
| 120 | <a href="tutorial.html#DefiningStatesAndEvents">example</a></li> |
|---|
| 121 | |
|---|
| 122 | <li>A state can be made a member of a particular orthogonal region by |
|---|
| 123 | passing an instantiation of the <code>orthogonal</code> class template |
|---|
| 124 | nested in its outer state; <a href= |
|---|
| 125 | "tutorial.html#OrthogonalStates">example</a></li> |
|---|
| 126 | </ul> |
|---|
| 127 | |
|---|
| 128 | <h3><a name="InitialPseudostate" id="InitialPseudostate">Initial |
|---|
| 129 | pseudostate</a></h3> |
|---|
| 130 | |
|---|
| 131 | <ul> |
|---|
| 132 | <li>The state that is initially entered is identified by template |
|---|
| 133 | parameters rather than by a default transition from the initial |
|---|
| 134 | pseudostate (there is no such thing in Boost.Statechart)</li> |
|---|
| 135 | |
|---|
| 136 | <li>For <code><a href= |
|---|
| 137 | "reference.html#ClassTemplatestate_machine">state_machine<></a></code> |
|---|
| 138 | and <code><a href= |
|---|
| 139 | "reference.html#ClassTemplateasynchronous_state_machine">asynchronous_state_machine<></a></code> |
|---|
| 140 | the state that is initially entered needs to be specified with the |
|---|
| 141 | <code>InitialState</code> template parameter; <a href= |
|---|
| 142 | "tutorial.html#DefiningStatesAndEvents">example</a></li> |
|---|
| 143 | |
|---|
| 144 | <li>For <code><a href= |
|---|
| 145 | "reference.html#ClassTemplatesimple_state">simple_state<></a></code> |
|---|
| 146 | and <code><a href= |
|---|
| 147 | "reference.html#ClassTemplatestate">state<></a></code> the inner |
|---|
| 148 | state(s) that is/are initially entered can be specified with the |
|---|
| 149 | <code>InnerInitial</code> template parameter; <a href= |
|---|
| 150 | "tutorial.html#DefiningStatesAndEvents">example</a></li> |
|---|
| 151 | </ul> |
|---|
| 152 | |
|---|
| 153 | <h3><a name="FinalPseudostate" id="FinalPseudostate">Final |
|---|
| 154 | pseudostate</a></h3> |
|---|
| 155 | |
|---|
| 156 | <ul> |
|---|
| 157 | <li>There is no such thing as a final pseudostate in |
|---|
| 158 | Boost.Statechart</li> |
|---|
| 159 | |
|---|
| 160 | <li>This functionality is implemented with a special reaction |
|---|
| 161 | (<code><a href= |
|---|
| 162 | "reference.html#ClassTemplatetermination">termination<></a></code>) |
|---|
| 163 | and special reaction function (<code><a href= |
|---|
| 164 | "reference.html#simple_state::terminate">simple_state<>::terminate()</a></code>); |
|---|
| 165 | <a href="tutorial.html#StateQueries">example</a></li> |
|---|
| 166 | </ul> |
|---|
| 167 | |
|---|
| 168 | <h3><a name="ShallowHistoryPseudostate" id= |
|---|
| 169 | "ShallowHistoryPseudostate">Shallow history pseudostate</a></h3> |
|---|
| 170 | |
|---|
| 171 | <ul> |
|---|
| 172 | <li>A shallow history transition target or shallow history inner initial |
|---|
| 173 | state can be specified with <code><a href= |
|---|
| 174 | "reference.html#ClassTemplateshallow_history">shallow_history<></a></code></li> |
|---|
| 175 | </ul> |
|---|
| 176 | |
|---|
| 177 | <h3><a name="DeepHistoryPseudostate" id="DeepHistoryPseudostate">Deep |
|---|
| 178 | history pseudostate</a></h3> |
|---|
| 179 | |
|---|
| 180 | <ul> |
|---|
| 181 | <li>A deep history transition target or deep history inner initial state |
|---|
| 182 | can be specified with <code><a href= |
|---|
| 183 | "reference.html#ClassTemplatedeep_history">deep_history<></a></code>; |
|---|
| 184 | <a href="tutorial.html#History">example</a></li> |
|---|
| 185 | </ul> |
|---|
| 186 | |
|---|
| 187 | <h3><a name="JunctionPoint" id="JunctionPoint">Junction point</a></h3> |
|---|
| 188 | |
|---|
| 189 | <ul> |
|---|
| 190 | <li>Does not exist in Boost.Statechart; <a href= |
|---|
| 191 | "rationale.html#Limitations">rationale</a></li> |
|---|
| 192 | </ul> |
|---|
| 193 | |
|---|
| 194 | <h3><a name="DynamicChoicePoint" id="DynamicChoicePoint">Dynamic choice |
|---|
| 195 | point</a></h3> |
|---|
| 196 | |
|---|
| 197 | <ul> |
|---|
| 198 | <li>Does not (yet?) exist in Boost.Statechart; <a href= |
|---|
| 199 | "rationale.html#Limitations">rationale</a></li> |
|---|
| 200 | </ul> |
|---|
| 201 | |
|---|
| 202 | <h3><a name="JoinAndForkBars" id="JoinAndForkBars">Join and fork |
|---|
| 203 | bars</a></h3> |
|---|
| 204 | |
|---|
| 205 | <ul> |
|---|
| 206 | <li>Do not exist in Boost.Statechart; <a href= |
|---|
| 207 | "rationale.html#Limitations">rationale</a></li> |
|---|
| 208 | </ul> |
|---|
| 209 | |
|---|
| 210 | <h2><a name="Events" id="Events">Events</a></h2> |
|---|
| 211 | |
|---|
| 212 | <ul> |
|---|
| 213 | <li>A event is defined by deriving a class from the <a href= |
|---|
| 214 | "reference.html#ClassTemplateevent"><code>event</code></a> class |
|---|
| 215 | template; <a href= |
|---|
| 216 | "tutorial.html#DefiningStatesAndEvents">example</a></li> |
|---|
| 217 | |
|---|
| 218 | <li>There is no distinction between signal and call events, see |
|---|
| 219 | below</li> |
|---|
| 220 | </ul> |
|---|
| 221 | |
|---|
| 222 | <h3><a name="CallEvent" id="CallEvent">Call event</a></h3> |
|---|
| 223 | |
|---|
| 224 | <ul> |
|---|
| 225 | <li>All events passed to <code><a href= |
|---|
| 226 | "reference.html#process_event">state_machine<>::process_event()</a></code> |
|---|
| 227 | are implicitly call events</li> |
|---|
| 228 | </ul> |
|---|
| 229 | |
|---|
| 230 | <h3><a name="SignalEvent" id="SignalEvent">Signal event</a></h3> |
|---|
| 231 | |
|---|
| 232 | <ul> |
|---|
| 233 | <li>All events passed to either <code><a href= |
|---|
| 234 | "reference.html#post_event0">simple_state<>::post_event()</a></code> |
|---|
| 235 | or <code><a href= |
|---|
| 236 | "reference.html#queue_event">fifo_scheduler<>::queue_event()</a></code> |
|---|
| 237 | are implicitly signal events</li> |
|---|
| 238 | </ul> |
|---|
| 239 | |
|---|
| 240 | <h3><a name="TimeEvent" id="TimeEvent">Time event</a></h3> |
|---|
| 241 | |
|---|
| 242 | <ul> |
|---|
| 243 | <li>Does not exist in Boost.Statechart</li> |
|---|
| 244 | |
|---|
| 245 | <li>A time event can be simulated with an external timer that is started |
|---|
| 246 | in the entry action and stopped in the exit action of a particular state. |
|---|
| 247 | When starting the timer, it is instructed to call <code><a href= |
|---|
| 248 | "reference.html#queue_event">fifo_scheduler<>::queue_event()</a></code> |
|---|
| 249 | when the due time elapses</li> |
|---|
| 250 | </ul> |
|---|
| 251 | |
|---|
| 252 | <h3><a name="ChangeEvent" id="ChangeEvent">Change event</a></h3> |
|---|
| 253 | |
|---|
| 254 | <ul> |
|---|
| 255 | <li>Does not exist in Boost.Statechart</li> |
|---|
| 256 | |
|---|
| 257 | <li>A change event can be simulated by packing to be monitored variables |
|---|
| 258 | into an external wrapper with <code>get</code> and <code>set</code> |
|---|
| 259 | methods. Whenever <code>set</code> is called the wrapper posts an |
|---|
| 260 | appropriate event</li> |
|---|
| 261 | </ul> |
|---|
| 262 | |
|---|
| 263 | <h2><a name="Reactions" id="Reactions">Reactions</a></h2> |
|---|
| 264 | |
|---|
| 265 | <h3><a name="Guard" id="Guard">Guard</a></h3> |
|---|
| 266 | |
|---|
| 267 | <ul> |
|---|
| 268 | <li>A guard can be implemented with a selection statement in a |
|---|
| 269 | <code><a href= |
|---|
| 270 | "reference.html#ClassTemplatecustom_reaction">custom_reaction<></a></code>; |
|---|
| 271 | <a href="tutorial.html#Guards">example</a></li> |
|---|
| 272 | </ul> |
|---|
| 273 | |
|---|
| 274 | <h3><a name="Transition" id="Transition">Transition</a></h3> |
|---|
| 275 | |
|---|
| 276 | <ul> |
|---|
| 277 | <li>A transition can be defined with either a <code><a href= |
|---|
| 278 | "reference.html#ClassTemplatetransition">transition<></a></code> or |
|---|
| 279 | a call to <code><a href= |
|---|
| 280 | "reference.html#transit1">simple_state<>::transit<></a></code> |
|---|
| 281 | in a <code><a href= |
|---|
| 282 | "reference.html#ClassTemplatecustom_reaction">custom_reaction<></a></code>; |
|---|
| 283 | <a href="tutorial.html#AddingReactions">example</a></li> |
|---|
| 284 | </ul> |
|---|
| 285 | |
|---|
| 286 | <h3><a name="Deferral" id="Deferral">Deferral</a></h3> |
|---|
| 287 | |
|---|
| 288 | <ul> |
|---|
| 289 | <li>A deferral reaction can be defined with either a <code><a href= |
|---|
| 290 | "reference.html#ClassTemplatedeferral">deferral<></a></code> or a |
|---|
| 291 | call to <code><a href= |
|---|
| 292 | "reference.html#defer_event">simple_state<>::defer_event()</a></code> |
|---|
| 293 | in a <code><a href= |
|---|
| 294 | "reference.html#ClassTemplatecustom_reaction">custom_reaction<></a></code>; |
|---|
| 295 | <a href="tutorial.html#DeferringEvents">example</a></li> |
|---|
| 296 | </ul> |
|---|
| 297 | |
|---|
| 298 | <h3><a name="InternalTransition" id="InternalTransition">Internal |
|---|
| 299 | transition (in-state reaction)</a></h3> |
|---|
| 300 | |
|---|
| 301 | <ul> |
|---|
| 302 | <li>An in-state reaction can be defined with either a <code><a href= |
|---|
| 303 | "reference.html#ClassTemplatein_state_reaction">in_state_reaction<></a></code> |
|---|
| 304 | or a call to <a href= |
|---|
| 305 | "reference.html#discard_event"><code>simple_state<>::discard_event()</code></a> |
|---|
| 306 | in a <code><a href= |
|---|
| 307 | "reference.html#ClassTemplatecustom_reaction">custom_reaction<></a></code></li> |
|---|
| 308 | </ul> |
|---|
| 309 | |
|---|
| 310 | <h2><a name="Actions" id="Actions">Actions</a></h2> |
|---|
| 311 | |
|---|
| 312 | <h3><a name="EntryAction" id="EntryAction">Entry action</a></h3> |
|---|
| 313 | |
|---|
| 314 | <ul> |
|---|
| 315 | <li>A state entry action can be defined by adding a constructor to a |
|---|
| 316 | state class; <a href="tutorial.html#HelloWorld">example</a></li> |
|---|
| 317 | </ul> |
|---|
| 318 | |
|---|
| 319 | <h3><a name="ExitAction" id="ExitAction">Exit action</a></h3> |
|---|
| 320 | |
|---|
| 321 | <ul> |
|---|
| 322 | <li>A state exit action can be defined by adding a destructor to a state |
|---|
| 323 | class; <a href="tutorial.html#HelloWorld">example</a></li> |
|---|
| 324 | </ul> |
|---|
| 325 | |
|---|
| 326 | <h3><a name="TransitionAction" id="TransitionAction">Transition |
|---|
| 327 | action</a></h3> |
|---|
| 328 | |
|---|
| 329 | <ul> |
|---|
| 330 | <li>A transition action can be defined by passing a function pointer |
|---|
| 331 | referencing the action to either <code><a href= |
|---|
| 332 | "reference.html#ClassTemplatetransition">transition<></a></code> or |
|---|
| 333 | <code><a href= |
|---|
| 334 | "reference.html#transit2">simple_state<>::transit<>()</a></code>; |
|---|
| 335 | <a href="tutorial.html#TransitionActions">example</a></li> |
|---|
| 336 | </ul> |
|---|
| 337 | |
|---|
| 338 | <h3><a name="DoActivity" id="DoActivity">Do activity</a></h3> |
|---|
| 339 | |
|---|
| 340 | <ul> |
|---|
| 341 | <li>Not supported in Boost.Statechart</li> |
|---|
| 342 | |
|---|
| 343 | <li>A do activity can be simulated with a separate thread that is started |
|---|
| 344 | in the entry action and cancelled (!) in the exit action of a particular |
|---|
| 345 | state</li> |
|---|
| 346 | </ul> |
|---|
| 347 | <hr> |
|---|
| 348 | |
|---|
| 349 | <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src= |
|---|
| 350 | "http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" |
|---|
| 351 | height="31" width="88"></a></p> |
|---|
| 352 | |
|---|
| 353 | <p>Revised |
|---|
| 354 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->03 December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38512" --></p> |
|---|
| 355 | |
|---|
| 356 | <p><i>Copyright © 2003-<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y" startspan -->2006<!--webbot bot="Timestamp" endspan i-checksum="770" --> |
|---|
| 357 | <a href="contact.html">Andreas Huber Dönni</a></i></p> |
|---|
| 358 | |
|---|
| 359 | <p><i>Distributed under the Boost Software License, Version 1.0. (See |
|---|
| 360 | accompanying file <a href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or |
|---|
| 361 | copy at <a href= |
|---|
| 362 | "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> |
|---|
| 363 | </body> |
|---|
| 364 | </html> |
|---|