Re: [boost] [msm] Passing constructor arguments to submachine

Hi Michael,
As already explained in another thread, it is possible to pass constructor arguments to msm state machines (to the front end).
Is it also possible to pass constructor arguments to submachines of a msm state machine?
Unfortunately, not yet. There was a proposal made during the review to allow states (including submachines) to be cloned from an existing one, but it is not implemented yet.
Or is there an other way in order to configure the inner submachine by calling some member methods from the outer state machine or therelike?
You can call get_state<my_submachine&>() on the outer fsm (at best in the entry behavior). For example: struct Playing_ : public msm::front::state_machine_def<Playing_> { template <class Event,class Fsm> void on_entry(Event const&,Fsm& fsm) { fsm.get_state<my_submachine&>() .foo(); } ... }; HTH, Christophe

At Tue, 1 Jun 2010 20:08:20 +0200, Christophe Henry wrote:
Hi Michael,
As already explained in another thread, it is possible to pass constructor arguments to msm state machines (to the front end).
Is it also possible to pass constructor arguments to submachines of a msm state machine?
Unfortunately, not yet. There was a proposal made during the review to allow states (including submachines) to be cloned from an existing one, but it is not implemented yet.
The Parameter library can sometimes be used to make this sort of thing work nicely. See Boost.Accumulators, for example. -- Dave Abrahams BoostPro Computing http://www.boostpro.com
participants (2)
-
Christophe Henry
-
David Abrahams