measur-tools-suite 1.0.11-beta.30 → 1.0.11-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +192 -242
- package/README.md +12 -3
- package/bin/package.json +1 -1
- package/docs/mainpage.dox +37 -16
- package/package.json +1 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -1,142 +1,24 @@
|
|
|
1
|
-
# How to Contribute
|
|
1
|
+
# How to Contribute
|
|
2
2
|
|
|
3
3
|
This guide provides clear standards and best practices for contributing to this project. It covers coding style, documentation, formatting, and workflow expectations to help maintain high code quality, ensure long-term maintainability, and foster smooth collaboration among all contributors.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
[Style Guide](#style-guide)
|
|
5
|
+
## [Style Guide](#style-guide)
|
|
10
6
|
|
|
11
7
|
Follow this guide to make sure your contributions align with the project's coding standards. This will help ensure that your code is readable, maintainable, and consistent with the rest of the codebase.
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
[Clang-Format](#clang-format)
|
|
9
|
+
## [Clang-Format](#clang-format)
|
|
16
10
|
|
|
17
11
|
Use Clang-Format to automatically format your code according to the project's style guide. This ensures consistent formatting across the codebase and reduces manual formatting effort.
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
[Doxygen Documentation](#doxygen-documentation)
|
|
13
|
+
## [Doxygen Documentation](#doxygen-documentation)
|
|
22
14
|
|
|
23
15
|
Follow these guidelines to document your code effectively using Doxygen. Proper documentation is crucial for understanding the codebase and facilitating collaboration.
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
[Conventional Commits](#conventional-commits)
|
|
17
|
+
## [Conventional Commits](#conventional-commits)
|
|
28
18
|
|
|
29
|
-
Use Conventional Commits to structure your commit messages. This helps maintain a clear project history and makes it easier to understand the purpose of each change.
|
|
19
|
+
Use Conventional Commits to structure your commit messages. This helps maintain a clear project history and makes it easier to understand the purpose of each change.
|
|
30
20
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<details>
|
|
34
|
-
<summary><b>Table of Contents</b></summary>
|
|
35
|
-
|
|
36
|
-
- [Style Guide](#style-guide)
|
|
37
|
-
- [Header Files](#header-files)
|
|
38
|
-
- [The #define Guard](#the-define-guard)
|
|
39
|
-
- [Format](#format)
|
|
40
|
-
- [Example](#example)
|
|
41
|
-
- [Include What You Use](#include-what-you-use)
|
|
42
|
-
- [Forward Declarations](#forward-declarations)
|
|
43
|
-
- [Bad](#bad)
|
|
44
|
-
- [Good](#good)
|
|
45
|
-
- [Defining Functions in Header Files](#defining-functions-in-header-files)
|
|
46
|
-
- [Example](#example-1)
|
|
47
|
-
- [Names and Order of Includes](#names-and-order-of-includes)
|
|
48
|
-
- [Scoping](#scoping)
|
|
49
|
-
- [Namespaces](#namespaces)
|
|
50
|
-
- [Local Variables](#local-variables)
|
|
51
|
-
- [Classes](#classes)
|
|
52
|
-
- [Structs vs. Classes](#structs-vs-classes)
|
|
53
|
-
- [Structs vs. Pairs and Tuples](#structs-vs-pairs-and-tuples)
|
|
54
|
-
- [Access Control](#access-control)
|
|
55
|
-
- [Declaration Order](#declaration-order)
|
|
56
|
-
- [Other C++ Features](#other-c-features)
|
|
57
|
-
- [Preincrement and Predecrement](#preincrement-and-predecrement)
|
|
58
|
-
- [Use of `const`](#use-of-const)
|
|
59
|
-
- [Naming](#naming)
|
|
60
|
-
- [File Names](#file-names)
|
|
61
|
-
- [Type Names](#type-names)
|
|
62
|
-
- [Concept Names](#concept-names)
|
|
63
|
-
- [Variable Names](#variable-names)
|
|
64
|
-
- [Common Variable Names](#common-variable-names)
|
|
65
|
-
- [Class Data Members](#class-data-members)
|
|
66
|
-
- [Struct Data Members](#struct-data-members)
|
|
67
|
-
- [Constant Names](#constant-names)
|
|
68
|
-
- [Function Names](#function-names)
|
|
69
|
-
- [Namespace Names](#namespace-names)
|
|
70
|
-
- [Enumerator Names](#enumerator-names)
|
|
71
|
-
- [Template Parameter Names](#template-parameter-names)
|
|
72
|
-
- [Macro Names](#macro-names)
|
|
73
|
-
- [Aliases](#aliases)
|
|
74
|
-
- [Comments](#comments)
|
|
75
|
-
- [When to comment](#when-to-comment)
|
|
76
|
-
- [When *not* to comment](#when-not-to-comment)
|
|
77
|
-
- [Comment Style](#comment-style)
|
|
78
|
-
- [Formatting](#formatting)
|
|
79
|
-
- [Looping and Branching Statements](#looping-and-branching-statements)
|
|
80
|
-
- [Clang-Format](#clang-format)
|
|
81
|
-
- [How to Format Code](#how-to-format-code)
|
|
82
|
-
- [Configuration](#configuration)
|
|
83
|
-
- [Updating the Style](#updating-the-style)
|
|
84
|
-
- [Best Practices](#best-practices)
|
|
85
|
-
- [Doxygen Documentation](#doxygen-documentation)
|
|
86
|
-
- [How to Generate Doxygen Documentation](#how-to-generate-doxygen-documentation)
|
|
87
|
-
- [Common Doxygen Tags](#common-doxygen-tags)
|
|
88
|
-
- [Documenting Units for Physical Quantities](#documenting-units-for-physical-quantities)
|
|
89
|
-
- [Template](#template)
|
|
90
|
-
- [Example](#example-2)
|
|
91
|
-
- [Documenting Formulas](#documenting-formulas)
|
|
92
|
-
- [Template](#template-1)
|
|
93
|
-
- [Example](#example-3)
|
|
94
|
-
- [File Documentation](#file-documentation)
|
|
95
|
-
- [Required tags](#required-tags)
|
|
96
|
-
- [Optional tags](#optional-tags)
|
|
97
|
-
- [Template](#template-2)
|
|
98
|
-
- [Example](#example-4)
|
|
99
|
-
- [Function \& Method Documentation](#function--method-documentation)
|
|
100
|
-
- [Required tags](#required-tags-1)
|
|
101
|
-
- [Optional tags](#optional-tags-1)
|
|
102
|
-
- [Template](#template-3)
|
|
103
|
-
- [Example](#example-5)
|
|
104
|
-
- [Class \& Struct Documentation](#class--struct-documentation)
|
|
105
|
-
- [Required tags](#required-tags-2)
|
|
106
|
-
- [Optional tags](#optional-tags-2)
|
|
107
|
-
- [Template](#template-4)
|
|
108
|
-
- [Example](#example-6)
|
|
109
|
-
- [Data-Member Documentation](#data-member-documentation)
|
|
110
|
-
- [Template](#template-5)
|
|
111
|
-
- [Example](#example-7)
|
|
112
|
-
- [Enumeration Documentation](#enumeration-documentation)
|
|
113
|
-
- [Required tags](#required-tags-3)
|
|
114
|
-
- [Optional tags](#optional-tags-3)
|
|
115
|
-
- [Template](#template-6)
|
|
116
|
-
- [Example](#example-8)
|
|
117
|
-
- [Constant Documentation](#constant-documentation)
|
|
118
|
-
- [Template](#template-7)
|
|
119
|
-
- [Example](#example-9)
|
|
120
|
-
- [Namespace Documentation](#namespace-documentation)
|
|
121
|
-
- [Required tags](#required-tags-4)
|
|
122
|
-
- [Optional tags](#optional-tags-4)
|
|
123
|
-
- [Template](#template-8)
|
|
124
|
-
- [Example](#example-10)
|
|
125
|
-
- [Module (Group) Documentation](#module-group-documentation)
|
|
126
|
-
- [Required tags](#required-tags-5)
|
|
127
|
-
- [Optional tags](#optional-tags-5)
|
|
128
|
-
- [Template](#template-9)
|
|
129
|
-
- [Example](#example-11)
|
|
130
|
-
- [Conventional Commits](#conventional-commits)
|
|
131
|
-
- [Commit Format](#commit-format)
|
|
132
|
-
- [Commit Types](#commit-types)
|
|
133
|
-
- [Commit Scopes](#commit-scopes)
|
|
134
|
-
- [Using Multiple Scopes](#using-multiple-scopes)
|
|
135
|
-
- [Breaking Changes](#breaking-changes)
|
|
136
|
-
|
|
137
|
-
</details>
|
|
138
|
-
|
|
139
|
-
<br><br>
|
|
21
|
+
<br>
|
|
140
22
|
|
|
141
23
|
# Style Guide
|
|
142
24
|
|
|
@@ -148,6 +30,8 @@ Every `.cpp` file should have an associated `.h` file. There are some common exc
|
|
|
148
30
|
|
|
149
31
|
### The #define Guard
|
|
150
32
|
|
|
33
|
+
---
|
|
34
|
+
|
|
151
35
|
All header files should have `#define` guards to prevent multiple inclusion.
|
|
152
36
|
|
|
153
37
|
#### Format
|
|
@@ -174,6 +58,8 @@ All header files should have `#define` guards to prevent multiple inclusion.
|
|
|
174
58
|
|
|
175
59
|
### Include What You Use
|
|
176
60
|
|
|
61
|
+
---
|
|
62
|
+
|
|
177
63
|
If a source or header file refers to a symbol defined elsewhere, it must directly include the header that provides the declaration or definition of that symbol. Do not include headers for any other reason.
|
|
178
64
|
|
|
179
65
|
Do **not** rely on transitive inclusions (i.e., do not assume that a header is included indirectly via another header). This practice allows unnecessary `#include` statements to be safely removed from headers without breaking dependent code.
|
|
@@ -182,15 +68,9 @@ This rule also applies to related headers: for example, if `foo.cpp` uses a symb
|
|
|
182
68
|
|
|
183
69
|
### Forward Declarations
|
|
184
70
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
#### Bad
|
|
71
|
+
---
|
|
188
72
|
|
|
189
|
-
|
|
190
|
-
class B; // Forward declaration without definition.
|
|
191
|
-
void FuncInB();
|
|
192
|
-
extern int variable_in_b;
|
|
193
|
-
```
|
|
73
|
+
Avoid using forward declarations where possible. Instead, include the headers you need.
|
|
194
74
|
|
|
195
75
|
#### Good
|
|
196
76
|
|
|
@@ -201,8 +81,18 @@ void f(void*);
|
|
|
201
81
|
void test(D* x) { f(x); } // Calls f(B*)
|
|
202
82
|
```
|
|
203
83
|
|
|
84
|
+
#### Bad
|
|
85
|
+
|
|
86
|
+
```cpp
|
|
87
|
+
class B; // Forward declaration without definition.
|
|
88
|
+
void FuncInB();
|
|
89
|
+
extern int variable_in_b;
|
|
90
|
+
```
|
|
91
|
+
|
|
204
92
|
### Defining Functions in Header Files
|
|
205
93
|
|
|
94
|
+
---
|
|
95
|
+
|
|
206
96
|
Only define a function at its public declaration if it is short (10 lines or fewer) or if it is a template function. Place longer function bodies in the `.cpp` file unless they must be in the header for performance or technical reasons.
|
|
207
97
|
|
|
208
98
|
If a definition must be in the header, avoid placing it in the public section. Instead, put it in a private section, an `internal` namespace, or below a comment like `// Implementation details only below here`.
|
|
@@ -233,6 +123,8 @@ void Foo<T>::MethodWithHugeBody() {
|
|
|
233
123
|
|
|
234
124
|
### Names and Order of Includes
|
|
235
125
|
|
|
126
|
+
---
|
|
127
|
+
|
|
236
128
|
Project-specific and third-party library headers should be included using double quotes (`"myheader.h"`), while standard library headers should use angle brackets (`<vector>`).
|
|
237
129
|
|
|
238
130
|
All of a project's header files should be listed as descendants of the project's source directory. For example, `myproject/include/module/header.h` should be included as `"module/header.h"`.
|
|
@@ -249,6 +141,8 @@ All third-party libraries should be defined as separate categories in the `.clan
|
|
|
249
141
|
|
|
250
142
|
### Namespaces
|
|
251
143
|
|
|
144
|
+
---
|
|
145
|
+
|
|
252
146
|
With few exceptions, place all code in a namespace. Namespaces should have unique names based on the project name and, if appropriate, its path.
|
|
253
147
|
|
|
254
148
|
- **Do not** use using-directives (e.g., `using namespace foo;`).
|
|
@@ -272,11 +166,13 @@ outer::foo();
|
|
|
272
166
|
|
|
273
167
|
### Local Variables
|
|
274
168
|
|
|
169
|
+
---
|
|
170
|
+
|
|
275
171
|
Place a function's variables in the narrowest scope possible, and initialize variables in the declaration.
|
|
276
172
|
- Declare variables as close as possible to their first use, and within the smallest scope needed.
|
|
277
173
|
- Always initialize variables at the point of declaration, rather than declaring and assigning separately.
|
|
278
174
|
|
|
279
|
-
|
|
175
|
+
#### Good
|
|
280
176
|
|
|
281
177
|
```cpp
|
|
282
178
|
int i = f(); // Declaration and initialization together.
|
|
@@ -285,7 +181,7 @@ f(jobs); // Declaration closely followed by use.
|
|
|
285
181
|
std::vector<int> v = {1, 2}; // Prefer brace initialization.
|
|
286
182
|
```
|
|
287
183
|
|
|
288
|
-
|
|
184
|
+
#### Bad
|
|
289
185
|
|
|
290
186
|
```cpp
|
|
291
187
|
int i;
|
|
@@ -305,7 +201,8 @@ Variables needed for if, while, and for statements should normally be declared w
|
|
|
305
201
|
while (const char* p = strchr(str, '/')) str = p + 1;
|
|
306
202
|
```
|
|
307
203
|
|
|
308
|
-
|
|
204
|
+
#### Caveat
|
|
205
|
+
|
|
309
206
|
If a variable is an object, its constructor and destructor are called each time it enters and leaves scope. For objects used in a loop, it may be more efficient to declare the variable outside the loop:
|
|
310
207
|
|
|
311
208
|
```cpp
|
|
@@ -328,6 +225,8 @@ Classes are the fundamental unit of code in C++. Naturally, we use them extensiv
|
|
|
328
225
|
|
|
329
226
|
### Structs vs. Classes
|
|
330
227
|
|
|
228
|
+
---
|
|
229
|
+
|
|
331
230
|
Use a `struct` only for passive objects that carry data; use a `class` for everything else.
|
|
332
231
|
|
|
333
232
|
- The `struct` and `class` keywords behave almost identically in C++, but we assign different semantic meanings:
|
|
@@ -338,6 +237,8 @@ For consistency with the STL, you may use `struct` for stateless types such as t
|
|
|
338
237
|
|
|
339
238
|
### Structs vs. Pairs and Tuples
|
|
340
239
|
|
|
240
|
+
---
|
|
241
|
+
|
|
341
242
|
Prefer to use a `struct` instead of a `std::pair` or `std::tuple` whenever the elements can have meaningful names.
|
|
342
243
|
|
|
343
244
|
While pairs and tuples can save time by avoiding the need to define a custom type, meaningful field names are almost always clearer than using `.first`, `.second`, or `std::get<X>`.
|
|
@@ -346,10 +247,14 @@ Use pairs and tuples only in generic code where the elements do not have specifi
|
|
|
346
247
|
|
|
347
248
|
### Access Control
|
|
348
249
|
|
|
250
|
+
---
|
|
251
|
+
|
|
349
252
|
Make class data members `private`, unless they are constants. This helps maintain class invariants and encapsulation, even if it requires writing simple accessor methods (usually `const`).
|
|
350
253
|
|
|
351
254
|
### Declaration Order
|
|
352
255
|
|
|
256
|
+
---
|
|
257
|
+
|
|
353
258
|
Group similar declarations together, placing public parts earlier.
|
|
354
259
|
|
|
355
260
|
A class definition must start with a `public:` section, followed by `protected:`, then `private:`. Omit any section that would be empty.
|
|
@@ -371,12 +276,14 @@ This order improves readability and makes it easier to find related declarations
|
|
|
371
276
|
|
|
372
277
|
### Preincrement and Predecrement
|
|
373
278
|
|
|
279
|
+
---
|
|
280
|
+
|
|
374
281
|
Use the prefix form (`++i`, `--i`) of the increment and decrement operators unless you specifically need the value before the increment or decrement (postfix semantics).
|
|
375
282
|
|
|
376
283
|
- The prefix form is generally more readable and can be more efficient, as it does not require making a copy of the original value.
|
|
377
284
|
- The postfix form (`i++`, `i--`) should only be used when the previous value is required in the same expression.
|
|
378
285
|
|
|
379
|
-
|
|
286
|
+
#### Good
|
|
380
287
|
|
|
381
288
|
```cpp
|
|
382
289
|
for (int i = 0; i < n; ++i) {
|
|
@@ -384,7 +291,7 @@ for (int i = 0; i < n; ++i) {
|
|
|
384
291
|
}
|
|
385
292
|
```
|
|
386
293
|
|
|
387
|
-
|
|
294
|
+
#### Bad
|
|
388
295
|
|
|
389
296
|
```cpp
|
|
390
297
|
for (int i = 0; i < n; i++) {
|
|
@@ -394,6 +301,8 @@ for (int i = 0; i < n; i++) {
|
|
|
394
301
|
|
|
395
302
|
### Use of `const`
|
|
396
303
|
|
|
304
|
+
---
|
|
305
|
+
|
|
397
306
|
Use `const` in APIs wherever it is meaningful and accurate. This includes function parameters, methods, and non-local variables. `constexpr` is preferred when a value is known at compile time.
|
|
398
307
|
|
|
399
308
|
- **Function parameters:**
|
|
@@ -419,12 +328,16 @@ Minimize the use of abbreviations that would likely be unknown to someone outsid
|
|
|
419
328
|
|
|
420
329
|
### File Names
|
|
421
330
|
|
|
331
|
+
---
|
|
332
|
+
|
|
422
333
|
Filenames are `snake_case` (all lowercase, with underscores between words). For instance: `my_class.cpp`, `polygon.cpp`.
|
|
423
334
|
|
|
424
335
|
C++ files have a `.cpp` extension, and header files have a `.h` extension.
|
|
425
336
|
|
|
426
337
|
### Type Names
|
|
427
338
|
|
|
339
|
+
---
|
|
340
|
+
|
|
428
341
|
Type names start with a capital letter and have a capital letter for each new word, with no underscores: MyExcitingClass, MyExcitingEnum.
|
|
429
342
|
|
|
430
343
|
The names of all types — classes, structs, type aliases, enums, and type template parameters — have the same naming convention. Type names should start with a capital letter and have a capital letter for each new word. No underscores. For example:
|
|
@@ -447,10 +360,14 @@ enum class MyClassError { ...
|
|
|
447
360
|
|
|
448
361
|
### Concept Names
|
|
449
362
|
|
|
363
|
+
---
|
|
364
|
+
|
|
450
365
|
Concept names follow the same rules as type names.
|
|
451
366
|
|
|
452
367
|
### Variable Names
|
|
453
368
|
|
|
369
|
+
---
|
|
370
|
+
|
|
454
371
|
The names of variables (including function parameters) and data members are `snake_case` (all lowercase, with underscores between words). Data members of classes (but not structs) additionally have trailing underscores. For instance: `a_local_variable`, `a_struct_data_member`, `a_class_data_member_`.
|
|
455
372
|
|
|
456
373
|
#### Common Variable Names
|
|
@@ -490,6 +407,8 @@ struct TableProperties {
|
|
|
490
407
|
|
|
491
408
|
### Constant Names
|
|
492
409
|
|
|
410
|
+
---
|
|
411
|
+
|
|
493
412
|
Variables declared `constexpr` or `const`, and whose value is fixed for the duration of the program, are named with a leading "k" followed by mixed case. Underscores can be used as separators in the rare cases where capitalization cannot be used for separation. For example:
|
|
494
413
|
|
|
495
414
|
```cpp
|
|
@@ -499,6 +418,8 @@ const int kAndroid8_0_0 - 24; // Android 8.0.0
|
|
|
499
418
|
|
|
500
419
|
### Function Names
|
|
501
420
|
|
|
421
|
+
---
|
|
422
|
+
|
|
502
423
|
Regular functions have mixed case; accessors and mutators are named like variables. Regular functions should be named with a verb or verb phrase, and should be descriptive of the action they perform. For example:
|
|
503
424
|
|
|
504
425
|
```cpp
|
|
@@ -511,6 +432,8 @@ Accessors and mutators (get and set functions) may be named like variables. Thes
|
|
|
511
432
|
|
|
512
433
|
### Namespace Names
|
|
513
434
|
|
|
435
|
+
---
|
|
436
|
+
|
|
514
437
|
Namespace names are `snake_case` (all lowercase, with underscores between words).
|
|
515
438
|
|
|
516
439
|
When choosing names for namespaces, note that names must be fully qualified when used in a header outside the namespace, because unqualified Aliases are generally banned.
|
|
@@ -521,6 +444,8 @@ Nested namespaces should avoid the names of well-known top-level namespaces, esp
|
|
|
521
444
|
|
|
522
445
|
### Enumerator Names
|
|
523
446
|
|
|
447
|
+
---
|
|
448
|
+
|
|
524
449
|
Enumerators (for both scoped and unscoped enums) should be named like constants with a leading "k" followed by mixed case. For example:
|
|
525
450
|
|
|
526
451
|
```cpp
|
|
@@ -533,11 +458,13 @@ enum class TableError {
|
|
|
533
458
|
|
|
534
459
|
### Template Parameter Names
|
|
535
460
|
|
|
461
|
+
---
|
|
462
|
+
|
|
536
463
|
Template parameters should follow the naming style for their category: type template parameters should follow the rules for [naming types](#type-names), and non-type template parameters should follow the rules for [naming variables](#variable-names) or [constants](#constant-names).
|
|
537
464
|
|
|
538
465
|
### Macro Names
|
|
539
466
|
|
|
540
|
-
|
|
467
|
+
---
|
|
541
468
|
|
|
542
469
|
In general macros should not be used. However, if they are absolutely needed, then they should be named with all capitals and underscores, and with a project-specific prefix. For example:
|
|
543
470
|
|
|
@@ -547,6 +474,8 @@ In general macros should not be used. However, if they are absolutely needed, th
|
|
|
547
474
|
|
|
548
475
|
### Aliases
|
|
549
476
|
|
|
477
|
+
---
|
|
478
|
+
|
|
550
479
|
The name for an alias follows the same principles as any other new name, applied in the context where the alias is defined rather than where the original name appears. For example:
|
|
551
480
|
|
|
552
481
|
```cpp
|
|
@@ -559,6 +488,8 @@ Clear, concise comments are essential for maintainable code. Use comments to cla
|
|
|
559
488
|
|
|
560
489
|
### When to comment
|
|
561
490
|
|
|
491
|
+
---
|
|
492
|
+
|
|
562
493
|
| Do comment when... | Avoid when... |
|
|
563
494
|
| -------------------------------------------------- | --------------------------------------------- |
|
|
564
495
|
| A non-obvious **algorithmic trick** needs context. | The code literally states the same thing. |
|
|
@@ -566,14 +497,10 @@ Clear, concise comments are essential for maintainable code. Use comments to cla
|
|
|
566
497
|
| There is a subtle **invariant / side-effect**. | The function already documents the behaviour. |
|
|
567
498
|
| You’re **explaining why**, not *what*. | You’re restating the *what* (“increment i”). |
|
|
568
499
|
|
|
569
|
-
### When *not* to comment
|
|
570
|
-
|
|
571
|
-
Do **not** add comments for:
|
|
572
|
-
- Self-explanatory names (e.g., `count`, `begin()`), trivial getters/setters, or obvious constructors.
|
|
573
|
-
- Code scheduled for removal—track this with a `TODO` in the issue tracker instead.
|
|
574
|
-
|
|
575
500
|
### Comment Style
|
|
576
501
|
|
|
502
|
+
---
|
|
503
|
+
|
|
577
504
|
1. **Place above** the line or block it explains—never to the right of long code.
|
|
578
505
|
2. **Start with a capital letter** and **end with a period** if the sentence is complete.
|
|
579
506
|
3. Use the `TODO(user, yyyy-mm-dd):` format for tasks.
|
|
@@ -581,7 +508,7 @@ Do **not** add comments for:
|
|
|
581
508
|
5. Prefer present tense and active voice.
|
|
582
509
|
6. Be specific and actionable—avoid vague or generic comments.
|
|
583
510
|
|
|
584
|
-
|
|
511
|
+
#### Good
|
|
585
512
|
|
|
586
513
|
```cpp
|
|
587
514
|
// Compute signed area via Shoelace formula.
|
|
@@ -593,7 +520,7 @@ if (HasSelfIntersection(verts)) return Err::kInvalid;
|
|
|
593
520
|
// TODO(alice, 2025-07-01): Replace O(n^2) intersection test with a sweep-line algorithm.
|
|
594
521
|
```
|
|
595
522
|
|
|
596
|
-
|
|
523
|
+
#### Bad
|
|
597
524
|
|
|
598
525
|
```cpp
|
|
599
526
|
// Increment i. // (What, not why)
|
|
@@ -607,9 +534,11 @@ area = PolygonSignedArea(verts);
|
|
|
607
534
|
|
|
608
535
|
### Looping and Branching Statements
|
|
609
536
|
|
|
537
|
+
---
|
|
538
|
+
|
|
610
539
|
**Always use braces** for all control statements (`if`, `else`, `for`, `while`, `do`, `switch`), even for single-line bodies. This prevents bugs and improves readability.
|
|
611
540
|
|
|
612
|
-
|
|
541
|
+
#### Good
|
|
613
542
|
|
|
614
543
|
```cpp
|
|
615
544
|
if (condition) {
|
|
@@ -624,14 +553,14 @@ for (int i = 0; i < 10; ++i) {
|
|
|
624
553
|
}
|
|
625
554
|
```
|
|
626
555
|
|
|
627
|
-
|
|
556
|
+
#### Bad
|
|
628
557
|
|
|
629
558
|
```cpp
|
|
630
559
|
if (condition)
|
|
631
560
|
DoSomething(); // Missing braces
|
|
632
561
|
```
|
|
633
562
|
|
|
634
|
-
|
|
563
|
+
#### Exceptions
|
|
635
564
|
|
|
636
565
|
Braces may be omitted only if the entire statement fits on one line and there is no `else` or `do ... while` part:
|
|
637
566
|
|
|
@@ -639,7 +568,7 @@ Braces may be omitted only if the entire statement fits on one line and there is
|
|
|
639
568
|
if (x == kFoo) return new Foo(); // OK
|
|
640
569
|
```
|
|
641
570
|
|
|
642
|
-
|
|
571
|
+
#### Switch/case
|
|
643
572
|
|
|
644
573
|
Braces in `case` blocks are optional, but if used, indent as shown:
|
|
645
574
|
|
|
@@ -652,7 +581,7 @@ switch (var) {
|
|
|
652
581
|
}
|
|
653
582
|
```
|
|
654
583
|
|
|
655
|
-
|
|
584
|
+
#### Empty loops
|
|
656
585
|
|
|
657
586
|
Use `{}` or `continue`; for empty bodies, not a lone semicolon:
|
|
658
587
|
|
|
@@ -661,15 +590,28 @@ while (condition) {}
|
|
|
661
590
|
while (condition) continue;
|
|
662
591
|
```
|
|
663
592
|
|
|
664
|
-
<br
|
|
593
|
+
<br>
|
|
665
594
|
|
|
666
595
|
# Clang-Format
|
|
667
596
|
|
|
668
597
|
This project uses [clang-format](https://clang.llvm.org/docs/ClangFormat.html) to ensure a consistent code style across all C++ files.
|
|
669
598
|
|
|
599
|
+
## Configuration
|
|
600
|
+
|
|
601
|
+
The formatting style is defined in the `.clang-format` file at the root of the repository. This file specifies rules for indentation, spacing, brace placement, include ordering, and more. The style is based on Google's C++ style guide with some customizations to fit the project's needs. To modify the formatting style, follow these steps:
|
|
602
|
+
|
|
603
|
+
1. **Open** the `.clang-format` file in the root directory.
|
|
604
|
+
2. **Experiment** with different settings using the [Clang-Format Configurator tool](https://clang-format-configurator.site/) or by editing the file directly.
|
|
605
|
+
3. **Apply changes** by copying your updated configuration into the `.clang-format` file.
|
|
606
|
+
4. **Reformat all code** to apply the new style. Use the following command to format every C++ source and header file in the project:
|
|
607
|
+
```bash
|
|
608
|
+
find . -name '*.cpp' -o -name '*.h' | xargs clang-format -i --style=file
|
|
609
|
+
```
|
|
610
|
+
5. **Commit and review:** Commit only the style changes and immediately open a pull request. This keeps formatting changes separate from functional code changes, making reviews easier and reducing merge conflicts.
|
|
611
|
+
|
|
670
612
|
## How to Format Code
|
|
671
613
|
|
|
672
|
-
To
|
|
614
|
+
To format your code using clang-format, run the following command from the root directory of the project:
|
|
673
615
|
|
|
674
616
|
```bash
|
|
675
617
|
clang-format -i --style=file <file1> <file2> ...
|
|
@@ -686,21 +628,6 @@ find . -name '*.cpp' -o -name '*.h' | xargs clang-format -i --style=file
|
|
|
686
628
|
|
|
687
629
|
You can also configure your editor (such as VS Code, CLion, or Vim) to automatically format code on save using clang-format. Refer to your editor’s documentation or extensions/plugins for setup instructions.
|
|
688
630
|
|
|
689
|
-
## Configuration
|
|
690
|
-
|
|
691
|
-
The formatting style is defined in the `.clang-format` file at the root of the repository. This file specifies rules for indentation, spacing, brace placement, include ordering, and more. The style is based on Google's C++ style guide with some customizations to fit the project's needs.
|
|
692
|
-
|
|
693
|
-
### Updating the Style
|
|
694
|
-
|
|
695
|
-
1. **Open** the `.clang-format` file in the root directory.
|
|
696
|
-
2. **Experiment** with different settings using the [Clang-Format Configurator tool](https://clang-format-configurator.site/) or by editing the file directly.
|
|
697
|
-
3. **Apply changes** by copying your updated configuration into the `.clang-format` file.
|
|
698
|
-
4. **Reformat all code** to apply the new style. Use the following command to format every C++ source and header file in the project:
|
|
699
|
-
```bash
|
|
700
|
-
find . -name '*.cpp' -o -name '*.h' | xargs clang-format -i --style=file
|
|
701
|
-
```
|
|
702
|
-
5. **Commit and review:** Commit only the style changes and immediately open a pull request. This keeps formatting changes separate from functional code changes, making reviews easier and reducing merge conflicts.
|
|
703
|
-
|
|
704
631
|
## Best Practices
|
|
705
632
|
|
|
706
633
|
- **Format before committing:** Always run clang-format on your changes before submitting a pull request.
|
|
@@ -709,7 +636,7 @@ The formatting style is defined in the `.clang-format` file at the root of the r
|
|
|
709
636
|
|
|
710
637
|
If you have questions about the formatting rules or need help configuring your editor, ask in the project discussions or open an issue.
|
|
711
638
|
|
|
712
|
-
<br
|
|
639
|
+
<br>
|
|
713
640
|
|
|
714
641
|
# Doxygen Documentation
|
|
715
642
|
|
|
@@ -720,20 +647,8 @@ Effective documentation makes code **readable, maintainable, and teachable**. St
|
|
|
720
647
|
|
|
721
648
|
Write documentation that serves **both** audiences.
|
|
722
649
|
|
|
723
|
-
> **Doxygen usage instructions and tag conventions are detailed in the following sections.**
|
|
724
650
|
> **Note:** This project uses `@` (not `\`) for all Doxygen commands and tags.
|
|
725
651
|
|
|
726
|
-
## How to Generate Doxygen Documentation
|
|
727
|
-
|
|
728
|
-
1. Ensure [Doxygen](https://www.doxygen.nl/) is installed on your system.
|
|
729
|
-
2. From the project root, run:
|
|
730
|
-
```bash
|
|
731
|
-
doxygen Doxyfile
|
|
732
|
-
```
|
|
733
|
-
3. The generated HTML and/or LaTeX documentation will appear in the output directory specified in your `Doxyfile`.
|
|
734
|
-
|
|
735
|
-
For more details on configuring or customizing Doxygen output, see the official [Doxygen manual](https://www.doxygen.nl/manual/index.html) or review the `Doxyfile` in the project root.
|
|
736
|
-
|
|
737
652
|
## Common Doxygen Tags
|
|
738
653
|
|
|
739
654
|
| Tag | Applies to | What it conveys |
|
|
@@ -758,28 +673,47 @@ For more details on configuring or customizing Doxygen output, see the official
|
|
|
758
673
|
| `@def` | macro block | Names the macro when the block is not directly above it. |
|
|
759
674
|
| `@copyright` | file banner | Legal notice or licence statement. |
|
|
760
675
|
|
|
761
|
-
##
|
|
676
|
+
## How to Generate Doxygen Documentation
|
|
677
|
+
|
|
678
|
+
1. Ensure [Doxygen](https://www.doxygen.nl/) is installed on your system.
|
|
679
|
+
2. From the project root, run:
|
|
680
|
+
```bash
|
|
681
|
+
doxygen Doxyfile
|
|
682
|
+
```
|
|
683
|
+
3. The generated HTML and/or LaTeX documentation will appear in the output directory specified in your `Doxyfile`.
|
|
684
|
+
|
|
685
|
+
For more details on configuring or customizing Doxygen output, see the official [Doxygen manual](https://www.doxygen.nl/manual/index.html) or review the `Doxyfile` in the project root.
|
|
686
|
+
|
|
687
|
+
## Documenting Code
|
|
688
|
+
|
|
689
|
+
When documenting code, use Doxygen comments to describe the purpose and behavior of classes, functions, and other entities. Use the following guidelines to ensure clarity and consistency.
|
|
690
|
+
|
|
691
|
+
### Documenting Units for Physical Quantities
|
|
692
|
+
|
|
693
|
+
---
|
|
762
694
|
|
|
763
695
|
When documenting variables that represent physical quantities, **always specify the unit** in the documentation. Use the `@unit` command, which is defined in the `Doxyfile` under `ALIASES`, to standardize unit notation across the codebase. The `@unit` command utilizes MathJax and the [siunitx](https://ctan.org/pkg/siunitx) library for typesetting units.
|
|
764
696
|
|
|
765
|
-
|
|
697
|
+
#### Template
|
|
766
698
|
|
|
767
699
|
```cpp
|
|
768
700
|
type variable_name; ///< Brief description @unit{unit}
|
|
769
701
|
```
|
|
770
702
|
|
|
771
|
-
|
|
703
|
+
#### Example
|
|
772
704
|
|
|
773
705
|
```cpp
|
|
774
706
|
double fan_speed; ///< Fan speed @unit{rpm}
|
|
775
707
|
double density_corrected; ///< Gas density corrected to reference conditions @unit{lb/ft^3}
|
|
776
708
|
```
|
|
777
709
|
|
|
778
|
-
|
|
710
|
+
### Documenting Formulas
|
|
711
|
+
|
|
712
|
+
---
|
|
779
713
|
|
|
780
714
|
When documenting functions, algorithms, or concepts that involve mathematical formulas, use the `@formula` command to typeset equations. This command is defined in the Doxyfile under `ALIASES` and uses MathJax for rendering. The `@formula` command allows you to assign a label to each equation, making it easy to reference equations elsewhere in your documentation.
|
|
781
715
|
|
|
782
|
-
|
|
716
|
+
#### Template
|
|
783
717
|
|
|
784
718
|
```cpp
|
|
785
719
|
/**
|
|
@@ -789,7 +723,7 @@ When documenting functions, algorithms, or concepts that involve mathematical fo
|
|
|
789
723
|
|
|
790
724
|
> The label entered in `equation_label` will be prefixed with `eq:` automatically. To reference the equation in your documentation, use `\eqref{eq:equation_label}`.
|
|
791
725
|
|
|
792
|
-
|
|
726
|
+
#### Example
|
|
793
727
|
|
|
794
728
|
```cpp
|
|
795
729
|
/**
|
|
@@ -798,11 +732,13 @@ When documenting functions, algorithms, or concepts that involve mathematical fo
|
|
|
798
732
|
*/
|
|
799
733
|
```
|
|
800
734
|
|
|
801
|
-
|
|
735
|
+
### File Documentation
|
|
736
|
+
|
|
737
|
+
---
|
|
802
738
|
|
|
803
739
|
Use a **single Doxygen block** at the very top of every header file.
|
|
804
740
|
|
|
805
|
-
|
|
741
|
+
#### Required tags
|
|
806
742
|
|
|
807
743
|
| Tag | Description |
|
|
808
744
|
| ---------- | ---------------------------------------------------- |
|
|
@@ -811,11 +747,11 @@ Use a **single Doxygen block** at the very top of every header file.
|
|
|
811
747
|
| `@ingroup` | Module or package this file belongs to |
|
|
812
748
|
| `@brief` | One-sentence purpose |
|
|
813
749
|
|
|
814
|
-
|
|
750
|
+
#### Optional tags
|
|
815
751
|
|
|
816
752
|
`@details`, `@note`, `@deprecated`, `@bug`, `@see`, `@copyright`
|
|
817
753
|
|
|
818
|
-
|
|
754
|
+
#### Template
|
|
819
755
|
|
|
820
756
|
```cpp
|
|
821
757
|
/**
|
|
@@ -835,7 +771,7 @@ Use a **single Doxygen block** at the very top of every header file.
|
|
|
835
771
|
*/
|
|
836
772
|
```
|
|
837
773
|
|
|
838
|
-
|
|
774
|
+
#### Example
|
|
839
775
|
|
|
840
776
|
```cpp
|
|
841
777
|
/**
|
|
@@ -855,11 +791,13 @@ Use a **single Doxygen block** at the very top of every header file.
|
|
|
855
791
|
*/
|
|
856
792
|
```
|
|
857
793
|
|
|
858
|
-
|
|
794
|
+
### Function & Method Documentation
|
|
795
|
+
|
|
796
|
+
---
|
|
859
797
|
|
|
860
798
|
Use a **Doxygen block** above each public function or method declaration in header files. This applies to both free functions and member functions of classes or structs.
|
|
861
799
|
|
|
862
|
-
|
|
800
|
+
#### Required tags
|
|
863
801
|
|
|
864
802
|
| Tag | Description |
|
|
865
803
|
| ------------ | ------------------------------------------------------------ |
|
|
@@ -867,11 +805,11 @@ Use a **Doxygen block** above each public function or method declaration in head
|
|
|
867
805
|
| `@param[in]` | Input parameter (`@param[out]` / `@param[in,out]` as needed) |
|
|
868
806
|
| `@return` | Meaning of the return value (omit for `void`) |
|
|
869
807
|
|
|
870
|
-
|
|
808
|
+
#### Optional tags
|
|
871
809
|
|
|
872
810
|
`@details`, `@tparam`, `@throws`, `@note`, `@deprecated`, `@bug`, `@see`
|
|
873
811
|
|
|
874
|
-
|
|
812
|
+
#### Template
|
|
875
813
|
|
|
876
814
|
```cpp
|
|
877
815
|
/**
|
|
@@ -893,7 +831,7 @@ Use a **Doxygen block** above each public function or method declaration in head
|
|
|
893
831
|
*/
|
|
894
832
|
```
|
|
895
833
|
|
|
896
|
-
|
|
834
|
+
#### Example
|
|
897
835
|
|
|
898
836
|
```cpp
|
|
899
837
|
/**
|
|
@@ -910,11 +848,13 @@ template <typename Point2D>
|
|
|
910
848
|
std::size_t Polygon::AddVertex(const Point2D& p);
|
|
911
849
|
```
|
|
912
850
|
|
|
913
|
-
|
|
851
|
+
### Class & Struct Documentation
|
|
852
|
+
|
|
853
|
+
---
|
|
914
854
|
|
|
915
855
|
Use a **Doxygen block** above each public `class` or `struct` declaration in header files and use `///<` for member notes.
|
|
916
856
|
|
|
917
|
-
|
|
857
|
+
#### Required tags
|
|
918
858
|
|
|
919
859
|
| Tag | Description |
|
|
920
860
|
| ------------------------- | -------------------- |
|
|
@@ -922,11 +862,11 @@ Use a **Doxygen block** above each public `class` or `struct` declaration in hea
|
|
|
922
862
|
| `@ingroup` | Module or package |
|
|
923
863
|
| `@brief` | One-sentence purpose |
|
|
924
864
|
|
|
925
|
-
|
|
865
|
+
#### Optional tags
|
|
926
866
|
|
|
927
867
|
`@details`, `@tparam`, `@note`, `@deprecated`, `@bug`, `@see`
|
|
928
868
|
|
|
929
|
-
|
|
869
|
+
#### Template
|
|
930
870
|
|
|
931
871
|
```cpp
|
|
932
872
|
/**
|
|
@@ -945,7 +885,7 @@ Use a **Doxygen block** above each public `class` or `struct` declaration in hea
|
|
|
945
885
|
*/
|
|
946
886
|
```
|
|
947
887
|
|
|
948
|
-
|
|
888
|
+
#### Example
|
|
949
889
|
|
|
950
890
|
```cpp
|
|
951
891
|
/**
|
|
@@ -994,28 +934,32 @@ private:
|
|
|
994
934
|
};
|
|
995
935
|
```
|
|
996
936
|
|
|
997
|
-
|
|
937
|
+
### Data-Member Documentation
|
|
938
|
+
|
|
939
|
+
---
|
|
998
940
|
|
|
999
941
|
Use **inline-after comments with `///<`** for one-line descriptions of data members and individual enum values. This applies to both classes and structs.
|
|
1000
942
|
|
|
1001
|
-
|
|
943
|
+
#### Template
|
|
1002
944
|
|
|
1003
945
|
```cpp
|
|
1004
946
|
Type name_; ///< <Concise purpose>
|
|
1005
947
|
```
|
|
1006
948
|
|
|
1007
|
-
|
|
949
|
+
#### Example
|
|
1008
950
|
|
|
1009
951
|
```cpp
|
|
1010
952
|
size_t count_ {0}; ///< Current vertex count
|
|
1011
953
|
std::vector<Vec2> verts_; ///< Vertices in counter-clockwise order
|
|
1012
954
|
```
|
|
1013
955
|
|
|
1014
|
-
|
|
956
|
+
### Enumeration Documentation
|
|
957
|
+
|
|
958
|
+
---
|
|
1015
959
|
|
|
1016
960
|
Document the **enum type** with a block comment; document each **enumerator** with `///<`. If an enum has only a few obvious values (e.g. `Clockwise`, `CounterClockwise`), the inline docs may be omitted.
|
|
1017
961
|
|
|
1018
|
-
|
|
962
|
+
#### Required tags
|
|
1019
963
|
|
|
1020
964
|
| Tag | Description |
|
|
1021
965
|
| ---------- | -------------------- |
|
|
@@ -1023,11 +967,11 @@ Document the **enum type** with a block comment; document each **enumerator** wi
|
|
|
1023
967
|
| `@ingroup` | Module or package |
|
|
1024
968
|
| `@brief` | One-sentence purpose |
|
|
1025
969
|
|
|
1026
|
-
|
|
970
|
+
#### Optional tags
|
|
1027
971
|
|
|
1028
972
|
`@details`, `@note`, `@deprecated`, `@bug`, `@see`
|
|
1029
973
|
|
|
1030
|
-
|
|
974
|
+
#### Template
|
|
1031
975
|
|
|
1032
976
|
```cpp
|
|
1033
977
|
/**
|
|
@@ -1045,7 +989,7 @@ Document the **enum type** with a block comment; document each **enumerator** wi
|
|
|
1045
989
|
*/
|
|
1046
990
|
```
|
|
1047
991
|
|
|
1048
|
-
|
|
992
|
+
#### Example
|
|
1049
993
|
|
|
1050
994
|
```cpp
|
|
1051
995
|
/**
|
|
@@ -1060,31 +1004,32 @@ enum class Axis {
|
|
|
1060
1004
|
};
|
|
1061
1005
|
```
|
|
1062
1006
|
|
|
1063
|
-
|
|
1007
|
+
### Constant Documentation
|
|
1008
|
+
|
|
1009
|
+
---
|
|
1064
1010
|
|
|
1065
1011
|
Document global constants with an **inline-after** comment.
|
|
1066
1012
|
|
|
1067
|
-
|
|
1013
|
+
#### Template
|
|
1068
1014
|
|
|
1069
1015
|
```cpp
|
|
1070
1016
|
constexpr Type kConstName ///< <Concise purpose>
|
|
1071
1017
|
```
|
|
1072
1018
|
|
|
1073
|
-
|
|
1019
|
+
#### Example
|
|
1074
1020
|
|
|
1075
1021
|
```cpp
|
|
1076
1022
|
constexpr double kPi = 3.141592653589793; ///< Circle ratio @unit{radians}
|
|
1077
1023
|
inline const Vec2 kOrigin {0.0, 0.0}; ///< Reference point (0,0)
|
|
1078
1024
|
```
|
|
1079
1025
|
|
|
1080
|
-
|
|
1026
|
+
### Namespace Documentation
|
|
1081
1027
|
|
|
1082
|
-
|
|
1083
|
-
## Namespace Documentation
|
|
1028
|
+
---
|
|
1084
1029
|
|
|
1085
1030
|
Namespaces are used to organize code into logical groups and prevent name collisions. Each namespace should be documented with a **single Doxygen block** placed at the top of the header file where the namespace is defined. This block describes the purpose, scope, and any relevant notes about the namespace.
|
|
1086
1031
|
|
|
1087
|
-
|
|
1032
|
+
#### Required tags
|
|
1088
1033
|
|
|
1089
1034
|
| Tag | Description |
|
|
1090
1035
|
| ------------ | -------------------- |
|
|
@@ -1092,11 +1037,11 @@ Namespaces are used to organize code into logical groups and prevent name collis
|
|
|
1092
1037
|
| `@ingroup` | Module or package |
|
|
1093
1038
|
| `@brief` | One-sentence purpose |
|
|
1094
1039
|
|
|
1095
|
-
|
|
1040
|
+
#### Optional tags
|
|
1096
1041
|
|
|
1097
1042
|
`@details`, `@note`, `@deprecated`, `@bug`, `@see`
|
|
1098
1043
|
|
|
1099
|
-
|
|
1044
|
+
#### Template
|
|
1100
1045
|
|
|
1101
1046
|
```cpp
|
|
1102
1047
|
/**
|
|
@@ -1114,7 +1059,7 @@ Namespaces are used to organize code into logical groups and prevent name collis
|
|
|
1114
1059
|
*/
|
|
1115
1060
|
```
|
|
1116
1061
|
|
|
1117
|
-
|
|
1062
|
+
#### Example
|
|
1118
1063
|
|
|
1119
1064
|
```cpp
|
|
1120
1065
|
/**
|
|
@@ -1125,24 +1070,26 @@ Namespaces are used to organize code into logical groups and prevent name collis
|
|
|
1125
1070
|
namespace geom { /* ... */ }
|
|
1126
1071
|
```
|
|
1127
1072
|
|
|
1128
|
-
|
|
1073
|
+
### Module (Group) Documentation
|
|
1074
|
+
|
|
1075
|
+
---
|
|
1129
1076
|
|
|
1130
1077
|
Modules (or groups) are collections of related namespaces, classes, and functions that together provide a high-level overview of a particular area of functionality in the codebase. Modules help organize documentation, making it easier for users and contributors to understand the structure and purpose of different parts of the project.
|
|
1131
1078
|
|
|
1132
1079
|
Each module should be documented with a **single Doxygen block** placed in a central documentation file (such as `mainpage.dox`). This block defines the module and provides an overview of its contents, design philosophy, and any relevant notes or references. All related code elements (namespaces, classes, functions, etc.) should reference the module using the `@ingroup` tag in their own documentation blocks to associate them with the appropriate group.
|
|
1133
1080
|
|
|
1134
|
-
|
|
1081
|
+
#### Required tags
|
|
1135
1082
|
|
|
1136
1083
|
| Tag | Description |
|
|
1137
1084
|
| ----------- | ------------------------------ |
|
|
1138
1085
|
| `@defgroup` | `<GroupName>` and display text |
|
|
1139
1086
|
| `@brief` | One-sentence description |
|
|
1140
1087
|
|
|
1141
|
-
|
|
1088
|
+
#### Optional tags
|
|
1142
1089
|
|
|
1143
1090
|
`@details`, `@note`, `@deprecated`, `@bug`, `@see`
|
|
1144
1091
|
|
|
1145
|
-
|
|
1092
|
+
#### Template
|
|
1146
1093
|
|
|
1147
1094
|
```cpp
|
|
1148
1095
|
/**
|
|
@@ -1159,7 +1106,7 @@ Each module should be documented with a **single Doxygen block** placed in a cen
|
|
|
1159
1106
|
*/
|
|
1160
1107
|
```
|
|
1161
1108
|
|
|
1162
|
-
|
|
1109
|
+
#### Example
|
|
1163
1110
|
|
|
1164
1111
|
```cpp
|
|
1165
1112
|
/**
|
|
@@ -1171,15 +1118,15 @@ Each module should be documented with a **single Doxygen block** placed in a cen
|
|
|
1171
1118
|
*/
|
|
1172
1119
|
```
|
|
1173
1120
|
|
|
1174
|
-
<br
|
|
1121
|
+
<br>
|
|
1175
1122
|
|
|
1176
1123
|
# Conventional Commits
|
|
1177
1124
|
|
|
1178
|
-
|
|
1125
|
+
This project follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for commit messages to ensure clarity, consistency, and automation in version control. This helps in generating changelogs, automating releases, and improving collaboration among contributors.
|
|
1179
1126
|
|
|
1180
1127
|
## Commit Format
|
|
1181
1128
|
|
|
1182
|
-
|
|
1129
|
+
Each commit message should follow this format:
|
|
1183
1130
|
|
|
1184
1131
|
```
|
|
1185
1132
|
<type>(<optional scopes>): <description>
|
|
@@ -1191,6 +1138,8 @@ Conventional Commits provide a structured commit message format to improve reada
|
|
|
1191
1138
|
|
|
1192
1139
|
## Commit Types
|
|
1193
1140
|
|
|
1141
|
+
Commit types indicate the nature of the changes made in the commit. They help categorize changes and provide context for reviewers and automated tools. The following types are used:
|
|
1142
|
+
|
|
1194
1143
|
- **`build`**: Changes that affect the build system or external dependencies.
|
|
1195
1144
|
- **`chore`**: Other changes that don't modify src or tests (e.g., config updates).
|
|
1196
1145
|
- **`ci`**: Changes to our CI configuration files and scripts.
|
|
@@ -1206,7 +1155,8 @@ Conventional Commits provide a structured commit message format to improve reada
|
|
|
1206
1155
|
|
|
1207
1156
|
## Commit Scopes
|
|
1208
1157
|
|
|
1209
|
-
Scopes indicate the specific module, component, or area affected by the commit. They help in understanding the reach of changes within the codebase.
|
|
1158
|
+
Scopes indicate the specific module, component, or area affected by the commit. They help in understanding the reach of changes within the codebase. The following scopes are used:
|
|
1159
|
+
|
|
1210
1160
|
- **`clang-format`**
|
|
1211
1161
|
- **`cli`**
|
|
1212
1162
|
- **`cmake`**
|
|
@@ -1229,26 +1179,26 @@ Scopes indicate the specific module, component, or area affected by the commit.
|
|
|
1229
1179
|
- **`wasteWater`**
|
|
1230
1180
|
- **`vscode`**
|
|
1231
1181
|
|
|
1232
|
-
|
|
1182
|
+
When a commit affects multiple areas, you can specify multiple scopes separated by a comma and a space:
|
|
1233
1183
|
|
|
1234
|
-
When a commit affects multiple areas, separate scopes with a comma and a space:
|
|
1235
1184
|
```
|
|
1236
1185
|
feat(cli, docs): add new command to generate reports
|
|
1237
1186
|
```
|
|
1238
1187
|
|
|
1239
1188
|
## Breaking Changes
|
|
1240
1189
|
|
|
1241
|
-
If a commit introduces breaking changes, it must be indicated in the type/scope prefix of a commit, or as an entry in the footer.
|
|
1242
|
-
- If included as a footer, a breaking change MUST consist of the uppercase text **`BREAKING CHANGE`**, followed by a colon, space, and description:
|
|
1190
|
+
If a commit introduces breaking changes, it must be indicated in the `type/scope` prefix of a commit, or as an entry in the footer.
|
|
1243
1191
|
|
|
1244
|
-
|
|
1245
|
-
feat: allow provided config object to extend other configs
|
|
1192
|
+
If included as a footer, a breaking change **MUST** consist of the uppercase text **`BREAKING CHANGE`**, followed by a colon, space, and description:
|
|
1246
1193
|
|
|
1247
|
-
|
|
1248
|
-
|
|
1194
|
+
```
|
|
1195
|
+
feat: allow provided config object to extend other configs
|
|
1196
|
+
|
|
1197
|
+
BREAKING CHANGE: `extends` key in config file is now used for extending other config files
|
|
1198
|
+
```
|
|
1249
1199
|
|
|
1250
|
-
|
|
1200
|
+
If included in the `type/scope` prefix, breaking changes **MUST** be indicated by a **`!`** immediately before the **`:`**. If **`!`** is used, **`BREAKING CHANGE:`** **MAY** be omitted from the footer section, and the commit description **SHALL** be used to describe the breaking change:
|
|
1251
1201
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1202
|
+
```
|
|
1203
|
+
feat!: send an email to the customer when a product is shipped
|
|
1204
|
+
```
|
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
MEASUR Tools Suite
|
|
2
|
-
---------------
|
|
1
|
+
# MEASUR Tools Suite
|
|
3
2
|
|
|
4
3
|
## Update (07/03/2025)
|
|
5
4
|
|
|
@@ -16,7 +15,9 @@ Hosted documentation can be found at [https://industrialresources.ornl.gov/measu
|
|
|
16
15
|
The npm packages can be downloaded and install from [registry](https://www.npmjs.com/package/measur-tools-suite)
|
|
17
16
|
|
|
18
17
|
### Dependencies
|
|
18
|
+
|
|
19
19
|
#### C++
|
|
20
|
+
|
|
20
21
|
- make
|
|
21
22
|
- CMake (cmake-curses to use the ccmake gui)
|
|
22
23
|
- GCC 4.8.5 or later
|
|
@@ -24,12 +25,15 @@ The npm packages can be downloaded and install from [registry](https://www.npmjs
|
|
|
24
25
|
- Doxygen (only for building documentation)
|
|
25
26
|
|
|
26
27
|
#### Web Assembly Compilation SDK
|
|
28
|
+
|
|
27
29
|
- Emscripten (emsdk) - Follow instructions for install https://emscripten.org/docs/getting_started/downloads.html
|
|
28
30
|
|
|
29
31
|
#### Node
|
|
32
|
+
|
|
30
33
|
- Node LTS [https://nodejs.org/en/](https://nodejs.org/en/)
|
|
31
34
|
|
|
32
35
|
### Building
|
|
36
|
+
|
|
33
37
|
- `cd` into the emsdk directory:
|
|
34
38
|
- run `./emsdk install latest` followed by `./emsdk activate latest`
|
|
35
39
|
- Activate PATH and other environment variables by running `source ./emsdk_env.sh` or on Windows run `emsdk_env.bat`
|
|
@@ -41,6 +45,7 @@ The npm packages can be downloaded and install from [registry](https://www.npmjs
|
|
|
41
45
|
- run `emmake make`
|
|
42
46
|
|
|
43
47
|
### Unit Tests
|
|
48
|
+
|
|
44
49
|
- To run the WASM unit tests:
|
|
45
50
|
- Install node_modules dependencies: `cd` into MEASUR-Tools-Suite directory and
|
|
46
51
|
run `npm install` followed by `npm run test-wasm`
|
|
@@ -54,15 +59,19 @@ The npm packages can be downloaded and install from [registry](https://www.npmjs
|
|
|
54
59
|
- On MacOS or Linux, the test executable can be found under the `bin` directory. On Windows, the executable can be found under either the `Debug` or `Release` directories, depending on CMake configuration
|
|
55
60
|
|
|
56
61
|
### Packaging
|
|
62
|
+
|
|
57
63
|
- Enable the `BUILD_PACKAGE` flag in the CMakeCache, then `cmake ./` then `make package`
|
|
58
64
|
- Or use this directly for Windows: `cmake -D BUILD_TESTING:BOOL=OFF ./` and `cmake --build . --config Release --target PACKAGE`
|
|
59
65
|
- To make package on Linux or Mac, run `ccmake.` and set BUILD_TESTING OFF, BUILD_PACKAGE ON, then configure and generate. Then `make package`.
|
|
60
66
|
|
|
61
67
|
### Documentation
|
|
68
|
+
|
|
62
69
|
- To generate documentation: `doxygen Doxyfile`
|
|
63
70
|
|
|
64
71
|
### Dockerizing
|
|
65
|
-
|
|
72
|
+
|
|
73
|
+
To make it easy for developers local building and testing, it is dockerized. To run it in docker follow these steps.
|
|
74
|
+
|
|
66
75
|
- Download the repository
|
|
67
76
|
- Open command line tool, change directory to the repository run `docker compose up -d`
|
|
68
77
|
- To stop the running container run `docker compose down`
|
package/bin/package.json
CHANGED
package/docs/mainpage.dox
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @mainpage MEASUR Tools Suite
|
|
3
3
|
*
|
|
4
|
-
* MEASUR is a suite that includes a set of key software platforms and more than
|
|
4
|
+
* MEASUR is a suite that includes a set of key software platforms and more than 80 calculators. Together, these tools
|
|
5
5
|
* can help manufacturers improve industrial system efficiency and identify potential savings opportunities.
|
|
6
6
|
*
|
|
7
7
|
* The software platforms in MEASUR are major updates to the system assessment tools developed by the department in the
|
|
@@ -22,16 +22,19 @@
|
|
|
22
22
|
* - @ref CompressedAirAssessments
|
|
23
23
|
* - @ref EnergyTreasureHuntModule
|
|
24
24
|
* - @ref SimpleEquipmentAndPropertyCalculators
|
|
25
|
+
* - @ref WasteWaterAssessments
|
|
26
|
+
* - @ref WaterAssessments
|
|
27
|
+
* - @ref ProcessCoolingAssessments
|
|
25
28
|
*
|
|
26
29
|
* @defgroup PumpingSystemAssessments Pumping System Assessments
|
|
27
30
|
*
|
|
28
31
|
* This portion of MEASUR includes tools such as the Pump System Assessment Tool (PSAT) and related calculators.
|
|
29
32
|
* MEASUR's pumping system tool helps evaluate the potential energy savings opportunities of pumping systems based on
|
|
30
|
-
* field-measured data. The tool enables users to
|
|
31
|
-
*
|
|
32
|
-
* to determine which would be the most energetically beneficial.
|
|
33
|
-
*
|
|
34
|
-
*
|
|
33
|
+
* field-measured data. The tool enables users to estimate system efficiency, energy use and cost, as well as create pump and system curves.
|
|
34
|
+
* They are intended to help industrial users assess different system modifications
|
|
35
|
+
* to determine which would be the most energetically beneficial. The what-if analysis helps users determine energy savings for different
|
|
36
|
+
* potential energy efficiency measures or test the automatic optimizer functionality, built on curves from the Hydraulic Institute (HI) and motor performance data.
|
|
37
|
+
* All MEASUR tools have extensive help text and the ability to share analyses with others.
|
|
35
38
|
*
|
|
36
39
|
* @defgroup ProcessHeatingAssessments Process Heating Assessments
|
|
37
40
|
*
|
|
@@ -39,8 +42,7 @@
|
|
|
39
42
|
* calculators. This tool introduces methods to improve thermal and electrical efficiency of process heating equipment.
|
|
40
43
|
* Industrial users can survey process heating equipment consuming fuel or electricity, and identify the most
|
|
41
44
|
* energy-intensive equipment. This tool can be used to perform a heat balance that identifies major areas of energy use
|
|
42
|
-
* under various operating conditions and test "what-if" scenarios for various options to reduce energy use.
|
|
43
|
-
* portion of MEASUR includes legacy tools developed by the department over the preceding decades, including PHAST.
|
|
45
|
+
* under various operating conditions and test "what-if" scenarios for various options to reduce energy use.
|
|
44
46
|
*
|
|
45
47
|
* @defgroup FanSystemAssessments Fan System Assessments
|
|
46
48
|
*
|
|
@@ -48,8 +50,7 @@
|
|
|
48
50
|
* tool helps users identify and evaluate the potential energy savings opportunities in fan systems. Industrial users
|
|
49
51
|
* can assess various system modifications to determine optimal system configurations and allows users to test
|
|
50
52
|
* customized "what-if" operating scenarios to minimize energy consumption. Alternatively, users can utilize the
|
|
51
|
-
* automatic optimizer functionality which is built upon published fan efficiency data and motor performance data.
|
|
52
|
-
* portion of MEASUR includes legacy tools developed by the department over the preceding decades, including FSAT.
|
|
53
|
+
* automatic optimizer functionality which is built upon published fan efficiency data and motor performance data.
|
|
53
54
|
*
|
|
54
55
|
* @defgroup SteamSystemAssessments Steam System Assessments
|
|
55
56
|
*
|
|
@@ -57,16 +58,14 @@
|
|
|
57
58
|
* and evaluate the potential energy savings opportunities in steam systems. Industrial users can better understand the
|
|
58
59
|
* current operating conditions of the components of a steam system, including boilers, turbines and flash tanks. The
|
|
59
60
|
* tool helps estimate the various steam flows throughout the system and test "what-if" scenarios for various
|
|
60
|
-
* opportunities to reduce energy use.
|
|
61
|
-
* preceding decades, including SSAT/SSMT.
|
|
61
|
+
* opportunities to reduce energy use.
|
|
62
62
|
*
|
|
63
63
|
* @defgroup CompressedAirAssessments Compressed Air Assessments
|
|
64
64
|
*
|
|
65
65
|
* This portion of MEASUR includes tools such as AirMaster+ and related calculators. MEASUR includes a series of tools
|
|
66
66
|
* that help users analyze energy use and savings opportunities in industrial compressed air systems. They can baseline
|
|
67
67
|
* existing and model future system operations improvements, and evaluate energy and dollar savings from many energy
|
|
68
|
-
* efficiency measures.
|
|
69
|
-
* decades, including the AirMaster+.
|
|
68
|
+
* efficiency measures.
|
|
70
69
|
*
|
|
71
70
|
* @defgroup EnergyTreasureHuntModule Energy Treasure Hunt Module
|
|
72
71
|
*
|
|
@@ -80,9 +79,31 @@
|
|
|
80
79
|
*
|
|
81
80
|
* @defgroup SimpleEquipmentAndPropertyCalculators Simple Equipment and Property Calculators
|
|
82
81
|
*
|
|
83
|
-
* The MEASUR software contains over
|
|
82
|
+
* The MEASUR software contains over 80 equipment and property calculators for simple energy-related calculations and
|
|
84
83
|
* analyses. These calculators can aid users in identifying, assessing, and quantifying simple energy-saving
|
|
85
|
-
* opportunities within a variety of systems, including
|
|
84
|
+
* opportunities within a variety of systems, including pump, fan, process heating, steam, motors, compressed air, and
|
|
86
85
|
* lighting systems. In addition, there are several general engineering calculators included to perform energy-related
|
|
87
86
|
* calculations and conversions.
|
|
87
|
+
*
|
|
88
|
+
* @defgroup WasteWaterAssessments Waste Water Assessments
|
|
89
|
+
*
|
|
90
|
+
* This portion of MEASUR includes tools such as the Bio-tiger wastewater model and related calculators. This tool helps users identify
|
|
91
|
+
* and evaluate the potential energy savings opportunities in the aeration stage of large-scale wastewater treatment systems.
|
|
92
|
+
* Industrial users can better understand the current oxygen requirements, supply, and aeration operating conditions of the system: the aeration tank and secondary clarifier.
|
|
93
|
+
* The tool helps understand the Monod kinetics and mass balances of the activated sludge process and test "what-if" scenarios for various
|
|
94
|
+
* opportunities to reduce energy use.
|
|
95
|
+
*
|
|
96
|
+
* @defgroup WaterAssessments Water Assessments
|
|
97
|
+
*
|
|
98
|
+
* This portion of MEASUR includes tools such as the Plant Water Profiler (PWP) and the water diagram
|
|
99
|
+
* This tool helps users create a water flow diagram and water balance, as well as calculate the true cost of water for a facility.
|
|
100
|
+
* This can help users identify systems that contribute the most toward waster intake and the true cost to target for water efficiency measures.
|
|
101
|
+
*
|
|
102
|
+
* @defgroup ProcessCoolingAssessments Process Cooling Assessments
|
|
103
|
+
*
|
|
104
|
+
* This portion of MEASUR includes tools such as the Chilled Water System Assessment (CWSA) tool and releated calculators.
|
|
105
|
+
* This tool helps users understand and evalute the potential energy savings opportunities of chillers and process cooling systems.
|
|
106
|
+
* Industrial users can better understand the current operating conditions of the components of a process cooling system, including chillers, cooling towers, and pumps.
|
|
107
|
+
* The tool helps estimate the year-round operating conditions and test "what-if" scenarios for various opportunities to reduce energy use.
|
|
108
|
+
*
|
|
88
109
|
*/
|