Author Topic: Initializers in C++ generation  (Read 4833 times)

robiwan

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Initializers in C++ generation
« on: February 12, 2007, 01:30:08 am »
I've tried to add constructor initializers for attributes by filling in the "Initial" field, but EA doesn't seem to generate them?

Also, how do I set initial values for superclasses that don't have default constructors? I can't add them in the code since EA deletes them on code generation.

If I add the initializers, then reverse engineer I thought EA might "pick them up", but again regenerating the code removes all initializers... :(

Help?
/R


Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8064
  • Karma: +118/-20
    • View Profile
Re: Initializers in C++ generation
« Reply #1 on: February 12, 2007, 01:05:48 pm »
Have a look at http://www.sparxsystems.com/EAUserGuide/index.html?cpp_conventions.htm.

A search in this forum also gives http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=general;action=display;num=1160867243 which provides some template modifications to do a bit more.

pborcic

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Initializers in C++ generation
« Reply #2 on: October 12, 2007, 12:05:31 pm »
I can live with EA not generating the constructor initializers for attributes, but does it have to erase the contents of the Initial field when you synchronize the model?
Is this a bug? Because it is very annoying.  >:(

robiwan

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Initializers in C++ generation
« Reply #3 on: October 14, 2007, 11:10:28 pm »
Actually if you use the "initializer" tagged value for the class, you can have roundtrip engineering. To "automatically" fill in this value, you can write your initializers in the C++ code and then synchronize the model. I agree that this is not as nice as having the Initial field of the attributes being generated as code, but it is ok.

pborcic

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Initializers in C++ generation
« Reply #4 on: October 15, 2007, 05:31:11 am »
I already use the "initializer" tag for calling base class constructors which works well.
My real complaint is that it wipes out whatever is in the attribute Initial field even though code generation doesn't use it. I just need to use it for documentation purposes for now (it keeps the guys in QA happy  ;) ).
Though it would be nice if it did work, especially for static constants. I wouldn't think it was that difficult. Even Rational Rose can do it (or at least it used to).  ;)

krhohio

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Initializers in C++ generation
« Reply #5 on: September 30, 2021, 11:26:37 am »
I think that the situation with this in 2021 is the same as it was in 2007?