What is the DATAFLOW Code Generator and what is it used for?
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:
- C++:98
- C++:11
- C++:14
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.
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
Note: C++11 is not compatible with the MISRA:C++ standard. Use Autosar C++ instead. See also Static Code Checker Support.
C++14
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 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.
Generator Configuration
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 more than one processor and different toolchains will be used to compile binaries for these.
The generator can be configured in the Build Configuration on the Unit Test Page.
There is 1 group of values that will be used to configure the generator:
- Generator
Generator Page
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.0.1 of the DATAFLOW Designer software.
Latest update 2022-04-12 by WUM.
Comments
0 comments
Please sign in to leave a comment.