Skip to content

Commit 55a005d

Browse files
authored
Merge pull request #2113 from jessica-mitchell/cleanup-cpp-docs
Clean up doxygen comments in nestkernel directory
2 parents 9e49c7e + ca7837d commit 55a005d

108 files changed

Lines changed: 2567 additions & 2380 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Guidelines for C++ code comments
2+
================================
3+
4+
There are two types of code comments for C++ files: doxygen style and C++ style comments.
5+
6+
* Doxygen styled comments are used for describing things like the purpose of the function, which parameters it accepts, and what output it generates.
7+
* Use Doxygen style comments in the header (``.h``) files. Avoid using them in ``.cpp`` files.
8+
* Do not duplicate code in comments.
9+
.. Include the variable name in functions in header file to match cpp file.
10+
11+
12+
Generate HTML from doxygen comments
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14+
15+
To generate HTML output of the doxgyen comments,
16+
17+
in the build directory,
18+
19+
run ``cmake`` with developer documentation on::
20+
21+
cmake -Dwith-devdoc=ON path/to/nest-simulator.
22+
23+
then
24+
25+
::
26+
27+
make docs
28+
xdg-open doc/doxygen/html/index.html
29+
30+
.. seealso::
31+
32+
See `the official doxygen documentation <https://www.doxygen.nl/>`_ for details.
33+
34+
35+
Doxygen style
36+
~~~~~~~~~~~~~
37+
38+
* Multi-line comments
39+
40+
.. code-block:: cpp
41+
42+
/**
43+
* Short description
44+
*
45+
* Further details, if necesary
46+
*/
47+
48+
.. note::
49+
50+
Functions and classes should use the multi-line style even for single line comments.
51+
52+
* Single or two line comments to use with variables:
53+
54+
.. code-block:: cpp
55+
56+
//! The maximum delay of the simulation
57+
long may_delay;
58+
59+
60+
* If a short comment is needed for variables, you can add a comment to the right of the code:
61+
62+
.. code-block:: cpp
63+
64+
long max_delay_; //!< The maximum delay of the simulation
65+
66+
C++ style
67+
~~~~~~~~~
68+
69+
* Multi-line comments:
70+
71+
.. code-block:: cpp
72+
73+
//
74+
//
75+
//
76+
//
77+
78+
* Single or two line comments:
79+
80+
.. code-block:: cpp
81+
82+
//

nestkernel/archiving_node.h

