Protocol function (operation) input parameter type issue [message #1781651] |
Sat, 10 February 2018 14:14  |
Eclipse User |
|
|
|
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:
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 15:08  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.02217 seconds