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

DataType Weight. More...

#include <ad/physics/Weight.hpp>

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

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

Detailed Description

DataType Weight.

Weight represents the mass of an object in kilogramsInputMax: Saturn V payload The unit is: Kilogram

Constructor & Destructor Documentation

◆ Weight() [1/2]

ad::physics::Weight::Weight ( )
inline

default constructor

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

◆ Weight() [2/2]

_AD_PHYSICS_WEIGHT_EXPLICIT_CONVERSION_ ad::physics::Weight::Weight ( double const  iWeight)
inline

standard constructor

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

Member Function Documentation

◆ ensureValid()

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

ensure that the Weight is valid

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

◆ ensureValidNonZero()

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

ensure that the Weight is valid and non zero

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

◆ isValid()

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

An Weight value is defined to be valid if:

◆ operator double()

_AD_PHYSICS_WEIGHT_EXPLICIT_CONVERSION_ ad::physics::Weight::operator double ( ) const
inline

conversion to base type: double

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

◆ operator!=()

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

standard comparison operator

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

◆ operator*()

Weight ad::physics::Weight::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+()

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

standard arithmetic operator

Parameters
[in]otherOther Weight
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+=()

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

standard arithmetic operator

Parameters
[in]otherOther Weight
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]

Weight ad::physics::Weight::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]

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

standard arithmetic operator

Parameters
[in]otherOther Weight
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-=()

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

standard arithmetic operator

Parameters
[in]otherOther Weight
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]

Weight ad::physics::Weight::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::Weight::operator/ ( const Weight other) const
inline

standard arithmetic operator

Parameters
[in]otherOther Weight
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 Weight is a type with physical unit, the division results in the dimensionless type.

◆ operator<()

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

standard comparison operator

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

◆ operator<=()

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

standard comparison operator

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

◆ operator=() [1/2]

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

standard assignment operator

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

◆ operator=() [2/2]

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

standard move operator

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

◆ operator==()

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

standard comparison operator

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

◆ operator>()

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

standard comparison operator

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

◆ operator>=()

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

standard comparison operator

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

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