This Code Engineering section covers the following subjects:
Code engineering** is the process of designing, implementing, and maintaining source code. This section describes how QM™ can assist you in this process by providing a unique approach to modeling the structure and content of the generated source code, also known as the "physical design" as defined below:
.h
files) and implementation files (.c
or .cpp
files), as well as "makefiles", build scripts, etc. The critical aspect of physical design is managing the inter-dependencies among the source code modules, as well as an information hiding policy to expose only the desired interfaces in the header files. Additionally, physical design of automatically generated source code must also afford a sufficiently flexible way of interfacing with hand-crafted code or any existing 3rd-party code.In QM™, directories and files are first-class model elements, so the physical design is an integral part of the model, just as the logical design is. This approach makes QM™ a unique tool on the market that allows you to explicitly perform physical design of the generated code as an integral part of the modeling process (as opposed to tweaking the code generator or adjusting hundreds of parameters of a "model compiler").
<class-name>.h
header file and <class-name>.c/.cpp
implementation file.The main enabler of the explicit physical design is representing directories and files as model items that can be added to the model and edited as any other parts of the model. But, it is critical to understand that the directories and files in the model are not the actual directories and files on disk. Rather, you should think of these model items as "templates" that the QM™ code generator uses to create the actual directories and files on your disk. (The word "template" here should not be confused with the "C++ templates"!)
The following picture shows an example of a directory-"template" and some file-"templates" in QM™. The file-"template" is shown both in the Model Explorer and in the MDI window:
The following picture shows how the directory-"template" and file-"templates" in the model generate the physical directory and files on disk. The code generation process is depicted as arrows from the model items to the files on disk.
The parts of code generated by QM™ are compliant with the industry safe coding standards for C and C++. Specifically, the QM code generator for the C language emits code compliant with the MISRA-C:2023↑ and the QM code generator for the C++ language emits code compliant with the MISRA-C++:2023↑.