Home » Modeling » Papyrus » C++ code generation(How to use C/C++ hello world example, to generate code from operation body.)
C++ code generation [message #1444675] |
Tue, 14 October 2014 11:42 |
Anantha Krishnan Messages: 26 Registered: April 2014 |
Junior Member |
|
|
Just elaborating my query and simplifying the question.
I do the steps below:
1. Create a Papyrus project - UML model and template UML Primitive Types.
2. Add C/C++ Profile to model.
3. Add Child Class, in this Add Child Operation.
4. In Operation Properties, in Method, add a new Opaque Behavior(OB).
5. In OB, Properties, add C++ Language, in right side box, the implementation code - cout << ...
6. In Model Explorer, rt. clk. model, Code Generation>Generate C++.
7. Accept query about creating a C++ Project, empty executable...
8. All expected files are generated, but in <classname>.cpp, the body code does not appear from the OB implementation entries.
Am I missing something basic pl.
Anantha Krishnan.
In the latest Papyrus(Luna) there is a C/C++ hello world example, that seems to provide for generating body code from entries in the UML model. I have been trying to create another Operation in the HelloWorld class and generate my own body code similarly, but its not happening.
What exactly are the steps for this pl. A detailed explanation I think is needed.
Also, what else code generation is now possible. How about state machine code-for transitions/entry/do/exit actions etc.
Thank you.
Anantha Krishnan
[Updated on: Mon, 20 October 2014 12:15] Report message to a moderator
|
|
|
Re: C++ code generation [message #1454649 is a reply to message #1444675] |
Tue, 28 October 2014 16:14 |
|
The most likely reason is that the language of the opaque behavior is ignored, since the language attribute does not match. The generator should accept the languages "C/C++" or "C++". By looking at the generator template, I found that only C/C++ is currently recognized. This is a bug, in particular since Papyrus proposes C++ in the list of available languages (however, the C/C++ view uses C/C++ as language). Can you please try out, if the generation works if you use C/C++ as language.
Can you also please post a bug that opaque behaviours with "C++" as language are ignored by the C++ code generator
|
|
| | | | |
Re: C++ code generation [message #1464472 is a reply to message #1464440] |
Fri, 07 November 2014 15:47 |
|
There is current support for code-generation from state-machines in Qompass, a component based framework that supports interaction components and container services (inspired from the CORBA component model). The state machine support is principally a demonstration that container services are very flexible. The support does for instance not support hierarchical or parallel state machines.
As Ernesto pointed out in https://www.eclipse.org/forums/index.php/t/819565/
Zeligsoft and CEA are working on UML/RT support in Papyrus that will include code generation for state-machines. It supports hierarchical, but not parallel state machines.
We have no fixed release date for UML/RT, but we target the Eclipse mars release (alpha versions might be available earlier).
In parallel CEA may eventually reuse the state-machine support in UML/RT for providing (non-parallel) state-machines in standard-UML.
|
|
| |
Re: C++ code generation [message #1467511 is a reply to message #1444675] |
Mon, 10 November 2014 04:47 |
Anantha Krishnan Messages: 26 Registered: April 2014 |
Junior Member |
|
|
Some queries pl., Ansgar:
1. I think UML-RT does not support parallel state machines?
2. I have a background working with Rational Rose-RT which has contributed to UML-RT, right? In Rose-RT, it was very intuitive - you created Capsules(Class stereotyped as Capsule with Papyrus/UML-RT profile is OK), then Protocols(in Papyrus I cant find this step of the Use Case?), followed by definition of Signals in each Protocol(what is the equivalent in Papyrus). Then you created Ports on/in Capsule Roles in a Structure Diagram(Composite Structure in Papyrus?) that are typed by the suitable Protocol. And the Roles have property of Base or Conjugate of the Protocol. What is the corresponding Use Case in Papyrus with UML-RT?
3. Again, in Rose-RT, the Use Case continued by creating State Machines for the dynamic behaviours of Capsules responding to Messages causing Signals on Ports. And, for RealTime systems, of course this is the most important. So we do need the State Machine feature with its codegen.
4. Rose-RT also generated "complete" code - along with a full Framework for Message based communication, timer services, besides threading(Capsules are basically Active Classes with potentially their own thread?),error/exception handling, logging etc. Is the Papyrus UML-RT feature also planned to provide these.
Thank you. If the above gets positive replies, Papyrus would be an awesome tool for real time systems design & development.
Anantha Krishnan.
4. Where can I obtain the official specification document of UML-RT profile - I cant find it on OMG site - is it not approved by OMG yet?
|
|
|
Re: C++ code generation [message #1467789 is a reply to message #1467511] |
Mon, 10 November 2014 10:03 |
Peter Cigehn Messages: 49 Registered: September 2014 |
Member |
|
|
Anantha Krishnan wrote on Mon, 10 November 2014 04:47
1. I think UML-RT does not support parallel state machines?
2. I have a background working with Rational Rose-RT which has contributed to UML-RT, right? In Rose-RT, it was very intuitive - you created Capsules(Class stereotyped as Capsule with Papyrus/UML-RT profile is OK), then Protocols(in Papyrus I cant find this step of the Use Case?), followed by definition of Signals in each Protocol(what is the equivalent in Papyrus). Then you created Ports on/in Capsule Roles in a Structure Diagram(Composite Structure in Papyrus?) that are typed by the suitable Protocol. And the Roles have property of Base or Conjugate of the Protocol. What is the corresponding Use Case in Papyrus with UML-RT?
3. Again, in Rose-RT, the Use Case continued by creating State Machines for the dynamic behaviours of Capsules responding to Messages causing Signals on Ports. And, for RealTime systems, of course this is the most important. So we do need the State Machine feature with its codegen.
4. Rose-RT also generated "complete" code - along with a full Framework for Message based communication, timer services, besides threading(Capsules are basically Active Classes with potentially their own thread?),error/exception handling, logging etc. Is the Papyrus UML-RT feature also planned to provide these.
1. No, UML-RT does not support parallell state machines (i.e. no multiple orthogonal regions, only one region per state machine).
2, 3, 4. If you have a background in Rose RealTime, you can expect more or less the same. UML-RT for Papyrus will be based on the same concepts as UML-RT for RoseRT including complete code generation and run-time framework. I guess Ansgar can confirm this as well.
/Peter Cigéhn
|
|
| | |
Re: C++ code generation [message #1469299 is a reply to message #1468890] |
Tue, 11 November 2014 13:28 |
|
Hi Anantha,
The code generation is using Extend and should be portable across the platforms supported by Eclipse. I do know that it works on my Mac and on Windows.
At this point, we are only testing running the code build and run on Linux, which gives us a good basis for Posix-compliant targets.
We are expecting to support the Eclipse development platforms by the time we release (modeling and code generation). The runtime service layer will also provide mechanisms to be adaptable to various runtimes.
/Charles Rivet
|
|
| | |
Goto Forum:
Current Time: Sat Apr 20 02:59:00 GMT 2024
Powered by FUDForum. Page generated in 0.03465 seconds
|