Christophe Bourez
I need to maintain a parameter into the state local storage. This parameter is initially contained in the event that causes the transition to the target state. I give hereafter a small illustrative example.
typename sc = boost::statechart;
class EvTest : public sc::event<EvTest> { public: EvTest(std::size_t val) : value(val) {} std::size_t getValue() const { return this->value; } private: std::size_t value; };
class MyStateMachine; class StSource; class StTarget;
class StSource : public sc::simple_state
{ public: typedef sc::custom_reaction<EvTest> reactions; sc::result react(const EvTest &event) { // How to pass event.getValue() to the target state ? transit<StTarget>(); } };
class StTarget : public sc::simple_state
{ public: StTarget(std::size_t val) : val(value) {} private: std::size_t value; };
I have a patch using boost.fusion to allow this. It works this way:
class StSource : public sc::simple_state
Thanks, Christophe
Regards, -- Felipe Magno de Almeida