Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » add C++ #include <> headers to state model in Papyrus(How can I add the headers to my state machine diagram)
add C++ #include <> headers to state model in Papyrus [message #1746207] Tue, 25 October 2016 09:37 Go to next message
Fariba Safari is currently offline Fariba SafariFriend
Messages: 4
Registered: October 2016
Junior Member
Hello,

I have a state machine, that I am trying to generate c++ code from it in Papyrus. I need to include header #include<math.h>, i do not know how can I add this to my model in Papyrus?
I know that in Papyrus RT, we can add them in Profile stereotype of capsule, but I am trying Papyrus UML not Papyrus RT.

Best Regards,
Fariba
Re: add C++ #include <> headers to state model in Papyrus [message #1746292 is a reply to message #1746207] Wed, 26 October 2016 13:45 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 219
Registered: May 2014
Location: Canada
Senior Member

Hi Fariba,

I am not an expert on the Papyrus Designer capabilities, but have you looked at the documentation page for Designer?

There seems to be some solutions described on that page that could help you move forward, e.g., the "External", "ExternLibrary", or "Include" stereotypes.


/Charles Rivet
Re: add C++ #include <> headers to state model in Papyrus [message #1746293 is a reply to message #1746292] Wed, 26 October 2016 14:03 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 246
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi Fariba,

There are two ways to do that with Papyrus SW designer.
(1) Use the C/C++ stereotype "Include". This has an attribute for body and header where you can explicitly add your #include (or other C++ statements).
(2) Declare a package called math (or similar) and apply the "ExternLibrary" stereotype. This stereotype has an attribute denoting the required includes. You can now declare a dependency from your class to this package or classes contained in that package. The latter is useful, if the header file defines several types that can be referenced by the user classes. For instance, in case of the pthread.h, a pre-defined designer model library defines the classes pthread, pthread_cond_t and pthread_mutex_t within a package called pthread.

In general, the 2nd approach is preferable, if some functions are frequently used.

Btw. are you using your own state-machine code generation or the state-machine code generation provided by Papyrus SW designer?
Re: add C++ #include <> headers to state model in Papyrus [message #1746346 is a reply to message #1746293] Thu, 27 October 2016 10:26 Go to previous messageGo to next message
Fariba Safari is currently offline Fariba SafariFriend
Messages: 4
Registered: October 2016
Junior Member
Thanks for your replies, I am using the Papyrus designer not my own code generation.
Re: add C++ #include <> headers to state model in Papyrus [message #1746987 is a reply to message #1746293] Tue, 08 November 2016 11:14 Go to previous message
Fariba Safari is currently offline Fariba SafariFriend
Messages: 4
Registered: October 2016
Junior Member
I tried the second approach with ExternLibrary and it worked! Thank you
Previous Topic:Setting values for stereotype properties typed by profile defined classes
Next Topic:enhancement request - NamedElement names shall be configurable
Goto Forum:
  


Current Time: Mon Aug 03 15:51:19 GMT 2020

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

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

Back to the top