Book a Demo

Author Topic: SD: Code generation: Call constructor for member  (Read 12892 times)

WhiteWinter

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
SD: Code generation: Call constructor for member
« 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


Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: SD: Code generation: Call constructor for memb
« Reply #1 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