Any tool which generate C++ code against a design - c++

I have a class diagram , I want that to draw it in some tool which can generate native C++ out of it , I wish to have design first approach to test the various data structures I am designing for my application

A lot of tools can make C++ code out of UML diagrams. Try Software Ideas Modeller for example, it's a great UML tool, and it's free for non-commercial use.
Also, wiki has a list of UML tools. You can sort them by "languages generated" column to check what they do support and chose the one that you will like.

You can also try UMLET for your work.
You can seach mofre on google by typing
related:www.softwareideas.net
related:www.umlet.com
From Tricky Hacker

Related

Software for browsing classes in a C/C++ project

I have seen that some developers have a graphical representation of all their classes in an image file which comes with their project. How can I myself create these graphics?
Basically they show what classes exist in a file and how these files relate to each other.
Thanks
Doxygen allows you to generate interactive class diagrams. Check out this page: http://www.doxygen.nl/manual/diagrams.html how to set it up.
It might be Doxygen, a software that generates documentation with dependancy graphs.
Eclipse has the ability to generate class diagrams and export them as images.
One common tool that allows people to do that fairly easily is Dot, which comes as part of Graphviz. Dot is sort of a markup language describing graphs. You can generate Dot files manually if you like, but there are a lot of code analysis tools that will do the job for you. Doxygen is one.
Another great tool for creating UML class diagrams is Dia.

C++ code to class diagram

Is there is a way I can generate a hierachial class diagram from C++ code. My code is spread over 5 to 6 .cpp files.
I would like to know if there is any free tool for the same.
Regards,
AJ
There's e.g. doxygen
http://www.doxygen.nl/manual/features.html says:
Uses the dot tool of the Graphviz tool kit to generate include dependency graphs, collaboration diagrams, call graphs, directory structure graphs, and graphical class hierarchy graphs.
It creates graphs like
(from http://www.vtk.org/doc/nightly/html/structvtkKdTree_1_1__cellList.html, an example listed on the doxygen site)
Since the question was about class diagrams you might also be interested in the UML_LOOK flag that makes the ouput a bit more uml-like.
Class diagrams are networks, not hierarchies. There a re quite a few tools that can generate them - my favourite is Enterprise Architect, but it isn't free (there is a trial).
Umberello is the Linux application that generate diagram from code.
Doxygen can create class-diagrams. However, I believe these diagrams are only to show the network of classes, they do not list methods and members and such.

C++ code visualization

A sort of follow up/related question to this.
I'm trying to get a grip on a large code base that has hundreds and hundreds of classes and a large inheritance hierarchy. I want to be able to see the "main veins" of the inheritance hierarchy at a glance - not all the "peripheral" classes that only do some very specific / specialized thing. Visual Studio's "View Class Diagram" makes something that looks like a train and its sprawled horizontally across the screen and isn't very organized. You can't grok it easily.
I've just tried doxygen and graphviz but the results are .. somewhat similar to Visual Studio. I'm getting sweet looking call graphs but again too much detail for what I'm trying to get.
I need a quick way to generate the inheritance hierarchy, in some kind of collapsible view.
Why not just do it manually, it is a great learning experience when starting to work with a large code base. I usually just look at what class inherits from what, and what class contain what instances, references or pointers to other classes. Have a piece of paper next to you and get drawing...
Instead of going into the full Class Designer tool, just use the "Class View" or the "Object Browser" in Visual Studio - they present fully collapsible class heirarchies.
A good UML tool should do the trick.
Here is a list of generic UMl tools: http://en.wikipedia.org/wiki/List_of_UML_tools
There are lots out there, all with varying feature sets. Try playing with a few to see if you get the output you desire. If they free ones fail you, you might have to shell out for a good commercial grade UML tool
You can try CppDepend, it doesn't create a class hierarchy like Doxygen does but it can show 'the big picture' for your project, it also shows some code metrics.
I've had most success with valgrind and kcachegrind to do this. You run valgrind against your debugging binary, perform whatever actions your interested in, then import the output into kcachegrind to see everything you'd ever want to know about who called what, how often, and when. Plus, because your doing it dynamically, it catches cases that static analysis likely wont.
I've also had some success using Enterprise Architect's reverse engineering features, although this doesn't end up nearly as nicely (but you get a workable UML model which is nice!).
And finally, a tool called "Understand". This is pretty good at static OO analysis, but I think quite pricey and not that widely used.
Try Source Insight it is possible to configure the depth of the generated graph in this tool.
See also C/C++ call-graph utility for Windows platform
Check out SourceNavigator, it's open source, works on a bunch of platforms and has a Hierarchy Browser, a Class Browser, a Cross-Reference Browser and more that will allow you navigate and understand the code.
I'm using it for some time now especially when I have new code to go through and understand.
For a reasonably priced commercial product, you may want to check out SolidSX from Vizlogix (www.vizlogix.com). (If you are outside of North America, go to SolidSource -- www.solidsourceit.com.)
It generates a radial diagram that can be collapsed and expanded. It also integrates with Visual Studio (both BSC and .NET).
What's your definition of 'main vein'? You either want a graph reducer or skeletizer (you could find or write one and apply it to what Doxygen and the rest produce) or, 'main vein' has something to do with the function of the code and, I don't think an automated tool can help you with that. Unless you can point out to it 'These are the important bits that do input and output, show me only elements that are one or two steps away from the paths between these'. Hum, sounds like a cool tool to write :)
... the inheritance hierarchy, in some kind of collapsible view.
again, a sweet idea for a tool!

