Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a state diagram in doxygen?

Tags:

c++

doxygen

Using doxygen I would like to produce state diagrams somehow. Are there any tricks in doxygen to help us achieve that?

Currently I am just using the pre-formatted text and then adding my own "free-text-diagram" which is hard to maintain and time-consuming to draw out.

I use all of the other diagrams produced by doxygen (i.e. inheritance, relations, etc...) but since state machines are not a "standard" c/c++ construct (i.e. eech designer can implemente them differently) I guess there is no automatic way to tell doxygen to do this for you. But is there some sort of creation of diagram elements that you can comment in next to each state? Maybe somthing like this crude example:

\section state Diagram
... description

\state state1...
\value1 returns state2
\value2 returns state1
int myState1Handler(){...}

\state state2...
\value1 returns state1
\value2 returns state2
int myState2Handler(){...}

EDIT 1:

Or, is it possible to use the graphviz markup language as suggested in the comments below and integrate them with the doxygen output somehow?

like image 428
code_fodder Avatar asked Oct 15 '13 06:10

code_fodder


People also ask

How do you make a graph on Doxygen?

If you have the "dot" tool in the path, you can set HAVE_DOT to YES in the configuration file to let doxygen use it. Doxygen uses the "dot" tool to generate the following graphs: A graphical representation of the class hierarchy will be drawn, along with the textual one.

How do you create a class diagram in Doxygen?

If you use the Doxygen GUI frontend tool you will find the relevant options in Step2: -> Wizard tab -> Diagrams . The DOT relation options are under the Expert Tab. You will be able to navigate the whole hierarchy, the limits are on what is displayed on a diagram.

What is Doxygen DOT?

Doxygen tag @dot allows for embedding the DOT graph definition directly into your documentation. The nodes of the graph can be made hyperlinks as it is demonstrated in the sample project. Doxygen itself uses DOT graphs to generate the class inheritance and call graph diagrams.


1 Answers

Doxygen (at least the latest version) provides the \dotfile and \dot special commands to insert arbitrary .dot files or inline dot graph descriptions to be rendered with graphviz to the generated documentation.

You might also consider to manage your state machines (by modelling, visual representation and code generation) using a tool like e.g. SMC.

like image 164
πάντα ῥεῖ Avatar answered Sep 28 '22 22:09

πάντα ῥεῖ