C++-to-UML transformations
Valid transformation sources
The source that you specify in the transformation configuration must be created using the C/C++ Development Tools (CDT).
| DCMP | C++ source objects |
|---|---|
| Conceptual Models Seed Concrete Models | You can select one or
more of the following items from one or more C++ projects:
|
| Conceptual Models Drive Development | |
| Reconciled Modeling | You can select the following items:
If you select an item that is not a C++ project, the reverse, or UML-to-C++, transformation determines the C++ project of the first item that it processes. The reverse transformation generates its output in this C++ project. |
If you select C++ elements in the Project Explorer view instead of using the Transformation Configuration editor, the source elements that you select override the source project or elements that are specified in the transformation configuration. The transformation configuration is not affected and the source that you specify on the Source and Target page of the transformation configuration editor or in the New Transformation Configuration wizard does not change.
Valid transformation targets
A valid transformation target is a UML model, UML model file, or root-level package in a UML model.
Alternate file names for reverse transformation output
You cannot create mapping models for the C++-to-UML transformation. However, if the transformation configuration implements the Reconciled Modeling DCMP, you can configure the reverse, or UML-to-C++, transformation, to create mapping models that enable you to specify alternate files names for the output that it generates.
The C++-to-UML transformation uses the mapping models to determine the appropriate name for the UML elements that it generates. For example, a UML model contains a package named PackageA, and PackageA contains a class named Class1. When you create a mapping model for the UML-to-C++ transformation, you can specify that Class1 has an alternate file name of MappedClass1. When you run the UML-to-C++ transformation, it generates C++ files named PackageA.MappedClass1.cpp and PackageA.MappedClass1.h. When you run the C++-to-UML transformation, the transformation determines that the original UML path for the C++ element is PackageA.Class1, and generates a UML class named Class1 in a UML package named PackageA.
If the artifact file name that you specify in the mapping model is not a valid C++ file name, the transformation modifies the name of the file when it creates the C++ code element. For example, if the mapping model specifies an alternate file name of "Mapped Class1", instead of MappedClass1, the transformation generates a C++ file named Mapped_Class1.cpp. The transformation does not keep a record of these modifications; therefore, the C++-to-UML transformation cannot map the Mapped_Class1 file to the original UML element. In this example, the C++-to-UML transformation transforms the Mapped_Class1 C++ source object into a UML class named Mapped_Class1, instead of Class1.
Support for multiple projects and their interdependencies
In C++-to-UML transformation configuration files, an association defines a link between a C++ element and a UML element. If you work with multiple C++ projects or UML models, you can create an association file that defines associations between C++ source elements and UML target elements in different projects.
Typically, you define associations between C++ elements in the transformation source and UML elements that are contained in models that are outside the scope of the transformation target element. By default, if the C++-to-UML transformation cannot create a reference to a concrete UML target element, and no association is defined, the transformation creates a visual reference to the corresponding C++ element. If you define an association between the elements, the transformation creates a reference to a concrete UML target element and does not create a visual reference.
A C++-to-UML association file has .xmi as a file name extension. Multiple transformation configurations can share an association file.
- Model project
- Model
- Package
- A C++ project called ProjectA, which contains ClassA, which contains an attribute of type ClassB
- A C++ project called ProjectB, which contains a class called ClassB
- A UML model called ModelB that corresponds to project ProjectB
- The C++ project called ProjectA is the transformation source
- A new UML model called ModelA is the transformation target
- An association between the C++ project called ProjectB and the UML model called ModelB
Synchronization of C++ code and UML model elements
To facilitate the synchronization of C++ code and UML model elements, you can specify that the transformation defines a type of link called a traceable relationship between UML elements and C++ code elements. You can specify this option when you configure a C++-to-UML or UML-to-C++ transformation to use the Reconciled Modeling or Conceptual design contract management protocol (DCMP). When you run the transformation, it creates traceable relationships by adding annotations and identifiers to the generated elements. Generating traceable relationships prevents the UML-to-C++ transformation from generating duplicate code elements in the C++ source code.
The transformation generates traceable relationships for the following elements:
- Classes, structs, and unions
- Interfaces
- Methods
- Attributes
- Typedef types
- Enumerations
- Enumeration literals
Comparing and merging transformation output with target UML models
The C++-to-UML transformation uses the comparing and merging functionality to determine the differences between the target model and the temporary model that the transformation generates. When you run the C++-to-UML transformation, the merge editor displays the differences between the two models. In the merge editor dialog box, you can select the changes that the transformation merges into the target model.
Integration with team support
The transformation provides integration functionality with IBM® Rational® Team Concert™, CVS, Rational ClearCase®, and Rational ClearCase LT version control systems, which enables you to automatically check out files or add new files. You must enable team capabilities to work with configuration management systems.