Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOxygen Documentation #15

Open
r-barnes opened this issue Sep 15, 2021 · 3 comments
Open

DOxygen Documentation #15

r-barnes opened this issue Sep 15, 2021 · 3 comments

Comments

@r-barnes
Copy link
Contributor

r-barnes commented Sep 15, 2021

I have an example of DOxygen-style documentation from my own work here: https://github.com/r-barnes/richdem/blob/master/include/richdem/depressions/Barnes2014.hpp

Excerpted:

/**
  @brief  Fills all pits and removes all digital dams from a DEM [one-line brief description]

    [paragraph-style longer description]
    Priority-Flood starts on the edges of the DEM and then works its way
    inwards using a priority queue to determine the lowest cell which has
    a path to the edge. The neighbours of this cell are added to the priority
    queue. If the neighbours are lower than the cell which is adding them, then
    they are raised to match its elevation; this fills depressions.

  @param[in,out]  elevations   A grid of cell elevations [list of input arguments

  @return True if XXX; otherwise, False [what the return value is/means]

  @pre
    1. @p elevations contains the elevations of every cell or a value _NoData_
       for cells not part of the DEM. Note that the _NoData_ value is assumed to
       be a negative number less than any actual data value. [pre-conditions]

  @post
    1. @p elevations contains the elevations of every cell or a value _NoData_
       for cells not part of the DEM.
    2. @p elevations contains no landscape depressions or digital dams. [postconditions]

  @correctness
    The correctness of this command is determined by inspection. (TODO)
    [The correctness field is one I've added to the RichDEM generator to make it more explicit how correctness is shown
*/
template <Topology topo, class elev_t>
bool PriorityFlood_Original(Array2D<elev_t> &elevations){
@r-barnes
Copy link
Contributor Author

You can also use inline documentation for things like classes, like so:

template<class T>
class Array2D {
 public:
  std::string filename;             ///< File, if any, from which the data was loaded
  std::string basename;             ///< Filename without path or extension
  std::vector<double> geotransform; ///< Geotransform of the raster
  std::string projection;           ///< Projection of the raster
  std::map<std::string, std::string> metadata; ///< Raster's metadata in key-value pairs

@r-barnes
Copy link
Contributor Author

But if you can get the documentation mostly there, I can make sure the syntax is okay.

@r-barnes
Copy link
Contributor Author

I'll hold off on the Python documentation for now, since that can mostly be copied from the C++ code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant