This website is no longer maintained. Its content may be obsolete. Please visit http://home.cern/ for current CERN information.
Doxygen HOWTO |
Authors: Jakub Moscicki & Max Sang
Home page: www.doxygen.org.
Doxygen can deal with two kinds of doc string: brief and long. For classes and files you want both, but for methods the brief is more useful (in my opinion).
To document a file, put this at the top:
/** * \file Definitions of interfaces IA, IB and IC. */
For documenting a class it's best to have both brief and long comments:
/** * \brief Widget thread monitor (singleton) * * The %MyClass class is a singleton accessed through etc etc... * */ class MyClass {...
For documenting methods in a class use:
/// Number of equivalent bin entries = \f$(\Sigma w)^2/\Sigma w^2\f$ float equivalentEntries(void) const;(note the use of LaTeX in the comments). For longer comments which go onto two lines you need to tell Doxygen explicitly that this is a brief comment, otherwise it will think it's the long one:
/// \brief Probability that this and another histogram come from the same /// parent distribution (uses default HDIFF). float similarityTo(const CHBookHisto& anotherHisto) const;
To put something on the main (front) page, put this somewhere sensible:
/** * \mainpage The Widget Package (part of %Anaphe) * * \section intro Introduction * * This is the introduction. * * etc... */
To prevent a word being linked (e.g. in the CHBook package there is a class called CHBook but when I write "the basic aim of the CHBook package is..." I don't want 'CHBook' to become a link to the class definition) just put % in front of it, like this:
/** * \mainpage The %CHBook package is an object oriented interface to HBOOK. */
Setting GENERATE_TAGFILE in the config file tells doxygen to generate a tagfile in the current directory:
GENERATE_TAGFILE = anaphe.fml.cpp.tagThis tagile (here called anaphe.fml.cpp.tag) is a short description of the symbols defined in the reference manual which doxygen just generated.
To use a tagfile generated by others you set TAGFILES:
TAGFILES = $(ANAPHE_DOC_ROOT)/Interfaces/doc/anaphe.Interfaces.tagIn this case I use the tagfile called anaphe.Interfaces.tag which is located in the directory $(ANAPHE_DOC_ROOT)/Interfaces/doc.
So having the two above settings in my config file I get the following: I generate the tagfile anaphe.fml.cpp.tag for other libs which use my library (FML). I use tagfile anaphe.Interfaces.tag generated by the author of Interfaces package, because I use some classes from that package and I want to cross-link to their description from my reference.
Bacause the documentation is location independant, so are the tagfiles. Tagfile does not say anything where the corresponding reference manual is physically located. This gives a lot of flexibility because you specify this information as a separate step, so you can freely move around pieces of the documentation and easily changed the html references using installdox script. This script is located in the html output directory, usually html subdirectory of the one containing config file (I personally use generated_doc/html so you will see it here):cd generated_doc/html chmod u+x installdox ./installdox -l anaphe.Interfaces.tag@${ANAPHE_WEB_URL}/Interfaces/generated_doc/html *The installdox command above says: make all references (links) to classes from Interfaces package point to ${ANAPHE_WEB_URL}/Interfaces/generated_doc/html (which is the URL of my project).
For the result have a look at: Introduction to FML. External links to Interfaces package are underlined.
Obligatory parts of config file:
# environment variables which must be defined # $(ANAPHE_DOC_ROOT) - the CVS root which is used for documentation PROJECT_NUMBER = "<i>CVS Version Information</i>$Name$$Date$" OUTPUT_DIRECTORY = generated_docVariable ANAPHE_DOC_ROOT should point to the directory (with the same structure as CVS packages directory) where needed tagfiles may be found. Tagfiles should be located in 'doc' subdirectory of the packages (together with config file).
set ANAPHE_WEB_DIR = /afs/cern.ch/sw/lhcxx/share/WWW/anapheweb/documentation set ANAPHE_WEB_URL = http://anaphe.web.cern.ch/anaphe/documentationSample script (thru gmake target install):
#!/bin/csh if(${?ANAPHE_WEB_DIR} == 0) then set ANAPHE_WEB_DIR = /afs/cern.ch/sw/lhcxx/share/WWW/anapheweb/documentation endif if(${?ANAPHE_WEB_URL} == 0) then set ANAPHE_WEB_URL = http://anaphe.web.cern.ch/anaphe/documentation endif echo ANAPHE_WEB_DIR = $ANAPHE_WEB_DIR echo ANAPHE_WEB_URL = $ANAPHE_WEB_URL cd ${ANAPHE_WEB_DIR}/FML/adi/generated_doc/html chmod u+x installdox ./installdox -l anaphe.Interfaces.tag@${ANAPHE_WEB_URL}/Interfaces/generated_doc/html * cd ${ANAPHE_WEB_DIR}/FML/fml/generated_doc/html chmod u+x installdox ./installdox -l anaphe.Interfaces.tag@${ANAPHE_WEB_URL}/Interfaces/generated_doc/html * cd ${ANAPHE_WEB_DIR}/FML/wrappers/generated_doc/html chmod u+x installdox ./installdox \ -l anaphe.Interfaces.tag@${ANAPHE_WEB_URL}/Interfaces/generated_doc/html \ -l anaphe.fml.cpp.tag@${ANAPHE_WEB_URL}/FML/fml/generated_doc/html \ -l anaphe.fml.adi.tag@${ANAPHE_WEB_URL}/FML/adi/generated_doc/html \ *