ad_physics
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ad::physics::RatioValue Class Reference

DataType RatioValue. More...

#include <ad/physics/RatioValue.hpp>

Public Member Functions

 RatioValue ()
 default constructor More...
 
_AD_PHYSICS_RATIOVALUE_EXPLICIT_CONVERSION_ RatioValue (double const iRatioValue)
 standard constructor More...
 
 RatioValue (const RatioValue &other)=default
 standard copy constructor
 
 RatioValue (RatioValue &&other)=default
 standard move constructor
 
RatioValueoperator= (const RatioValue &other)=default
 standard assignment operator More...
 
RatioValueoperator= (RatioValue &&other)=default
 standard move operator More...
 
bool operator== (const RatioValue &other) const
 standard comparison operator More...
 
bool operator!= (const RatioValue &other) const
 standard comparison operator More...
 
bool operator> (const RatioValue &other) const
 standard comparison operator More...
 
bool operator< (const RatioValue &other) const
 standard comparison operator More...
 
bool operator>= (const RatioValue &other) const
 standard comparison operator More...
 
bool operator<= (const RatioValue &other) const
 standard comparison operator More...
 
RatioValue operator+ (const RatioValue &other) const
 standard arithmetic operator More...
 
RatioValueoperator+= (const RatioValue &other)
 standard arithmetic operator More...
 
RatioValue operator- (const RatioValue &other) const
 standard arithmetic operator More...
 
RatioValue operator-= (const RatioValue &other)
 standard arithmetic operator More...
 
RatioValue operator* (const double &scalar) const
 standard arithmetic operator More...
 
RatioValue operator/ (const double &scalar) const
 standard arithmetic operator More...
 
double operator/ (const RatioValue &other) const
 standard arithmetic operator More...
 
RatioValue operator- () const
 standard arithmetic operator More...
 
_AD_PHYSICS_RATIOVALUE_EXPLICIT_CONVERSION_ operator double () const
 conversion to base type: double More...
 
bool isValid () const
 
void ensureValid () const
 ensure that the RatioValue is valid More...
 
void ensureValidNonZero () const
 ensure that the RatioValue is valid and non zero More...
 

Static Public Member Functions

static RatioValue getMin ()
 get minimum valid RatioValue (i.e. cMinValue)
 
static RatioValue getMax ()
 get maximum valid RatioValue (i.e. cMaxValue)
 
static RatioValue getPrecision ()
 get assumed accuracy of RatioValue (i.e. cPrecisionValue)
 

Static Public Attributes

static const double cMinValue
 constant defining the minimum valid RatioValue value (used in isValid())
 
static const double cMaxValue
 constant defining the maximum valid RatioValue value (used in isValid())
 
static const double cPrecisionValue
 constant defining the assumed RatioValue value accuracy (used in comparison operator==(), operator!=())
 

Detailed Description

DataType RatioValue.

Defines a general ratio. The unit is: Ratio

Constructor & Destructor Documentation

◆ RatioValue() [1/2]

ad::physics::RatioValue::RatioValue ( )
inline

default constructor

The default value of RatioValue is: std::numeric_limits<double>::quiet_NaN()

◆ RatioValue() [2/2]

_AD_PHYSICS_RATIOVALUE_EXPLICIT_CONVERSION_ ad::physics::RatioValue::RatioValue ( double const  iRatioValue)
inline

standard constructor

Note
_AD_PHYSICS_RATIOVALUE_EXPLICIT_CONVERSION_ defines, if only an explicit conversion is allowed.

Member Function Documentation

◆ ensureValid()

void ad::physics::RatioValue::ensureValid ( ) const
inline

ensure that the RatioValue is valid

Throws an std::out_of_range() exception if the RatioValue in not valid (i.e. isValid() returns false)

◆ ensureValidNonZero()

void ad::physics::RatioValue::ensureValidNonZero ( ) const
inline

ensure that the RatioValue is valid and non zero

Throws an std::out_of_range() exception if the RatioValue in not valid or zero (i.e. isValid() returns false)

◆ isValid()

bool ad::physics::RatioValue::isValid ( ) const
inline
Returns
true if the RatioValue in a valid range

An RatioValue value is defined to be valid if:

◆ operator double()

_AD_PHYSICS_RATIOVALUE_EXPLICIT_CONVERSION_ ad::physics::RatioValue::operator double ( ) const
inline

conversion to base type: double

Note
the conversion to the base type removes the physical unit. _AD_PHYSICS_RATIOVALUE_EXPLICIT_CONVERSION_ defines, if only explicit calls are allowed.

◆ operator!=()

