Sparx Systems Forum

Enterprise Architect => Uml Process => Topic started by: WhiteWinter on March 15, 2014, 04:12:55 am

Title: SD: Code generation: Call constructor for member
Post by: WhiteWinter on March 15, 2014, 04:12:55 am
Hey guys,

i generate C++ code from the sequence diagram (=interaction diagram).
My goal is to call the constructor for a private member of a class.

For example: The class Foo has a private member m_bar of the type Bar, then I expect this code line for the constructor call.

Code: [Select]
*m_bar = new Bar();
In the sequence i draw a message line from :Foo to m_bar:Bar, leave the message field empty and set the lifecycle field to New.

Now in the generated code i got this:
Code: [Select]
Bar* m_bar = new Bar();
But i don't want a new local variable.

How do i fix this - any hints?

WhiteWinter

Title: Re: SD: Code generation: Call constructor for memb
Post by: Nizam Mohamed on March 15, 2014, 04:50:54 pm
This comes from the "Action Create" template. If you don't want this to be rendered, just remove the contents from the C++ "Action Create" template  (Tools -> Source Code GEneration Templates)

NB - you can always say "Get Default Template" to revert it