Problem(Abstract)
Simple Example using the C++ Analyzer with Rose RealTime
Resolving the problem
A Japanese translation of this Solution is available. See Solution 169450329.
QUESTION:
Is there a simple example that illustrates how to use the C++ Analyzer to reverse engineer C++ code into Rose RealTime?
ANSWER:
Yes. Here is a very simple example.
NOTE: This example is meant to illustrate how to use the C++ Analzyer to reverse engineer a few simple C++ classes. In more complex cases, there may be some additional steps required. Please consult the C++ Analyzer for further information.
1. Unzip the attached file, 115138634_AnalyzerExample.zip, to a temporary directory.
2. Take a look at the files (engine.h, engine.cpp, move.h, move.cpp) to become familiar with the classes that will be brought into Rose RealTime.
3. Start the C++ Analyzer. From Rose RealTime, select Tools > C++ Analyzer...
4. Create a new C++ Analzyer project. From the C++ Analyzer, select File > New.
5. You will be prompted to define the $DATA virtual path symbol if it is not defined already. Select OK to define it now. Set the "Actual Path" to be the temporary directory where the C++ files are stored. "Add" the pathmap and then "Close" the dialog.
6. The Project dialog will now appear. Click on the "Files..." button.
7. The "Project Files" dialog will appear. In the lower half, browse to the temporary directory where the C++ files are located. In the upper half, select the four files (engine.h, engine.cpp, move.h, move.cpp) and click "Add Selected". They should now appear on the right hand side under "Files in List". Click OK to close this dialog.
8. In the Project dialog, select all four files.
9. Analyze the selected files. Select Action > Analyze.
10. Code cycle the files. Select Action > CodeCycle. This will add tags to our original four C++ files. Select Yes to update the files.
11. Create a Rose model from the files. Select Action > Export to Rose... Browse to the temporary directory where the C++ files are stored and name the file temp.mdl. The "Option Set" should be set to FirstLook. Select OK.
12. Set the $DATA virtual path symbol in Rose RealTime. In Rose RealTime, select File > Edit Path Map... Add the $DATA symbol and browse to the temporary directory where the C++ files are stored. "Add" the pathmap and then "Close" the dialog.
13. Open the model file. In Rose RealTime, select File > Open. Select "Rose model" as the file type. Browse to the temporary directory and open temp.mdl.
14. A dialog box will appear stating that one or more files have been loaded from an older format and that you should select File -> Save As to avoid overwriting. Click OK.
15. The Boat, Car, Engine, and Vehicle class will now be in the model. There is a "Reverse Engineered" diagram which shows these classes.
16. Import the code for these classes. Select Tools > Import Code... Move the four files to the right-hand side and click OK.
17. Now the operations in the classes in the model have source code.
18. Save the Rose RealTime model.
Note: The end result is a blank RoseRT model with the reverse engineered classes in a package. To bring those classes into a RoseRT framework (e.g. C++), export the package and then import the resulting *.rtptl file into the desired framework.