boost msm Orthogonal execute.
define multi initial states.
- sequence init states define
using initial_state = boost::mpl::vector<Init, Working>;
when received the same events, the excute sequence will is Init State --> Working state.
//Orthogonal Region msm
struct transition_table : mpl::vector<
// Start Event Next Action Guard
msmf::Row<Working, Abort, msmf::none, msmf::none, ExecutionInformation>,
msmf::Row<Working, Abort, msmf::none, PerformSetWaitFlag, ExecutionNeedWait>,
msmf::Row<Init, Event1, State1, PerformEvent1Action, ExecutionInformation>,
msmf::Row<State1, Timeout, msmf::none, PerformEvent1Action, ExecutionInformation>,
msmf::Row<State1, Abort, End, msmf::none, ExecutionIsNgApBackground >
>{};
//Orthogonal test.
std::cout<<"Orthogonal test."<<std::endl;
sm1.process_event(Event1{});
Abort abort;
abort.isNgApMsgBack = true;
sm1.process_event(abort);
// log
Msm test start.
Init::on_entry()
Working::on_entry()
Orthogonal test.
received message: Event1 .
sourceState is: (anonymous namespace)::Sm1_::Init .
targetState is: (anonymous namespace)::Sm1_::State1 .
PerformEvent1Action
State1::on_entry()
ExecutionIsNgApBackground:
received message: Abort .
sourceState is: (anonymous namespace)::Sm1_::State1 .
targetState is: (anonymous namespace)::Sm1_::End .
State1::on_exit()
End::on_entry()
received message: Abort .
sourceState is: (anonymous namespace)::Sm1_::Working .
targetState is: (anonymous namespace)::Sm1_::Working .
event isNgApMsgBack is true.
PerformSetWaitFlag
网友评论