Boost logo

Boost Users :

Subject: [Boost-users] [MSM] How to use is_flag_active inside on_entry ?
From: Gábor Márton (gabor.marton_at_[hidden])
Date: 2011-08-26 14:02:25


Hi,

I would like to use is_flag_active<SomeFlag>() function inside one of my state's on_entry template function:
        struct StBladeDown : public msm::front::state<> {
                template<class Event, class FSM>
                void on_entry(Event const& event, FSM& fsm) {
                        if(fsm.is_flag_active<FlagMaster>()) { // ERROR
                                // doSomeThing();
                        }
                }
        };
However I got the following compile error:
StOk.hpp: In member function 'void mr::mrd::amfo::StOk_::StBladeDown::on_entry(const Event&, FSM&)':
StOk.hpp:78: error: expected primary-expression before '>' token
StOk.hpp:78: error: expected primary-expression before ')' token

However outside of the state machine, I mean if I first declare a state machine, I can use the is_flag_active:
        StAMFODirector backEnd;
        backEnd.start();
        processEvent(backEnd,EvBladeDown());
        processEvent(backEnd,EvMaster());
        if(backEnd.is_flag_active<FlagMaster>()){ // OK
                _LOG_DEBUG("Flag Master active");
        }

If I use the front_end's is_flag_ I get compiler error again (no such function in msm::back::state_machine).

Any idea how to use is_flag_active together with on_entry? Or if it is not possible are there any alternatives?

Thanks for any help,
Gabor


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