-
Notifications
You must be signed in to change notification settings - Fork 1
CPP Code Generation
Ábel Hegedüs edited this page Jul 2, 2015
·
15 revisions
Note: If you are generating CPP code from the UML model, the model elements should be in a component, because the code generation runs only on components.
- Open a Class Diagram created under the root of your UML model in Papyrus
- Right click on the blank area in the editor (this is equal to selecting the Model element) and select Generate CPP code for selected UML model
- Use the UML-Integration to generate xtUMLrt model from UML
- Open the xtUMLrt model (with Sample Reflective Ecore Editor)
- Right click on any XTComponent and select Generate CPP code for selected XTComponent
If you have generated code from the PingPong example UML model you can follow these steps to build and run the generated cpp code:
- The code snippets for the XTClasses will be generated into an
emdw-cpp-genfolder next to the model file - The snippets can be copied to the prepared C++ project found in
tests/Test_Ping_Pong
- Insert the content of the generated files between the
// GENERATED CODE STARTand// GENERATED CODE ENDcomments ofPing.cc,Ping.hh,Pong.ccandPong.hhin/Test_Ping_Pong/src/Comp
- Delete the contents of the
/Test_Ping_Pong/model/emdw-cpp-gendirectory if it exists.
- It contains the generated code which can cause compile errors
- Compile and run the code to see trace information on the standard output
If you have generated code from a single class containing a statemachine you can follow these steps to build and run the generated cpp code:
- The code snippets for the XTClasses inside the XTComponent will be generated into an
emdw-cpp-genfolder next to the model file
- If the model is not in the workspace, a new project called
com.ericsson.emdw.cpp.generated.codeis created and the snippets are saved under a folder with the same name as the model file (e.g.model.xtuml)
- The snippets can be copied to the prepared C++ project found in
tests/Dummy_StateMachine
- Insert the content of the generated files between the
// GENERATED CODE STARTand// GENERATED CODE ENDcomments ofTEST.ccandTEST.hhinTest_FSM/Main_Package/Test_Component - Note that you will have to edit
Test_FSM.ccandTest_Package_decl.hhif your XTClass is not calledTEST. Additionally you have to edit the namespaces and the fully qualified names if the class is not in the::Test_FSM::Test_Component::Test_Packagenamespace.
- Compile and run the code to see trace information on the standard output
You can find a simple example that contains a single TEST class here.
You can find the PingPong example model here.
You can find more example models here.