|
Boost Users : |
Subject: Re: [Boost-users] [msm] Manually setting the machine state
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2012-06-18 14:57:17
>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
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