Book a Demo

Author Topic: C++ code generation.. what is OperationBody?  (Read 4878 times)

stephane

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
C++ code generation.. what is OperationBody?
« on: June 03, 2004, 12:39:05 am »
Hi,
I just started to create a class in EA and generated
C++ code.. so far all is OK. (cpp and h are created)

Now my question:
is it possible to generate also the body of a function?

Example I would like to have the following code generated:
class MyTest {
private:
 int counter;
public:
 int getCounterIncr() {
          counter++;
          return counter;};
};

I didnt find where to place the
          {
          counter++;
          return counter;
           }
body.

I tried write this code in the "behaviour" edit box,
but then the generated code is commented out .
:(

So I looked in the onlinehelp found that there exist
templates, that you can do lots of things
and saw the macro substitutions:
"OperationImpl" "OperationBodyImpl" and others.

.. but I didn't find a dialog where I can type in that stuff.

Does somebody know if its possible at all (if its a real
feature or a missing feature or a bug)??

Thanks

Stephane

Tjerk

  • EA User
  • **
  • Posts: 231
  • Karma: +1/-0
    • View Profile
Re: C++ code generation.. what is OperationBody?
« Reply #1 on: June 03, 2004, 01:20:58 am »
You might wanna try filling in the behaviour tab that is found in the operation window (press F10 when you've selected a class in a diagram or in the projectbrowser).

Tjerk

stephane

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: C++ code generation.. what is OperationBody?
« Reply #2 on: June 03, 2004, 04:24:37 am »
.. its exactly what I already tried,

the problem is that the inserted code is
"out-commented":
all lines starts with "//"

thomaskilian

  • Guest
Re: C++ code generation.. what is OperationBody?
« Reply #3 on: June 03, 2004, 06:17:15 am »
Maybe you should try the source code window to enter the code. Was it that simple ???

stephane

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: C++ code generation.. what is OperationBody?
« Reply #4 on: June 03, 2004, 07:45:11 am »
oh no... thanks a lot  :D

I simply didn't find it and the online help
"code generation" part doesnt mention the
"source code windowr".

Anyway I would like a more detailed help
(simply still don't know what OperationBody body
is or where the corresponding dialog-mask is)

But again THANKS  ;D

oops forgot one thing...there is still a small problem which remains:
if I regenerate the files, my function body will be gone, hmm.
For now I will use the source code window and I suppose i
have to be very carefully to make changes only in the sourcefile and resynchronise every time, even if  it's not
the perfect solution .
Maybe somebody from Spark has an idea for a future
enhancement in this direction.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C++ code generation.. what is OperationBody?
« Reply #5 on: June 03, 2004, 07:10:30 pm »
Hi,

EA isn't meant to generate method code, but if you really want to make it do that, you could use the operation behaviour field and just change the operation body code generation template so that it doesn't add the comment lines.

Mind you the prefered solution would be to have you text in the code, use "synchronise" rather than "generate" and EA will leave that code alone.

Simon

stephane

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: C++ code generation.. what is OperationBody?
« Reply #6 on: June 04, 2004, 01:52:24 am »
I will try it. EA is a nice tool for a fair price.

The greatest weaknes of EA (I think) are:

- documentation (mostly a dialog image with some line
 of text)
  or things like OperationBody or OperationBodyImpl
  not commented (yes they are mentioned but thats all)
  and I still do not know what they really mean or how
  they work.

- lots of dialogs popping up/too much clicks:
 Example: I would like to edit the names of the  
 attributes/functions directly in the class graphical representation (like argouml), instead of
 - double click the class
 - click on detail tab
 - click on attributes
  (we could call it to deeply nested functionality, but
  OK you have a lot of funcs so it may be complicated,
  but for editing the methods and attributes this would
   be nice)

- The source code editor (specially for me now)
 could have more functionality:
 - warn me if a file has been modified by another tool
 -  allow switching between *.h and *.cpp file
     important if I work in C++ (for java and other languages
 which have no heder files this might be OK)
 - would be nice: support ctrl+insert and shift+insert
   in addition to ctrl+c and ctrl+v
 - or the ability to use embed another editor:
    did you look at www.scintilla.org?
   Is use Scite.exe editor which is built upon it, and
   is small, fast and powerful (including code folding)
   The PythonWin python IDE use it. :-) really nice.



... but perhaps MDG Link for Visual Studio.NET
is a solution (hope it will be part of EA without the
need to purchase it, so it would replace the source editor)

Barry_Pearce

  • EA User
  • **
  • Posts: 70
  • Karma: +0/-0
    • View Profile
Re: C++ code generation.. what is OperationBody?
« Reply #7 on: June 24, 2004, 03:19:47 pm »
Couple of points.

The code generation templates are adequately explained in the help - but I recommend d/l the PDF user guide - the section in there and some time & effort to understand how codegen works will mean all becomes clear....

To make life easy place a comment at the start of each template...this will be codegen'd into your code and you can see the templates in action very clearly then...

---

With regard to editors, in 'tools | options' under  'Generation |- Code Editors' you can plough in your favourite editor so that when you press CTRL-E it opens up the source file (header only)....it is a failing of EA that it does not yet support opening the source body  - fingers crossed for 730 :)