Hi, I would like to reuse a state in statechart at different places of the state machine (so it can be a sub-state of at least 2 other states) or in different state machines. Since the state class has a template parameter with the context I am a bit stuck here. Have you done that yet or have an idea about how to do it ? Thanks, Philippe
Hi Philippe
I would like to reuse a state in statechart at different places of the state machine (so it can be a sub-state of at least 2 other states) or in different state machines. Since the state class has a template parameter with the context I am a bit stuck here. Have you done that yet or have an idea about how to do it ?
Make the state in question a template, example: http://www.boost-consulting.com/boost/libs/statechart/doc/tutorial.html#Subm... Here the states On and Off are parametrized with an enum. You can of course parametrize them with just about anything, including their context. Templated states have a few gotchas though: - http://www.boost-consulting.com/boost/libs/statechart/doc/faq.html#Templated... - All base class members become dependent names. You therefore need to prepend base member function calls with this-> and fully qualify base typedefs. HTH, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
participants (2)
-
Andreas Huber
-
Philippe DAVID