any idea how, using boost msm 1_60, I can get the current_state(s) of a submachine? Consider the following code, describing an outer state machine that allows for chosing between two different traffic lights (standard red, yellow, green one and another with alternating two yellow lights for instance):
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>;
Now, I can skip into the RYG via
SMBackend oSM. oSM.process_event(evSelectCommonRYG());
But how can I get the current state of the RYG submachine?
oSM.current_state()[0]
returns 1 only (as this is the state of the outer state machine BigMom...)...
Thanks for help!