Boost logo

Boost Users :

Subject: Re: [Boost-users] [statechart] history not saved
From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2012-11-08 17:10:20


Ilya Orlov <iorlov <at> gmail.com> writes:

> I missed your advice in previous message. I changed transition code to A1
state and it worked perfectly. But ideally, I'd like to transit from B not to
A1 but to A state. How I can change this code to get it working with saving all
history for A-substates?

I guess you are missing the fact that the template argument passed to
deep_history is actually the *default* *state*. This is the state that is
entered when no history has ever been saved. If history has been saved (as is
the case in your example code) then transit< sc::deep_history < StateA1 > >()
will transit to whatever inner state of A was active before A was exited. This
is explained in more detail here:

<http://www.boost.org/doc/libs/1_52_0/libs/statechart/doc/tutorial.html#History>

HTH,

Andreas Huber

P.S. In your example you're also specifying sc::deep_history< StateA1 > as
InnerInitial of A. So you could even transit directly to A, as follows:

return transit < StateA >();

and get exactly the same behavior as when you write:

return transit< sc::deep_history < StateA1 > >();


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net