Boost logo

Boost Users :

Subject: [Boost-users] [meta-state-machine] Flag_AND doesn't work
From: Péter Szabados (kangirigungi_at_[hidden])
Date: 2011-09-05 08:34:45


Hi,
I am using Boost 1.47.0, and wrote a state machine in MSM with 2
parallel regions. In each region, one state has a flag defined.
According to the documentation, when I ask the flag the following way:
sm.is_flag_active<FlagStarted, StateMachine::Flag_AND>()
then it returns true if both regions are in a state with the flag.
However, it doesn't work for me.

I have attached an example of this problem. It has the states
Stopped1, Started1 and Stopped2, Started2 for the two regions
respectively. The states Started1 and Started2 has the flag
FlagStarted attached. The flag is checked after each call of
process_event. The output of the program is the following:

Entering Stopped1
Entering Stopped2
(sm.is_flag_active<FlagStarted, StateMachine::Flag_OR>()): no
(sm.is_flag_active<FlagStarted, StateMachine::Flag_AND>()): no
Leaving Stopped1
Entering Started1
(sm.is_flag_active<FlagStarted, StateMachine::Flag_OR>()): yes
(sm.is_flag_active<FlagStarted, StateMachine::Flag_AND>()): no
Leaving Stopped2
Entering Started2
(sm.is_flag_active<FlagStarted, StateMachine::Flag_OR>()): yes
(sm.is_flag_active<FlagStarted, StateMachine::Flag_AND>()): no

After the second transition, we are in state (Started1, Started2). The
flag should be active here, but it isn't. Is there a problem with MSM,
or am I doing something wrong?

-- 
Péter



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