Book a Demo

Author Topic: Class relations that do not affect code generation  (Read 2538 times)

Asperamanca

  • EA User
  • **
  • Posts: 91
  • Karma: +0/-0
    • View Profile
Class relations that do not affect code generation
« on: April 27, 2011, 10:09:22 pm »
EA 8.0

I would like to see certain relationships in a class diagram that do not affect code generation.

e.g. I would like to have a "DerivedClass" show a Generalization relationship to "BaseTemplateClass".
Because "BaseTemplateClass" is a template class, generating code like

class DerivedClass : public BaseTemplateClass

will not do what I need. Instead I would need, e.g.

class DerivedClass : public BaseTemplateClass<float>

I could achieve the correct code generation by setting the parent of DerivedClass to "BaseTemplateClass<float>", but I would lose the visible connector in the diagram.

I know it's an ugly solution, but I would like to have connectors that do not in any way affect code generation, so I can achieve both a correct diagram and correct generated code.

Is that possible?

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Class relations that do not affect code genera
« Reply #1 on: April 28, 2011, 08:06:47 am »
Why not model the base class on your diagram as a template class? Not entirely sure in C++ code generator is perfect for template classes and you may need to experiment a little.

The settings for template classes are on the details tab class properties. (Select Parameterised for the Type drop down)

Cheers

Phil
Models are great!
Correct models are even greater!

Asperamanca

  • EA User
  • **
  • Posts: 91
  • Karma: +0/-0
    • View Profile
Re: Class relations that do not affect code genera
« Reply #2 on: April 28, 2011, 05:31:29 pm »
Phil,

I've been doing that, but have so far found no clean way to define the template parameters in such a way they both look correct in the diagram and source code.

(see also: http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1303832304)

It would just feel good to know a fallback strategy if the things I have in mind aren't workable in EA 8.