Loading...
Searching...
No Matches
supernovas::Temperature Class Reference
Helpers and utilities

A physical temperature value, which can be instantiated, and then expressed, in different commonly used temperature units (C, K, or F). More...

`#include <supernovas.h>`

Inheritance diagram for supernovas::Temperature:

## Public Member Functions

double | celsius () const
| Returns the temperature value in degrees Celsius.
double | fahrenheit () const
| Returns the temperature value in degrees Fahrenheit.
double | kelvin () const
| Returns the temperature value in degrees Kelvin.
std::string | SI_unit () const override
std::string | to_string (int decimals=1) const override
| Returns a human-readable string representation of this temperature value.
Public Member Functions inherited from supernovas::Scalar
virtual | ~Scalar ()
bool | equals (const Scalar &other, double precision) const
| Checks if this scalar quantity is the same as another, within the specified precision.
double | SI_value () const
| The value of this scalar quantity in S.I.
Public Member Functions inherited from supernovas::Validating
bool | is_valid () const
| Returns the previously set 'valid' state of the implementing instance.
| operator bool () const
| Objects that implement Validating can be used in conditionals directly, without explicitly calling is_valid().

## Static Public Member Functions

static Temperature | celsius (double value)
| Returns a new temperature object, with the specified temperature value defined in degrees Celsius.
static Temperature | fahrenheit (double value)
| Returns a new temperature object, with the specified temperature value defined in degrees Fahrenheit.
static Temperature | kelvin (double value)
| Returns a new temperature object, with the specified temperature value defined in degrees Kelvin.

## Additional Inherited Members

Protected Member Functions inherited from supernovas::Scalar
| 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 inherited from supernovas::Scalar
double | _value
| The value in S.I. units.
Protected Attributes inherited from supernovas::Validating
bool | _valid = false
| the state variable.

## Detailed Description

A physical temperature value, which can be instantiated, and then expressed, in different commonly used temperature units (C, K, or F).

Within SuperNOVAS it is normally used to express ambient temperatures at an observing location, but users may utilize it in any other context also.

Since
  1.6

See also
  Weather

## Member Function Documentation

## celsius() [1/2]

double supernovas::Temperature::celsius | ( |  | ) | const

Returns the temperature value in degrees Celsius.

Returns
  [C] The temperature value

Since
  1.6

See also
  kelvin(), farenheit()

References supernovas::Scalar::_value, and celsius().

Referenced by celsius(), celsius(), fahrenheit(), supernovas::Source::horizontal_track(), and to_string().

## celsius() [2/2]

Temperature supernovas::Temperature::celsius | ( | double | value | ) |

static

Returns a new temperature object, with the specified temperature value defined in degrees Celsius.

Parameters

  value | [C] temperature value

Returns
  A new temperature object with the specified value.

Since
  1.6

See also
  kelvin(), farenheit()

References celsius(), and supernovas::Validating::is_valid().

## fahrenheit() [1/2]

double supernovas::Temperature::fahrenheit | ( |  | ) | const

Returns the temperature value in degrees Fahrenheit.

Returns
  [F] The temperature value

Since
  1.6

See also
  celsius(), kelvin()

References celsius(), and fahrenheit().

Referenced by fahrenheit(), and fahrenheit().

## fahrenheit() [2/2]

Temperature supernovas::Temperature::fahrenheit | ( | double | value | ) |

static

Returns a new temperature object, with the specified temperature value defined in degrees Fahrenheit.

Parameters

  value | [F] temperature value

Returns
  A new temperature object with the specified value.

Since
  1.6

See also
  celisus(), kelvin()

References fahrenheit(), and supernovas::Validating::is_valid().

## kelvin() [1/2]

double supernovas::Temperature::kelvin | ( |  | ) | const

Returns the temperature value in degrees Kelvin.

Returns
  [K] The temperature value

Since
  1.6

See also
  celsius(), farenheit()

References supernovas::Scalar::_value, and kelvin().

Referenced by kelvin(), and kelvin().

## kelvin() [2/2]

Temperature supernovas::Temperature::kelvin | ( | double | value | ) |

static

Returns a new temperature object, with the specified temperature value defined in degrees Kelvin.

Parameters

  value | [K] temperature value

Returns
  A new temperature object with the specified value.

Since
  1.6

See also
  celsius(), farenheit()

References supernovas::Validating::is_valid(), and kelvin().

## SI_unit()

std::string supernovas::Temperature::SI_unit | ( |  | ) | const

override virtual

Implements supernovas::Scalar.

References SI_unit().

Referenced by SI_unit().

## to_string()

std::string supernovas::Temperature::to_string | ( | int | decimals = 1 | ) | const

override virtual

Returns a human-readable string representation of this temperature value.

Parameters

  decimals | (optional) [0:16] decimal places to print (default: 1).

Returns
  a string with the human readable representation of this temperature.

Since
  1.6

Reimplemented from supernovas::Scalar.

References celsius(), and to_string().

Referenced by to_string().