Sparx Systems Forum

Enterprise Architect => Uml Process => Topic started by: kalpesh on April 16, 2010, 02:29:51 pm

Title: Main() or Wraper code of Enterprise architect
Post by: kalpesh on April 16, 2010, 02:29:51 pm
I am trying to generate code in C++.
For class I am able to get .h and .c files.
But How enterprise Architect provide main for initialisation?
Or we need to write our main as our own?
Title: Re: Main() or Wraper code of Enterprise architect
Post by: Nizam Mohamed on April 16, 2010, 02:52:50 pm
Kalpesh, if you are the same person who initiated
this (http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1271053624)  discussion ..

people seem to have replied and are awaiting your feedback!

W.r.t code generation from classes, EA does not generate an application, rather it just renders what you've modeled, so no wrapper or main is generated unless you have a method called main and some code to be rendered within.

or, you can edit the  code generation templates (http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/overridingdefaulttemplates.html) to generate it automatically.
Title: Re: Main() or Wraper code of Enterprise architect
Post by: Makulik on April 16, 2010, 08:05:46 pm
Just an additional note about C++ and main. Usually my implementations of main for C++ don't exceed more than 10(!) lines of code. It should be almost nothing in there. I'll give an example:

Code: [Select]
int main(int argc, char** argv)
{

      ConfigServiceOpts opts;
      if(opts.scanOpts(argc,argv))
      {
            ConfigService configService(opts);
            configService.run();
      }
      return 0;
}


Just another 0.02 EUR upon this topic.

WBR
g.