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

DataType Speed. More...

#include <ad/physics/Speed.hpp>

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

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

Detailed Description

DataType Speed.

The rate of change of an object's position with respect to time. The speed of an object is the magnitude of its velocity. The unit is: MeterPerSecond

Constructor & Destructor Documentation

◆ Speed() [1/2]

ad::physics::Speed::Speed ( )
inline

default constructor

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

◆ Speed() [2/2]

_AD_PHYSICS_SPEED_EXPLICIT_CONVERSION_ ad::physics::Speed::Speed ( double const  iSpeed)
inline

standard constructor

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

Member Function Documentation

◆ ensureValid()

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

ensure that the Speed is valid

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

◆ ensureValidNonZero()

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

ensure that the Speed is valid and non zero

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

◆ isValid()

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

An Speed value is defined to be valid if:

◆ operator double()

_AD_PHYSICS_SPEED_EXPLICIT_CONVERSION_ ad::physics::Speed::operator double ( ) const
inline

conversion to base type: double

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

◆ operator!=()

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

standard comparison operator

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

◆ operator*() [1/2]

Speed ad::physics::Speed::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*() [2/2]

SpeedSquared ad::physics::Speed::operator* ( const Speed other) const

standard arithmetic operator

Parameters
[in]otherOther Speed
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 Speed is a type with physical unit, the multiplication results in the Squared type.

◆ operator+()

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

standard arithmetic operator

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

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

standard arithmetic operator

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

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

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

standard arithmetic operator

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

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

standard arithmetic operator

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

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

standard arithmetic operator

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

◆ operator<()

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

standard comparison operator

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

◆ operator<=()

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

standard comparison operator

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

◆ operator=() [1/2]

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

standard assignment operator

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

◆ operator=() [2/2]

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

standard move operator

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

◆ operator==()

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

standard comparison operator

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

◆ operator>()

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

standard comparison operator

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

◆ operator>=()

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

standard comparison operator

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

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