What is the DATAFLOW Code Generator and what is it used for?
This Guide Article has been written for Version 2.1 of the DATAFLOW Software. For Previous Releases use the version selection in the navigation bar at the top of this page.
The DATAFLOW Software is installed with the DATAFLOW Code Generator that generates C++ code from the DATAFLOW Model created in the DATAFLOW Designer.
The code generator supports the following features:
- Generate DATAFLOW Artifacts such as Software Components and User Defined Types
- Generate Unit Tests for the generated Artifacts
- Configurable C++ Language Standard
- Generate Static Checker Suppression
- Configurable Coding Style
- Configuration of Output Location
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:
- C++:98
- C++:11
- C++:14
- C++:17
- C++:20
- C++:23
C++:98
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.
Note: C++:98 Support will be droped for the next major DATAFLOW Runtime release (V4.0).
C++:11
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
- uint64/int64 suffixes (LL, ULL)
Note: C++:11 is not compatible with the MISRA:C++ standard. Use Autosar C++ instead. See also Static Code Checker Support.
Note: C++:11 Support will be droped for the next major DATAFLOW Runtime release (V4.0).
C++14
Generates c++ code according to ISO/IEC 14882:2014.
When this standard is selected, the following changes are applied to the generated code:
- All C++:11 features (see above)
- Use of binary integer literals for enumerators and identifiers when configured in Dataflow DESIGNER
Note: C++11 is not compatible with the MISRA:C++ standard. Use Autosar C++ instead. See also Static Code Checker Support.
C++17
Generates c++ code according to ISO/IEC 14882:2017.
When this standard is selected, the following changes are applied to the generated code:
- All C++:14 features (see above)
Note: C++11 is not compatible with the MISRA:C++ standard. Use Autosar C++ instead. See also Static Code Checker Support.
C++20
Generates c++ code according to ISO/IEC 14882:2020.
When this standard is selected, the following changes are applied to the generated code:
- All C++:17 features (see above)
At the moment, there are no additional changes, but there may be differences in the generated code in the future.
C++23
Generates c++ code according to ISO/IEC 14882:2023.
When this standard is selected, the following changes are applied to the generated code:
- All C++:20 features (see above)
- New float literal suffixes (F32, F64)
- New size_t suffix (UZ)
At the moment, there are no additional changes, but there may be differences in the generated code in the future.
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 rule sets.
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.
Configuration of Output Location
The basic configuration of the DATAFLOW Code Generator is part of the Build Configuration. This allows to have multiple configurations inside the same DATAFLOW Model, for example when a System contains multiple components that need code to be generated for seperate firmwares.
Generator Page
The generator can be configured in the Build Configuration on the Generator Page.
The Root Path defines the folder where the generated code will be located.
The generator allows to exclude certain types of artifacts from the code generation by unchecking the checkboxes.
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 IMT 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\Dataflow\Studio v2.0\Dataflow.Generator.App.exe".
When the generation process requires a custom argument passed to the code generator, this can be configured as well (one argument per line).
Intermediate files
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 generate model files, configuration files and meta files. The sub folder for these files can be configured if necessary, These files can always be generated from the Designer model and do not require version control.
If required, the file header for the generated model files (*.dff) can be configured as well, e.g. to match a company coding style policy.
Note: The configuration and meta files used by the generator use the JSON format and do not support adding a file header.
Required Module: DATAFLOW Code
This Article has been written based on V2.1.1 of the DATAFLOW Designer software.
Latest update 2023-05-31 by WUM.
Comments
0 comments
Please sign in to leave a comment.