Go to the documentation of this file.
25 #include "spdlog/fmt/ostr.h"
26 #include "spdlog/spdlog.h"
39 #define AD_PHYSICS_DURATIONSQUARED_THROWS_EXCEPTION 1
41 #if SAFE_DATATYPES_EXPLICIT_CONVERSION
45 #define _AD_PHYSICS_DURATIONSQUARED_EXPLICIT_CONVERSION_ explicit
50 #define _AD_PHYSICS_DURATIONSQUARED_EXPLICIT_CONVERSION_
93 : mDurationSquared(std::numeric_limits<double>::quiet_NaN())
103 : mDurationSquared(iDurationSquared)
146 return std::fabs(mDurationSquared - other.mDurationSquared) <
cPrecisionValue;
174 return (mDurationSquared > other.mDurationSquared) &&
operator!=(other);
190 return (mDurationSquared < other.mDurationSquared) &&
operator!=(other);
206 return ((mDurationSquared > other.mDurationSquared) ||
operator==(other));
222 return ((mDurationSquared < other.mDurationSquared) ||
operator==(other));
239 DurationSquared const result(mDurationSquared + other.mDurationSquared);
258 mDurationSquared += other.mDurationSquared;
277 DurationSquared const result(mDurationSquared - other.mDurationSquared);
296 mDurationSquared -= other.mDurationSquared;
352 double const result = mDurationSquared / other.mDurationSquared;
380 return mDurationSquared;
392 auto const valueClass = std::fpclassify(mDurationSquared);
393 return ((valueClass == FP_NORMAL) || (valueClass == FP_ZERO)) && (
cMinValue <= mDurationSquared)
407 spdlog::info(
"ensureValid(::ad::physics::DurationSquared)>> {} value out of range", *
this);
408 #if (AD_PHYSICS_DURATIONSQUARED_THROWS_EXCEPTION == 1)
409 throw std::out_of_range(
"DurationSquared value out of range");
425 spdlog::info(
"ensureValid(::ad::physics::DurationSquared)>> {} value is zero", *
this);
426 #if (AD_PHYSICS_DURATIONSQUARED_THROWS_EXCEPTION == 1)
427 throw std::out_of_range(
"DurationSquared value is zero");
460 double mDurationSquared;
478 return value.operator*(other);
489 inline ::ad::physics::DurationSquared
fabs(const ::ad::physics::DurationSquared other)
509 static inline ::ad::physics::DurationSquared
lowest()
511 return ::ad::physics::DurationSquared::getMin();
516 static inline ::ad::physics::DurationSquared
max()
518 return ::ad::physics::DurationSquared::getMax();
524 static inline ::ad::physics::DurationSquared
epsilon()
526 return ::ad::physics::DurationSquared::getPrecision();
542 #ifndef GEN_GUARD_AD_PHYSICS_DURATIONSQUARED
543 #define GEN_GUARD_AD_PHYSICS_DURATIONSQUARED
564 return os << double(_value);
576 return to_string(
static_cast<double>(value));
579 #endif // GEN_GUARD_AD_PHYSICS_DURATIONSQUARED
namespace ad
Definition: Acceleration.hpp:30
bool operator<=(const DurationSquared &other) const
standard comparison operator
Definition: DurationSquared.hpp:218
DurationSquared()
default constructor
Definition: DurationSquared.hpp:92
DurationSquared operator/(const double &scalar) const
standard arithmetic operator
Definition: DurationSquared.hpp:329
DurationSquared operator*(const double &scalar) const
standard arithmetic operator
Definition: DurationSquared.hpp:311
bool operator!=(const DurationSquared &other) const
standard comparison operator
Definition: DurationSquared.hpp:156
static DurationSquared getMin()
get minimum valid DurationSquared (i.e. cMinValue)
Definition: DurationSquared.hpp:435
static inline ::ad::physics::DurationSquared lowest()
Definition: DurationSquared.hpp:509
bool operator<(const DurationSquared &other) const
standard comparison operator
Definition: DurationSquared.hpp:186
static const double cMinValue
constant defining the minimum valid DurationSquared value (used in isValid())
Definition: DurationSquared.hpp:73
_AD_PHYSICS_DURATIONSQUARED_EXPLICIT_CONVERSION_ DurationSquared(double const iDurationSquared)
standard constructor
Definition: DurationSquared.hpp:102
DurationSquared & operator=(const DurationSquared &other)=default
standard assignment operator
static const double cPrecisionValue
constant defining the assumed DurationSquared value accuracy (used in comparison operator==(),...
Definition: DurationSquared.hpp:84
static DurationSquared getMax()
get maximum valid DurationSquared (i.e. cMaxValue)
Definition: DurationSquared.hpp:443
static const double cMaxValue
constant defining the maximum valid DurationSquared value (used in isValid())
Definition: DurationSquared.hpp:78
bool isValid() const
Definition: DurationSquared.hpp:390
bool operator==(const DurationSquared &other) const
standard comparison operator
Definition: DurationSquared.hpp:142
DataType DurationSquared.
Definition: DurationSquared.hpp:67
DurationSquared operator-=(const DurationSquared &other)
standard arithmetic operator
Definition: DurationSquared.hpp:292
double operator/(const DurationSquared &other) const
standard arithmetic operator
Definition: DurationSquared.hpp:348
static inline ::ad::physics::DurationSquared max()
Definition: DurationSquared.hpp:516
DurationSquared operator+(const DurationSquared &other) const
standard arithmetic operator
Definition: DurationSquared.hpp:235
static inline ::ad::physics::DurationSquared epsilon()
Definition: DurationSquared.hpp:524
static DurationSquared getPrecision()
get assumed accuracy of DurationSquared (i.e. cPrecisionValue)
Definition: DurationSquared.hpp:451
inline ::ad::physics::DurationSquared operator*(const double &other, ::ad::physics::DurationSquared const &value)
standard arithmetic operator
Definition: DurationSquared.hpp:476
bool operator>(const DurationSquared &other) const
standard comparison operator
Definition: DurationSquared.hpp:170
inline ::ad::physics::Weight fabs(const ::ad::physics::Weight other)
overload of the std::fabs for Weight
Definition: Weight.hpp:480
DurationSquared & operator+=(const DurationSquared &other)
standard arithmetic operator
Definition: DurationSquared.hpp:254
inline ::ad::physics::Acceleration fabs(const ::ad::physics::Acceleration other)
overload of the std::fabs for Acceleration
Definition: Acceleration.hpp:481
bool operator>=(const DurationSquared &other) const
standard comparison operator
Definition: DurationSquared.hpp:202
DurationSquared operator-(const DurationSquared &other) const
standard arithmetic operator
Definition: DurationSquared.hpp:273
std::string to_string(::ad::physics::Acceleration const &value)
overload of the std::to_string for Acceleration
Definition: Acceleration.hpp:559
#define _AD_PHYSICS_DURATIONSQUARED_EXPLICIT_CONVERSION_
Enable/Disable explicit conversion. Currently set to "implicit conversion allowed".
Definition: DurationSquared.hpp:50
DataType Duration.
Definition: Duration.hpp:67
DurationSquared operator-() const
standard arithmetic operator
Definition: DurationSquared.hpp:364
void ensureValidNonZero() const
ensure that the DurationSquared is valid and non zero
Definition: DurationSquared.hpp:420
std::ostream & operator<<(std::ostream &os, Acceleration const &_value)
standard ostream operator
Definition: Acceleration.hpp:547
void ensureValid() const
ensure that the DurationSquared is valid
Definition: DurationSquared.hpp:403