|
Boost Users : |
Subject: [Boost-users] [MSM] Is there an elegant way to get the outermost FSM?
From: Gábor Márton (gabor.marton_at_[hidden])
Date: 2011-08-30 07:41:15
Hi,
I am having a statemachine with a submachine. In the internal submachine I need to check if there is a flag active in the outer statemachine.
Currently I solve this with a const pointer to the outermost FSM passed to the submachine's constructor:
backEnd.set_states(msm::back::states_ <<
StOk(msm::back::states_ <<
StSlave(&backEnd)));
StSlave is the internal submachine in which I need to check whether a flag in StOk is active or not.
Then I check the flag activity status e.g in a guard of StSlave like this:
struct GrdBladeUp {
template<class EVT, class FSM, class SourceState, class TargetState>
bool operator()(EVT const& event, FSM& fsm, SourceState&, TargetState&) {
if(fsm.getOutermostFSM()->template is_flag_active<FlagBladeUp>()) {
return true;
}
return false;
}
};
Is there an easier way to get somehow the parent fsm or the outermost fsm of a submachine?
Thanks,
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