Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost MSM: Can not get out of the submachine
From: gauravk (gaurav_kulkarni_at_[hidden])
Date: 2011-06-03 19:47:41


Thank you for the response. I have moved generation of the event "last_state"
to main function instead of the payment_done struct (I have attached the
code too. As I mentioned the code and some logic is not sophisticated.) and
the code seems to be working. However if I want to make an auto-transition
from the Payment sub-machine (once it reaches the final "payment_done"
state) to the next state in the vending machine how do I do that? I tried to
declare en exit_pseudo_state without an event (struct payment_done: public
exit_pseudo_state<last_state>) and then declare an auto-transition from
"Payment" submachine to "waiting" state in the vending machine (Row <
Payment::exit_pt<payment_done>, none, waiting, dispense_item, none>) but I
am receiving compilation errors.

I have another question to ask. If one wants to access info stored in one
state from another state, what will be an elegant way to do that? For eg. In
case of the vending machine example, lets assume the selection state stores
the product selected by the customer. This info then needs to be accessed
while dispensing the product at later stages. One way could be storing
pointers to all the instances of structs that represent state in the state
machine. However in this case submachines may not be able to access the info
stored in the parent machine.

Thanks!
http://boost.2283326.n4.nabble.com/file/n3572332/vending_machine.cpp
vending_machine.cpp

--
View this message in context: http://boost.2283326.n4.nabble.com/Boost-MSM-Can-not-get-out-of-the-submachine-tp3567263p3572332.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net