Author Topic: where is main?  (Read 4764 times)

kalpesh

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
where is main?
« on: April 12, 2010, 04:27:03 pm »
1. Where is main provided by enterprise architect while code generation?

2. Can anyone tell me how to create object of predefined class?

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: where is main?
« Reply #1 on: April 13, 2010, 02:03:11 am »
Quote
1. Where is main provided by enterprise architect while code generation?
Whereever you put it (global namespace of course), if you need to do so. what language are u using? I guess C, C++
or C# ...

Quote
2. Can anyone tell me how to create object of predefined class?
I don't understand this question. what's a predefined class? did you mean how to create a classes' instance on a behavioral diagram?? simply drag the class from project tree view to the diagram and choose 'create instance' instead of 'simple link'.

HTH
g.

beginner

  • Guest
Re: where is main?
« Reply #2 on: April 13, 2010, 04:24:50 am »
Quote
1. Where is main provided by enterprise architect while code generation?

2. Can anyone tell me how to create object of predefined class?
1. Why can't you write question one can understand?

2. Why not read the manual and point out the part you did not understand?

b.

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: where is main?
« Reply #3 on: April 13, 2010, 09:20:03 am »
Quote
1. Why can't you write question one can understand?

@Beginner,
How is that helpful? You may ask for clarification by all means, but let's try to be a little less condescending. This is a user forum, not the "room for abuse".

@kalpesh
To answer part of your question: EA only generates methods that you have specified in your object model. If you want a main method, then you will need to explicitly add one to a class, or modify a code generation template to add one if a class has a particular stereotype.

For instances of classes (objects) on diagrams see Makulik's post. If you want to prototype an instance of a particular class you can use the Object Workbench (see http://www.sparxsystems.com/uml_tool_guide/visual_execution_analyzer/the_workbench.html)
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: where is main?
« Reply #4 on: April 13, 2010, 04:36:38 pm »
Quote
2. Can anyone tell me how to create object of predefined class?

Since this question has been posted in the Automation Interface, Add-Ins and Tools section I assume you want to know how to create an object (instance) of a class through the API?

To do so you need to
- select the location you want the object to be stored (e.g. a package)
- Add a new element to Elements collection of that location (package.Elements.AddNew()) with type = "Object"
- Set the ClassifierID of the new element to the ElementID of the existing class
- Update the new element.

Geert

beginner

  • Guest
Re: where is main?
« Reply #5 on: April 13, 2010, 08:44:32 pm »
Quote
@Beginner,
How is that helpful? You may ask for clarification by all means, but let's try to be a little less condescending. This is a user forum, not the "room for abuse".
Which shouldn't hinder those writing a question to be a bit more elaborate. There are so many threads discussing about what the poster could have meant with his question. Sometimes these discussions are funny and/or fruitful. Sometimes they aren't. Look at this question #2. Where, which under what circumstances for what reason? Adding one or two more sentences to formulate a more clear question would help the poster and those answering.

b.

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: where is main?
« Reply #6 on: April 13, 2010, 10:51:25 pm »
I would be interested in a note from  kalpesh about all that. If we guessed the right things about his questions, what he understood from our answers, a.s.o.

I agree with michael that, if nothing helpful could be said, we should avoid writing anything (that principle was already mentioned recently elswhere by geert if I remember correctly).

I my younger years I've been trying to help moderating the german ISO C++ usenet group. about 70% of questions asked there had nothing to do with ISO C++ or STL, but where OS specific (mostly by the windows developers). There was a FAQ covering these topics (what exactly is discussed in the forum), and where to find information about the topics frequently asked but not covered or wanted there.
There was a standard reply and also the thread title was marked appropriately, when the topic wasn't relevant.

just my 0.02 EUR
g.
« Last Edit: April 13, 2010, 10:52:37 pm by Makulik »