Generating UML from C++ code?
Here are a few options:
Step-by-Step Guide to Reverse Engineering Code into UML Diagrams with Microsoft Visio 2000 - http://msdn.microsoft.com/en-us/library/aa140255(office.10).aspx
BoUML - http://bouml.fr/features.html
StarUML - http://staruml.sourceforge.net/en/
Reverse engineering of the UML class diagram from C++ code in presence of weakly typed containers (2001) - http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.27.9064
Umbrello UML Modeller - http://uml.sourceforge.net/
A list of other tools to look at - http://plg.uwaterloo.ca/~migod/uml.html
how to generate UML class diagram from C++
Some remarks :
- cat and dog are C++ struct => their members are public, not private
- you missed to indicate the types of name, id, owner and age
- you used associations navigable in the two directions, but a cat and a dog do not know the corresponding Pet
- the association end must be named (cats / dogs), and it is useless to also show them through attributes
So, also adding the modifiers I speak about in the comments of your question :
(I use cat/dog rather than Cat/Dog to follow the C++ code, but to use Cat/Dog is better)
Automatically generate a uml diagram of my c++ code
Do you know about Doxygen and its many options?
In fact, Google's number two hit for Doxygen and UML is this previous StackOverflow question.
UML Diagrams with C
Yes, you can use UML to describe programs in any language.
When an object (structure, w/e ) has it's lifecycle tight coupled with another object is Composition , not Aggregation
What you described is neither Composition nor Aggregation. The lifecycle of a particular structure/buffer that's only valid through a certain code segment can be better represented through a Sequence diagram (get buffer , release buffer calls should be shown in the diagram)
You will have allot of Composition and Aggregation in C. Think about POD structs. Some of them reference other POD structs inside them. If the reference comes with memory ownership it's Composition (eg :pointer which needs to be released). If the reference doesn't come with memory ownership it's Aggregation (eg : pointer which you don't have to release when releasing the structure).
How can I generate UML class diagrams from C++ source files?
For parsing C++ code, the best tool I have used is BoUML. It is not perfect, and it won't generate the diagrams for you, but it does understand the relationships. If you pull two classes into a class diagram, it will automatically draw the relationships, and it allows you to grow the diagram by selecting a particular class and having the tool bring up related classes (both classes that depend on the selected one and classes that the selected one depends on).
How can I automatically generate UML diagrams from Objective-C code?
Have a look at doxygen. Which seem to have support for Objective-C. It might not give you an UML diagram but it is able to show references etc in graphs and with added comments you can give more information for the formatted output.
See here for an example in Objective-C, the clang project (oups, clang is actually written in C++ and works on Objective-C code) But I found this blog post about using doxygen for Objective-C code
Visual Studio - Generate UML from a c++ project
Visual Studio has the build-in UML generator.
On Visual Studio project, select Class View
, right click on the namespace, select View Class Diagram
. It may take a while to generate UML diagrams if your project is big.
Hope this helps.
Visual Studio 2015 generate UML from code
In solution explorer right click and:
add > item.. > General > class diagram
Then you can fairly easy make a domain model by dragging entity classes in and right click on a few properties and choose: "Show as association"
Eclipse plugin for generating UML diagram from c++ code
From the list of UML tools, I only see commercial UML editors (with C++ as one of the language reverse engineered), like:
- Enterprise Architect
- Magic Draw
- Modelio
In other word, I don't know of a open-source project offering C++ reverse engineered UML diagrams.
nrs mentions in the comments, from the Modelio Wikipedia entry:
The core Modelio software was released under the GPLv3 on October 5, 2011.
Key APIs are licensed under the more permissive Apache License 2.0.
Note: it is a standalone app (based on Eclipse RCP), which cannot be added directly in your IDE Eclipse.
Eclipse as a plugin.
Related Topics
How to Export Templated Classes from a Dll Without Explicit Specification
A Fast Method to Round a Double to a 32-Bit Int Explained
What Is the Fastest Way to Change a Key of an Element Inside Std::Map
Reduce Flicker with Gdi+ and C++
How to Update a Printed Message in Terminal Without Reprinting
How to Read Groups of Integers from a File, Line by Line in C++
How to Correctly Initialize Member Variable of Template Type
Using Export Keyword with Templates
Why Is It Not Possible to Overload Class Templates
Conditional Operator Used in Cout Statement
What Does "Memory Allocated at Compile Time" Really Mean
Osx - Replace Gcc Version 4.2.1 with 4.9 Installed via Homebrew
Netbeans 7.2 Shows "Unable to Resolve Identifier" , Although Build Is Successful
Get the Status of a Std::Future