Book a Demo

Author Topic: Parametrized class C++  (Read 2723 times)

sergiyn

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Parametrized class C++
« on: August 27, 2003, 02:14:24 pm »
C++ code generation for parametrized class creates .h and .cpp file. .cpp file contains (as usual) implementation of the defined functions which doesn't make any sense in case of a template since it's not linkable... Is there a way to create the implementation in the .h file?

thnx

benc

  • EA Administrator
  • EA User
  • *****
  • Posts: 200
  • Karma: +0/-0
    • View Profile
Re: Parametrized class C++
« Reply #1 on: August 27, 2003, 07:09:29 pm »
Hi sergiyn,

In the current release of EA (618), it's not possible to move the implementation to the .h file.  However, if you have access to the beta version of EA 3.60 (see the Registered Users page), you can specify the template class's functions to be inline.  Set the tagged value "inline" to be "true", for the relevant functions.

This will still create a .cpp (empty), but will place the function body stubs in the class declaration on initial forward generation.

I've only had a quick play around with this using the beta and it seems to do what your after.  If you care to modify the default code generation templates, there are probably simpler ways to achieve this than setting each method to inline in the model... for example using a class-level tagged value and checking this in the code generation templates.

Hope this will prove useful.

Regards,
Ben


sergiyn

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Parametrized class C++
« Reply #2 on: August 28, 2003, 05:27:02 am »
Hi Ben,

thank you very much for the prompt answer.
Unfortunatelly I don't have access to the "Registered Users" area, since I'm evaluating the product...

I guess code generation templates are also part of the new release? Couldn't find them in the EA 3.51.

Regards,
Sergej.

benc

  • EA Administrator
  • EA User
  • *****
  • Posts: 200
  • Karma: +0/-0
    • View Profile
Re: Parametrized class C++
« Reply #3 on: August 28, 2003, 11:03:19 pm »
Hi sergiyn,

That's right.  The code generation templates will be part of the EA 3.60 release- not available in EA 3.51.

Regards,
Ben