C++ Round-Trip Engineering with UML Class Model
Visual Paradigm for UML 7.2 (Professional Edition or above) supports round-trip engineering of ANSI C++ source code. In this tutorial we will talk about how to perform C++ round-trip code engineering between your source code and class diagram.
To generate C++ code:
- You can right click on your class model(s) and select C++ Round-trip > Generate Code.

- The Generate Code dialog will be shown.

- You can specify different output path for different Models in your project. Since all of our classes are modeled under Implementation Model, click on the <Root> cell and press the ... button in the cell, and then select Implementation Model. Press OK to proceed.

- Click on the ... button next to the source path and specify the output location.

- Press OK to proceed, and now the source code being generated to the folder you specified.

- You can also generate source code for the entire project by selecting Tools > C++ Round-trip > Generate Code.

- Various options on how the code should be generated such as default type, text encoding, brace and indentation, also the default template for operations, getters and setters can be configured by pressing the Advanced Options... button inside the Generate Code dialog.

-
In some cases you don't want to generate code for some of your of your class models, you can put the classes into ignore list by pressing the Ignore Classes... button, and move the classes to Ignore Classes list.
After generated the code, you can modify it with IDE or test editor. Once you finish modification, you can reverse it back to the VP-UML. As it is round-trip code engineering, the unrelated modification will be overwritten during synchronization. For example, assume you have modified the operations of a class model, reverse your source file with modified attributes will not affect losing your change on the operation.
- If you want to reverse engineer specific class, you can simply right click on it and select C++ Round-trip > Reverse Code.

- Or you can perform reverse engineering on multiple source folder by selecting Tools > C++ Round-trip > Reverse Code.

- You can add new source path by pressing the "+" button, then specify the source folder and target model by clicking on the row. Once you finish specify the source paths and destination models, you can then press the OK button to proceed.

Resources
- FireSafetyDepartment.vpp
Rate this Article
Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).
One Moment Please
Thanks for rating this article.
Comments (0)