measur-tools-suite 1.0.11-beta.56 → 1.0.11-beta.65
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 +33 -26
- package/assets/wasm-initialization.png +0 -0
- package/bin/client.js +2 -1
- package/bin/client.wasm +0 -0
- package/bin/package.json +5 -4
- package/contributing/style-guide.md +51 -70
- package/docs/dependencies/mathjax-config.js +1 -1
- package/package.json +5 -4
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,42 +27,49 @@ 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
|
|
|
44
|
-
|
|
51
|
+
MEASUR Tools Suite is distributed as a modularized WebAssembly Module.
|
|
52
|
+
Below is an illustration of the WASM initialization and usage process:
|
|
45
53
|
|
|
46
54
|

|
|
47
55
|
|
|
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
|
|
56
|
+
### WASM Unit Tests
|
|
54
57
|
|
|
58
|
+
- Ensure you have followed the "Build WebAssembly Module" steps above
|
|
59
|
+
- From the root directory of the MEASUR Tools Suite repository run `npm install` to install node dependencies
|
|
60
|
+
- Then run `npm run test-wasm-mocha`
|
|
61
|
+
> All mocha tests found under `tests/wasm-mocha/` will be executed.
|
|
62
|
+
> Migration of unit tests to the mocha framework is a WIP.
|
|
55
63
|
|
|
56
64
|
### C++ Unit Tests
|
|
57
65
|
|
|
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
|
|
66
|
+
- Ensure the `BUILD_TESTING` flag is set (which is default) when running CMake
|
|
67
|
+
- From the root directory of the MEASUR Tools Suite repository, run `mkdir build-cpp` and `cd build-cpp`
|
|
68
|
+
- Then run `cmake ..`
|
|
69
|
+
> 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"`
|
|
70
|
+
- Then run `cmake --build .`
|
|
71
|
+
- Then run `cd bin` and `./cpp_tests` to execute the tests
|
|
72
|
+
> On Windows, the executable can be found under either the `Debug` or `Release` directories, depending on CMake configuration
|
|
66
73
|
|
|
67
74
|
### Packaging
|
|
68
75
|
|
|
@@ -70,9 +77,11 @@ Below is an illustration of the WASM initialization process:
|
|
|
70
77
|
- Or use this directly for Windows: `cmake -D BUILD_TESTING:BOOL=OFF ./` and `cmake --build . --config Release --target PACKAGE`
|
|
71
78
|
- 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
79
|
|
|
73
|
-
### Documentation
|
|
80
|
+
### Generate Documentation Locally
|
|
74
81
|
|
|
75
|
-
-
|
|
82
|
+
- Ensure Doxygen (v 1.14.0 or later) is installed
|
|
83
|
+
- From the root directory of the MEASUR Tools Suite repository run `doxygen Doxyfile`
|
|
84
|
+
> The documentation will be generated in the `/docs/html` directory
|
|
76
85
|
|
|
77
86
|
### Dockerizing
|
|
78
87
|
|
|
@@ -87,5 +96,3 @@ To make it easy for developers local building and testing, it is dockerized. To
|
|
|
87
96
|
- Note:
|
|
88
97
|
- Every time the container is started it will rebuild the application, to check status run `docker compose logs --tail 5`
|
|
89
98
|
- **This is not a tutorial for docker, assumption is made the user is knowledgeable.**
|
|
90
|
-
|
|
91
|
-
|
|
Binary file
|