
Hi, <snip code>
You see that the code calls f*sm.process_event(Event2())* within the state *SubState1* of the submachine to make a transition from the top-level state *State1* to *State2* of the outer statemachine. Unfortunately this doesn't work although the *Event2* is defined in the transition table of the outer-statemachine.
On the other hand it a transition from *State1* to state *State2* works in case the event *Event2* is fired outside the submachine ( please refer to the void test() function in the code above).
I actually don't want to define a transition in the transition table of submachine to enter an pseudo exit point like:
msmf::Row < SubState1, Event2, Exit1, msmf::none, msmf::none >
Is there a possibility in MSM to exit a composite state if an event is fired from that composite state?
It's a question which is asked regularly on different forms. It usually boils down to a current limitation, that the FSM template parameter refers to the lowest level fsm, not the outer, and you want to send the event to the outest to get correct handling. Actually I got this asked a few days ago. You need to get to the lower-level fsm a way to call the outest: - let the outer state machine set a pointer to itself into each submachine - hide this inside a boost::function. Unfortunately it means a boost::function for every event - use type_erasure (not in boost yet) to have just one object with several members instead of many boost::function objects I'm aware of this limitation and I want to provide a solution (a variadic list of FSMs) right after the thread thing you just asked. In the meantime you will have to use one of the above solutions.
Thank you in advance for your time and help!
Grüße ;),
:) Grüße, Christophe