Getting started

Model level creation operations

The first step in this tour is to create the model shown in figure below, by first creating the “My planner” package inside the root package, and then the “Task management” package inside the “My planner” package.


The model you are going to build

We are now going to continue by designating the main entities of our application (Project, Task, Human Resource and Person), and the relationships between these entities.

Let’s create a class to represent, for instance, projects.  For this, create the “Project” class in the “Task Management” package.


Creating the “Project” class in the “Task management” package

Steps:

C++ does not provide automatic memory management and garbage collecting features, and its syntax does not permit the initialization of class members in declaration points. In most cases, you have to manually specify the creation and destruction semantics of your classes by writing constructors, destructors, and so on.

In order to avoid you forgetting creation operations for your objects, and to explicitly represent creation semantics at model level, Modelio C++ Designer automatically constructs UML creation operations when a class is created in the model.  Modelio C++ Designer follows best C++ practices and uses a design pattern to create the so-called “Coplien form”:


Automatically constructed creation operations

For each operation, Modelio C++ Designer automatically creates C++ notes with “TODO” comments, suggesting that you provide their C++ implementation.

This model level pattern is dynamic, meaning that when you rename a UML class, its creation operations are renamed automatically.


The names of the creation operations are automatically modified when the class name is modified

First C++ generation

To generate C++ code from the application model, select the element to generate and click on the  "Smart generate" button in the C++ property view.


Launching C++ code generation using the button in the property view

If you have not created your own build project, Modelio C++ Designer automatically creates a default build project.

The default build project manifests the whole model, meaning that all model elements (except those marked by the “No Code” flag) are translated.

Its C++ code generation target uses the type library, compilation platform, output directories, header and body file extensions specified by Modelio C++ Designer parameters.

Its doxygen documentation target uses doxygen options and output directories specified by Modelio C++ Designer parameters.

Its compilation target uses makefile and compiler options specified by Modelio C++ Designer parameters.

Note: Default C++ code, documentation generation and compilation options must be defined using Modelio C++ Designer parameters, before using it for the first time.