Book a Demo

Author Topic: How can I generate class diagrams from the .h?  (Read 18796 times)

waleriadavid

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
How can I generate class diagrams from the .h?
« on: July 18, 2013, 09:45:06 pm »
Hello,

I'm starting use the software Enterprise Architect (EA-UML), and I need to generate a class diagram from ".h".

How can I do this?

Thanks,

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: How can I generate class diagrams from the .h?
« Reply #1 on: July 19, 2013, 12:31:19 am »
Hello,

make sure the the default language is set to C
(Tools, Options, Sorce Code Engineering)
create an empty package:
- Right Click on the package
- Code Engeneering
- Import Source Directory
- Choose File Extens (C,H)
- Select Directory
- OK

EA creates the class(es). Create a diagram and drag the class onto the diagram.

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

waleriadavid

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: How can I generate class diagrams from the .h?
« Reply #2 on: July 19, 2013, 01:56:10 am »
Hi,

I did the following. Created an example of a class diagram, a sequence diagram, a state diagram, the use case.
After I generated the code from the class diagram, in the directory it generated codes C++ Source and .h
Then tried to generate through the ".h" class diagram. I did so:
1- I created a new package and add a new diagram(empty)
2- In Tools -> Source Code Engineering -> Import C++ Files

It imports the classes, but does not generate the diagram

Thanks,

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: How can I generate class diagrams from the .h?
« Reply #3 on: July 19, 2013, 04:45:20 am »
Hi,

the import only creates classes from *.h/*.c files in case of C++/C.

A Diagram is a view of your system at hand. You, the modeler, defines what you want to see and what you want to communicate to your readers. A class is often part of several diagrams, several views.

For example you want to see the context of the class, a diagram. In another view / diagram you want to show the relations of the class. It's a different diagram with the same class but something other around it. In a third diagram you want to show the attributes of the class. This is just a new diagram with the same class and other visibility settings.

So you are the boss of your views. In other words you are the boss of what you want to tell. So it's your task to make some valuable diagrams.

Always keep in mind: If you delete a diagram the model will not change. It might be not understandable but in essence it's the same. A Diagram is simply a view to your model to improve understanding.

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How can I generate class diagrams from the .h?
« Reply #4 on: July 19, 2013, 08:29:56 am »
Was your diagram open when you selected Import C++ Files? If not that may be the reason why nothing was created.

The other option is using the Import Source Directory command. There are options for when to add classes to diagrams using that command. I believe the default is to add to newly created diagrams only, but there are also options for force it to one way or the other.

waleriadavid

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: How can I generate class diagrams from the .h?
« Reply #5 on: July 19, 2013, 11:37:12 pm »
Hello,

I created a simple class generated the code of this class and then created a new project and did the reverse,  I imported the ".h" and I managed to generate the diagram. Just takes a doubt my. It does not matter multiplicities?

Thanks a lot!!!