Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: DanG83616 on July 16, 2008, 08:56:54 am

Title: Pointers on creating transform templates
Post by: DanG83616 on July 16, 2008, 08:56:54 am
Hi,
Is there a white paper or perpahs a helpful thread of discussion for writing transform templates? I want to transform the model I've created that defines component subassemblies into code. I think I need to transform components to classes and then generate code from there. I'm not having luck with getting elemType == Component -> Class to work right (at all). Any pointers?

I've been messing with the default templates (C++) but no luck.

Thanks,
Dan
Title: Re: Pointers on creating transform templates
Post by: Eve on July 17, 2008, 08:24:40 am
For starters, if you're working with default templates for C++, you're looking at code templates, not transform templates.

To make a transform that converts components to classes, change the class template to the following.

Code: [Select]
%if elemType == "Component"%
Class
%else%
%elemType%
%endIf%
{
  %TRANSFORM_REFERENCE("Class")%
  %TRANSFORM_CURRENT()%
%list="ClassParameter" @separator="\n" @indent="    "%
%list="ClassBase" @separator="\n" @indent="  "%
%list="ClassInterface" @separator="\n" @indent="  "%
%list="InnerClass" @separator="\n" @indent="  "%
%list="Attribute" @separator="\n" @indent="  "%
%list="Operation" @separator="\n" @indent="  "%
}
%list="Connector" @separator="\n"%
Title: Re: Pointers on creating transform templates
Post by: DanG83616 on July 17, 2008, 09:28:25 am
That got me rolling. It turns out I was using the transform templates but I had created one called "C++" in keeping with the examples (C#, etc). It probably would be better to name it something different.

Next, I've been using InformationFlow to depict "wires" between components (Com1,port1 to Comp2, portN). The transform gave me an error and I see that InformationFlow is not one of the supported connectors. Any suggestions?

Thanks,
Dan
Title: Re: Pointers on creating transform templates
Post by: Eve on July 18, 2008, 08:30:23 am
They should be supported, so send in a bug report and we'll get it fixed.
Title: Re: Pointers on creating transform templates
Post by: DanG83616 on July 19, 2008, 01:36:07 am
I submitted a bug report and also have a work around. Directed associations are supported and should suffice for my purpose. InformationFlow was an intuitive connector for the context but its special features are not really necessary for modeling a trace between component ports.

Thanks,
Dan