Specifying alternate file names for UML-to-C++ transformation output

You cannot create mapping models for the C++-to-UML transformation. However, if you enable the reverse, or UML-to-C++, transformation when you create or edit your transformation configuration, you can create mapping models that enable you to specify alternate files names for output that the UML-to-C++ transformation generates.
If you enable the reverse transformation, you can create and configure mapping models for the reverse transformation. 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 PackageA, and PackageA contains 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, then 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.


Feedback