Skip to content
ionous edited this page Apr 6, 2016 · 1 revision

Links to other statechart projects.

Useful Documentation

Books

Other Implementations

I've mainly been trying to track down fully functional ( if not necessarily fully featured ) C and C++ hierarchical statemachines. There are a bunch of projects which have been started, then stopped; with little to no documentation. It doesn't seem there are many meant to be used as standalone libraries. Here are a few that are.

This is the implementation described in Miro Samek's Practical Statechart book. It's C based, with licenses both commercial and GNU. The company also provides a free graphical modeling tool: you model in the tool, add your code in the tool, and then it generates the QP implementation incorporating the code you input.

Boost MSM is a close to a full UML spec implementation.

What I see as benefits are: Statecharts implemented with the MSM are amazing readable. It generates the whole machine at compile time, so I suspect its smaller and faster at run-time than almost any other system.

What I see as drawbacks are: Its template magic makes it incredibly slow to compile. More importantly it seems to require the use of a concrete event class -- not a pointer or a reference -- for event dispatch which makes event queuing, and the separation of code into different modules difficult.

There's an msm guide on reboltz as well.

That's right! Boost has more than one statechart implementation.

States are modeled as instances of classes. They are created on state enter, and destroyed on state exit; RTTI, and C++ exceptions are a key part of its implementation. Like MSM, it has compile time checking of machine correctness.

The author has a list of advantages boost statechart provides.

A simple, easy to understand templated statechart. It's not meant to be a complete statechart implementation, more a starting point.

Lua

  • Miros A straight port of QP from C to pure lua.
  • rFSM An implementation of UML statecharts from scratch in pure lua. Its most distinguishing features are its ability to generate graphical charts of the code based charts(!), and support for uml do events.

Code Generators

There are bunches of professional grade statemachine code generator tools. Mainly, they seem to be targeted for Java.

SinelaboreRT - is a visual editor and simulation tool for hierarchical state machines that targets, C, C++, Java and C#. I like that you edit the hierarchy with a tree view control, and it generates the pretty pictures for you. It has a relatively inexpensive license fee, and seems worth checking out.

SMC - the statemachine compiler is not meant to be a statechart implementation so it does not support hierarchical states, but it does target both C and C++, along with many other languages as well.

Domain Specific Languages

Martin Fowler wrote about using DSL to describe simple non-hierarchical statemachines. There are various implementations of his idea around the web. These are a few:

Clone this wiki locally