Mrz 052016
 

YAKINDU statechart tools are a pretty nice tool to model statemachines. You can generate code for C/C++ and Java out of the model. Further you can validate and simulate your statemachine to verify the behaviour. If you want to integrate your statemachine into a Qt application the concept of signals and slots fits perfectly into the in and out events of the statechart definition language of the YAKINDU SCT. My new custom Qt generator links both concepts together. It generates a C++ class which links between the C++ class generated from the C++ generator of YAKINDU SCT and the custom implementation code which must be implemented for custom behaviour of your application.

The generated code implements the following methods of the statemachines base class:

  1. Initialisation of all SCT operation callbacks (so called OCB).
  2. A pure virtual method initializeValues() for custom value initialisation.
  3. In events as Qt slots.
  4. Out events as Qt signals.
  5. Respects internal events with an extra runCycle() call.
  6. Optional implementation of the TimerInterface.
  7. Implementation of all SCT operations.

The generator supports C++11 and has optional multi threading support by specifying The QThread class as base class.

There is a detailed documentation at the SourceForge project site. There are also some small example Qt applications to show how the generator works: https://github.com/stmork/sctqtgen/tree/master.

Download

If you have a working YAKINDU SCT running you only need to add an update site to your Eclipse. You may choose between a snapshot build or the release build.

Have a lot of fun with the new generator and feel free to file issues.

  4 Responses to “Published a Qt generator for YAKINDU statechart tools”

  1. Steffen, great work!
    How about moving from sourceforge to GitHub with your code?

    • Hi Andreas,

      thank you for your post. For the first I decided to use SorceForge because it was the easiest and quickest way for me. I know SourceForge is a bit old fashioned against the social media features of github. For me it’s important to have webspace for download and updates sites as well as a web presentation like http://www.jee-generator.org I know that there is no web site for the Qt generator, yet, but I don’t have a lot of spare time. So I will spend my time for setting up a web site and may be I will migrate to github later.

  2. Would you mind to give a small example how the QT-generator works?
    Becouse for me it is difficult to understand what to do with the generated code and get a running system.

    • Look at the following example in the SVN repository: https://svn.code.sf.net/p/sctqtgen/code/trunk/de.morknet.sct.qt.example.calculator/ It contains the generated classes as well.

      The class CalculatorStateMachine contains the implementation of the generated class AbstractCalculatorDispatcher genererated by my SCT-Qt-Generator. This one implements the AbstractCalculator class generated by the YAKINDU-SCT.

      The signals und slots must be connected between the MainWindow and the CalculatorStateMachine. This is done inside the constructor of the MainWindow class.

      I hope this helps for the first.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)