Overview

In Cxx, there are many way to specify the usage of a class. These can be separated into two parts:

  • forward declaration

  • file inclusion, using the #include directive

When you explicitly link two UML elements, either by typing an attribute or a parameter, or by creating an association, a usage is generated in the source code. Depending of the kind of usage, a forward declaration or an inclusion is generated. Modelio Cxx Designer will always prefer forward declaration, in order to limit the dependencies of the generated file.

File inclusion

When you need to explicitly create an include, element imports are used. Element imports are the UML link that provides an element with visibility of another importable element. In the Cxx language, this notion is expressed through #include directives.

The visibility of the element import designates the file where the include is to be generated:

  • A public element import, displayed with the «access» keyword in a UML diagram, will be translated into an include in the header file.

  • A private element import, displayed with the «import» keyword in a UML diagram, will be translated into an include in the body file.