Boost logo

Boost :

Subject: Re: [boost] [msm] Version 2.0 available
From: Juraj Ivančić (juraj.ivancic_at_[hidden])
Date: 2009-11-13 20:34:28


Christophe Henry wrote:
> Msm v2.0 is a redesign of Msm v1.20 and offers a separation beetween
> front- and back-ends.

MSM 1.20 allowed writing a state machine with actions/guards which
modify some external state.

E.g.

<code>
struct MyStateMachine
     : public boost::msm::state_machine
{
     MyStateMachine( SomeExternalContext & context )
         : context_( context ) {}

     SomeExternalClass &context_;

     ....guards/actions which mess with 'context_'...
};
</code>

However with MSM 2.0 this becomes:

<code>
struct MyStateMachine_
     : public msm::front::state_machine_def<MyStateMachine_>
{
     MyStateMachine( SomeExternalClass & context )
         : context_( context ) {}

     SomeExternalClass &context_;

     ....
};

typedef msm::back::state_machine<MyStateMachine_> MyStateMachine;
</code>

I no longer instantiate the state machine directly and cannot pass
parameters to constructor and it seems that msm::back::state_machine
will not do this for me (after a quick glance at the definition it
seemed to me that msm::back::state_machine expects its template
parameter to be default constructible).

Is this wrong or am I missing something obvious? Is there some way I
could still achieve the old functionality?

Thank you for the great library btw. :)

TIA


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk