measur-tools-suite 1.0.11-beta.56 → 1.0.11-beta.60
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 +50 -69
- package/EMSCRIPTEN_BINDINGS_CHANGES.md +1 -1
- package/README.md +30 -25
- package/bin/client.wasm +0 -0
- package/bin/package.json +1 -1
- package/contributing/style-guide.md +51 -70
- package/docs/dependencies/mathjax-config.js +1 -1
- package/package.json +1 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -410,7 +410,7 @@ void processData(const std::vector<int>& data) {
|
|
|
410
410
|
|
|
411
411
|
## Naming
|
|
412
412
|
|
|
413
|
-
|
|
413
|
+
Use the following naming conventions for various elements in the codebase to ensure consistency and readability.
|
|
414
414
|
|
|
415
415
|
<!-- START mdsplit-ignore -->
|
|
416
416
|
**[Return to Index](#style-guide-index)**
|
|
@@ -418,16 +418,10 @@ Naming conventions are crucial for maintaining a consistent and readable codebas
|
|
|
418
418
|
|
|
419
419
|
### Files
|
|
420
420
|
|
|
421
|
-
Use `snake_case` suffixed with the appropriate file extension (`.h`, `.hpp`, or `.cpp`) for file names
|
|
422
|
-
|
|
423
|
-
```cpp
|
|
424
|
-
my_class.h
|
|
425
|
-
my_class.cpp
|
|
426
|
-
```
|
|
421
|
+
Use `snake_case` suffixed with the appropriate file extension (`.h`, `.hpp`, or `.cpp`) for file names (e.g., `my_class.h`, `my_class.cpp`).
|
|
427
422
|
|
|
428
423
|
> [!NOTE]
|
|
429
|
-
> This project uses `.h` for header files and `.cpp` for source files.
|
|
430
|
-
> File names should be descriptive and reflect the content or purpose of the file.
|
|
424
|
+
> This project uses `.h` for header files and `.cpp` for source files.
|
|
431
425
|
|
|
432
426
|
<!-- START mdsplit-ignore -->
|
|
433
427
|
**[Return to Index](#style-guide-index)**
|
|
@@ -435,20 +429,7 @@ my_class.cpp
|
|
|
435
429
|
|
|
436
430
|
### Namespaces
|
|
437
431
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
```cpp
|
|
441
|
-
namespace my_project {
|
|
442
|
-
namespace utils {
|
|
443
|
-
|
|
444
|
-
// Utility functions go here.
|
|
445
|
-
|
|
446
|
-
} // namespace utils
|
|
447
|
-
} // namespace my_project
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
> [!NOTE]
|
|
451
|
-
> All code in the namespace should be under one or more directories with the same name as the namespace.
|
|
432
|
+
Use `snake_case` for namespace names (e.g., `my_project`, `utils`).
|
|
452
433
|
|
|
453
434
|
<!-- START mdsplit-ignore -->
|
|
454
435
|
**[Return to Index](#style-guide-index)**
|
|
@@ -456,17 +437,7 @@ namespace utils {
|
|
|
456
437
|
|
|
457
438
|
### Classes and Structs
|
|
458
439
|
|
|
459
|
-
Use `PascalCase` for class and struct names
|
|
460
|
-
|
|
461
|
-
```cpp
|
|
462
|
-
class MyClass {
|
|
463
|
-
// Class members
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
struct MyStruct {
|
|
467
|
-
// Struct members
|
|
468
|
-
};
|
|
469
|
-
```
|
|
440
|
+
Use `PascalCase` for class and struct names (e.g., `MyClass`, `MyStruct`).
|
|
470
441
|
|
|
471
442
|
<!-- START mdsplit-ignore -->
|
|
472
443
|
**[Return to Index](#style-guide-index)**
|
|
@@ -474,14 +445,24 @@ struct MyStruct {
|
|
|
474
445
|
|
|
475
446
|
### Functions and Methods
|
|
476
447
|
|
|
477
|
-
Use `camelCase` for function and method names
|
|
448
|
+
Use `camelCase` for function and method names (e.g., `myFunction`, `computeArea`).
|
|
478
449
|
|
|
479
|
-
|
|
480
|
-
|
|
450
|
+
Use verbs or verb phrases for function names to indicate actions.
|
|
451
|
+
|
|
452
|
+
- Accessor methods (getters) should be named after the property they return, without a `get` prefix (e.g., `eyeColor()`).
|
|
453
|
+
- Mutator methods (setters) should be named with a `set` prefix followed by the property name (e.g., `setEyeColor()`).
|
|
481
454
|
|
|
482
|
-
|
|
455
|
+
#### Example
|
|
456
|
+
|
|
457
|
+
```cpp
|
|
458
|
+
class Dog {
|
|
483
459
|
public:
|
|
484
|
-
|
|
460
|
+
std::string eyeColor() const { return eye_color_; } // Accessor for eye_color_
|
|
461
|
+
|
|
462
|
+
void setEyeColor(const std::string& color) { eye_color_ = color; } // Mutator for eye_color_
|
|
463
|
+
|
|
464
|
+
private:
|
|
465
|
+
std::string eye_color_;
|
|
485
466
|
};
|
|
486
467
|
```
|
|
487
468
|
|
|
@@ -491,7 +472,9 @@ public:
|
|
|
491
472
|
|
|
492
473
|
### Variables
|
|
493
474
|
|
|
494
|
-
|
|
475
|
+
Use `snake_case` for variable names and function parameters.
|
|
476
|
+
|
|
477
|
+
#### Example
|
|
495
478
|
|
|
496
479
|
```cpp
|
|
497
480
|
void processData(int input_value) {
|
|
@@ -505,37 +488,27 @@ void processData(int input_value) {
|
|
|
505
488
|
|
|
506
489
|
### Member Variables
|
|
507
490
|
|
|
508
|
-
|
|
491
|
+
Use `snake_case` for member variable names, with a trailing underscore (`_`) to distinguish them from local variables and parameters.
|
|
509
492
|
|
|
510
|
-
|
|
493
|
+
#### Example
|
|
511
494
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
2. `m_` prefix:
|
|
521
|
-
|
|
522
|
-
```cpp
|
|
523
|
-
class MyClass {
|
|
524
|
-
private:
|
|
525
|
-
int m_value;
|
|
526
|
-
std::string m_name;
|
|
527
|
-
};
|
|
528
|
-
```
|
|
495
|
+
```cpp
|
|
496
|
+
class Dog {
|
|
497
|
+
private:
|
|
498
|
+
std::string name_;
|
|
499
|
+
int age_;
|
|
500
|
+
std::string eye_color_;
|
|
501
|
+
};
|
|
502
|
+
```
|
|
529
503
|
|
|
530
|
-
|
|
531
|
-
> This project uses the underscore suffix convention for class member variables.
|
|
504
|
+
Use `snake_case` for struct member variables without a trailing underscore.
|
|
532
505
|
|
|
533
|
-
|
|
506
|
+
#### Example
|
|
534
507
|
|
|
535
508
|
```cpp
|
|
536
|
-
struct
|
|
537
|
-
|
|
538
|
-
|
|
509
|
+
struct Point2 {
|
|
510
|
+
double x;
|
|
511
|
+
double y;
|
|
539
512
|
};
|
|
540
513
|
```
|
|
541
514
|
|
|
@@ -545,7 +518,9 @@ struct MyStruct {
|
|
|
545
518
|
|
|
546
519
|
### Constants and Enums
|
|
547
520
|
|
|
548
|
-
Use `PascalCase` for enum names and `PascalCase` prefixed with `k` for constants and enum values
|
|
521
|
+
Use `PascalCase` for enum names and `PascalCase` prefixed with `k` for constants and enum values.
|
|
522
|
+
|
|
523
|
+
#### Example
|
|
549
524
|
|
|
550
525
|
```cpp
|
|
551
526
|
enum class Color {
|
|
@@ -564,7 +539,9 @@ constexpr double kPi = 3.14159;
|
|
|
564
539
|
|
|
565
540
|
### Aliases
|
|
566
541
|
|
|
567
|
-
Use `PascalCase` for type aliases
|
|
542
|
+
Use `PascalCase` for type aliases.
|
|
543
|
+
|
|
544
|
+
#### Example
|
|
568
545
|
|
|
569
546
|
```cpp
|
|
570
547
|
using StringList = std::vector<std::string>;
|
|
@@ -576,7 +553,9 @@ using StringList = std::vector<std::string>;
|
|
|
576
553
|
|
|
577
554
|
### Templates
|
|
578
555
|
|
|
579
|
-
Use `PascalCase` for template parameters
|
|
556
|
+
Use `PascalCase` for template parameters.
|
|
557
|
+
|
|
558
|
+
#### Example
|
|
580
559
|
|
|
581
560
|
```cpp
|
|
582
561
|
template <typename InputType>
|
|
@@ -589,7 +568,9 @@ InputType processInput(InputType input);
|
|
|
589
568
|
|
|
590
569
|
### Macros
|
|
591
570
|
|
|
592
|
-
Use `UPPER_CASE` with a project-specific prefix for macro names
|
|
571
|
+
Use `UPPER_CASE` with a project-specific prefix for macro names.
|
|
572
|
+
|
|
573
|
+
#### Example
|
|
593
574
|
|
|
594
575
|
```cpp
|
|
595
576
|
#define MYPROJECT_MAX(a, b) ((a) > (b) ? (a) : (b))
|
|
@@ -7,7 +7,7 @@ The following table summarizes the changes made to the Emscripten bindings in th
|
|
|
7
7
|
| Previous Signature | Updated Signature |
|
|
8
8
|
| ------------------ | --------------------- |
|
|
9
9
|
| getConditionFactor | shapeFactor |
|
|
10
|
-
| getID |
|
|
10
|
+
| getID | id |
|
|
11
11
|
| getHeatLoss | totalHeatLoss |
|
|
12
12
|
| getSurface | surfaceDescription |
|
|
13
13
|
| setConditionFactor | setShapeFactor |
|
package/README.md
CHANGED
|
@@ -27,17 +27,24 @@ The npm packages can be downloaded and install from [registry](https://www.npmjs
|
|
|
27
27
|
#### Web Assembly Compilation SDK
|
|
28
28
|
|
|
29
29
|
- Emscripten (emsdk) - Follow instructions for install https://emscripten.org/docs/getting_started/downloads.html
|
|
30
|
+
- From the emsdk directory run `./emsdk install latest`
|
|
31
|
+
- Then run `./emsdk activate latest`
|
|
32
|
+
- Then run `source ./emsdk_env.sh` to set the environment variables in the current terminal session.
|
|
33
|
+
- On Windows use `emsdk_env.bat`
|
|
34
|
+
|
|
35
|
+
> [!NOTE]
|
|
36
|
+
> This needs to be done each time a new terminal session is started, or add the command to your shell profile script (e.g. .bashrc, .zshrc, etc.)
|
|
30
37
|
|
|
31
38
|
#### Node
|
|
32
39
|
- Node LTS [https://nodejs.org/en/](https://nodejs.org/en/)
|
|
33
40
|
|
|
34
|
-
### Build
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- run `emmake make`
|
|
40
|
-
|
|
41
|
+
### Build Web Assembly Module
|
|
42
|
+
|
|
43
|
+
- Ensure you have followed the "Install and Activate Emscripten" steps above
|
|
44
|
+
- From the root directory of the MEASUR Tools Suite repository run `emcmake cmake -DBUILD_WASM=ON`
|
|
45
|
+
> If multiple compilers are present and default environment is not used, use `-G "<XXX> Makefiles"`. For example, on Windows using MinGW: `emcmake cmake -D BUILD_WASM=ON .. -G "MinGW Makefiles"`
|
|
46
|
+
- Then run `emmake make`
|
|
47
|
+
> This will create the build artifacts `client.js` and `client.wasm` in the `/bin` directory. `client.js` is the glue code for initializing the WASM module. Place the two files in the same directory within your project and execute the `client.js` script.
|
|
41
48
|
|
|
42
49
|
### WASM Initialization Example
|
|
43
50
|
|
|
@@ -45,24 +52,22 @@ Below is an illustration of the WASM initialization process:
|
|
|
45
52
|
|
|
46
53
|

|
|
47
54
|
|
|
48
|
-
###
|
|
49
|
-
|
|
50
|
-
- Follow the "Build WebAssembly Module" steps above
|
|
51
|
-
- run `npm install` to install node dependencies
|
|
52
|
-
- run `npm run test-wasm`
|
|
53
|
-
- a simple express server will be server to `localhost:3000` and a batch of script testing files will be executed
|
|
55
|
+
### WASM Unit Tests
|
|
54
56
|
|
|
57
|
+
- Ensure you have followed the "Build WebAssembly Module" steps above
|
|
58
|
+
- From the root directory of the MEASUR Tools Suite repository run `npm install` to install node dependencies
|
|
59
|
+
- Then run `npm run test-wasm`
|
|
60
|
+
> A simple express server will be served to `localhost:3000` and a batch of script testing files will be executed
|
|
55
61
|
|
|
56
62
|
### C++ Unit Tests
|
|
57
63
|
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- 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
|
|
64
|
+
- Ensure the `BUILD_TESTING` flag is set (which is default) when running CMake
|
|
65
|
+
- From the root directory of the MEASUR Tools Suite repository, run `mkdir build-cpp` and `cd build-cpp`
|
|
66
|
+
- Then run `cmake ..`
|
|
67
|
+
> If multiple compilers are present and default environment is not used, use `-G "XXX Makefiles"`. For example for windows using MinGW => `cmake .. -G "MinGW Makefiles"`
|
|
68
|
+
- Then run `cmake --build .`
|
|
69
|
+
- Then run `cd bin` and `./cpp_tests` to execute the tests
|
|
70
|
+
> On Windows, the executable can be found under either the `Debug` or `Release` directories, depending on CMake configuration
|
|
66
71
|
|
|
67
72
|
### Packaging
|
|
68
73
|
|
|
@@ -70,9 +75,11 @@ Below is an illustration of the WASM initialization process:
|
|
|
70
75
|
- Or use this directly for Windows: `cmake -D BUILD_TESTING:BOOL=OFF ./` and `cmake --build . --config Release --target PACKAGE`
|
|
71
76
|
- To make package on Linux or Mac, run `ccmake.` and set BUILD_TESTING OFF, BUILD_PACKAGE ON, then configure and generate. Then `make package`.
|
|
72
77
|
|
|
73
|
-
### Documentation
|
|
78
|
+
### Generate Documentation Locally
|
|
74
79
|
|
|
75
|
-
-
|
|
80
|
+
- Ensure Doxygen (v 1.14.0 or later) is installed
|
|
81
|
+
- From the root directory of the MEASUR Tools Suite repository run `doxygen Doxyfile`
|
|
82
|
+
> The documentation will be generated in the `/docs/html` directory
|
|
76
83
|
|
|
77
84
|
### Dockerizing
|
|
78
85
|
|
|
@@ -87,5 +94,3 @@ To make it easy for developers local building and testing, it is dockerized. To
|
|
|
87
94
|
- Note:
|
|
88
95
|
- Every time the container is started it will rebuild the application, to check status run `docker compose logs --tail 5`
|
|
89
96
|
- **This is not a tutorial for docker, assumption is made the user is knowledgeable.**
|
|
90
|
-
|
|
91
|
-
|
package/bin/client.wasm
CHANGED
|
Binary file
|
package/bin/package.json
CHANGED
|
@@ -245,73 +245,56 @@ void processData(const std::vector<int>& data) {
|
|
|
245
245
|
|
|
246
246
|
## Naming
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
Use the following naming conventions for various elements in the codebase to ensure consistency and readability.
|
|
249
249
|
|
|
250
250
|
|
|
251
251
|
### Files
|
|
252
252
|
|
|
253
|
-
Use `snake_case` suffixed with the appropriate file extension (`.h`, `.hpp`, or `.cpp`) for file names
|
|
254
|
-
|
|
255
|
-
```cpp
|
|
256
|
-
my_class.h
|
|
257
|
-
my_class.cpp
|
|
258
|
-
```
|
|
253
|
+
Use `snake_case` suffixed with the appropriate file extension (`.h`, `.hpp`, or `.cpp`) for file names (e.g., `my_class.h`, `my_class.cpp`).
|
|
259
254
|
|
|
260
255
|
> [!NOTE]
|
|
261
|
-
> This project uses `.h` for header files and `.cpp` for source files.
|
|
262
|
-
> File names should be descriptive and reflect the content or purpose of the file.
|
|
256
|
+
> This project uses `.h` for header files and `.cpp` for source files.
|
|
263
257
|
|
|
264
258
|
|
|
265
259
|
### Namespaces
|
|
266
260
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
```cpp
|
|
270
|
-
namespace my_project {
|
|
271
|
-
namespace utils {
|
|
272
|
-
|
|
273
|
-
// Utility functions go here.
|
|
274
|
-
|
|
275
|
-
} // namespace utils
|
|
276
|
-
} // namespace my_project
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
> [!NOTE]
|
|
280
|
-
> All code in the namespace should be under one or more directories with the same name as the namespace.
|
|
261
|
+
Use `snake_case` for namespace names (e.g., `my_project`, `utils`).
|
|
281
262
|
|
|
282
263
|
|
|
283
264
|
### Classes and Structs
|
|
284
265
|
|
|
285
|
-
Use `PascalCase` for class and struct names
|
|
266
|
+
Use `PascalCase` for class and struct names (e.g., `MyClass`, `MyStruct`).
|
|
286
267
|
|
|
287
|
-
```cpp
|
|
288
|
-
class MyClass {
|
|
289
|
-
// Class members
|
|
290
|
-
};
|
|
291
268
|
|
|
292
|
-
|
|
293
|
-
// Struct members
|
|
294
|
-
};
|
|
295
|
-
```
|
|
269
|
+
### Functions and Methods
|
|
296
270
|
|
|
271
|
+
Use `camelCase` for function and method names (e.g., `myFunction`, `computeArea`).
|
|
297
272
|
|
|
298
|
-
|
|
273
|
+
Use verbs or verb phrases for function names to indicate actions.
|
|
299
274
|
|
|
300
|
-
|
|
275
|
+
- Accessor methods (getters) should be named after the property they return, without a `get` prefix (e.g., `eyeColor()`).
|
|
276
|
+
- Mutator methods (setters) should be named with a `set` prefix followed by the property name (e.g., `setEyeColor()`).
|
|
301
277
|
|
|
302
|
-
|
|
303
|
-
void myFunction();
|
|
278
|
+
#### Example
|
|
304
279
|
|
|
305
|
-
|
|
280
|
+
```cpp
|
|
281
|
+
class Dog {
|
|
306
282
|
public:
|
|
307
|
-
|
|
283
|
+
std::string eyeColor() const { return eye_color_; } // Accessor for eye_color_
|
|
284
|
+
|
|
285
|
+
void setEyeColor(const std::string& color) { eye_color_ = color; } // Mutator for eye_color_
|
|
286
|
+
|
|
287
|
+
private:
|
|
288
|
+
std::string eye_color_;
|
|
308
289
|
};
|
|
309
290
|
```
|
|
310
291
|
|
|
311
292
|
|
|
312
293
|
### Variables
|
|
313
294
|
|
|
314
|
-
|
|
295
|
+
Use `snake_case` for variable names and function parameters.
|
|
296
|
+
|
|
297
|
+
#### Example
|
|
315
298
|
|
|
316
299
|
```cpp
|
|
317
300
|
void processData(int input_value) {
|
|
@@ -322,44 +305,36 @@ void processData(int input_value) {
|
|
|
322
305
|
|
|
323
306
|
### Member Variables
|
|
324
307
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
1. Underscore suffix:
|
|
328
|
-
|
|
329
|
-
```cpp
|
|
330
|
-
class MyClass {
|
|
331
|
-
private:
|
|
332
|
-
int value_;
|
|
333
|
-
std::string name_;
|
|
334
|
-
};
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
2. `m_` prefix:
|
|
338
|
-
|
|
339
|
-
```cpp
|
|
340
|
-
class MyClass {
|
|
341
|
-
private:
|
|
342
|
-
int m_value;
|
|
343
|
-
std::string m_name;
|
|
344
|
-
};
|
|
345
|
-
```
|
|
308
|
+
Use `snake_case` for member variable names, with a trailing underscore (`_`) to distinguish them from local variables and parameters.
|
|
346
309
|
|
|
347
|
-
|
|
348
|
-
> This project uses the underscore suffix convention for class member variables.
|
|
310
|
+
#### Example
|
|
349
311
|
|
|
350
|
-
|
|
312
|
+
```cpp
|
|
313
|
+
class Dog {
|
|
314
|
+
private:
|
|
315
|
+
std::string name_;
|
|
316
|
+
int age_;
|
|
317
|
+
std::string eye_color_;
|
|
318
|
+
};
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Use `snake_case` for struct member variables without a trailing underscore.
|
|
322
|
+
|
|
323
|
+
#### Example
|
|
351
324
|
|
|
352
325
|
```cpp
|
|
353
|
-
struct
|
|
354
|
-
|
|
355
|
-
|
|
326
|
+
struct Point2 {
|
|
327
|
+
double x;
|
|
328
|
+
double y;
|
|
356
329
|
};
|
|
357
330
|
```
|
|
358
331
|
|
|
359
332
|
|
|
360
333
|
### Constants and Enums
|
|
361
334
|
|
|
362
|
-
Use `PascalCase` for enum names and `PascalCase` prefixed with `k` for constants and enum values
|
|
335
|
+
Use `PascalCase` for enum names and `PascalCase` prefixed with `k` for constants and enum values.
|
|
336
|
+
|
|
337
|
+
#### Example
|
|
363
338
|
|
|
364
339
|
```cpp
|
|
365
340
|
enum class Color {
|
|
@@ -375,7 +350,9 @@ constexpr double kPi = 3.14159;
|
|
|
375
350
|
|
|
376
351
|
### Aliases
|
|
377
352
|
|
|
378
|
-
Use `PascalCase` for type aliases
|
|
353
|
+
Use `PascalCase` for type aliases.
|
|
354
|
+
|
|
355
|
+
#### Example
|
|
379
356
|
|
|
380
357
|
```cpp
|
|
381
358
|
using StringList = std::vector<std::string>;
|
|
@@ -384,7 +361,9 @@ using StringList = std::vector<std::string>;
|
|
|
384
361
|
|
|
385
362
|
### Templates
|
|
386
363
|
|
|
387
|
-
Use `PascalCase` for template parameters
|
|
364
|
+
Use `PascalCase` for template parameters.
|
|
365
|
+
|
|
366
|
+
#### Example
|
|
388
367
|
|
|
389
368
|
```cpp
|
|
390
369
|
template <typename InputType>
|
|
@@ -394,7 +373,9 @@ InputType processInput(InputType input);
|
|
|
394
373
|
|
|
395
374
|
### Macros
|
|
396
375
|
|
|
397
|
-
Use `UPPER_CASE` with a project-specific prefix for macro names
|
|
376
|
+
Use `UPPER_CASE` with a project-specific prefix for macro names.
|
|
377
|
+
|
|
378
|
+
#### Example
|
|
398
379
|
|
|
399
380
|
```cpp
|
|
400
381
|
#define MYPROJECT_MAX(a, b) ((a) > (b) ? (a) : (b))
|