C++ Code Architecture Specification

This section describes the UML and SysML to C++ architecture.

This page discusses:

General Concepts

C++ code generators produce code from an input model. The code is generated into files.

The generated files are standardized to contain the same type of information to ease the readability.

Code Generator Specification

This section is divided in two parts:

  • The generated files specification
  • The behavior specification

Files Specifications

Common to All Files

Operations generates a header for c++ files. The C and C++ code deployment feature defines how to do configure this header

For the header file, the following header is created to avoid including the same file multiple times.

#ifndef BUTTON_BUTTON_H
#define BUTTON_BUTTON_H

Example: Inclusion macro protection

Include of header is done after the header of the multiple inclusion macro.

For the header file, before the final line is printed, a macro definition closing the inclusion macro protection macro is inserted.

#endif /*BUTTON_BUTTON_H*/

Example: Inclusion macro protection closure

The last line of the file is a standard line indicating that file generation is completed.

/* end of file */

Example: End of file

The first line of the file is a timestamp.

Semantic Code Specifications

This section describes the behavior of the code generator depending on the input element.

Generated_from Tag

The @generated_from tag is inserted every time a code or code section is generated for a specific element.

User Code Section

The user code section identifies a user-specific code area that can be modified by the user and can be protected when a file is regenerated.

The user code section starts with a comment BEG_USER_CODE(<ID>).

The user code section starts with a comment END_USER_CODE(<ID>).

The user code section uniqueness is identified in the file by its <ID>.

Note: Comments BEG_USER_CODE(<ID>) and END_USER_CODE(<ID>) must not be deleted.

Note: <ID> must not be modified.