Hi JD [snip rest of code]
struct MyMachine : sc::state_machine< MyMachine, Whatever > { void unconsumed_event( const sc::event_base & evt ) { // How can I display a message here with the event name? } };
There are two options to do this: 1) Use C++ RTTI, i.e. type_info::name(). This is the easiest option as it necessitates the least amount of work but of course requires that you compile your program with C++ RTTI enabled. 2) Use event_base::custom_static_type_ptr http://www.boost-consulting.com/boost/libs/statechart/doc/reference.html#eve... and event_base::custom_dynamic_type_ptr http://www.boost-consulting.com/boost/libs/statechart/doc/reference.html#eve... as demonstrated for states in http://www.boost-consulting.com/boost/libs/statechart/doc/tutorial.html#Stat.... This requires slightly more work than 1) but works even if you compile your program with C++ RTTI disabled.
So the objective is to display the event name returned by the 'name' function when an event is unconsumed. I have tried some way like using dynamic_type and static_type but no luck...
See above, that should solve the event name problem quite nicely. HTH, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.