[statechart] Events forwarding and orthogonal states
Hi all, I've a problem similar to the one discussed in this old post: http://boost.2283326.n4.nabble.com/statechart-Broadcasting-events-to-orthogo... I have a state, let's call it A, which contains two orthogonal regions. State X is the initial state of region 0 and state Y is the initial state of region 1. Both state A and state Y have a custom reaction for event E. State Y execute some computation based on event E while state A simply keeps track of how many times the event E is triggered. State A discard the event at the end of the custom reaction, while state Y forward it (the goal would be to forward it to the state A).
From the old post I think I have understood how the statechart library works and why the state Y never receives the event E. I guess that in my case state X is chosen as first state to process event E. Given that X is not interested in event E, the event is forwarded to state A, which process it and discard it.
I see few possible solutions (with drawbacks) but I would like to know how this problem should be addressed. 1) I could do the counting directly in the state Y and remove the custom reaction to E from state A. This would work, however if tomorrow I will define a third state Z interested in E, I would have to duplicate the event counting code, which would work only if I assume that the Z and Y are not active at the same time (otherwise the event would be counted twice). 2) I could define an event that is listened only by state A and is triggered by the state Y after processing E. This doesn't seem really elegant and if multiple states are interested in E I have to be careful to not count the event twice. -- View this message in context: http://boost.2283326.n4.nabble.com/statechart-Events-forwarding-and-orthogon... Sent from the Boost - Users mailing list archive at Nabble.com.
participants (1)
-
lucaghera