Is there a way to automatically generate the data flow diagrams and flowcharts?

I am recently working on some long and obscure codes written by some other smart guys.
I'm thinking of generating the Data Flow Diagrams and the Flowcharts to facilitate my work. Is there any kinds of software that can do this job automatically?
P.S. Most of the codes are in C and Fortran.
Dataflow diagrams are harder because they require most of a compiler front end to derive the basic information needed to draw them. But you can get call and caller graphs as well as some kinds of entity relationship diagrams out of Doxygen with Graphviz.
Also, Graphviz is generally useful for drawing all kinds of graphs with readable layouts from raw data. It is easy to walk a tree structure and output a description in the DOT language for Graphviz to draw, for example.
Set Doxygen up with the right options, and turn it loose on the legacy code and you will get the beginnings of an internals document to help find your way around too.
"Code Visual to Flowchart" from FateSoftware may also obe of help.
You can try code2flow:
https://code2flow.com
It convert your code to Flowchart.
Dia is a program that resembles Microsoft Visio. It isn't as smooth, but it gets the job done. I always use this professionally when Visio isn't available. This is mainly for UML and Flowcharts, exports to png, and vectors, and I think PDF's as well.

flowchart best practices

Could some one point to articles / books on how to create good flow chart diagrams?
BoUML-it's free!
I've used this open source tool for the last 6 months at work to create UML diagrams:
bouml.free.fr/
I've used it on both a Macbook running OS X, as well as Ubuntu Linux on a desktop, both with success. It also does codegen (although I haven't used this feature myself). If you create a diagram from within BoUML, you can right click ->Tools->HTML etc,etc., and it and actually generate the diagram -- this will create a whole tree of html, css, etc., and include a .png file which you can later choose to import into a Word-like document.
If you're new to UML, and would like to explore that route, I suggest UML Distilled by Martin Fowler as a way to quickly ramp up. I still use this as a reference when I'm putting diagrams together and I forget some syntactical detail ;) The nice thing about UML is that most programmers will understand it. If you don't want to buy a book you can, of course, Google 'UML tutorial' and get a slew of free info.
Non-UML:
You can also use open office's draw application to do some simple flow charting. It has some nice non-uml shapes, so if you're not trying to be 'strict' in the sense of conforming to UML, and just want a simple flow chart, that may be a good choice.
Check this one out:
http://drakon-editor.sourceforge.net/DRAKON.pdf
Tutorial here.
Also get a copy of Microsoft Visio.