Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » C++ Code generation help needed?
C++ Code generation help needed? [message #1266482] Fri, 07 March 2014 09:10 Go to next message
Joost Kraaijeveld is currently offline Joost Kraaijeveld
Messages: 173
Registered: July 2009
Senior Member
Hi,

Because I am interested in C++ code generation I looked at
http://wiki.eclipse.org/Codegen_description and tried the code
generator. It sort of works but needs some work. I am willing to
contribute to the development.

Who is actually working on the generator and what could I do to help?

Joost
Re: C++ Code generation help needed? [message #1266497 is a reply to message #1266482] Fri, 07 March 2014 09:35 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar Radermacher
Messages: 15
Registered: March 2011
Junior Member
Dear Joost,

help is always welcome Smile
What are the things that are missing from your viewpoint. What could you contribute?
Re: C++ Code generation help needed? [message #1266511 is a reply to message #1266497] Fri, 07 March 2014 10:00 Go to previous messageGo to next message
Joost Kraaijeveld is currently offline Joost Kraaijeveld
Messages: 173
Registered: July 2009
Senior Member
On 07-03-14 15:35, Ansgar Radermacher wrote:
> Dear Joost,
>
> help is always welcome :)
> What are the things that are missing from your viewpoint. What could you
> contribute?

I am missing right now:
- installation instructions for the plugin/code generator
- some architectural documents or development plan that can guide me
through the current code base and that gives me an idea where you want
go to.

I am interested (have a need for the generator as part of my work and
studies) in working transformations from class, state and (hopefully)
activity diagrams into fully compilable C++ and runnable code ( or as
compilable and runnable as possible). I do not care much for any C
directed transformations.


Joost
Re: C++ Code generation help needed? [message #1266607 is a reply to message #1266511] Fri, 07 March 2014 13:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4014
Registered: July 2009
Senior Member
Hi

If you really mean "fully compilable C++ and runnable" then perhaps you
are interested in OCL to C++ as well.

The evolving OCL to Java is structured with the intention of supporting
other languages as well, but ... a far from trivial job, but possible.

Regards

Ed Willink


On 07/03/2014 15:00, Joost Kraaijeveld wrote:
> On 07-03-14 15:35, Ansgar Radermacher wrote:
>> Dear Joost,
>>
>> help is always welcome :)
>> What are the things that are missing from your viewpoint. What could you
>> contribute?
>
> I am missing right now:
> - installation instructions for the plugin/code generator
> - some architectural documents or development plan that can guide me
> through the current code base and that gives me an idea where you want
> go to.
>
> I am interested (have a need for the generator as part of my work and
> studies) in working transformations from class, state and (hopefully)
> activity diagrams into fully compilable C++ and runnable code ( or as
> compilable and runnable as possible). I do not care much for any C
> directed transformations.
>
>
> Joost
>
>
Re: C++ Code generation help needed? [message #1266650 is a reply to message #1266607] Fri, 07 March 2014 14:33 Go to previous messageGo to next message
Joost Kraaijeveld is currently offline Joost Kraaijeveld
Messages: 173
Registered: July 2009
Senior Member
On 07-03-14 19:07, Ed Willink wrote:
> Hi
>
> If you really mean "fully compilable C++ and runnable" then perhaps you
> are interested in OCL to C++ as well.
My ambitions are actually to create both a UML to C++ translator *and* a
UML to a (probabilistic) model checker (Prism or MRMC) so I am
definitely interested in OCL to something transformations.
>
> The evolving OCL to Java is structured with the intention of supporting
> other languages as well, but ... a far from trivial job, but possible.

I will look into it. But first a UML to C++ transformation. So much to
do, so little time....

Joost
Re: C++ Code generation help needed? [message #1271214 is a reply to message #1266511] Fri, 14 March 2014 10:27 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar Radermacher
Messages: 15
Registered: March 2011
Junior Member
There's a framework for component-oriented applications called Qompass designer. The basic idea is that the code generator only supports "basic" features. More complex ones are supported by model transformations that are executed before the code generation. The transformations already implemented include in particular (1) "connector reification": replacing UML connectors with an interaction component, (2) container extension: embedding a class into a container (composite) and add services to this container and (3) component to OO transformations: replace ports and connectors. (2) has been used to implement tracing mechanisms and a simple state machine support.

Qompass is available as Papyrus extension via the standard update-site. It comes with online-help, a cheat-sheet and some example. But the documentation is certainly far from perfect. Please contact my by private mail (firstname.lastname@cea.fr) for more information.

Ansgar (Radermacher)
Re: C++ Code generation help needed? [message #1273202 is a reply to message #1271214] Wed, 19 March 2014 14:04 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen Blackwell
Messages: 8
Registered: March 2014
Junior Member
I too, am interested in C++ code generation from Papyrus.
I am just comming back to look at this again after several years. It has never been quite clear to me how all the Eclipse parts fit together but my hazy understanding of it is as follows. Please correct any misunderstandings or omissions that you see.

Papyrus is a Eclipse graphical editing tool that supports the UML2 standard (among others).
It's output is a Meta Object Facility (MOF) Model that adheres to the XMI standard.
The intent is that MOF Model-To-Text transformation (MOFM2T) tools take the Papyrus output model and generate code.
There are 3 MOFM2T tools currently supported by Eclipse: - Acceleo, JET2 and Xpand

Here is where I get lost. I don't find any reference to C++ in Acceleo, JET2 is specifically for Java code generation I'm not quite sure what XPand does.

You say that Qompass designer is available as a Papyrus extension but when I go to Help->Install Additional Papyrus Components it does not show up. I am running Papyrus version 0.10.2.v201402191554.

Thanks,
Steve
Re: C++ Code generation help needed? [message #1273322 is a reply to message #1273202] Wed, 19 March 2014 18:17 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4014
Registered: July 2009
Senior Member
HI

All three are model to text tools that may be used to generate C++ text
(or Ada, or ...); you just have to write the program/templates.

Regards

Ed Willink

On 19/03/2014 20:10, Stephen Blackwell wrote:
> I too, am interested in C++ code generation from Papyrus. I am just
> comming back to look at this again after several years. It has never
> been quite clear to me how all the Eclipse parts fit together but my
> hazy understanding of it is as follows. Please correct any
> misunderstandings or omissions that you see.
>
> Papyrus is a Eclipse graphical editing tool that supports the UML2
> standard (among others).
> It's output is a Meta Object Facility (MOF) Model that adheres to the
> XMI standard. The intent is that MOF Model-To-Text transformation
> (MOFM2T) tools take the Papyrus output model and generate code.
> There are 3 MOFM2T tools currently supported by Eclipse: - Acceleo,
> JET2 and Xpand
>
> Here is where I get lost. I don't find any reference to C++ in
> Acceleo, JET2 is specifically for Java code generation I'm not quite
> sure what XPand does.
>
> You say that Qompass designer is available as a Papyrus extension but
> when I go to Help->Install Additional Papyrus Components it does not
> show up. I am running Papyrus version 0.10.2.v201402191554.
>
> Thanks,
> Steve
Re: C++ Code generation help needed? [message #1273898 is a reply to message #1273322] Thu, 20 March 2014 14:04 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen Blackwell
Messages: 8
Registered: March 2014
Junior Member
Quote:
...you just have to write the program/templates


Oh, is that all? Rolling Eyes

Has anybody made a basic "Hello world" project in Papyrus and used some M2T method to generate C++ code and run it successfully?

If so, please post the steps used. It would make a great very basic tutorial.

Steve
Re: C++ Code generation help needed? [message #1273928 is a reply to message #1273898] Thu, 20 March 2014 15:00 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4014
Registered: July 2009
Senior Member
HI

What is an hello world project?

If you just want cout << "Hello world\n", then about 10 lines of Acceleo
will generate the 5 lines of C++.

Presumably you want models.

If you want the full reflective power of EMF in C++ then it's a huge
undertaking.

If you want something lightweight it's really easy and you get what you
want.

Regards

Ed Willink




On 20/03/2014 18:04, Stephen Blackwell wrote:
> Quote:
>> ...you just have to write the program/templates
>
>
> Oh, is that all? :roll:
> Has anybody made a basic "Hello world" project in Papyrus and used
> some M2T method to generate C++ code and run it successfully?
>
> If so, please post the steps used. It would make a great very basic
> tutorial.
>
> Steve
Re: C++ Code generation help needed? [message #1274601 is a reply to message #1273928] Fri, 21 March 2014 13:55 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen Blackwell
Messages: 8
Registered: March 2014
Junior Member
My ultimate goal is to move away from Rhapsody.
My Rhapsody models contain some complicated state charts including parallel states, embedded or sub-state charts and derived state charts.

My immediate goal to to determine if Eclipse/Papyrus/Acceleo/??? can do the job.
To that end I want to start creating the simplest project I can, my "hello world" project, and run through all the steps to build and validate a model, generate, compile and build a C++ program.
Then I will slowly start to increase the complexity of the model to see what limtations and problems I run into.


As far as I can tell from what I've read, this should be possible but I have not found any useful examples or tutorials to get started.

So again, if anybody knows or any such documentation, please post a link.
The documentation that I have read for both Papyrus and Acceleo is, shall we say, obtuse.

FWIW, I would be happy to help improve the documentation.

Thanks,
Steve
Re: C++ Code generation help needed? [message #1307464 is a reply to message #1266482] Mon, 21 April 2014 11:32 Go to previous messageGo to next message
Anantha Krishnan is currently offline Anantha Krishnan
Messages: 1
Registered: April 2014
Junior Member
My trials with the TestCDTintegration sample reveal some basic issues that the team could pl. explain:
1. The code generated has #include <...> for project based .h files that should possibly be "..." for MinGW maybe.
2. The includes also seem to add the folder name in front of each class .h file like #include <TestCDTintegration/class0.h> whereas the .h files are in ..\TestCDTintegration\class0.h etc.
3. Possibly also the forward slashes should be substituted by back slash - '\' in place of '/'...

A tutorial on how to create the C++ project, embed the UML model, apply C_Cpp profile, generate C++, then build with CDT would be definitely of great help.

Or, where the settings for codegen paths can be edited would be useful.

Anantha
Re: C++ Code generation help needed? [message #1309294 is a reply to message #1307464] Tue, 22 April 2014 11:59 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar Radermacher
Messages: 15
Registered: March 2011
Junior Member
Dear all,

Papyrus comes with a Acceleo based C++ code generator, the CDT editing feature is still experimental. It would be good to hear your feedback what works and what does not.

Although the work has been done on a Linux machine, the use of "/" instead of "\" should not impose any problems on Windows with mingw, cygwin or Visual C++. But you need eventually setup your include paths properly in the CDT project settings.

There are two different ways to use the C++ code generation. The first is the direct production of a C++ file (.cpp/.h) that belongs to the model element, the 2nd a support for component based modeling, including the generation of code from a so-called deployment plan. The idea is that a deployment plan describes instances and their allocation to hardware nodes. This approach is inspired by the CORBA Component Model (CCM).

There is a HelloWorld sample model for the 2nd way. It requires to

(1) Install Qompass designer from the Papyrus extensions
(2) Create an empty project (could be a CDT project, but does not have to be)
(3) Select the created project and choose FILE>New>Example.
(4) Select "Qompass Hello World example" from the list.
(5) Open the created example and select the deployment tab. Generate code from the deployment plan with a right click on the selected plan and then choose "Generate deployment models and code" from the context menu.
(6) The generator will produce a model for each node. Each node corresponds to a CDT project containing this model and the code generated from it.

Whereas the 2nd way to produce code is more powerful, it is also more complicated. Therefore, I will also providing a Hello World example for a simple object-oriented model soon.

Re: C++ Code generation help needed? [message #1310533 is a reply to message #1309294] Wed, 23 April 2014 04:36 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar Radermacher
Messages: 15
Registered: March 2011
Junior Member
If you use plain code generation (without instance based deployment), the CDT project settings must contain an include path of the form
"${workspace_loc:/<the name of your project>}"
b
Thus, all files will be found.

There are two improvements of the generation plugins that will be added soon

(1) Add an option that code generation on a single class will also generate the code on which the class depends such as the package or referenced types.
(2) Automatically configure the include path settings of the CDT project mentioned above.

Re: C++ Code generation help needed? [message #1352229 is a reply to message #1310533] Tue, 13 May 2014 07:08 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar Radermacher
Messages: 15
Registered: March 2011
Junior Member
The improvements are now available with M7 or the nightly builds. Code generation now

- generates into a separate CDT project, starting with a configurable prefix and the model name. This enables to have multiple models in the same project
- the created project is automatically configured for working with the code generation
- code is generated for required files as well.

- currently, the first code generation produces Acceleo errors. As a workaround, you need to reset the Acceleo driver after the first generation. Subsequent code generation will work.

There is a HelloWorld example available via the File->New->Examples (is must be placed into an existing project)
Re: C++ Code generation help needed? [message #1387840 is a reply to message #1309294] Wed, 25 June 2014 13:10 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen Blackwell
Messages: 8
Registered: March 2014
Junior Member
Finnally, the forum login has been fixed!!!

Where do I find QCompass? I don't see it in the extensions.

I'm using v0.10.2.v201402191554 on a Windows 7 pltform which Help->Check for Updates says is the latest.

Help->Install Papyrus Additional Components does not show any QCompass.
Help->Install New Software... search for QCompass does not show anything.
Help->Install Modelling Components ...search for QCompass doe not show anything.

Thanks,
Steve

Re: C++ Code generation help needed? [message #1391219 is a reply to message #1387840] Mon, 30 June 2014 11:57 Go to previous message
Stephen Blackwell is currently offline Stephen Blackwell
Messages: 8
Registered: March 2014
Junior Member
OK,

I have updated from Eclipse Kepler to Eclipse Luna and now QCompass is available.

Steve
Previous Topic:How to set diagrams background color?
Next Topic:Question about the implementation of UML Constraints
Goto Forum:
  


Current Time: Thu Jul 31 05:35:47 EDT 2014

Powered by FUDForum. Page generated in 0.02657 seconds