General documentation guidelines
Classes and methods can be documented both in the .cxx and .h files. For the long descriptions of a class functionality and its methods we usually prefer the .cxx file.
Class documentation
The documentation for the class is in general located at the beginning of the .cxx file.
The \class
Doxygen command is mandatory otherwise Doxygen will not associate the comments
to the proper class. The first sentence is a brief description of the class and will
appear in all class listings. For an example see the TF2 class documentation:
Method documentation
Methods are documented just before the method/function is defined in the .cxx file.
The use of \param[in]
and \param[out]
is encouraged to document the parameters of the
method. The agreed formatting is as follows:
Free functions documentation
Doxygen does not document default parameters of free functions if the only doxygen documentation provided for the function is in source files (as opposed to header files). To bypass this issue it is enough to provide a brief documentation for such functions in the header file. For example if the source file is:
and the header file:
Then a proper documentation with the default parameters is generated.
Data Member documentation
IMPORTANT: It is crucial to use ///<
and only ///<
to comment data members: this
comment is correctly understood by genreflex/rootcling.
The usage of other Doxygen constructs can interfere with the I/O subsystem!
The usage of “//!” will still result in transiency of members but not in Doxygen documentation.
Tutorials’ documentation
ROOT tutorials are also included in the ROOT documentation. The tutorials’ macros headers should look like:
This example shows that four new directives have been implemented:
-
\macro_image
The images produced by this macro are shown. A caption can be added to document the pictures:\macro_image This is a picture
. When the option(nobatch)
is passed, the macro is executed without the batch option. Some tutorials generate pictures (png or pdf) withPrint
orSaveAs
. Such pictures can be displayed with\macro_image (picture_name.png[.pdf])
When the option (tcanvas_js) is used the image is displayed as JavaScript. For ROOT 7 tutorials, when the option (rcanvas_js) is used the image is displayed as json file. -
\macro_code
The macro code is shown. A caption can be added:\macro_code This is code
-
\macro_output
The output produced by this macro is shown. A caption can be added:\macro_output This the macro output
-
\notebook
To generate the corresponding jupyter notebook. In case the tutorial does not generate any graphics output, the option-nodraw
should be added. This directive needs jupyter to be properly installed when building the documentation of tutorials having this directive.
Note that the doxygen directive \authors
or \author
must be the last one
of the macro header.