Book a Demo

Author Topic: using EA code gen with C++Builder6 - any takers?  (Read 3222 times)

donquixote

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
using EA code gen with C++Builder6 - any takers?
« on: January 03, 2006, 09:36:33 pm »
Hi. EA newbie here.

And I'm even newer to the attempt to customize code generation templates.  ???

So I'm wondering if anybody here is successfully using Enterprise Architect code generation with C++Builder6?

I've figured out how to modify the C++ templates so as to generate code, from a class diagram, that is largely compatible with C++Builder, but I'm not sure how to get EA to generate compatible code when it comes to the way Builder represents (i.e., declares) properties.

As Builder users know, a 'property' declaration in Builder requires the extended '__property' keyword, and perhaps a '__published' scope, and may or may not read or write to a data member, has the 'read=' and 'write=' syntax, and depending on how the property is implemented, (usually protected) a get and/or a set method may or may not be necessary.

If anyone has had some success with this, I'd appreciate a little help or advice. Can someone on the list help me figure this out in less than a fortnight?

Thanks.

/ donquixote

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: using EA code gen with C++Builder6 - any taker
« Reply #1 on: January 05, 2006, 07:55:35 pm »
Currently we don't support the C++ Builder extensions to C++ in our code engineering.  That means there will be a bit of work generating the properties, but it's not impossible.  Although I think that until we implement support you won't be able to achieve synchronisation.

EA does handle Delphi properties, and they work in much the same way.  They are modelled in EA by using tagged values with the name "property".  (You need to check Tools | Options | Object | 'Allow Duplicate Tags' in order to see and edit them.)  The first letter of the property corresponds to the scope character, and the rest of it is exactly how it should be generated.

You could do something similar for C++ builder properties, and then call an addin from the templates to actually generate the properties.  (See http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=general;action=display;num=1123859046;start=4#4 for an example of both the addin code and the template)  I recommend looking at how Delphi properties work if you want to try this.

The other alternative that I can see is to model them as either stereotyped attributes or operations.  You can then create a stereotype override so that it generates the correct thing.

A stereotyped attribute would probably be the easiest way to implement this.  Either with a single tagged value for the entire property, or individual tagged values for each part of the property.  (Read accessor, write accessor and any others that are possible)

I hope that this helps.

donquixote

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: using EA code gen with C++Builder6 - any taker
« Reply #2 on: January 05, 2006, 09:05:02 pm »
I'm still a little too green to know exactly what you're talking about, but I appreciate the hints.

Thanks.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: using EA code gen with C++Builder6 - any taker
« Reply #3 on: January 08, 2006, 09:13:18 pm »
Ok.  Let me make it a bit simpler.  (Starting by only giving one option.)

  • Open the Stereotypes dialog (Settings | UML | Stereotypes)
  • Create a stereotype 'property' with Base Class 'Operation'
  • Open the code template editor.  Select C++, and the Attribute Declaration template.
  • Click 'Add New Stereotyped Override'.  With 'Feature' being 'property'.
  • I don't know the exact syntax that you need to use, but set the template to something like the following.
    Code: [Select]
    %PI=" "%
    __property
    %attName%:
    %attType%

    %attTag:"read"?"read=" value%
    %attTag:"write"?"write=" value";

Now, when you can create an attribute in the model with the stereotype "property", give it tagged values "read" and/or "write" and generate.  It should then generate something reasonable.  Just modify my templates to make it work fully.

Hope that helps.

donquixote

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: using EA code gen with C++Builder6 - any taker
« Reply #4 on: January 10, 2006, 12:49:10 am »
This gets me a little closer. Thanks again.

Trash

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
  • 10 equals 2, nothing else...
    • View Profile
Re: using EA code gen with C++Builder6 - any taker
« Reply #5 on: March 15, 2007, 11:50:37 pm »
Is there a solution for this problem?

At my company we have about 300 megabytes of Borland 6 sources with extensive use of the borland macros we would like to backengineer and I've tried the solutions given but nothing seems to work, I just keep getting that annoying little message telling me to create a macro....