Marine systems simulation
Loading...
Searching...
No Matches
marenv.h
1#pragma once
3
4#if defined(_WIN32) || defined(_WIN64)
5 #ifdef MARENV_EXPORTS
6 #define MARENV_API __declspec(dllexport)
7 #else
8 #define MARENV_API __declspec(dllimport)
9 #endif
10#else
11 #define MARENV_API
12#endif
13
15
16namespace marenv
17{
18constexpr double PI = 3.14159265358979323846;
19constexpr double gravity = 9.81;
20constexpr double seawaterDensity = 1025.0;
21
39enum class Status
40{
41 OK,
42 OUT_OF_RANGE_INACCURATE,
43 NOT_APPLICABLE_NOT_SET,
44 ERROR_NOT_SET,
45 NOT_IMPLEMENTED
46};
47
52inline Status& operator+=(Status& lhs, Status rhs) noexcept
53{
54 // Keep the first error status
55 if (lhs == Status::OK) lhs = rhs;
56 return lhs;
57}
58
63inline Status& operator&=(Status& lhs, Status rhs) noexcept
64{
65 // Only update if we haven't already failed
66 if (lhs == Status::OK) {
67 lhs = rhs;
68 }
69 return lhs;
70}
71
76inline Status operator&(Status lhs, Status rhs) noexcept
77{
78 lhs &= rhs;
79 return lhs;
80}
82
83struct MARENV_API NoCopyNoMove
84{
86
88
89 NoCopyNoMove() = default;
90 NoCopyNoMove(const NoCopyNoMove&) = delete;
91 NoCopyNoMove& operator=(const NoCopyNoMove&) = delete;
92 NoCopyNoMove(NoCopyNoMove&&) = delete;
93 NoCopyNoMove& operator=(NoCopyNoMove&&) = delete;
95
96};
98
100{
102
103 MoveNoCopy() = default;
104 MoveNoCopy(const MoveNoCopy&) = delete;
105 MoveNoCopy& operator=(const MoveNoCopy&) = delete;
106 MoveNoCopy(MoveNoCopy&&) = default;
107 MoveNoCopy& operator=(MoveNoCopy&&) = default;
109
110};
111
119} // namespace marenv
Status
Definition marenv.h:40
The marenv root namespace.
Definition CumulativeDistribution.h:8
Status operator&(Status lhs, Status rhs) noexcept
Definition marenv.h:76
constexpr double gravity
Gravity constant.
Definition marenv.h:19
constexpr double PI
Defines pi.
Definition marenv.h:18
constexpr double seawaterDensity
Ocean water density.
Definition marenv.h:20
Status & operator&=(Status &lhs, Status rhs) noexcept
Definition marenv.h:63
Status & operator+=(Status &lhs, Status rhs) noexcept
Definition marenv.h:52
Policy mixin: this type is default copyable but not movable.
Definition marenv.h:100
Policy mixin: this type is neither copyable nor movable.
Definition marenv.h:84