Book a Demo

Author Topic: Import section generation issue(MDG/Own Language)  (Read 3488 times)

Sébastien P

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Import section generation issue(MDG/Own Language)
« on: June 24, 2011, 08:01:16 pm »
Hi,

I would like to use the code generation with a customized C++ language.
So I created a new language included in a MDG technology.

The customization of C++ Code Template with specific naming rules is not easy but it is working, except Import Section in header and implement file.

For default C++ I get generation of dependencies in header file from Class diagram, and also dependencies and namespaces in implement file.
However for my custom language I can't get any include files or namespaces, even if I add manually include data in Imports or Headers Code Gen dialog.

It seems Field Substitution Macros %fileImports% and %fileHeaders% in Code Generation Template are not supported in my custom language.

Does anyone already get this issue?

Sébastien


Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Import section generation issue(MDG/Own Langua
« Reply #1 on: June 27, 2011, 08:49:19 am »
Use a list over import templates.

Sébastien P

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Import section generation issue(MDG/Own Langua
« Reply #2 on: June 27, 2011, 11:40:01 pm »
Simon,

By default for c++ code generation, in the "Import Section" template there is no list.

Only the field substitution macro %fileImport% is used, as shown in the following piece of code:

$COMMENT="WARNING: THIS IS AN ADVANCED TEMPLATE"
$COMMENT="DO NOT MODIFY UNLESS YOU ARE AN"
$COMMENT="ADVANCED USER!"
%fileImports%

Even if I would use a list, I don't really see a list of what I need to do.

I would like to use the field substitution macro %fileImport% in my custom C++, as it works in the default C++ language. Why it is not working in my custom language?

Here is the extract of the definition of fileImports:
Code Gen dialog: Imports. For supported languages this  also includes dependencies derived from associations.

As said in the help there is 2 contents:
- the static content of Code Gen dialog -> Imports.
- the dynamic content from associations

As a first exercise, I would like to be able to retrieve in my generate source code the static content I wrote in Imports dialog of my class from the class diagram.
 
The field substitution macro is not specific to the default C++ language. That should works in every others languages (custom or not), isn't it?

Sebastien

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Import section generation issue(MDG/Own Langua
« Reply #3 on: June 28, 2011, 08:37:57 am »
PHP uses the list.

Sébastien P

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Import section generation issue(MDG/Own Langua
« Reply #4 on: June 29, 2011, 12:48:40 am »
Ok I succeeded to retrieve my static "include" file and dynamic dependency files with the piece of code from PHP.

I'm preempted by more urgent works, so I didn't take the time to well format my generated code but I believe it's Ok.

Thanks Simon