Lines changed: 22 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -49,68 +49,37 @@ namespace nest
4949
class ArchivingNode : public StructuralPlasticityNode
5050
{
5151
public:
52-
/**
53-
* \fn ArchivingNode()
54-
* Constructor.
55-
*/
5652
ArchivingNode();
5753

58-
/**
59-
* \fn ArchivingNode()
60-
* Copy Constructor.
61-
*/
6254
ArchivingNode( const ArchivingNode& );
6355

6456
/**
65-
* \fn double get_K_value(long t)
66-
* return the Kminus (synaptic trace) value at t (in ms). When the trace is
67-
* requested at the exact same time that the neuron emits a spike, the trace
68-
* value as it was just before the spike is returned.
57+
* Return the Kminus (synaptic trace) value at time t (given in ms).
58+
*
59+
* When the trace is requested at the exact same time that the neuron emits a spike,
60+
* the trace value as it was just before the spike is returned.
6961
*/
7062
double get_K_value( double t ) override;
7163

7264
/**
73-
* \fn void get_K_values( double t,
74-
* double& Kminus,
75-
* double& nearest_neighbor_Kminus,
76-
* double& Kminus_triplet )
77-
* write the Kminus (eligibility trace for STDP),
78-
* nearest_neighbour_Kminus (eligibility trace for nearest-neighbour STDP:
79-
* like Kminus, but increased to 1, rather than by 1, on a spike
80-
* occurrence),
81-
* and Kminus_triplet
82-
* values at t (in ms) to the provided locations.
65+
* Write the different STDP K values at time t (in ms) to the provided locations.
66+
*
67+
* @param Kminus the eligibility trace for STDP
68+
* @param nearest_neighbour_Kminus eligibility trace for nearest-neighbour STDP, like Kminus,
69+
but increased to 1, rather than by 1, when a spike occurs
70+
* @param Kminus_triplet eligibility trace for triplet STDP
71+
*
8372
* @throws UnexpectedEvent
8473
*/
8574
void get_K_values( double t, double& Kminus, double& nearest_neighbor_Kminus, double& Kminus_triplet ) override;
8675

8776
/**
88-
* \fn void get_K_values( double t,
89-
* double& Kminus,
90-
* double& Kminus_triplet )
91-
* The legacy version of the function, kept for compatibility
92-
* after changing the function signature in PR #865.
93-
* @throws UnexpectedEvent
94-
*/
95-
void
96-
get_K_values( double t, double& Kminus, double& Kminus_triplet )
97-
{
98-
double nearest_neighbor_Kminus_to_discard;
99-
get_K_values( t, Kminus, nearest_neighbor_Kminus_to_discard, Kminus_triplet );
100-
}
101-
102-
/**
103-
* \fn double get_K_triplet_value(std::deque<histentry>::iterator &iter)
104-
* return the triplet Kminus value for the associated iterator.
77+
* Return the triplet Kminus value for the associated iterator.
10578
*/
10679
double get_K_triplet_value( const std::deque< histentry >::iterator& iter );
10780

10881
/**
109-
* \fn void get_history(long t1, long t2,
110-
* std::deque<Archiver::histentry>::iterator* start,
111-
* std::deque<Archiver::histentry>::iterator* finish)
112-
* return the spike times (in steps) of spikes which occurred in the range
113-
* (t1,t2].
82+
* Return the spike times (in steps) of spikes which occurred in the range [t1,t2].
11483
*/
11584
void get_history( double t1,
11685
double t2,
@@ -130,26 +99,26 @@ class ArchivingNode : public StructuralPlasticityNode
13099

131100
protected:
132101
/**
133-
* \fn void set_spiketime(Time const & t_sp, double offset)
134-
* record spike history
102+
* Record spike history
135103
*/
136104
void set_spiketime( Time const& t_sp, double offset = 0.0 );
137105

138106
/**
139-
* \fn double get_spiketime()
140-
* return most recent spike time in ms
107+
* Return most recent spike time in ms
141108
*/
142109
inline double get_spiketime_ms() const;
143110

144111
/**
145-
* \fn void clear_history()
146-
* clear spike history
112+
* Clear spike history
147113
*/
148114
void clear_history();
149115

150-
// number of incoming connections from stdp connectors.
151-
// needed to determine, if every incoming connection has
152-
// read the spikehistory for a given point in time
116+
/**
117+
* Number of incoming connections from STDP connectors.
118+
*
119+
* This variable is needed to determine if every incoming connection has
120+
* read the spikehistory for a given point in time
121+
*/
153122
size_t n_incoming_;
154123

155124
private:

nestkernel/clopath_archiving_node.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ nest::ClopathArchivingNode::ClopathArchivingNode( const ClopathArchivingNode& n
6464
void
6565
nest::ClopathArchivingNode::init_clopath_buffers()
6666
{
67-
// Implementation of the delay of the convolved membrane potentials. This
68-
// delay is not described in Clopath et al. 2010 but is present in the code
69-
// (https://senselab.med.yale.edu/ModelDB/showmodel.cshtml?model=144566) on
70-
// ModelDB which was presumably used to create the figures in the paper.
71-
// Since we write into the buffer before we read from it, we have to
72-
// add 1 to the size of the buffers.
7367
delayed_u_bars_idx_ = 0;
7468
delay_u_bars_steps_ = Time::delay_ms_to_steps( delay_u_bars_ ) + 1;
7569
delayed_u_bar_plus_.resize( delay_u_bars_steps_ );
@@ -170,6 +164,7 @@ nest::ClopathArchivingNode::get_LTP_history( double t1,
170164
else
171165
{
172166
std::deque< histentry_extended >::iterator runner = ltp_history_.begin();
167+
173168
// To have a well defined discretization of the integral, we make sure
174169
// that we exclude the entry at t1 but include the one at t2 by subtracting
175170
// a small number so that runner->t_ is never equal to t1 or t2.

nestkernel/clopath_archiving_node.h

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,36 +40,23 @@ namespace nest
4040
{
4141

4242
/**
43-
* \class ClopathArchivingNode
44-
* a archiving node which additionally archives parameters
43+
* An archiving node which additionally archives parameters
4544
* and buffers needed for the Clopath plasticity rule
4645
*/
4746
class ClopathArchivingNode : public ArchivingNode
4847
{
4948

5049
public:
51-
/**
52-
* \fn ClopathArchivingNode()
53-
* Constructor.
54-
*/
5550
ClopathArchivingNode();
5651

57-
/**
58-
* \fn ClopathArchivingNode()
59-
* Copy Constructor.
60-
*/
6152
ClopathArchivingNode( const ClopathArchivingNode& );
6253

6354
/**
64-
* \fn double get_LTD_value(long t)
6555
* Returns value in LTD history at time t
6656
*/
6757
double get_LTD_value( double t ) override;
6858

6959
/**
70-
* \fn void get_LTP_history(long t1, long t2,
71-
* std::deque<Archiver::histentry>::iterator* start,
72-
* std::deque<Archiver::histentry>::iterator* finish)
7360
* Sets pointer start (finish) to the first (last) entry in LTP_history
7461
* whose time argument is between t1 and t2
7562
*/
@@ -79,43 +66,44 @@ class ClopathArchivingNode : public ArchivingNode
7966
std::deque< histentry_extended >::iterator* finish ) override;
8067

8168
/**
82-
* \fn double get_theta_plus()
8369
* Returns threshold theta_plus_
8470
*/
8571
double get_theta_plus() const;
8672

8773
/**
88-
* \fn double get_theta_minus()
8974
* Returns threshold theta_minus_
9075
*/
9176
double get_theta_minus() const;
9277

9378
protected:
9479
/**
95-
* \fn void write_LTD_history( Time const& t_sp,
96-
* double u_bar_minus, double u_bar_bar )
9780
* Creates a new entry in the LTD history and deletes old entries that
9881
* are not needed any more.
9982
*/
10083
void write_LTD_history( const double t_ltd_ms, double u_bar_minus, double u_bar_bar );
10184

10285
/**
103-
* \fn void write_LTP_history( const double t_ltp_ms, double u,
104-
* double u_bar_plus )
10586
* Creates a new entry in the LTP history and delets old entries that
10687
* are not needed any more.
10788
*/
10889
void write_LTP_history( const double t_ltp_ms, double u, double u_bar_plus );
10990

11091
/**
111-
* \fn void write_clopath_history( Time const& t_sp,
112-
* double u, double u_bar_plus, double u_bar_minus, double u_bar_bar )
11392
* Writes and reads the delayed_u_bar_[plus/minus] buffers and
11493
* calls write_LTD_history and write_LTP_history if
11594
* the corresponding Heaviside functions yield 1.
11695
*/
11796
void write_clopath_history( Time const& t_sp, double u, double u_bar_plus, double u_bar_minus, double u_bar_bar );
11897

98+
/**
99+
* Initialization of buffers.
100+
*
101+
* The implementation of the delay of the convolved membrane potentials as used
102+
* here is not described in Clopath et al. 2010, but is present in the code
103+
* on ModelDB (https://senselab.med.yale.edu/ModelDB/showmodel.cshtml?model=144566)
104+
* which was presumably used to create the figures in the paper. Since we write
105+
* into the buffer before we read from it, we have to add 1 to the size of the buffers.
106+
*/
119107
void init_clopath_buffers();
120108
void get_status( DictionaryDatum& d ) const override;
121109
void set_status( const DictionaryDatum& d ) override;

nestkernel/common_properties_hom_w.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,6 @@
2323
#ifndef COMMON_PROPERTIES_HOM_W_H
2424
#define COMMON_PROPERTIES_HOM_W_H
2525

26-
/** @BeginDocumentation
27-
28-
Name: static_synapse_hom_w - Static synapse type
29-
using homogeneous weight, i.e. all synapses
30-
feature the same w.
31-
32-
FirstVersion: April 2008
33-
34-
Author: Moritz Helias, Susanne Kunkel
35-
36-
SeeAlso: static_synapse
37-
*/
38-
3926
// Includes from nestkernel:
4027
#include "common_synapse_properties.h"
4128

@@ -48,19 +35,12 @@ namespace nest
4835
class CommonPropertiesHomW : public CommonSynapseProperties
4936
{
5037
public:
51-
/**
52-
* Default constructor.
53-
* Sets all property values to defaults.
54-
*/
5538
CommonPropertiesHomW()
5639
: CommonSynapseProperties()
5740
, weight_( 1.0 )
5841
{
5942
}
6043

61-
/**
62-
* Get all properties and put them into a dictionary.
63-
*/
6444
void
6545
get_status( DictionaryDatum& d ) const
6646
{
@@ -91,4 +71,4 @@ class CommonPropertiesHomW : public CommonSynapseProperties
9171

9272
} // namespace nest
9373

94-
#endif // COMMON_PROPERTIES_HOM_W_H
74+
#endif /* #ifndef COMMON_PROPERTIES_HOM_W_H */

nestkernel/common_synapse_properties.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@
3434
namespace nest
3535
{
3636

37-
/**
38-
* Default implementation of an empty CommonSynapseProperties object.
39-
*/
40-
4137
CommonSynapseProperties::CommonSynapseProperties()
4238
: weight_recorder_()
4339
, wr_node_id_( 0 )

0 commit comments

Comments
 (0)