I'm looking for a framework that provides execution of hierarchical state machines (HSMs).
These are the requirements for the framework:
- Conforms to UML state machine semantics (as much as possible)
- Supports at least
- run-to-completion semantics
- hierarchical states
- entry and exit actions
- transition actions
- guards
- events with custom parameters
- Is object-oriented or does at least not prohibit OO designs
The target platform is an medium- to large-sized embedded system with an OS.
Do you know a framework that fulfills the above requirements? What are the pros and cons of your framework?
As of today there is a new C++ (supports C++11 and C++03 with Boost) alternative available. It's called yasmine (and I am the architect). It fulfills all the above requirements.
Some pros and cons (cited from the yasmine web page):
Note
I know this is an old question, but it's Google's #1 for "c++ uml state machine" which makes it very relevant.
Check out the Quantum Platform.
I've used it on several embedded projects (from very tiny to very large), and it supports all of the bullet items you require, and more.
The web page for the QP does a much better job of explaining itself than I can do here.
Be aware, the QP does not implement 100% of the functionality specified in the UML specification, but the departures are clearly explained, and in all my experience with the QP, none of them have been a problem for the project.
There are also 2 Boost statechart packages, which you seem to know about.
If you are looking for a framework that supports hierarchical and concurrent state machines with UML semantics (entry/exit, transitions, guards, events with parameters, asynchronous/synchronous), have a look at my state machine code and diagram generator.
Instead on implementing the state machine "by hand", describe the state machine in a simple human readable and writable xml description and let the state machine generator write the code source in C++, C# or java.
Actually, for the C++ version, the generated code can be easily cross-compiled for an medium/large size embedded system. It has been done already.
You may have a look at my C++ template class framework STTCL that is purposed to provide mapping of UML 2.2 state diagram notation to implementation classes. The STTCL approach is a refinement of the GoF state pattern and tries to fill the gap(s) to the UML state chart notation.
The framework implementations are configurable regarding OS dependencies as far these are needed (only for asynchronous execution models).
There's a PDF document available explaining the concept in more detail.
You should go and check out Boost MSM, it's new for Boost 1.44 but seems quite complete. I have not yet tried it out myself but it looks quite promising.