好的,我找到了答案。让我恼火的是,我真的需要阅读未注释的boost头文件,而不是文档或引用来找出该做什么。
我需要使用
a_irow
结构不涉及转换,而只是调用操作:
struct transition_table : boost::mpl::vector<
// Start Event Next Action
a_row < Idle , run , Running, &MyStateMachine::do_start >,
a_row < Running , stop , Idle , &MyStateMachine::do_stop >,
a_irow < Idle , step , &MyStateMachine::do_idle >,
a_irow < Running , step , &MyStateMachine::do_step >
> {};
总而言之,这些是可以添加的行类型:
a_row<Source, Event, Target, Action >
_row<Source, Event, Target >
row<Source, Event, Target, Action, Guard>
g_row<Source, Event, Target, Guard>
a_irow<Source, Event, , Action >
irow<Source, Event, Action, Guard>
g_irow<Source, Event, Guard>
_irow<Source, Event, > // Forces events to be ignored
使用:
typename Source;
class Event;
typename Target;
typedef void (Derived::*action)(Event const&) Action;
typedef bool (Derived::*guard)(Event const&) Guard;
参考:
boost/msm/front/state_machine_def.hpp