[statechart] history in the different state hierarchies
Hello everybody.
I have a problem similar to the one described in the Statechart tutorial, but a
little different. My state machine has two states (let's call them A and B) in
the different state hierarchies and a third state C that can be transited to
from either A or B. The transition from C must be done to either A or B,
depending on where we came to C from.
So I've decided to use the history. The difference between this problem and
what's described in the tutorial is that A and B don't belong to the same
composite state (they only belong to the same state machine). I can't simply
declare "has_xxx_history" in the outer state like it's done in the tutorial.
Here's what I've tried to do:
#include <iostream>
#include
Hi
I have a problem similar to the one described in the Statechart tutorial, but a little different. My state machine has two states (let's call them A and B) in the different state hierarchies and a third state C that can be transited to from either A or B. The transition from C must be done to either A or B, depending on where we came to C from.
So I've decided to use the history. The difference between this problem and what's described in the tutorial is that A and B don't belong to the same composite state (they only belong to the same state machine). I can't simply declare "has_xxx_history" in the outer state like it's done in the tutorial.
If you want to transition to either state_A or state_B from state_C based on history, I'm afraid putting state_A and state_B in the same direct or indirect outer state is your only option. That's how history works. In your example, it seems it would be possible to put state_A and state_B into a new outer state state_X and transition to state_X with deep history, no? Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
Hi Andreas,
If you want to transition to either state_A or state_B from state_C based on history, I'm afraid putting state_A and state_B in the same direct or indirect outer state is your only option. That's how history works.
Thanks, that's what I needed to know, I guess... At first I thought it could work without putting the states in some outer state.
In your example, it seems it would be possible to put state_A and state_B into a new outer state state_X and transition to state_X with deep history, no?
Yes, it works fine with the outer state, just like it's explained in the tutorial. I think I'll have to revise the layout of my state machine. Thanks again for the explanation.
participants (2)
-
Andreas Huber
-
Vlad Orlov