Book a Demo

Author Topic: attType = common type ?  (Read 2783 times)

pocketom

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
attType = common type ?
« on: April 01, 2010, 04:28:40 am »
I just tried to setup my own PIM language.

1. I added a new product(which seems to mean "Language") called "PIM" in Settings / Code Datatypes ...
2. I added some basic Datatypes, most of the "Common Type" I set to the common types I found defined for other languages
3. I do a model transformation to C# using the following intermediary code:
Code: [Select]
Attribute
{
  %TRANSFORM_REFERENCE()%
  %TRANSFORM_CURRENT("scope","type","stereotype")%
  scope=%qt%%attScope == "Public" ? "Private" : value%%qt%
  type=%qt%%CONVERT_TYPE("C#",attType)%%qt%
  
  %if classStereotype=="enumeration"%
      stereotype="enum"
  %else%
      stereotype=%qt%%attStereotype%%qt%
  %endIf%
}

This works for the types like Integer, Float,... But I recognized that it doesn't work for my "Identifier" (common type "Guid") datatype. So I tried a bit and found out that the same works for a PIM's "Foo" (common type "String", resulting correctly in "string" in C#), but if I change the common type to "StringX" (for both my PIM and C# data types of course), it doesn't work anymore...
But both have the same common type? Are the 'real' common types defined somewhere else?

What I want to achieve finally is simple:

Lang      Datatype      Common Type
PIM        Identifier      GUID
C#         Guid             GUID

In this case (PIM->C#), nothing is transformed, I get "Identifier" copied instead of getting "Guid" as the result...  :-/

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: attType = common type ?
« Reply #1 on: April 06, 2010, 08:23:39 am »
The convert type macro converts from the common type to the language type, not the other way around.  It should convert GUID -> Identifier or GUID -> Guid.

pocketom

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: attType = common type ?
« Reply #2 on: April 06, 2010, 11:48:30 pm »
Ok, so I guess the conclusion is to work only with common types when defining classes in the PIM model right?

But what I don't understand is how to convert from one language to another? In a specific language you use specific types that need to be converted to other specific types of the target language. Is there another convert command for this case?

Thanks!