Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: aram on May 30, 2006, 12:50:25 am
-
The C++ code generation template introduces simple errors when generating the code. For association classes it generates a pointer variable however in the getters and setters it uses this variable as an value object.
I've tried to modify the template but I got stuck in the following lines:
%if opCode != ""%
%WRAP_LINES(opCode, "-1", "\t", "")%
This opCode produces the getter/setter method implementation. However it is not explained anywhere how is opCode constructed and how could one modify it.
-
I'm not very much in C++ but I can't recall any opCode macro. Can you point out in which template you found this. I just browsed through them but could not find it.
-
its in the C++ Language Operation Body template.
I've tried to remove the lines
%if opCode != ""%
%WRAP_LINES(opCode, "-1", "\t", "")%
then i don't get any getter/setter implementation which means that the whole thing is being done exactly in the opCode macro.
thnx.
-
Now this is funny. The help file does not explain opCode while (almost?) all other op* macros are explained. Search the help for "opBehaviour" and you will see the list - except opCode. Sparxian, could you pls. fix that...
However, I remember now that this will return the contents of the "Initial Code:" frame which you will find in Properties/Behaviour of an operation.
-
So what should I do to have
*variable = newVal
instead of the currently generated
variable = newVal
-
You likely have to look into the Attribute Declaration macro. There's a place where "By Reference" is used. This is just a shot in the dark. Maybe someone else has better advice :-/
-
Shortly after the code that you've removed there is the following that generates the code you're interested in.
%elseIf opStereotype == "property set" and opTag:"attribute_name" != ""%
\t%opTag:"attribute_name"% = newVal;
If you're removing the first clause of the if-else, make sure you change the next elseIf to an if.
-
The opCode macro is documented in the help file for 791.
-
:)