Configuring UML-to-Real-Time-C++ transformations

To specify the information that the transformation uses to generate the output that you expect, you use the New Transformation Configuration wizard and the transformation configuration editor, which guide you through the configuration.

About this task

A transformation configuration has .tc as a file name extension, and contains the information that the transformation uses to generate the output that you expect. A transformation configuration also contains information that is specific to a particular type of transformation. To edit an existing transformation configuration, in a view that shows the workspace resources, double-click a transformation configuration file, which opens the transformation configuration editor.

To simplify working with the transformation configuration file, save the configuration file in the project that contains the elements to transform.

To configure a UML-to-Real-Time-C++ transformation:

Procedure

  1. Click File > New > Other > Transformations > Transformation Configuration.
  2. Specify the details of the configuration. In the New Transformation Configuration wizard, on the Specify a Configuration Name and Transformation page, complete the following steps:
    1. In the Name field, specify a name for the configuration.
    2. In the Configuration file destination field, specify the destination for the transformation configuration file. The destination is a relative path in your current workspace. You can specify a fully qualified project name or folder name. If you specify a folder in a project, you must prefix the folder name with a forward slash (/).
    3. From the Transformation list, select a transformation.
      Note: To display the transformations that are installed, but not enabled, click Show all transformations. A transformation must be bound to a capability to appear in this list.
  3. Click Next.
  4. Specify the source and target elements for the transformation. For a list of valid source and target elements, see the related concept topic for this transformation. Click the Sources and Target tab; then complete the following steps:
    1. In the Sources section, specify any combination of models, packages, capsules, classes, enumerations, and protocols used in the component. Click Add to select elements that are included in the source for the transformation.
    2. In the Target section, select the destination of the transformation output. You can specify a C++ project or any of its folders.
      • To manually define a new C++ project for the output, click Create.
      • To assign an existing C++ project as the target of transformation output, click Browse.
      • To automatically create new target projects based upon the settings on the Target Configurations page of the Transformation Configuration editor, click Generate target projects from target configurations.
        Note: If the transformation configuration was imported from a component in a Rational Rose® RealTime model and you selected the option to delay the generation of CDT target projects in the import wizard, this option is selected by default.

        You can accept the default location for generated projects. To set a new location, clear the Use default location check box; then type or select a location.

  5. Click Next.
  6. Optional: To generate debugging information, on the Main page, select the Generate a debug log check box. The next time that you run the transformation, the log file is generated as an XML file in the folder that you specify in the transformation preferences. If you do not specify a location for the log files, the transformation generates the log file in the .metadata folder in your workspace.
    Tip: To set preferences for transformations, click Window > Preferences; then expand Modeling and click Transformations.

    The log file provides information about the source elements, the target elements, and the rules that the transformation applies to transform the source elements. If the transformation transforms many elements, you might experience decreased performance while the transformation generates the log file; therefore, you should only generate a log file for debugging purposes.

  7. Optional: To prevent new dialog boxes from opening while a transformation runs, on the Main page, select the Run the forward transformation silently check box.

    Running a transformation in silent mode suppresses all dialog boxes that the transformation generates. The transformation applies default rules and behavior, which might generate unexpected or incorrect transformation output. You should only run a transformation in silent mode to validate that the transformation runs, instead of validating the transformation output. For example, you might run a transformation in silent mode as part of an automated task or automated test suite.

    Setting the transformation to run in silent mode overrides the file-overwrite options that you specify, and overwrites files if necessary.

  8. Click Finish. The transformation configuration editor opens, and the contents of the configuration are displayed.
  9. Optional: Specify documentation about the transformation configuration. This field is useful for communicating information about a configuration that multiple users share. On the Main page, in the Documentation field, specify additional information about the transformation configuration.
  10. Optional: To specify the top-level capsule, click the Properties tab. Each UML-to-Real-Time-C++ transformation configuration with an artifact type of C++ executable and an environment of C++ TargetRTS must specify a top-level capsule. The top-level capsule represents the highest scope of the executable code that you want the transformation to create.
    1. Beside Top capsule, click Select.
    2. In the navigation tree of your UML development project model, select a capsule to define as the top-level capsule for your transformation configuration.
    3. Click OK.
  11. Optional: To specify code generation options, on the Properties page, complete one or more of the following steps:
    • By default, data classes are compiled individually. Clear the Compile data classes individually check box to compile classes as part of the unit cpp file, so that the file includes all the classes directly.
    • For C++ external library artifact types, #include preprocessing directives for individual classes are generated by default from the external library. Clear the Generate class inclusions check box to include in unit.h the file from the Include file name field file instead.
    • To specify the type of artifact to compile when the project builds, from the Artifact type list select C++ Executable (default), C++ External Library, or C++ Library.
    • To specify which runtime system and code generator to use in the build, from the Environment list select C++ or C++ TargetRTS (default).
    • Specify additional code generation properties as needed, such as default arguments and the include file name.
  12. Optional: Transformation configurations can use property sets for the generation, execution, and compilation properties. You can define inheritance relationships between transformation configurations so that, if a default property set changes, all the transformation configurations in the system that use the property set inherit the changes. In addition, if the target projects are subsequently generated, the same behavior is applied for the CDT project configurations.

    To specify inheritance of properties from one or more UML-to-Real-Time-C++ transformation configurations, complete the following steps:

    1. On the Properties page, beside Inherited transformation configurations, click Add.
    2. Select one or more transformation configuration files. In cases of multiple inheritance, the order in which transformation configurations are specified dictates the inheritance priority when parent configurations have the same properties.

      If the property text is displayed in bold font in the transformation configuration editor, the property is local to the configuration. The local property takes precedence over the property that is stored in the inherited transformation configurations.

    3. Click OK; then click Save.
  13. To specify dependencies from a UML-to-Real-Time-C++ transformation configuration to prerequisite transformation configurations in one or more projects, complete the following steps:
    1. In the Properties page, next to Prerequisite transformation configurations, click Add.
    2. Locate .tc files by expanding project trees; then select one or more transformation configurations.
    3. Click OK; then click Save.
    The next time that you run the transformation, the prerequisite transformation configurations run against the source UML elements.
  14. Optional: To specify the CDT project configuration of target projects that are generated from the transformation, click the Target Configurations tab. If you import a Rational Rose RealTime component and choose not to create the associated CDT project at the time of model import, the C++ project settings are stored on the Target Configurations page. The target project is dynamically created the first time you run the transformation.

    When you modify properties on the Target Configurations page, the corresponding CDT configuration is updated.

  15. Optional: You can manage threads in a transformation configuration by adding and deleting physical and logical threads. For C++ TargetRTS environments, if the type of the built artifact is C++ Library, you can specify only logical threads. If the artifact type is C++ Executable, you can specify physical threads and assign logical threads to them. To manage threads, complete the following steps:
    1. Click the Threads tab.
    2. (C++ Executable only) To add a physical thread, under Physical threads, click Add, type a name for the new thread, and click OK. Edit the default values for stack size, priority, and implementation class as needed.
    3. To add a logical thread, under Logical threads, click Add, type a name for the new thread, and click OK. For a C++ Executable, you can select a physical thread to which the new logical thread is assigned.
    4. (C++ Executable only) To move a logical thread from one physical thread to another, drag the logical thread in the Physical threads tree view to another physical thread.
    5. To delete a thread, select the thread and click Remove. You cannot delete the MainThread and TimerThread physical threads.
  16. Optional: To display the errors that occurred when the transformation ran, on the Main page, select the Open the Report dialog box when the transformation is complete check box. Selecting this check box displays only the generated errors. The same information is also written to the error log, which you can view by clicking Window > Show View > Error log.

    To display the warnings that occurred when the transformation ran, select the Show warnings in the Report dialog box check box.

  17. Optional: For transformation configurations that inherit from another transformation configuration, you can choose to override or inherit the values of many individual properties from inherited configurations. To open a pop-up menu containing a list of options for each property, right-click a property name in the Transformation Configuration editor.
  18. Click File > Save.

Results

The options are applied the next time that you run the transformation.

Feedback