Boost logo

Boost Users :

Subject: Re: [Boost-users] Pass data to states, in boost state chart
From: jusva2010 (justinjose12002_at_[hidden])
Date: 2011-05-02 22:55:26

Thanks alot for your reply..

Do you have any sample code for doing that?

Currently i am trying like this...I am not sure it is the correct way to do

1. Declared a local varable in State machine

struct StateMachine:sc::state_machine<StateMachine, Initial>

  int getData();
  void setData(int data);
  private int data;

2. Set the value

  SateMachine machine;

3. access that value from state event handler

   sc::result Initial::react(const event())
     cout << "Data:" << context< StateMachine>().getData() << endl;

Please advise if there is any other better solution

Thanks in advance

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at