In order to deploy a code generator and actually generate code, you have to set up a code generator project. This is described in the following subsections.
For configuring the code generation process, itemis CREATE uses a textual generator model called SGen. It can be created either by using the itemis CREATE Statechart generator model wizard or by creating a text file with the filename extension .sgen.
To create a generator model using the wizard, proceed as follows:
Selecting code generator and statecharts
The result is the specified .sgen file. It has the following format:
GeneratorModel for [GeneratorId] {
statechart [StatechartReference] {
feature [Feature] {
[ParameterName] = [ParameterValue]
}
}
}
The [GeneratorId] represents the unique ID of the chosen generator. Currently, itemis CREATE supports the following code generators out of the box:
create::c
– Generator ID for the C code generator
create::cpp
– Generator ID for the C++ code generator
create::python
– Generator ID for the Python code generator
create::java
– Generator ID for the Java code generator
create::scxml
– Generator ID for the SCXML code generator
create::images
– Generator ID for the statechart image generator
A single generator model may contain multiple
statechart … { … }
blocks and thus specify the code generation for multiple statecharts. For each statechart, the generator process can be configured with
Features. Each feature has one or more parameters. These parameters can be configured with
ParameterName
=
ParameterValue.
Besides generating code from a statechart model, it is also possible to generate code from a test file written in the SCTUnit language. The SCTUnit code generators translate SCTUnit tests into a unit test framework of the target langauge. The following generators are available:
*
create::sctunit::c
– Generator ID for the SCTUnit C code generator
*create::sctunit::cpp
– Generator ID for the SCTUnit C++ code generator
*create::sctunit::python
– Generator ID for the SCTUnit Python code generator
*create::sctunit::java
– Generator ID for the SCTUnit Java code generator
*create::sctunit::scxml::qt
– Generator ID for the SCTUnit SCXML Qt code generatorSee also chapter Generating SCTUnit source code for more information.