Berthold Stoeger
ae81b42fe2
core: introduce a few user-defined literals for unit types
...
Thise makes initialization of unit types more palatable.
For example:
surface.time = sample.time - duration_t { .seconds = 20 };
=> surface.time = sample.time - 20_sec;
delta_depth.mm = feet_to_mm(1.0); // 1ft
=> delta_depth = 1_ft;
get_cylinderid_at_time(..., { .seconds = 20 * 60 + 1 }));
=> get_cylinderid_at_time(..., 20_min + 1_sec));
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-09-11 10:23:07 +02:00
Berthold Stoeger
c812dd140b
core: move get_surface_pressure() to struct dive
...
Feel natural in a C++ code base.
Remove the second parameter, because all callers where passing
`true` anyway.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
bdd5527005
core: move *_to_depth() functions into struct dive
...
Seems logical in a C++ code base.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
bf84d66df2
core: move depth_to_* functions into struct dive
...
Seems logical in a C++ code base.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
2b3d2f1020
core: add default initialization to sruct deco_state
...
Don't memset() to clear deco_state, use assignment of
default constructed object (or better yet: just default
construct).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
411188728d
core: return pressures structure from fill_pressures()
...
Instead of taking an out-parameter. That's more idiomatic C++.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
2df30a4144
core: remove ssrf.h include file
...
It didn't contain anything.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
b56dd13add
build: remove extern "C" linkage
...
No more C source files, no more necessity to use C-linkage.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
ec0bc2d06c
cleanup: replace MIN and MAX macrors by standard versions
...
In C++ files, replace MIN and MAX by std::min and std::max,
respectively. There are still a few C files using these
macros. Convert them in due course.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
f69686d429
planner: encapsulate deco state cache in a struct
...
Removes memory management pain: the struct cleans up when it
goes out of scope.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
77e8c3655e
core: compile planner source files with C++
...
Another relatively easily converted part of the code.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00