boost statechart - using deep_history/shallow_history with custom reactions

Hi Question on using history with custom reactions I have a parent-state-A state and a parent-state-B state parent-state-A has a child-state-A1 and a child-state-A2 (nested state) The machine initializes on parent-state-A entering by default in child-state-A1 (the initial state) Then moves to child-state-A2 Then to parent-state-B Then a event occurs and I need the machine to go back to child-state-A2 (and not the initial state child-state-A2) question is how do I do it when using custom reactions that is, instead of doing a hardcoded parent-state-B::react (event& evty) { return transit<child-state-A2 > (); } I would like to do something like parent-state-B::react (event& evty) { return transit<parent-state-A > (); } and let the state machine figure out that it needs to go back to child-state-A2 rather then the initial child-state-A1 the documentation shows how to do it with sc::transition... but I couldn't find a way to do it in the case of custom reactions trial and error didn't work either... help! : ) thanks in advance silva

Hi
the documentation shows how to do it with sc::transition... but I couldn't find a way to do it in the case of custom reactions trial and error didn't work either...
Did you try return transit< sc::deep_history< child-state-A1 > >() ? Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

Hi Andreas that worked perfectly! thanks! Just so that I understand the mechanism, basically I have to transit into the initial state child-state-A1 , and deep_history will know that it actually needs to go through child-state-A2 on its way there. correct? regards silva
Hi
the documentation shows how to do it with sc::transition... but I couldn't find a way to do it in the case of custom reactions trial and error didn't work either...
Did you try return transit< sc::deep_history< child-state-A1 > >() ? Regards, -- Andreas Huber
On Fri, Nov 13, 2009 at 10:41 PM, ae ss
Hi
Question on using history with custom reactions
I have a parent-state-A state and a parent-state-B state
parent-state-A has a child-state-A1 and a child-state-A2 (nested state)
The machine initializes on parent-state-A entering by default in child-state-A1 (the initial state) Then moves to child-state-A2 Then to parent-state-B
Then a event occurs and I need the machine to go back to child-state-A2 (and not the initial state child-state-A2)
question is how do I do it when using custom reactions that is, instead of doing a hardcoded
parent-state-B::react (event& evty) { return transit<child-state-A2 > (); }
I would like to do something like
parent-state-B::react (event& evty) { return transit<parent-state-A > (); }
and let the state machine figure out that it needs to go back to child-state-A2 rather then the initial child-state-A1
the documentation shows how to do it with sc::transition... but I couldn't find a way to do it in the case of custom reactions trial and error didn't work either...
help! : )
thanks in advance silva

Just so that I understand the mechanism, basically I have to transit into the initial state child-state-A1 , and deep_history will know that it actually needs to go through child-state-A2 on its way there. correct? http://www.boost.org/libs/statechart/doc/reference.html#ClassTemplatedeep_hi... No, the template parameter you pass to sc::deep_history is the *default* *state*, which is entered when no history information is available. If history information is available, then the last exited child-state of parent-state-A is entered. Whether or not the default state also happens to be the initial state is irrelevant. HTH, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

thanks!
On Mon, Nov 16, 2009 at 7:31 PM, Andreas Huber
Just so that I understand the mechanism, basically I have to transit into the initial state child-state-A1 , and deep_history will know that it actually needs to go through child-state-A2 on its way there. correct?
http://www.boost.org/libs/statechart/doc/reference.html#ClassTemplatedeep_hi...
No, the template parameter you pass to sc::deep_history is the *default* *state*, which is entered when no history information is available. If history information is available, then the last exited child-state of parent-state-A is entered. Whether or not the default state also happens to be the initial state is irrelevant.
HTH,
-- Andreas Huber
When replying by private email, please remove the words spam and trap from the address shown in the header.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
ae ss
-
Andreas Huber