Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Papyrus for Real Time » Protocol function (operation) input parameter type issue(How to assign const char* to operation input paramter)
Protocol function (operation) input parameter type issue [message #1781651] Sat, 10 February 2018 19:14 Go to next message
Md. Abu Faisal is currently offline Md. Abu FaisalFriend
Messages: 3
Registered: January 2018
Junior Member
Hi
I am facing an issue while defining a protocol function (operation) input parameter. I want to pass const char* type data but I cannot see how to assign this type to a function parameter, instead there is option to select String type from <<EPackage, Model Library>> PrimitiveTypes.

Can anybody please let me know how may I assign the input parameter of a protocol function (operation) to be of type const char* instead of String?

**Reason behind not using String as type:
I am having a protocol like this
<<Protocol>> TestProtocol
  > in method1 (arg : String)


then in a transition code snippet I have:
const char* s = "test";


but when i am calling
testProt.method1(s).send();
it gives me compilation warning: deprecated conversion from string constant to 'char*'.


Regards.
Faisal
Re: Protocol function (operation) input parameter type issue [message #1781844 is a reply to message #1781651] Tue, 13 February 2018 20:08 Go to previous message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
In Papyrus-RT the code generator uses "char *" for UML Strings, not "const char *".

If you are only getting a warning, it's not a problem.

If you are getting a compilation error, then try declaring your string as a "char *" instead of a "const char *". If it really needs to be a const char *, you need to do an explicit cast, or manually copy the data, or any other typical C/C++ solutions to this.
Previous Topic:Error while performing start-up tasks
Next Topic:strings as message parameters?
Goto Forum:
  


Current Time: Thu Apr 25 21:00:26 GMT 2024

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

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

Back to the top