我正在尝试制作一个状态机DcuClientMachine
,它有两种状态 - StandBy
(默认状态)和Operating
. StandBy
只是一个简单的状态,而Operating
是一个嵌套的Parsing
状态,默认状态。EvConnecting
事件假设StandBy
-> Operating
( Parsing
)
#include <boost/statechart/event.hpp>
#include <boost/statechart/state_machine.hpp>
#include <boost/statechart/simple_state.hpp>
#include <boost/statechart/transition.hpp>
#include <boost/statechart/custom_reaction.hpp>
namespace sc = boost::statechart;
struct EvConnecting : sc::event<EvConnecting>{};
struct StandBy;
struct DcuClientMachine : sc::state_machine<DcuClientMachine, StandBy>{};
struct Operating;
struct Parsing;
struct StandBy : sc::simple_state<StandBy, DcuClientMachine >
{
//typedef sc::transition<EvConnecting, Operating> reactions; //(*1)
typedef sc::custom_reaction<EvConnecting> reactions; //(*2)
sc::result react( const EvConnecting & )
{
return transit< Operating >();
//return forward_event( ); //(*3)
}
};
struct Operating : sc::simple_state<Operating, DcuClientMachine, Parsing>{};
struct Parsing : sc::simple_state<Parsing, DcuClientMachine>{};
int main()
{
return 0;
}
(*1) 和 (*2) 产生
boost\statechart\simple_state.hpp(887): error C2039: 'inner_initial_list' : is not a member of 'DcuClientMachine'
如果我使用(* 3),那么没关系,代码已编译。
这段代码有什么问题?
谢谢你。