The DATAFLOW Installation comes with a Code Generator that generates C++ code from the DATAFLOW Model designed using the DATAFLOW Designer.
The code generator supports the following features:
- Generate DATAFLOW Artifacts
- Generate Unit Tests
- Configurable C++ Language Standard
- Generate Static Checker Suppression
- Configurable Coding Style
- Generator Configuration
Generate DATAFLOW Artifacts
The code generator allows to generate C++ classes for various elements in the DATAFLOW Designer project.
See the Generate C++ Type and Component Code article for details.
Generate Unit Tests
The code generator allows to generate unit tests for a configured unit test framework.
See the Generate C++ Unit Test Code article for details.
C++ Language Standards
The code generator can generate code for the following language standards:
Generates c++ code according to ISO/IEC 14882:1998. This is also suitable for C++ 03 compilers. The differences between C++98 and C++03 are so few and so technical that they ought not concern users.
Note: C++98 is not compatible with the Autosar C++ standard. Use MISRA C++ instead.
Generates c++ code according to ISO/IEC 14882:2011. When this standard is selected, the following changes are applied to the generated code:
- Enumerations use the enum class instead of an enum nested inside a struct
- nullptr is used instead of NULL
- User defined literals can be generated for user defined types (new in V2.0)
- Trailing return type for method can be generated as an option
- The keywords final and override are used when implementing methods from interfaces
- The keyword auto is used for local variables
- The keyword delete is used to avoid automatic generation of default constructors
- The keyword default is used to indicate the use of the automatically generated constructor
Note: C++11 is not compatible with the MISRA:C++ standard. Use Autosar C++ instead. See also Static Code Checker Support.
Generates c++ code according to ISO/IEC 14882:2011. When this standard is selected, all changes mentioned for C++11 above are applied.
At the moment, there are no additional changes, but there may be differences in the generated code in the future.
Note: C++14 is not compatible with the MISRA:C++ standard. Use Autosar C++ instead.
Static Code Checker Suppression
The code generator allows to configure one static code checker. If enabled, it generates suppression comments with justifications for all enabled rulesets.
See the C++ Static Code Checker Suppression article for details.
Configure Coding Style
The code generator allows to configure the style of the generated code.
See the Coding Style Configuration article for details.
The basic configuration of the DATAFLOW Code Generator is independent of the Toolchain configuration in the generator page of the project configuration dialog.
Configure output directory
The root directory for all the generated source code can be configured in the generator page of the project configuration dialog:
All paths in the Toolchains will be relative to this folder.
When the checkbox is enabled, all files in the target folder will be deleted prior to code generation.
Warning: This will delete all user defined code in these folder and all sub-folders.
It can be usefull to enable this and generate code, when the project structure is changed and no user code has been written yet. The option should be disabled after this to avoid unintended overwrites.
With the default configuration, the code generator will never overwrite handler files. This can be changed by enabling the option:
Warning: This will override all user defined code in these files.
It can be useful to enable this and generate code, when model changes have been made to update the handler classes. The user defined code must be merged with the new files using the version control system afterwards. The option should be disabled after this to avoid unintended overwrites.
Configure generator executable
In special cases, it can be necessary to use another generator binary than the one installed together with DATAFLOW Designer. If a special generator binary has been provided by DATAFLOW Software AG, the location of that binary can be configured:
To revert this change, set the value back to the original installation of the code generator in "C:\Program Files (x86)\DffStudio\DffStudio v1.6\Generator\DffStudio.App.Generator.exe".
When the generation process requires a custom argument passed to the code generator, this can be configured as well (one argument per line):
The code generation process will generate intermediate files. These files can always be generated from the designer model and do not require version control.
The location of the intermediate files can be configured:
The code generation process will also generate configuration files for the code generator. These files can always be generated from the Designer model and does not require version control.
The option to clear the directory should be enabled to avoid side effects between code generation runs.
The location of the configuration files can be configured:
This Article has been written based on V1.6.1 of the DATAFLOW Designer software.
Latest update 2021-10-07 by WUM.