Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: kalpesh 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?
-
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# ...
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.
-
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.
-
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)
-
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,
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.
-
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.