Boost logo

Boost Users :

Subject: Re: [Boost-users] [msm] Manually setting the machine state
From: Mark S (mark_at_[hidden])
Date: 2012-06-19 05:35:20


>
> 
>
> >Hi,
>
> >
> >I'm wondering if it's possible to set the current state of a state
> machine manually from outside the machine.
>
> >My rationale for wanting to do this is I need to recover the state of an
> FSM that has been shutdown/terminated part way through it's
>
> >sequence. When restarting I want to build up the current state based on a
> log of its actions. I'm unable to serialise out the state prior to
> >termination as it may be from a crash and it's vital that it can continue
> after recovery in the exact state it left off.
>
> >Thanks,
>
> >Mark
>
> Hi,
>
> You can call current_state(), which gives you an array of current state
> indexes and you can cont_cast away the const but it doesn't feel right.
> If you know your current state prior to the crash so that you are able to
> save it and reset it again after the crash, why not simply save the
> serialized state machine (MSM supports this out of the box)? In both cases
> you cannot be in the exact state where you left it because crashes are
> usually unpredictable, not even talking about the data which you could have
> saved in your FSM.
>
> HTH,
> Christophe
>

Thanks for your reply Christophe,

As I mentioned before serialising the state of the machine isn't an option
for me, this is due to performance. I don't really need the implementation
internals of the state machine to be exactly as they were, just the ability
to set up the data in my state classes and then set the starting state.

Doesn't the de-serialisation do something like this?

Mark



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