Book a Demo

Author Topic: New Template ParameterNotes  (Read 10039 times)

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
New Template ParameterNotes
« on: July 07, 2004, 05:38:52 am »
Hi,

it would be nice to have a Template called

"ParameterNotes" which can be given to the %list% macro.

The ParameterNotes template should know all infos of the parameter dialog.

Here is an example for C++ code generation:

If this ParameterNotes template is defined like this
Code: [Select]
$comment = "@param"
$comment += "[" +  %paramKind% + "] "
$comment += %paramName% + " " + %paramNotes%
WRAP_COMMENT($comment, "80", "", "/// ")


And Operation template is defined like
Code: [Select]
//////////////////////////////////////////////////////////////////
/// %opNotes%
///
%list=ParameterNotes @separator="" @indent=""%  
%OperationDeclaration%
$bodyLoc = %opTag:"bodyLocation"%
%if opTag:"inline" == "true" or $bodyLoc == "header" or $bodyLoc == "classDec"%
%PI="\n"%
%OperationBody%
%endTemplate%


The output will be
Code: [Select]
//////////////////////////////////////////////////////////////////
/// This is the operation description
///
/// @param[in] param1 This ist the Desc of Param1. The exact
/// meaning of this parameter is here not importatant
/// @param[out] error      Tis is the errorcode
void myOperation(int param1, int& error);


would really be nice to have this. And would cause that we renew our license.  ;D OK, I'm sure that we renew our EA license anyway, because EA is the best UML tool i ever have seen.

bye
Andreas
« Last Edit: July 07, 2004, 05:47:09 am by glaubitz »
bye
Andreas

Barry_Pearce

  • EA User
  • **
  • Posts: 70
  • Karma: +0/-0
    • View Profile
Re: New Template ParameterNotes
« Reply #1 on: July 07, 2004, 08:44:09 am »
Bit fickle eh? Anyway...developers shoud be looking in the model for documentation not the source code ;)

Mind you it would be nice.
« Last Edit: July 07, 2004, 08:44:41 am by Barry_Pearce »

AdamHearn

  • EA User
  • **
  • Posts: 58
  • Karma: +0/-0
    • View Profile
Re: New Template ParameterNotes
« Reply #2 on: July 07, 2004, 11:25:57 am »
You can get close with what's there now...

C++ code gen options:
Comment Style: XML.NET
Method notes: In header - I assume ;)

This will provide you with some basic info although the formatting will not be as you desire:
Code: [Select]

     ///
     /// <param name="arg1">This is arg 1 notes</param>
     /// <param name="arg2">This is arg 2 notes</param>
     virtual void MyMethod(byte arg1, unsigned char arg2) =0;

Here's the Javadoc comment style:
Code: [Select]

     /**
      * @param arg1    This is arg 1 notes
      * @param arg2    This is arg 2 notes
      *
      */
virtual void MyMethod(byte arg1, unsigned char arg2) =0;

Barry_Pearce

  • EA User
  • **
  • Posts: 70
  • Karma: +0/-0
    • View Profile
Re: New Template ParameterNotes
« Reply #3 on: July 07, 2004, 03:49:44 pm »
Yeah that stuff already appears from the current CGT as you say...but the problem is the nice semantic information about in/out/in-out (and possibly fixed) have been lost and are not making it into the code.

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: New Template ParameterNotes
« Reply #4 on: July 08, 2004, 01:30:17 am »
Quote
Anyway...developers shoud be looking in the model for documentation not the source code

You're right. However I develop a framework, and the ducumentation for it is generated out of the sourcecode by doxygen. That's the reason why i need the comments in the sourcecode.


I know both sulutions (the JavaDoc and the XML-Style). At the moment I use the JavaDoc-sulution like already discused in

Quote
the problem is the nice semantic information about in/out/in-out (and possibly fixed) have been lost

And the in, out, in-out problem is not fixed at the moment as you see in http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.cgi?board=general;action=display;num=1088595585.
bye
Andreas

Barry_Pearce

  • EA User
  • **
  • Posts: 70
  • Karma: +0/-0
    • View Profile
Re: New Template ParameterNotes
« Reply #5 on: July 08, 2004, 03:34:31 pm »
Incidentally ive recently logged an issue regarding lack of decent return documentation for an operation...which is the last bit of missing info about the method.

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: New Template ParameterNotes
« Reply #6 on: July 08, 2004, 11:37:39 pm »
Don't forget the exceptions ;)
bye
Andreas

Barry_Pearce

  • EA User
  • **
  • Posts: 70
  • Karma: +0/-0
    • View Profile
Re: New Template ParameterNotes
« Reply #7 on: July 13, 2004, 01:08:29 pm »
Wellthats an interesting one as the throw specification is actually done via a tag rather than any direct support....which leaves documentation in a real limbo...

bcgiMJ

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: New Template ParameterNotes
« Reply #8 on: September 18, 2004, 01:28:01 pm »
I've actually gone so far as to change the code generation templates for C++ in a number of ways, but with respect to return values I altered them so that tags of "return const" and "return reference" set to "true" do the obvious things, and checking the "Const" box in the operation dialog makes the operation a const member function, which seems more "correct" to me given how the other check boxes in that section are treated.

It might be nice if the UI allowed for return values from operations to have an associated "Fixed" checkbox and to allow selection of "return by reference" or "return by value" with the latter being the default. Then the tags would not be necessary.

One shortcoming I noticed (and corrected) is that if you mark a parameter to an operation as "inout" or "out" the generated code is still passing by value, not by reference. I changed the code template to pass in a C++ reference if the parameter is not "in".

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: New Template ParameterNotes
« Reply #9 on: September 19, 2004, 06:10:17 pm »
Hi guys,

Just so you know.  Build 737 has the capability to define your own custom templates that will make the ParameterNotes template possible.  The only thing is that it will be Parameter__Notes.

Look at http://www.sparxsystems.com.au/EAUserGuide/customtemplates.htm for more information.

Simon
« Last Edit: September 19, 2004, 06:10:37 pm by simonm »