Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which State Machine execution frameworks for C++ implement UML semantics? [closed]

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?

like image 712
theDmi Avatar asked Sep 20 '10 09:09

theDmi


5 Answers

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.

like image 183
Dan Avatar answered Nov 01 '22 06:11

Dan


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.

like image 39
Andreas Magnusson Avatar answered Nov 01 '22 06:11

Andreas Magnusson


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):

Advantages of using yasmine

  • She provides a complete implementation of UML state machine semantics.
  • yasmine is a modern C++ implementation using C++11 (C++03 support is available, too).
  • Because it's C++ (and not C) the code integrates nicely into OO code.
  • She's well documented [...]
  • Because she is open source you can check her implementation out. Also this guarantees long term usability and availability.
  • The library enables you to create state machines at runtime.
  • [...]

What yasmine is not

She's not a minimum foot print library that prioritizes on running on every system no matter how few resources are available. yasmine is not resource hungry, but she cannot (and does not want to) compete with switch-case-based bare-metal no-abstraction libraries.

Note

I know this is an old question, but it's Google's #1 for "c++ uml state machine" which makes it very relevant.

like image 24
DrP3pp3r Avatar answered Nov 01 '22 08:11

DrP3pp3r


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.

like image 28
Frederic Heem Avatar answered Nov 01 '22 07:11

Frederic Heem


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.

like image 1
Makulik Avatar answered Nov 01 '22 07:11

Makulik