Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Imported C++ registered package
Imported C++ registered package [message #1760974] Thu, 04 May 2017 19:30 Go to next message
Stephen Blackwell is currently offline Stephen BlackwellFriend
Messages: 118
Registered: March 2014
Senior Member
I imported the C++ STL registered package into a project and added a property, s, of type string to a class. Then I generated the code.

The generated .h file contains this:

class myHelloWorldClass {
public:
	/**
	 * 
	 */
	string s;

	/**
	 * 
	 */
	void run();

};



The problem is that the type should be "std::string" instead of just "string" so the code will not compile as is.

The workaround is to add "using namespace std;" to the header but this should not be necessary. Is there another way?

I understand that this library is still a work in progress and the bugzilla improvement issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=496934 is still in the NEW state.

Also I would like to help fix this and work on the STL package if someone will point me in the right direction.

Steve

PS This is with version 2.0.3.201703080851.
Re: Imported C++ registered package [message #1761219 is a reply to message #1760974] Tue, 09 May 2017 07:41 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 159
Registered: March 2011
Location: Paris Saclay, France
Senior Member
The ExtLibrary stereotype already supports the use of qualified names via the "prefix" attribute. However, this attribute is not set to "std::" in the STL model library and there is an error in the evaluation of this attribute. I will correct this two problems asap.
Re: Imported C++ registered package [message #1761289 is a reply to message #1761219] Tue, 09 May 2017 13:37 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen BlackwellFriend
Messages: 118
Registered: March 2014
Senior Member
Excellent. Do you think these fixes will be in the May release?
Re: Imported C++ registered package [message #1763304 is a reply to message #1761289] Fri, 12 May 2017 13:38 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 159
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Yes, the fix should be in the latest build now and the release is planned for the beginning of next week.
Re: Imported C++ registered package [message #1775903 is a reply to message #1760974] Wed, 08 November 2017 03:18 Go to previous messageGo to next message
Sekwon Jang is currently offline Sekwon JangFriend
Messages: 10
Registered: November 2017
Junior Member
I am a beginner about Papyrus.
I need to make a property with std::string type in a class.
But I can't find std::string in type dialog because there are UMLRT-RTS and AnsiCLibrary.
I guess that if I import C++ registered package, I will find std::string in type dialog.
Is it right?
If it is right, Can you show me where to find C++ registered Package and how to import C++ registered Package.
Re: Imported C++ registered package [message #1776023 is a reply to message #1775903] Thu, 09 November 2017 13:05 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 159
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi,

Since you have the choice between the UMLRT-RTS and the Ansi-C library, you have probably Papyrus-RT installed.
The STL library (quite limited though). is part of Papyrus SW designer which you can install either via the market-place or its update-site (neon or oxygen): http://download.eclipse.org/modeling/mdt/papyrus/components/designer/
While Papyrus-RT targets a specific modeling approach dedicated for real-time systems, Papyrus SW Designer is a bit broader. After you installed SW designer, have a look at the installed examples (File->New->Example)
Re: Imported C++ registered package [message #1776040 is a reply to message #1776023] Thu, 09 November 2017 16:26 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 200
Registered: May 2014
Location: Canada
Senior Member

Since Papyrus-RT seems to be involved, I should mention that the STL is not supported by its code generatorand we therefore do not provide a type library for it.

We currently only support the ANSI C types and the UML primitive types, each having their own library that can be imported.

The UML type library does contain a "String" type that the code generator converts to "char *".

Please note that if you are using Papyrus-RT, there is a dedicated Papyrus-RT forum available.


/Charles Rivet
Re: Imported C++ registered package [message #1776098 is a reply to message #1775903] Fri, 10 November 2017 15:47 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen BlackwellFriend
Messages: 118
Registered: March 2014
Senior Member
Is this what you are looking for?

https://wiki.eclipse.org/Papyrus/Codegen/CppHelloWorld#Add_The_Code

Steve

Re: Imported C++ registered package [message #1776534 is a reply to message #1776040] Fri, 17 November 2017 11:53 Go to previous messageGo to next message
Sekwon Jang is currently offline Sekwon JangFriend
Messages: 10
Registered: November 2017
Junior Member
I have found the way to std::string as variable type of class attribute.
I applied AttributeProperties to the variable of a class and set std::string to type:String of AttributeProperties.
I don't have any problem until now.
Is it correct to use std::string like this?
Re: Imported C++ registered package [message #1776767 is a reply to message #1776534] Tue, 21 November 2017 12:36 Go to previous message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 159
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi,

AttributeProperties is a stereotype of the Papyrus-RT C++ profile and is taken into account by the Papyrus-RT code generator. The use of the STL model library (coming with Papyrus-SW designer) in Papyrus-RT has not been intended, but seems to be ok - if you apply the additional stereotype.

If you use the code generation from Papyrus SW designer, you just type your class attribute with "string" from the STL model library, i.e. you don't need this stereotype.

Ansgar
Previous Topic:Unable to Java round-trip
Next Topic:Understanding the Architecture Framework
Goto Forum:
  


Current Time: Wed Sep 26 00:27:40 GMT 2018

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

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

Back to the top