bool ad::physics::RatioValue::operator!= ( const RatioValue other) const
inline

standard comparison operator

Parameters
[in]otherOther RatioValue.
Returns
true if one of the RatioValue is not valid or they can be taken as numerically different

◆ operator*()

RatioValue ad::physics::RatioValue::operator* ( const double &  scalar) const
inline

standard arithmetic operator

Parameters
[in]scalarScalar double value
Returns
Result of arithmetic operation.
Note
throws a std::out_of_range exception if value or the result of the operation is not valid

◆ operator+()

RatioValue ad::physics::RatioValue::operator+ ( const RatioValue other) const
inline

standard arithmetic operator

Parameters
[in]otherOther RatioValue
Returns
Result of arithmetic operation.
Note
throws a std::out_of_range exception if one of the two operands or the result of the operation is not valid

◆ operator+=()

RatioValue& ad::physics::RatioValue::operator+= ( const RatioValue other)
inline

standard arithmetic operator

Parameters
[in]otherOther RatioValue
Returns
Result of arithmetic operation.
Note
throws a std::out_of_range exception if one of the two operands or the result of the operation is not valid

◆ operator-() [1/2]

RatioValue ad::physics::RatioValue::operator- ( ) const
inline

standard arithmetic operator

Returns
Result of arithmetic operation.
Note
throws a std::out_of_range exception if this or the result of the operation is not valid

◆ operator-() [2/2]

RatioValue ad::physics::RatioValue::operator- ( const RatioValue other) const
inline

standard arithmetic operator

Parameters
[in]otherOther RatioValue
Returns
Result of arithmetic operation.
Note
throws a std::out_of_range exception if one of the two operands or the result of the operation is not valid

◆ operator-=()

RatioValue ad::physics::RatioValue::operator-= ( const RatioValue other)
inline

standard arithmetic operator

Parameters
[in]otherOther RatioValue
Returns
Result of arithmetic operation.
Note
throws a std::out_of_range exception if one of the two operands or the result of the operation is not valid

◆ operator/() [1/2]

RatioValue ad::physics::RatioValue::operator/ ( const double &  scalar) const
inline

standard arithmetic operator

Parameters
[in]scalarScalar double value
Returns
Result of arithmetic operation.
Note
throws a std::out_of_range exception if this or the result of the operation is not valid or other is zero

◆ operator/() [2/2]

double ad::physics::RatioValue::operator/ ( const RatioValue other) const
inline

standard arithmetic operator

Parameters
[in]otherOther RatioValue
Returns
Result of arithmetic operation.
Note
throws a std::out_of_range exception if one of the two operands or the result of the operation is not valid or other is zero
since RatioValue is a type with physical unit, the division results in the dimensionless type.

◆ operator<()

bool ad::physics::RatioValue::operator< ( const RatioValue other) const
inline

standard comparison operator

Parameters
[in]otherOther RatioValue.
Returns
true if both RatioValue are valid and this RatioValue is strictly numerically smaller than other.
Note
the precision of RatioValue is considered

◆ operator<=()

bool ad::physics::RatioValue::operator<= ( const RatioValue other) const
inline

standard comparison operator

Parameters
[in]otherOther RatioValue
Returns
true if both RatioValue are valid and this RatioValue is numerically smaller than other.
Note
the precision of RatioValue is considered

◆ operator=() [1/2]

RatioValue& ad::physics::RatioValue::operator= ( const RatioValue other)
default

standard assignment operator

Parameters
[in]otherOther RatioValue
Returns
Reference to this RatioValue.

◆ operator=() [2/2]

RatioValue& ad::physics::RatioValue::operator= ( RatioValue &&  other)
default

standard move operator

Parameters
[in]otherOther RatioValue
Returns
Reference to this RatioValue.

◆ operator==()

bool ad::physics::RatioValue::operator== ( const RatioValue other) const
inline

standard comparison operator

Parameters
[in]otherOther RatioValue
Returns
true if both RatioValue are valid and can be taken as numerically equal

◆ operator>()

bool ad::physics::RatioValue::operator> ( const RatioValue other) const
inline

standard comparison operator

Parameters
[in]otherOther RatioValue.
Returns
true if both RatioValue are valid and this RatioValue is strictly numerically greater than other.
Note
the precision of RatioValue is considered

◆ operator>=()

bool ad::physics::RatioValue::operator>= ( const RatioValue other) const
inline

standard comparison operator

Parameters
[in]otherOther RatioValue.
Returns
true if both RatioValue are valid and this RatioValue is numerically greater than other.
Note
the precision of RatioValue is considered

The documentation for this class was generated from the following file: