Developers are expected to document their functions using Doxygen syntax. Specific auto-documentation styles for various types of functions are shown below. We will base our examples on the code from Ellipsoid.h and Ellipsoid.cpp files in the source tree.
These types of functions are typically defined in the struct/class definition itself and serve a simple purpose of returning a computed value. In this case, we will use a simple one line description. For example, isce3::core::Ellipsoid::a()
These types of functions are typically defined in the struct/class definition itself and serve a simple purpose of setting a value with input or perform a simple computation with input. In this case, we will user the "brief" keyword from doxygen to provide a one line description and "param" keyword to describe the parameter in detail. For example, isce3::core::Ellipsoid::a(double)
These types of functions should typically not be defined in the struct/class definition. These are included either in the .h header file or the .icc include file. In this case, a brief one liner is provided as part of the function declaration in the header file followed by a detail description of the parameters just before the function specification in the header file or the .icc file. For example, documentation of function isce3::core::Ellipsoid::rDir can be found in two places - first in the class declaration as
and later in the header file, just before the function declaration as
For functions that are defined within a namespace and are not a member of a class/struct (e.g., isce/core/Serialization.h), you must first indicate that comments within the file contain documentation for a header file using the "\file" command. Also, the namespace declarations must be commented. For example,
For all regular C++ functions that are not inlined, a brief one line description must be provided in the header file irrespective the number of input arguments. For example, class isce3::core::Ellipsoid::xyzToLonLat
The detailed description of individual parameters must be provided just before the function specification. The detailed description can also include math equations and references to publications or reports. For example, isce3::core::Ellipsoid::xyzToLonLat
Doxygen interprets CUDA code in the same manner as C/C++. Use the same style guidelines as regular C++ code for documenting the CUDA code.
Developers are expected to document their functions using Google Style docstrings. ISCE uses sphinx with the autodoc, autosummary and napoleon extensions. We will base our examples on the code from pyEllipsoid.pyx file in the extensions folder of the source tree.
Cython/Python docstrings must clearly include sections for Args and Returns. Each of the Args entries must include a python type expected by the function. Note that in case of Cython, the type could also be optionally included as a part of the function signature in the input arguments. However, the python type should always be included in the docstrings.
For example, pyEllipsoid.copyFrom
For example, pyEllipsoid.rDir
If a function returns multiple values, the return type must be clearly indicated as tuple. The order of the returned results in the tuple must then be included in a list. For example, pyEllipsoid.getTCNbasis
Keyword arguments are also listed under the Args section of the docstring but are clearly labelled as optional. For example
Python class documentation will be extracted from the docstring immediately following the class declaration. Note that class constructors are special and should not be documented in the function. Instead the docstring following the class declaration should describe the arguments expected by the class constructor. For example,for class pyEllipsoid