Weird behaviour when changing states in boost::fsm
Hi, I realized a weird behaviour when using boost::fsm. Here's my state setup: I have a parent state which has two substates. One is basicly a noop as InnerInitial, the other is and OptionsDialog. Now, in a custom_reaction's react function in the parent state, I call transit<OptionsDialog> in order to go to the OptionsDialog-substate. What happens is that the parentstate itself is destroyed and reentered, then it enters the OptionsDialog state. Something similar happens when I use transit<ParentState> to go back to the ParentState (which should automatically enter the InnerInitial, no?). It exits the OptionsDialog, then exits ParentState and reenters ParentState (I haven't checked if it enters the InnerInitial). If in the OptionsDialog, I do a transit<NoOpInnerInitial> it just goes there without first destroying the parent-state (just exits OptionsDialog but not ParentState). Is this the expected behaviour, if so, could someone explain how to get the desired behaviour? Thanks, Jan Eickmann
Hi Jan
I realized a weird behaviour when using boost::fsm. Here's my state setup:
I have a parent state which has two substates. One is basicly a noop as InnerInitial, the other is and OptionsDialog. Now, in a custom_reaction's react function in the parent state, I call transit<OptionsDialog> in order to go to the OptionsDialog-substate. What happens is that the parentstate itself is destroyed and reentered, then it enters the OptionsDialog state.
As Darryl has already pointed out (Thanks Darryl!) this is expected and in line with the behavior defined by UML/Harel.
Something similar happens when I use transit<ParentState> to go back to the ParentState (which should automatically enter the InnerInitial, no?).
Yes.
It exits the OptionsDialog, then exits ParentState and reenters ParentState (I haven't checked if it enters the InnerInitial).
Again, all expected and it should enter InnerInitial.
If in the OptionsDialog, I do a transit<NoOpInnerInitial> it just goes there without first destroying the parent-state (just exits OptionsDialog but not ParentState). Is this the expected behaviour, if so, could someone explain how to get the desired behaviour?
IIUC, it seems that you don't need the parent state, as you basically just have 2 states (ShowOptionsDialog/DontShowOptionsDialog), with 2 or 3 transitions between these states. Then again, this obviously depends on whether it is just a toy example or a part of a bigger FSM. In the latter case you'd need to give a rough description of the desired behavior of the whole FSM... Regards, Andreas
participants (2)
-
Andreas Huber
-
Jan Eickmann