|
Boost Users : |
Subject: Re: [Boost-users] [msm] submachine interaction
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2010-05-22 15:55:13
> Hello -
>
> I've created a state machine in MSM successfully, but cannot figure
> out how to interact with a submachine state object.
>
> Using the tutorial machine in "Defining a submachine", can a playlist
> be provided to Playing? I'd like to call a constructor, or a 2 stage
> init function of Playing, but haven't figure out how.
>
> I could use the "FSM" parameter of the on_entry method of the
> submachine to pull the playlist, but it appears that FSM is the
> submachine itself (Playing), not the containing machine (Player) as it
> is for regular states.
>
> Thanks for you help,
> Gordon Smith
Hi Gordon,
You could call "get_state<player_::Playing&>()" on the player instance
but I agree that the current behavior makes little sense, so I just
changed it.
The "FSM" parameter of on_entry (and on_exit) for a submachine now
will be the containing machine (player), so that submachines' entry
and exit conditions get the same parameters as substates.
Of course, substates of the submachine still get as FSM parameter the
submachine, not the containing machine.
As we are still far from the release, we still have time to make this change.
Should I have broken somebody's code, please shout ;-)
I now moved MSM to the trunk, and all changes are now done there, so
you need to get:
https://svn.boost.org/svn/boost/trunk/boost/msm/back/state_machine.hpp
(it is also in the sandbox, just in case).
Thanks for the report,
Christophe
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