|
Boost Users : |
From: Igor R. (igor_rubinov_at_[hidden])
Date: 2008-04-22 09:37:20
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'.
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net