SinelaboreRT Header Logo

SinelaboreRT

As simple as possible, but not any simpler!

User Tools

Site Tools


wiki:manual:state_machine_generate

How to generate state machine code from UML

Once the state machine has been modelled, you can generate state machine code from that model. The Code Generator can be fully controlled by a number of command line flags and parameters and a configuration file.

Example: Generate C code from Cadifra modelling tool

C:\>c:\jdk-11\bin\java.exe -cp "c:\sinelaboreRT5.0\bin\*" codegen.Main -p CADIFRA -l cx -o oven first_example_step3.cdd

Example: Generate CPP code from Enterprise Architect modelling tool

java "$(CODEGEN_PATH)/*" codegen.Main -l cppx -p EA -t "Model:implementation:oven" -o oven  oven.xml

Here is a list of all supported command line flags and parameters:

java -cp "path_to_jar_file/*" codegen.Main
Usage: java -cp "PATH-TO-JAR/*" codegen.Main [-xls] [-gencfg] [-doxygen] [-Trace] [-verbose] [-U configfile] [-t route:to:class] [-Lstates] [-Levents] [-l cppx|cx|SSC|java|swift|csharp|lua|python|rust|go] [-A] [-s|-S|-E] [-c|-c1] [-p EA|MD|CADIFRA|UMODEL|ARGOUML|SSC|ASTAH|VP|Modelio|MM|PlantUML|DrawIO] [-o outfilename] modelfilname
Flag Description
-t In case a XMI file shall be parsed the path to the class that contains the state machine definition must be specified. This option allows you to model more than one state-based class and then generate one after the other by calling the code-generator with the corresponding path.
-p Defines the used input format e.g. EA for Enterprise Architect.
-o <file> Output filename (excluding file extension.
-l Target language -l cx or -l cppx for example.
-Trace Activates the generation of trace code.
-gencfg Prints out all configuration options for a specific lan- guage (use -l to define the language).
-verbose Enables the output of information messages during parsing and code generation
-c or c1 Print transition coverage information and creates an Excel sheet with test routes. -c uses a depth-first tree search algorithm which produces fewer but longer test routes. -c1 uses a breadth first algorithm which creates more but shorter test routes.
-U <file> Path and name of the codegen configuration file.
-L <file> Path and name of the license file
-Lstates List the states in the model on the console.
-Levents List the events in the model on the console.
-xls Creates a state table in Excel format
-doxygen Creates a dot based description of the state diagram as part of the C/CPP file. This allows Doxygen to add a state machine diagram to the software documentation.
-s Start in interactive simulation mode. Also consider to use the -v flag in addition which enables the printout of the executed C-code per simulation step.
-S Start simulation in graphical interactive mode.
-E Start the integrated state diagram editor.
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
wiki/manual/state_machine_generate.txt · Last modified: 2023/12/15 11:11 by webmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki