Introduction

Code generation consists of producing Cxx 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 Cxx 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 Cxx 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 Cxx Designer supports two usage modes:

Conception mode

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 Cxx 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 Cxx code directly from high-level models, Modelio Cxx Designer automatically deduces C++-specific model decorations (Cxx properties) from high-level UML model properties. Modelio Cxx Designer then analyzes UML attributes, such as ordering and uniqueness, and applies Cxx expert logics and best practices to derive reasonable decorations and subsequently Cxx code, which adequately expresses model semantics.

With Modelio Cxx 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.

Implementation mode

In implementation mode, you manage C-specific application properties yourself, and specify Cxx properties by manually decorating the model. The C-oriented GUI hides the underlying UML extensions, making it easy to work in Cxx terms and to immediately observe the effects of decorations on the generated Cxx code.

Modelio Cxx 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 Cxx code has been generated, you can create Cxx 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 Cxx Designer transparently deduces decorations for high-level model parts and retrieves decorations specified by you.

Model-level accessors

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 Cxx 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 Cxx Designer automatically creates a UML operation in the respective class, which implements the respective access method, and then automatically deduces the Cxx 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.

Model-level creation operations

Cxx requires that the creation and destruction behavior of each class object be explicitly specified. Modelio Cxx Designer is the first solution to maintain these semantics at model level.

When you create a class, Modelio Cxx Designer automatically creates its default constructor, destructor, and assignment operator, in accordance with Cxx best practices. It automatically deduces the Cxx 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.

Control and flexibility

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 Cxx code generation from the early development process steps onwards.

Permanent model-code consistency

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 Cxx 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.