How to get current state from state machine?

Hi All, How can I get the current state of the state machine? Currently i am getting in this way.. i would like to know if there any better way statemachine --------------- struct StateMachine:sc::state_machine<StateMachine, Initial> { void setState(string s){ state = s; } string getState() { return state; } private: string state; } //event struct dummyEvent:sc::event<dummyEvent> { } //state struct Initial:sc::simple_state<Initial, StateMachine> { typedef mpl::list<sc::custom_reactions<dummyEvent>> reactions; sc::result react(const dummyEvent&); } In react function of the 'Initial' state sc::result Initial::react(const dummyEvent&) { context <StateMachine>().setState("Initial"); } In my main main() { StateMachine machine; machine.initiate() cout << "Current State "<< machine.getState() << endl; // return me the current state } Thanks in adavance justin ----- justin -- View this message in context: http://boost.2283326.n4.nabble.com/How-to-get-current-state-from-state-machi... Sent from the Boost - Users mailing list archive at Nabble.com.
participants (1)
-
jusva2010