Skip to main content



      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 05:37 Go to next message
Eclipse UserFriend
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 09:45 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: add C++ #include <> headers to state model in Papyrus [message #1746293 is a reply to message #1746292] Wed, 26 October 2016 10:03 Go to previous messageGo to next message
Eclipse UserFriend
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 06:26 Go to previous messageGo to next message
Eclipse UserFriend
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 06:14 Go to previous message
Eclipse UserFriend
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: Sat May 24 19:56:26 EDT 2025

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

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

Back to the top