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.

January 6, 2010
User Rating: / 1
Views: 4,917
PDF Link Add comments
Edition: Professional or above (Edition comparison)

To generate C++ code:
  1. You can right click on your class model(s) and select C++ Round-trip > Generate Code.
    gen code from class
  2. The Generate Code dialog will be shown.
    gen code dialog
  3. 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.
    select model
  4. Click on the ... button next to the source path and specify the output location.
    select src folder
  5. Press OK to proceed, and now the source code being generated to the folder you specified.
    generated code
  6. You can also generate source code for the entire project by selecting Tools > C++ Round-trip > Generate Code.
    generate code for project
  7. 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.
    advanced options
  8. 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.
    ignore
    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.
  9. If you want to reverse engineer specific class, you can simply right click on it and select C++ Round-trip > Reverse Code.
    reverse class
  10. Or you can perform reverse engineering on multiple source folder by selecting Tools > C++ Round-trip > Reverse Code.
    reverse project
  11. 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.
    add src path

Resources

  1. FireSafetyDepartment.vpp

Rate this Article

Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).

You may be interested in

  1. Writing Effective Use Case
  2. UML Package Diagram
    Tagged:
  3. Draw Entity Relationship Diagram (ERD)
    Tagged:
  4. Produce UML Use Cases from Business Process Diagram (BPD)
  5. Draw UML Sequence Diagram with Keyboard
Tags of this article:

Comments (0)

Write comment

Rating

Comment

Enter the calculation result

security code