Code generation consists of producing C++ source files from UML model packages and classes. The actual rules used to map packages and classes to directories and files are presented later in this user guide.
UML model elements themselves are not enough to adequately describe C++ applications, for example, to describe the container (collection) types required to store multiple attributes or to describe pointer semantics. This means that before proceeding with C++ generation, the UML model must be decorated using additional model elements, tagged values, stereotypes and notes, which describe its C++-specific semantics and behavior.
Modelio C++ Designer supports two usage modes:
In conception mode, you focus on high-level model properties: application entities (modeled by UML classes), their relations (modeled by associations and links) and attributes, and their contracts (modeled by UML operations). When conceiving a model, you do not want to be distracted by low-level C++ details, such as the representation of a given multiple association by a vector or hash map, or the passing of a given operation parameter by a pointer or by a value.
To help you get quality C++ code directly from high-level models, Modelio C++ Designer automatically deduces C++-specific model decorations (C++ properties) from high-level UML model properties. Modelio C++ Designer then analyzes UML attributes, such as ordering and uniqueness, and applies C++ expert logics and best practices to derive reasonable decorations and subsequently C++ code, which adequately expresses model semantics.
With Modelio C++ Designer, you can immediately check your application models, and supports advanced modeling concepts, such as agile modeling. It tightens the link between application model and code, and extends the limits of UML model usage in the development process, thereby making UML models a practical development tool.
In implementation mode, you manage C++-specific application properties yourself, and specify C++ properties by manually decorating the model. The C++-oriented GUI hides the underlying UML extensions, making it easy to work in C++ terms and to immediately observe the effects of decorations on the generated C++ code.
Modelio C++ Designer supports transparent switching between the conception and implementation modes. You can reinforce the results of automatic deduction by adding your own decorations. For instance, once a model is automatically decorated and prototype C++ code has been generated, you can create C++ code notes, specifying detailed application behavior. You can indicate that a model element is to be ignored by automatic deduction and manually decorate it instead. This can be very practical when the results of automatic deduction do not correspond to your needs, for example, when you need to override a function defined in an external library, such as a message handler. Modelio C++ Designer transparently deduces decorations for high-level model parts and retrieves decorations specified by you.
The methods used to access the attributes of application classes provide an important part of the model semantics. However, these accessors are traditionally produced only at code level. Modelio C++ Designer is the first solution to support model-level accessors.
When you specify an “open” access mode (“read”, “write” or both) for an attribute or association end, Modelio C++ Designer automatically creates a UML operation in the respective class, which implements the respective access method, and then automatically deduces the C++ decorations of its return types and parameters, before automatically generating its [prototype] code.
The generation of accessors directly at UML model level lets you explicitly express access semantics at a high level, according to the access patterns you have chosen, thereby constituting a solid bridge between the application model and the code.
C++ requires that the creation and destruction behavior of each class object be explicitly specified. Modelio C++ Designer is the first solution to maintain these semantics at model level.
When you create a class, Modelio C++ Designer automatically creates its default constructor, destructor, and assignment operator, in accordance with C++ best practices. It automatically deduces the C++ decorations of their parameters, and generates some of their code and “to do” notes, reminding you to implement the creation and destruction of the class objects.
Constructors are implemented by design patterns. A creation pattern defines a set, particular signature and creation operation code, and possibly other model elements, such as class factories. These patterns are dynamic, meaning that when a class is updated (its name is changed), the related creation operations are automatically updated according to the pattern.
The automatic generation of creation operations at model level simplifies the essential task of implementing creation behavior, and constitutes a solid bridge between the application code and the model.
Through the transparent support of the conception and implementation modes and the support of dynamic patterns for model-level accessor and creation operations, you can benefit from a high level of automation, simplicity and flexibility, as well as full control over C++ code generation from the early development process steps onwards.
In addition to the conception and implementation modes and model-level dynamic patterns, the consistency of the UML model and the generated code is maintained through the model-driven generation mode.
This model-driven generation mode allows the generation of the entire C++ application from the model, as well as the retrieval of the code, inserted or edited externally using dedicated markers. This means that full model-code consistency is permanently ensured.