Note that there are some explanatory texts on larger screens.

plurals
  1. POBoost Statechart - Local transitions
    primarykey
    data
    text
    <p>I'm hoping that someone can help me out with this problem, or at least point out the error of my ways... </p> <p>As a simple illustration of my problem consider a part of an application where you can enter a "Functions Mode" state of operation. Four sub-modes are then available depending on which function key F1-F4 that the user presses. By default, F1 mode is entered. The state diagram starts off as follows: </p> <p><img src="https://i.stack.imgur.com/VI05u.png" alt="Diagram 1"></p> <p>The user can press F1-F4 at any time to switch to the corresponding mode. Adding these transitions to the inner states leads to the following:</p> <p><img src="https://i.stack.imgur.com/SeR05.png" alt="Diagram 2"></p> <p>Obviously this is (a) a mess, and (b) a lot of transitions to define. If at some point I want to add an F5Mode then... well, you get the picture. To avoid this I'd like to do the following:</p> <p><img src="https://i.stack.imgur.com/itPhV.png" alt="Diagram 3"></p> <p>Boost Statechart allows me to define transitions from FunctionMode to any of the inner states, but the result isn't what I expected. The actual outcome is as follows:</p> <p><img src="https://i.stack.imgur.com/NgGGh.png" alt="Diagram 4"></p> <p>I.e. pressing F1-F4 to switch modes causes the outer FunctionMode state to be exited and re-entered along with triggering the unwanted exit and entry actions.</p> <p>Way back in 2006, <a href="http://boost.2283326.n4.nabble.com/statechart-UML2-0-local-transitions-and-history-td2557450.html" rel="nofollow noreferrer">this thread</a> between the library author and a user seems to describe the same problem. I think that the author suggests doing the following as a work-around:</p> <p><img src="https://i.stack.imgur.com/BVRjR.png" alt="Diagram 5"> </p> <p>However, that work-around doesn't seem very appealing to me: It has added an extra state level to be compiled, the code has become less readable, deep-history would have to be used to return to any of the function mode sub-states and the Intermediate state object is needlessly being destructed and constructed again.</p> <p>So... where am I going wrong? Or what are the alternatives? I've had a brief look at Boost Meta State Machine (msm) but from what I've seen so far I much prefer the look of Statechart.</p> <p>I'm surprised that more users haven't faced the same problem... which makes me think that perhaps my approach is completely wrong!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload