Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Anantha Krishnan is currently offline Anantha KrishnanFriend
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 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 456
Registered: March 2011
Location: Paris Saclay, France
Senior Member
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 #1455205 is a reply to message #1454649] Wed, 29 October 2014 05:55 Go to previous messageGo to next message
Anantha Krishnan is currently offline Anantha KrishnanFriend
Messages: 26
Registered: April 2014
Junior Member
Yes, Ansgar, the codegen is correct if I enter C/C++ as the language for the OB.

I have raised a bug already, no. 449026.

Thanks.

Anantha Krishnan.
Re: C++ code generation [message #1463437 is a reply to message #1455205] Thu, 06 November 2014 15:04 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen BlackwellFriend
Messages: 138
Registered: March 2014
Senior Member
Anantha,

I voted for your bug just in the unlikely case it makes any difference.

I also note that the second part of your post about what is currently possible with code generation has never been answered. It does not appear that code generation from state machines has been implemented.

Is there any documentation, such as a roadmap for code generation?

Steve
Re: C++ code generation [message #1463886 is a reply to message #1463437] Fri, 07 November 2014 01:48 Go to previous messageGo to next message
Anantha Krishnan is currently offline Anantha KrishnanFriend
Messages: 26
Registered: April 2014
Junior Member
Thanks Steve.

The team may like to answer reg roadmap for code generation from State Machines.

One option may be use of qompass which states there is c++ coden from "simple" state machines. I am trying out, slowly.

One other feature to help with this especially in integration with other tools may be an export and import from xmi files.

Anantha Krishnan.
Re: C++ code generation [message #1464440 is a reply to message #1463886] Fri, 07 November 2014 15:02 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen BlackwellFriend
Messages: 138
Registered: March 2014
Senior Member
Anantha,

I found this thread, https://www.eclipse.org/forums/index.php/t/819565/ that says that the team is working on generating code from state machine but it is not ready for prime time yet. Hopefully, there is a roadmap for when it will be released. I will be checking it out as soon as it is. I want to be able to move away from Rhapsody but I have a large number of fairly complicated state machines.

To the team that is working on this, if there is anything I can do to help, please let me know.
I see that your bug has been moved to the FIXED state in bugzilla.

I need to look into Qompass further.

Steve
Re: C++ code generation [message #1464472 is a reply to message #1464440] Fri, 07 November 2014 15:47 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 456
Registered: March 2011
Location: Paris Saclay, France
Senior Member
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 #1464639 is a reply to message #1464472] Fri, 07 November 2014 19:05 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen BlackwellFriend
Messages: 138
Registered: March 2014
Senior Member
Ansgar,

Do you know if there are any plans to eventually work on parallel states?
If not, would it make any difference if I filed an RFE in bugzilla?
Re: C++ code generation [message #1467511 is a reply to message #1444675] Mon, 10 November 2014 04:47 Go to previous messageGo to next message
Anantha Krishnan is currently offline Anantha KrishnanFriend
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 Go to previous messageGo to next message
Peter Cigehn is currently offline Peter CigehnFriend
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 #1468424 is a reply to message #1467789] Mon, 10 November 2014 21:04 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 219
Registered: May 2014
Location: Canada
Senior Member

There was a short presentation at EclipseCon Europe's Modeling Summit about UML-RT support in Papyrus. if you want to know what was said, check out my blog at http://selrahcsoftconsult.com/2014/11/10/eclipsecon-europe-2014-the-aftermath/.

And although parallel regions are not supported in UML-RT (nor where they in RSARTE, RoseRT, or ObjecTime Developer), there have been patterns that simulate that capability since the ObjecTime days.


/Charles Rivet
Re: C++ code generation [message #1468890 is a reply to message #1468424] Tue, 11 November 2014 06:07 Go to previous messageGo to next message
Anantha Krishnan is currently offline Anantha KrishnanFriend
Messages: 26
Registered: April 2014
Junior Member
Thank you Charles. Looks great - hope we can get to see the UML-RT in Papyrus next gen soon.

One question - is that going to be only Linux (especially the framework/codegen) or Ok for Windows with say MinGW?

Anantha Krishnan
Re: C++ code generation [message #1469299 is a reply to message #1468890] Tue, 11 November 2014 13:28 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 219
Registered: May 2014
Location: Canada
Senior Member

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
Re: C++ code generation [message #1470105 is a reply to message #1469299] Wed, 12 November 2014 04:46 Go to previous messageGo to next message
Anantha Krishnan is currently offline Anantha KrishnanFriend
Messages: 26
Registered: April 2014
Junior Member
Thank you for the information.

What is the expected date for the release pl.

Anantha Krishnan
Re: C++ code generation [message #1482146 is a reply to message #1470105] Fri, 21 November 2014 14:30 Go to previous message
Anantha Krishnan is currently offline Anantha KrishnanFriend
Messages: 26
Registered: April 2014
Junior Member
Back to query reg use of Qompass for state machine modelling and C++ codegen, on Windows8.1 and cygwin64.

I created a simple state machine under the HelloWorld component of Qompass Helloworld example, applied the ContainerRule "StateMachineWCallEvents", went through the transformation and codegen steps.

In trying to build the project that is created, I get the following error.

Building file: ../root/OS_AL/Util/BString.cpp
Invoking: Cygwin C++ Compiler
g++ -DOS_Cygwin -I"C:\Users\pjakrishnan\pprsykndluna3nov2014ws\HelloWorld_monoNode_SystemDepPlan2" -I"C:\Users\pjakrishnan\pprsykndluna3nov2014ws\HelloWorld_monoNode_SystemDepPlan2\root" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"root/OS_AL/Util/BString.d" -MT"root/OS_AL/Util/BString.d" -o "root/OS_AL/Util/BString.o" "../root/OS_AL/Util/BString.cpp"
In file included from ../root/OS_AL/Util/BString.cpp:16:0:
C:\Users\pjakrishnan\pprsykndluna3nov2014ws\HelloWorld_monoNode_SystemDepPlan2/root/OS_AL/ProcessingResources/Thread.h:28:52: fatal error: sys/procfs.h: No such file or directory
compilation terminated.
make: *** [root/OS_AL/Util/BString.o] Error 1
root/OS_AL/Util/subdir.mk:36: recipe for target 'root/OS_AL/Util/BString.o' failed

Is this a problem of Cygwin on Windows, or what am I missing pl.

Anantha Krishnan.
Previous Topic:Basic use of SysML elements
Next Topic:How to install Java code generator for Papyrus
Goto Forum:
  


Current Time: Thu Mar 28 21:18:55 GMT 2024

Powered by FUDForum. Page generated in 0.06193 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top