Book a Demo

Author Topic: [inout] C++ References  (Read 6160 times)

CookingFat

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
[inout] C++ References
« on: February 14, 2005, 03:30:05 am »
Hi,

I have a class operation that takes a parameter as an [inout], the model correctly shows the reference but when I do code generation (C++) the parameters are not passed by reference.  

If I select the parameter as fixed the it is correctly marked as const.

Is there something I'm missing?

Thanks

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: [inout] C++ References
« Reply #1 on: February 14, 2005, 06:42:22 pm »
The current code generation templates do not check the Kind or the parameter.  Instead they expect the reference to be put as part of the type. (ie. int* or int&)  We do have a prototype template change that will generate the default C++ reference type (Tools | Options | Generation | C++ Specifications) but these haven't been included with the standard release of EA yet because other areas of code (notably the reverse engineering and the create property dialog) need to be modified to set the parameter kind in the appropriate way.

You can edit the template to generate the way you want.  It should look something like this.  (New bits are in red)

%PI=" "%
%paramFixed=="T" ? "const" : ""%
%paramIsEnum=="T" ? "enum" : "" %
%if paramKind=="inout" or paramKind=="out"%
%if paramTag:"refType" != ""%
$ref = %paramTag:"refType"%
%else%
$ref = %genOptCPPDefaultReferenceType%
%endIf%
%endIf%

%paramType%$ref
%PI=""%
%if paramType != "void"%
%paramName%
%endIf%
%PI=""%
%if paramDefault != "" and paramDefault != "<none>"%
= %paramDefault%
%endIf%


Simon

CookingFat

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: [inout] C++ References
« Reply #2 on: February 14, 2005, 10:22:35 pm »
Okay, thank you for your help.  Do you have any idea when it's likely to be built into EA