Find a file
2020-01-06 22:39:59 +01:00
.gitignore initial commit 2020-01-06 22:39:59 +01:00
generator.py initial commit 2020-01-06 22:39:59 +01:00
main.cpp initial commit 2020-01-06 22:39:59 +01:00
Makefile initial commit 2020-01-06 22:39:59 +01:00
README.md initial commit 2020-01-06 22:39:59 +01:00
state-machine.gv initial commit 2020-01-06 22:39:59 +01:00

State machine generator

This tool is used to describe a state machine in dot format (used by Graphviz). It then generates the corresponding C++ code with identified callbacks.

Usage

  • Create a Python3 virtualenv with pydot installed
  • Create a dot file with the state machine named "state_machine.gv"
  • Run 'make png' to see the PNG representation
  • Run 'make cpp' to generate the C++ code

C++ code

The tool will generate 3 files:

  • 'state_machine.h' and 'state_machine.cpp' that contain the skeleton of the state machine
  • 'state_impl.cpp' that contains the empty callbacks

You can compile these sources with a simple main like the one provided.