任何想法如何使用boost msm 1_60,我可以得到submachine的current_state(s)?考虑下面的代码,描述外的状态机,其允许(具有交替的例如两个黄灯标准的红,黄,绿一个又一个的)两个不同的交通信号灯之间艇员选拔:boost msm submachine current_state用于访问子状态
class SMBigMom : public msmf::state_machine_def<SMBigMom>
{
public:
SMBigMom() {};
using initial_state = SMSelectorState;
class SMLightBase : public msmf::state_machine_def<SMLightBase>
{
public:
SMLightBase() {};
using initial_state = BaseState;
struct transition_table : mpl::vector<> {};
};
using SMBaseBackend = msm::back::state_machine<SMLightBase>;
class SMCommonRYG : public SMLightBase
{
public:
SMCommonRYG() = default;
~SMCommonRYG() {};
using initial_state = Red; // init state
struct transition_table : mpl::vector<
// Start, Event, Target, Action, Guard
msmf::Row< Red, evNext, RedYellow, msmf::none, msmf::none >,
msmf::Row< RedYellow, evNext, Green, msmf::none, msmf::none >,
msmf::Row< Green, evNext, Yellow, msmf::none, msmf::none >,
msmf::Row< Yellow, evNext, Red, msmf::none, msmf::none >
> {};
};
using SMCommonRYGBackend = msm::back::state_machine<SMCommonRYG>;
class SMYellowAlternate : public SMLightBase
{
public:
SMYellowAlternate() = default;
~SMYellowAlternate() {};
using initial_state = Yellow; // init state
struct transition_table : mpl::vector<
// Start, Event, Target, Action, Guard
msmf::Row< Yellow, evNext, Yellow2, msmf::none, msmf::none >,
msmf::Row< Yellow2, evNext, Yellow, msmf::none, msmf::none >
> {};
};
using SMYellowAlternateBackend = msm::back::state_machine<SMYellowAlternate>;
struct transition_table : mpl::vector<
msmf::Row< SMSelectorState, evSelectCommonRYG, SMCommonRYGBackend, msmf::none, msmf::none >,
msmf::Row< SMSelectorState, evSelectYellowAlternate, SMYellowAlternateBackend, msmf::none, msmf::none >
> {};
};现在
using SMBackend = msm::back::state_machine<SMBigMom>;
,我可以通过
SMBackend oSM. oSM.process_event(evSelectCommonRYG());
跳跃到RYG但我怎么能得到RYG冲锋枪的现状如何?
oSM.current_state()[0]
只返回1(因为这是外状态机BigMom ...的状态)...
感谢您的帮助!