Author Topic: Extending EA templates to generate code  (Read 4365 times)

gfsergio

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Extending EA templates to generate code
« on: September 02, 2004, 10:37:16 am »
Hi,

we are interested to extend the EA templates in order to generate code in the style of C++.  In particular, we are going to extend the existing EA templates for C++, in order to generate code also from UML elements such as ports, parts, state machines and so on.

So, we would like to know if it is possible, by means of the EA templates mechanism, to determine these kind of  information from the UML models.

Many thanks, in advance.

Sergio

Gary W.

  • EA User
  • **
  • Posts: 139
  • Karma: +0/-0
    • View Profile
Re: Extending EA templates to generate code
« Reply #1 on: September 03, 2004, 10:50:29 am »
Hi,

I have no answer to this, but I wanted to point out to the general EA community that this functionality is desired by many.

One of my clients chose Objecteering over EA, because the former can define profiles with user-defined extensions, which is what my client wants to do (e.g. to enforce standards, or to generate spatially aware DB object definitions).

If this is planned for the future, it would be good for someone at EA to confirm this, so I can pass along this my   client.

Gary

benc

  • EA Administrator
  • EA User
  • *****
  • Posts: 200
  • Karma: +0/-0
    • View Profile
Re: Extending EA templates to generate code
« Reply #2 on: September 05, 2004, 06:12:57 pm »
Hi Sergio and Gary,

Currently EA's code template framework does not directly support generation of ports and parts. We are aware of this limitation however, and will be adding this functionality to the code template framework. One possibility that may interest you for now- you can make a call to an add-in function from within the code templates. For example you could provide an add-in with the details of the class currently being generated and have the add-in deal with generation of the ports and parts- then pass this back to your code template. I have used this approach in the past to overcome certain limitations in the code template framework.

This involves use of some undocumented features,  but you can check this related thread:
http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.cgi?board=general;action=display;num=1088595585;start=3#3


Basically your class body code template might contain something like :

$result = %EXEC_ADD_IN("MyAddIn","MyFunctionToGeneratePorts",classGUID)%

Your addin function would be dealing with the Element.EmbeddedElements collection. (Note we will be adding "Part" as a member types for this collection in EA 737)

As regards code generation of state machines and other behavioural aspects of the UML model, we are currently doing some preliminary development in this area and plan to support this in future. However, this functionality won't be available in the short term.

Gary, in response to your note : EA does have a useful profile mechanism which can be used in conjunction with code templates. (Tagged values and stereotypes provide the primary extension mechanism for profiles and code gen). If you care to elaborate further on the your specific needs, that would be great. We always appreciate the feedback and try to respond as best we can :)

I hope this is of some help.

Regards,
Ben