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

DataType Probability. More...

#include <ad/physics/Probability.hpp>

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

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

Detailed Description

DataType Probability.

A probability value in the range of [0.0; 1.0].

Constructor & Destructor Documentation

◆ Probability() [1/2]

ad::physics::Probability::Probability ( )
inline

default constructor

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

◆ Probability() [2/2]

_AD_PHYSICS_PROBABILITY_EXPLICIT_CONVERSION_ ad::physics::Probability::Probability ( double const  iProbability)
inline

standard constructor

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

Member Function Documentation

◆ ensureValid()

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

ensure that the Probability is valid

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

◆ ensureValidNonZero()

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

ensure that the Probability is valid and non zero

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

◆ isValid()

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

An Probability value is defined to be valid if:

◆ operator double()

_AD_PHYSICS_PROBABILITY_EXPLICIT_CONVERSION_ ad::physics::Probability::operator double ( ) const
inline

conversion to base type: double

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

◆ operator!=()

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

standard comparison operator

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

◆ operator*()

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

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

standard arithmetic operator

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

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

standard arithmetic operator

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

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

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

standard arithmetic operator

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

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

standard arithmetic operator

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

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

standard arithmetic operator

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

◆ operator<()

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

standard comparison operator

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

◆ operator<=()

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

standard comparison operator

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

◆ operator=() [1/2]

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

standard assignment operator

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

◆ operator=() [2/2]

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

standard move operator

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

◆ operator==()

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

standard comparison operator

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

◆ operator>()

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

standard comparison operator

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

◆ operator>=()

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

standard comparison operator

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

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