Hello,
I'd like to define some events of my state machine as templates that would be instantiated just before posting to the state machine. However, it seems that there is no way to define reactions with unspecialized templates, so I have to specialize them at the stage of reaction definition. The way to do this I can think about is to parametrize the state machine itself. But this means parametrizing *all* the states:
template<class MyType> class MyFSM : public sc::asynchronous_state_machine<MyFSM<MyType>, InitialState>
{
public:
typedef MyType Type;
//....
};
template<class MyType> struct MyState : sc::simple_state<MyState, MyFSM<MyType>, InitialState>
{
sc::transition<MyEvent<MyType>, NextState>;
// or: sc::transition<MyEvent<typename outermost_context_type::Type>, NextState>;
};
Besides, all the state machine then should be defined in the header file..
Do I miss something? Is there some less weird way to do this?
Thanks a lot,
Igor'.
Get news, entertainment and everything you care about at Live.com. Check it out!