Go to the documentation of this file.
25 #include "spdlog/fmt/ostr.h"
26 #include "spdlog/spdlog.h"
39 #define AD_PHYSICS_ACCELERATION_THROWS_EXCEPTION 1
41 #if SAFE_DATATYPES_EXPLICIT_CONVERSION
45 #define _AD_PHYSICS_ACCELERATION_EXPLICIT_CONVERSION_ explicit
50 #define _AD_PHYSICS_ACCELERATION_EXPLICIT_CONVERSION_
85 : mAcceleration(std::numeric_limits<double>::quiet_NaN())
95 : mAcceleration(iAcceleration)
138 return std::fabs(mAcceleration - other.mAcceleration) <
cPrecisionValue;
166 return (mAcceleration > other.mAcceleration) &&
operator!=(other);
182 return (mAcceleration < other.mAcceleration) &&
operator!=(other);
198 return ((mAcceleration > other.mAcceleration) ||
operator==(other));
214 return ((mAcceleration < other.mAcceleration) ||
operator==(other));
231 Acceleration const result(mAcceleration + other.mAcceleration);
250 mAcceleration += other.mAcceleration;
269 Acceleration const result(mAcceleration - other.mAcceleration);
288 mAcceleration -= other.mAcceleration;
324 Acceleration const result(
operator/(scalarAcceleration));
344 double const result = mAcceleration / other.mAcceleration;
372 return mAcceleration;
384 auto const valueClass = std::fpclassify(mAcceleration);
385 return ((valueClass == FP_NORMAL) || (valueClass == FP_ZERO)) && (
cMinValue <= mAcceleration)
399 spdlog::info(
"ensureValid(::ad::physics::Acceleration)>> {} value out of range", *
this);
400 #if (AD_PHYSICS_ACCELERATION_THROWS_EXCEPTION == 1)
401 throw std::out_of_range(
"Acceleration value out of range");
417 spdlog::info(
"ensureValid(::ad::physics::Acceleration)>> {} value is zero", *
this);
418 #if (AD_PHYSICS_ACCELERATION_THROWS_EXCEPTION == 1)
419 throw std::out_of_range(
"Acceleration value is zero");
452 double mAcceleration;
470 return value.operator*(other);
481 inline ::ad::physics::Acceleration
fabs(const ::ad::physics::Acceleration other)
501 static inline ::ad::physics::Acceleration
lowest()
503 return ::ad::physics::Acceleration::getMin();
508 static inline ::ad::physics::Acceleration
max()
510 return ::ad::physics::Acceleration::getMax();
516 static inline ::ad::physics::Acceleration
epsilon()
518 return ::ad::physics::Acceleration::getPrecision();
527 #ifndef GEN_GUARD_AD_PHYSICS_ACCELERATION
528 #define GEN_GUARD_AD_PHYSICS_ACCELERATION
549 return os << double(_value);
561 return to_string(
static_cast<double>(value));
564 #endif // GEN_GUARD_AD_PHYSICS_ACCELERATION
namespace ad
Definition: Acceleration.hpp:30
Acceleration()
default constructor
Definition: Acceleration.hpp:84
Acceleration operator-() const
standard arithmetic operator
Definition: Acceleration.hpp:356
static inline ::ad::physics::Acceleration max()
Definition: Acceleration.hpp:508
double operator/(const Acceleration &other) const
standard arithmetic operator
Definition: Acceleration.hpp:340
Acceleration operator-(const Acceleration &other) const
standard arithmetic operator
Definition: Acceleration.hpp:265
static Acceleration getMin()
get minimum valid Acceleration (i.e. cMinValue)
Definition: Acceleration.hpp:427
_AD_PHYSICS_ACCELERATION_EXPLICIT_CONVERSION_ Acceleration(double const iAcceleration)
standard constructor
Definition: Acceleration.hpp:94
inline ::ad::physics::Acceleration operator*(const double &other, ::ad::physics::Acceleration const &value)
standard arithmetic operator
Definition: Acceleration.hpp:468
bool operator!=(const Acceleration &other) const
standard comparison operator
Definition: Acceleration.hpp:148
bool operator>=(const Acceleration &other) const
standard comparison operator
Definition: Acceleration.hpp:194
static Acceleration getPrecision()
get assumed accuracy of Acceleration (i.e. cPrecisionValue)
Definition: Acceleration.hpp:443
static const double cPrecisionValue
constant defining the assumed Acceleration value accuracy (used in comparison operator==(),...
Definition: Acceleration.hpp:76
bool operator<(const Acceleration &other) const
standard comparison operator
Definition: Acceleration.hpp:178
bool operator<=(const Acceleration &other) const
standard comparison operator
Definition: Acceleration.hpp:210
Acceleration operator/(const double &scalar) const
standard arithmetic operator
Definition: Acceleration.hpp:321
void ensureValidNonZero() const
ensure that the Acceleration is valid and non zero
Definition: Acceleration.hpp:412
static const double cMinValue
constant defining the minimum valid Acceleration value (used in isValid())
Definition: Acceleration.hpp:65
static const double cMaxValue
constant defining the maximum valid Acceleration value (used in isValid())
Definition: Acceleration.hpp:70
bool operator==(const Acceleration &other) const
standard comparison operator
Definition: Acceleration.hpp:134
Acceleration & operator+=(const Acceleration &other)
standard arithmetic operator
Definition: Acceleration.hpp:246
Acceleration operator-=(const Acceleration &other)
standard arithmetic operator
Definition: Acceleration.hpp:284
#define _AD_PHYSICS_ACCELERATION_EXPLICIT_CONVERSION_
Enable/Disable explicit conversion. Currently set to "implicit conversion allowed".
Definition: Acceleration.hpp:50
static Acceleration getMax()
get maximum valid Acceleration (i.e. cMaxValue)
Definition: Acceleration.hpp:435
static inline ::ad::physics::Acceleration epsilon()
Definition: Acceleration.hpp:516
static inline ::ad::physics::Acceleration lowest()
Definition: Acceleration.hpp:501
DataType Acceleration.
Definition: Acceleration.hpp:59
inline ::ad::physics::Weight fabs(const ::ad::physics::Weight other)
overload of the std::fabs for Weight
Definition: Weight.hpp:480
Acceleration & operator=(const Acceleration &other)=default
standard assignment operator
inline ::ad::physics::Acceleration fabs(const ::ad::physics::Acceleration other)
overload of the std::fabs for Acceleration
Definition: Acceleration.hpp:481
std::string to_string(::ad::physics::Acceleration const &value)
overload of the std::to_string for Acceleration
Definition: Acceleration.hpp:559
bool isValid() const
Definition: Acceleration.hpp:382
bool operator>(const Acceleration &other) const
standard comparison operator
Definition: Acceleration.hpp:162
Acceleration operator+(const Acceleration &other) const
standard arithmetic operator
Definition: Acceleration.hpp:227
std::ostream & operator<<(std::ostream &os, Acceleration const &_value)
standard ostream operator
Definition: Acceleration.hpp:547
void ensureValid() const
ensure that the Acceleration is valid
Definition: Acceleration.hpp:395
Acceleration operator*(const double &scalar) const
standard arithmetic operator
Definition: Acceleration.hpp:303