![]() |
SuperNOVAS C++ API v1.6
High-precision C/C++ astrometry library
|
Abstract base class for scalar quantities, expressed in standard S.I. More...
#include <supernovas.h>
Inheritance diagram for supernovas::Scalar:Public Member Functions | |
| virtual | ~Scalar () |
| bool | equals (const Scalar &other, double precision) const |
| Checks if this scalar quantity is the same as another, within the specified precision. | |
| virtual std::string | SI_unit () const =0 |
| double | SI_value () const |
| The value of this scalar quantity in S.I. | |
| virtual std::string | to_string (int decimals=3) const |
| Returns a human readable representation of this scalar quantity. | |
Public Member Functions inherited from supernovas::Validating | |
| bool | is_valid () const |
| Returns the previously set 'valid' stae of the implementing instance. | |
| operator bool () const | |
Objects that implement Validating can be used in conditionals directly, without explicitly calling is_valid(). | |
Protected Member Functions | |
| Scalar () | |
| Instantiates a standard undefined (invalid) scalar quantity with NAN value. | |
| Scalar (double SI_value) | |
| Instantiates a scalar quantity with an initializing value in standard S.I. | |
Protected Member Functions inherited from supernovas::Validating | |
| Validating () | |
| dummy constructor; | |
Protected Attributes | |
| double | _value |
| The value in S.I. units. | |
Protected Attributes inherited from supernovas::Validating | |
| bool | _valid = false |
| the state variable. | |
Abstract base class for scalar quantities, expressed in standard S.I.
units.
|
inlineprotected |
Instantiates a standard undefined (invalid) scalar quantity with NAN value.
References _value.
Referenced by supernovas::Angle::Angle(), supernovas::Coordinate::Coordinate(), supernovas::Interval::Interval(), supernovas::ScalarVelocity::ScalarVelocity(), and equals().
|
protected |
Instantiates a scalar quantity with an initializing value in standard S.I.
units.
| SI_value | the initializing value in S.I. units. |
References supernovas::Validating::_valid, _value, and SI_value().
|
inlinevirtual |
| bool supernovas::Scalar::equals | ( | const Scalar & | other, |
| double | precision ) const |
Checks if this scalar quantity is the same as another, within the specified precision.
Two scalar quantities are equal only if they have the same S.I. units and the same S.I. values within the specified precision.
| other | Another scalar quantity. |
| precision | Precision for the comparison in the same S.I. units as this quantity. |
true if the two scalars have the same S.I. units and values within the specified precision, otherwise false.
|
pure virtual |
Implemented in supernovas::Angle, supernovas::Coordinate, supernovas::Interval, supernovas::Pressure, supernovas::ScalarVelocity, and supernovas::Temperature.
Referenced by equals(), and to_string().
| double supernovas::Scalar::SI_value | ( | ) | const |
|
virtual |
Returns a human readable representation of this scalar quantity.
Subclasses may override the default implementation to provide their own.
| decimals | (optional) [0:16] Number of decimal places to print (default: 3). |
Reimplemented in supernovas::Angle, supernovas::Coordinate, supernovas::Interval, supernovas::Pressure, supernovas::ScalarVelocity, and supernovas::Temperature.
|
protected |
The value in S.I. units.
Referenced by Scalar(), Scalar(), supernovas::TimeAngle::TimeAngle(), supernovas::Coordinate::abs(), supernovas::ScalarVelocity::abs(), supernovas::Angle::arcmin(), supernovas::Angle::arcsec(), supernovas::Pressure::atm(), supernovas::Coordinate::au(), supernovas::ScalarVelocity::au_per_day(), supernovas::Pressure::bar(), supernovas::ScalarVelocity::beta(), supernovas::Temperature::celsius(), supernovas::Interval::days(), supernovas::Angle::deg(), supernovas::Angle::equals(), equals(), supernovas::ScalarVelocity::equals(), supernovas::Angle::fraction(), supernovas::Coordinate::Gpc(), supernovas::Interval::hours(), supernovas::TimeAngle::hours(), supernovas::Pressure::hPa(), supernovas::ScalarVelocity::in_direction(), supernovas::Interval::inv(), supernovas::Interval::julian_centuries(), supernovas::Interval::julian_years(), supernovas::Temperature::kelvin(), supernovas::Coordinate::km(), supernovas::ScalarVelocity::km_per_s(), supernovas::Pressure::kPa(), supernovas::Coordinate::kpc(), supernovas::Coordinate::lyr(), supernovas::Coordinate::m(), supernovas::ScalarVelocity::m_per_s(), supernovas::Angle::mas(), supernovas::Pressure::mbar(), supernovas::Interval::milliseconds(), supernovas::Interval::minutes(), supernovas::Coordinate::Mpc(), supernovas::TimeAngle::operator+(), supernovas::TimeAngle::operator-(), supernovas::Coordinate::operator/(), supernovas::Pressure::Pa(), supernovas::Coordinate::pc(), supernovas::Angle::rad(), supernovas::Interval::seconds(), SI_value(), supernovas::Coordinate::to_string(), supernovas::Interval::to_string(), supernovas::Pressure::to_string(), to_string(), supernovas::Pressure::torr(), supernovas::ScalarVelocity::travel(), supernovas::Angle::uas(), supernovas::Interval::weeks(), and supernovas::Interval::years().