documentationjavadocdoxygendoxywizard

How to comment the file itself using Javadoc and Doxygen


I have a problem with documenting the file itself using javadoc style and doxygen. I can generate nice documentation for variables and functions but for the file itself, the doxygen always thinks the header of the file is the documentation for the next immediate variable or macro following it even if that var or macro has its own javadoc comment block. Take the example below:

/**
 * MAX9611 Sensor I2C
 *
 * @author  Saeid Yazdani
 * @date    01/07/2016
 *
 */


#ifndef MAX9611_HPP
#define MAX9611_HPP

#include "stdint.h" //for uint and stuff

/**
* max9611 RS+ ADC value is 0 to 57.3V in 12bit
* so to convert it to real voltage we need this constant 57.3/4096
* this can be used for both RS+ and OUT adc values to be converted to real V
*/
#define MAX9611_VOLT_MUL        0.0139892578125

So, when I generate documentation for this file (using doxygen/doxywizard) the documentation for the defined macro will be replaced by the header of the file.

What is the correct way to do such thing? Is it considered a good practice to document the file itself (with information like description, author, time, version and ...) and if so how to solve the problem that I just described?


Solution

  • Use the \file command.

    The Doxygen manual provides this example code:

    /** \file file.h
     * A brief file description.
     * A more elaborated file description.
     */
    /**
     * A global integer value.
     * More details about this value.
     */
    extern int globalValue;
    

    and a link to the output:

    enter image description here