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

DataType Distance. More...

#include <ad/physics/Distance.hpp>

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

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

Detailed Description

DataType Distance.

The length of a specific path traveled between two points. The unit is: Meter

Constructor & Destructor Documentation

ad::physics::Distance::Distance ( )
inline

default constructor

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

_AD_PHYSICS_DISTANCE_EXPLICIT_CONVERSION_ ad::physics::Distance::Distance ( double const  iDistance)
inline

standard constructor

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

Member Function Documentation

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

ensure that the Distance is valid

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

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

ensure that the Distance is valid and non zero

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

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

An Distance value is defined to be valid if:

_AD_PHYSICS_DISTANCE_EXPLICIT_CONVERSION_ ad::physics::Distance::operator double ( ) const
inline

conversion to base type: double

Note
the conversion to the base type removes the physical unit. _AD_PHYSICS_DISTANCE_EXPLICIT_CONVERSION_ defines, if only explicit calls are allowed.
bool ad::physics::Distance::operator!= ( const Distance other) const
inline

standard comparison operator

Parameters
[in]otherOther Distance.
Returns
true if one of the Distance is not valid or they can be taken as numerically different
DistanceSquared ad::physics::Distance::operator* ( const Distance other) const

standard arithmetic operator

Parameters
[in]otherOther Distance
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
since Distance is a type with physical unit, the multiplication results in the Squared type.
Distance ad::physics::Distance::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
Distance ad::physics::Distance::operator+ ( const Distance other) const
inline

standard arithmetic operator

Parameters
[in]otherOther Distance
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
Distance& ad::physics::Distance::operator+= ( const Distance other)
inline

standard arithmetic operator

Parameters
[in]otherOther Distance
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
Distance ad::physics::Distance::operator- ( const Distance other) const
inline

standard arithmetic operator

Parameters
[in]otherOther Distance
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
Distance ad::physics::Distance::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
Distance ad::physics::Distance::operator-= ( const Distance other)
inline

standard arithmetic operator

Parameters
[in]otherOther Distance
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
Distance ad::physics::Distance::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
double ad::physics::Distance::operator/ ( const Distance other) const
inline

standard arithmetic operator

Parameters
[in]otherOther Distance
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 Distance is a type with physical unit, the division results in the dimensionless type.
bool ad::physics::Distance::operator< ( const Distance other) const
inline

standard comparison operator

Parameters
[in]otherOther Distance.
Returns
true if both Distance are valid and this Distance is strictly numerically smaller than other.
Note
the precision of Distance is considered
bool ad::physics::Distance::operator<= ( const Distance other) const
inline

standard comparison operator

Parameters
[in]otherOther Distance
Returns
true if both Distance are valid and this Distance is numerically smaller than other.
Note
the precision of Distance is considered
Distance& ad::physics::Distance::operator= ( const Distance other)
default

standard assignment operator

Parameters
[in]otherOther Distance
Returns
Reference to this Distance.
Distance& ad::physics::Distance::operator= ( Distance &&  other)
default

standard move operator

Parameters
[in]otherOther Distance
Returns
Reference to this Distance.
bool ad::physics::Distance::operator== ( const Distance other) const
inline

standard comparison operator

Parameters
[in]otherOther Distance
Returns
true if both Distance are valid and can be taken as numerically equal
bool ad::physics::Distance::operator> ( const Distance other) const
inline

standard comparison operator

Parameters
[in]otherOther Distance.
Returns
true if both Distance are valid and this Distance is strictly numerically greater than other.
Note
the precision of Distance is considered
bool ad::physics::Distance::operator>= ( const Distance other) const
inline

standard comparison operator

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

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