We write all the API documentation with Doxygen. The add.h and add.cpp are reference implementations of the style guide.
YYYY-MM-DD.snake_case for the variables and functions.. at the end of each list item.bib file in the repository.@a for italics (parameters).@b for bold (single emphasis).@c for monospace (for file names / code symbols).# style for headings.@ for all Doxygen special commands.//!< for inline documentation (see above) so keep the caveats in mind from the Doxygen manual.// and /**/ are used to describe steps of an algorithm in-place./** style.*.Each file shall begin with a @file block as shown:
The salient points are:
@file must be present and is simply the filename.@author is always SymEngine Developers.git handle more granular attribution.@date is the date the file was last modified.@brief should be a single line about the contents of the file.Created on: is not a Doxygen directive, but should be present.@ref tags are meant to allow the user to jump to relevant sections more easily.Note that this block is to appear before any #ifndef and #include preprocessor directives.
It is in the .h file that @ingroup and @defgroup directives are used for grouping. The logical grouping follows the layout of the tests directory.
To maintain the logical division of .cpp and .h files, we disallow long comments in header files. This is also to reduce the compilation time when changing minor documentation[^1]. Anything longer than one line should be replaced with a short description which is expanded on in a @note in the corresponding .cpp. Acceptable special directives are (in order):
@brief for a pithy description of the entity.@pre for describing preconditions (optional).@see for related functions.@param one for each input parameter.@param[out] is not used, we have the .cpp to describe the effects of void functions.@return one for each possible return value with a line on the condition..cpp has the implementation details.void functions should @return Void. (including the .).@relatesalso takes a single class and groups the function with the class in the output (optional).Note that since C++ is strongly typed, there is no need to describe the type of inputs (@param) or the outputs.
For example:
These are typically simply a @return directive in a single line //!<; but should be used sparingly. If the function in question requires more documentation it probably should not be inline.
Here we expect:
@details for explanations of the overall algorithm, speed concerns, etc.@note for longer details of the parameters or other important issues.@warning for pitfalls.@see is allowed in both headers and code files, but only sparingly.This formulation; with comments in the code, to augment the documentation blocks is the most legible method.
Classes descriptions have the @class directive declared before @brief in .h files and before @details in the .cpp as well.
We expect the build system to be able to find graphviz for dot.
[^1]: Changing a header triggers the recompilation of the entire project.