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

DataType Duration. More...

#include <ad/physics/Duration.hpp>

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

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

Detailed Description

DataType Duration.

A duration represents a time interval. The unit is: Second

Constructor & Destructor Documentation

◆ Duration() [1/2]

ad::physics::Duration::Duration ( )
inline

default constructor

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

◆ Duration() [2/2]

_AD_PHYSICS_DURATION_EXPLICIT_CONVERSION_ ad::physics::Duration::Duration ( double const  iDuration)
inline

standard constructor

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

Member Function Documentation

◆ ensureValid()

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

ensure that the Duration is valid

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

◆ ensureValidNonZero()

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

ensure that the Duration is valid and non zero

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

◆ isValid()

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

An Duration value is defined to be valid if:

◆ operator double()

_AD_PHYSICS_DURATION_EXPLICIT_CONVERSION_ ad::physics::Duration::operator double ( ) const
inline

conversion to base type: double

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

◆ operator!=()

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

standard comparison operator

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

◆ operator*() [1/2]

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

DurationSquared ad::physics::Duration::operator* ( const Duration other) const

standard arithmetic operator

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

◆ operator+()

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

standard arithmetic operator

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

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

standard arithmetic operator

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

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

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

standard arithmetic operator

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

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

standard arithmetic operator

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

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

standard arithmetic operator

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

◆ operator<()

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

standard comparison operator

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

◆ operator<=()

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

standard comparison operator

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

◆ operator=() [1/2]

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

standard assignment operator

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

◆ operator=() [2/2]

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

standard move operator

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

◆ operator==()

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

standard comparison operator

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

◆ operator>()

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

standard comparison operator

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

◆ operator>=()

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

standard comparison operator

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

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