|
quanta 0.1.0
Type-safe units for temperature, frequency, electrical and spatial quantities, modeled after std::chrono
|
An absolute temperature on a given scale. More...
#include <quanta/thermo.hpp>
Public Types | |
| using | scale = Scale |
| The temperature scale. | |
| using | delta_type = Delta |
| The delta type. | |
| using | rep = typename Delta::rep |
| The representation type. | |
Public Member Functions | |
| constexpr | temperature ()=default |
| Constructs a temperature at the scale's zero point. | |
| temperature (const temperature &)=default | |
| template<typename Rep2 > requires std::convertible_to<const Rep2&, rep> && (treat_as_inexact_v<rep> || !treat_as_inexact_v<Rep2>) | |
| constexpr | temperature (const Rep2 &r) |
| Constructs from a tick count. | |
| constexpr | temperature (const Delta &d) |
| Constructs from a delta. | |
| template<typename Delta2 > requires (!std::is_same_v<Delta, Delta2>) && _temperature_castable<temperature<Scale, Delta2>, temperature> && _implicit_temperature_conversion<Scale, Delta2, Scale, Delta> | |
| constexpr | temperature (const temperature< Scale, Delta2 > &t) |
| template<typename Delta2 > requires (!std::is_same_v<Delta, Delta2>) && _temperature_castable<temperature<Scale, Delta2>, temperature> && (!_implicit_temperature_conversion<Scale, Delta2, Scale, Delta>) | |
| constexpr | temperature (const temperature< Scale, Delta2 > &t) |
| template<typename Scale2 , typename Delta2 > requires (!std::is_same_v<temperature, temperature<Scale2, Delta2>>) && _temperature_castable<temperature<Scale2, Delta2>, temperature> && _implicit_temperature_conversion<Scale2, Delta2, Scale, Delta> | |
| constexpr | temperature (const temperature< Scale2, Delta2 > &t) |
| template<typename Scale2 , typename Delta2 > requires (!std::is_same_v<temperature, temperature<Scale2, Delta2>>) && _temperature_castable<temperature<Scale2, Delta2>, temperature> && (!_implicit_temperature_conversion<Scale2, Delta2, Scale, Delta>) | |
| constexpr | temperature (const temperature< Scale2, Delta2 > &t) |
| ~temperature ()=default | |
| temperature & | operator= (const temperature &)=default |
| constexpr rep | count () const |
| Returns the tick count. | |
| constexpr temperature & | operator++ () |
| constexpr temperature | operator++ (int) |
| constexpr temperature & | operator-- () |
| constexpr temperature | operator-- (int) |
| constexpr temperature | operator- () const |
| Negates the temperature (e.g. | |
| template<typename Rep2 , typename Precision2 > | |
| constexpr temperature & | operator+= (const delta< Rep2, Precision2 > &d) |
| template<typename Rep2 , typename Precision2 > | |
| constexpr temperature & | operator-= (const delta< Rep2, Precision2 > &d) |
Static Public Member Functions | |
| static constexpr temperature | min () noexcept |
| Returns the minimum representable temperature. | |
| static constexpr temperature | max () noexcept |
| Returns the maximum representable temperature. | |
An absolute temperature on a given scale.
Similar to std::chrono::time_point, temperature represents an absolute point on a temperature scale. The scale defines the zero point (offset from absolute zero), and the delta type defines the precision.
As with time_point, a temperature plus or minus a delta is a temperature, and the difference of two temperatures is a delta. Adding two temperatures is ill-formed.
| Scale | The temperature scale (celsius_scale, kelvin_scale, fahrenheit_scale). |
| Delta | The delta type for precision (default: delta<int64_t>). |
Definition at line 959 of file thermo.hpp.
| using quanta::thermo::temperature< Scale, Delta >::delta_type = Delta |
The delta type.
Definition at line 966 of file thermo.hpp.
| using quanta::thermo::temperature< Scale, Delta >::rep = typename Delta::rep |
The representation type.
Definition at line 968 of file thermo.hpp.
| using quanta::thermo::temperature< Scale, Delta >::scale = Scale |
The temperature scale.
Definition at line 964 of file thermo.hpp.
|
constexprdefault |
Constructs a temperature at the scale's zero point.
Referenced by quanta::thermo::temperature< Scale, Delta >::max(), quanta::thermo::temperature< Scale, Delta >::min(), quanta::thermo::temperature< Scale, Delta >::operator++(), quanta::thermo::temperature< Scale, Delta >::operator-(), and quanta::thermo::temperature< Scale, Delta >::operator--().
|
default |
|
inlineexplicitconstexpr |
Constructs from a tick count.
| Rep2 | The source representation type. |
| r | The tick count in scale units. |
Definition at line 981 of file thermo.hpp.
|
inlineexplicitconstexpr |
Constructs from a delta.
| d | The delta from the scale's zero point. |
Definition at line 988 of file thermo.hpp.
|
inlineconstexpr |
Definition at line 999 of file thermo.hpp.
|
inlineexplicitconstexpr |
Definition at line 1006 of file thermo.hpp.
|
inlineconstexpr |
Definition at line 1014 of file thermo.hpp.
|
inlineexplicitconstexpr |
Definition at line 1022 of file thermo.hpp.
|
default |
|
inlineconstexpr |
Returns the tick count.
Definition at line 1029 of file thermo.hpp.
Referenced by quanta::thermo::operator+(), quanta::thermo::operator-(), quanta::thermo::operator<=>(), quanta::thermo::operator==(), quanta::thermo::to_string(), quanta::thermo::to_string(), and quanta::thermo::to_string().
|
inlinestaticconstexprnoexcept |
Returns the maximum representable temperature.
Definition at line 1074 of file thermo.hpp.
References quanta::thermo::temperature< Scale, Delta >::temperature().
|
inlinestaticconstexprnoexcept |
Returns the minimum representable temperature.
Definition at line 1071 of file thermo.hpp.
References quanta::thermo::temperature< Scale, Delta >::temperature().
|
inlineconstexpr |
Definition at line 1031 of file thermo.hpp.
|
inlineconstexpr |
Definition at line 1036 of file thermo.hpp.
References quanta::thermo::temperature< Scale, Delta >::temperature().
|
inlineconstexpr |
Definition at line 1059 of file thermo.hpp.
|
inlineconstexpr |
Negates the temperature (e.g.
to write -123_dc as -(123_dc)).
Only available on relative scales such as Celsius and Fahrenheit; on an absolute scale (Kelvin) negation would fall below absolute zero and is a compile error.
Definition at line 1052 of file thermo.hpp.
References quanta::thermo::temperature< Scale, Delta >::temperature().
|
inlineconstexpr |
Definition at line 1038 of file thermo.hpp.
|
inlineconstexpr |
Definition at line 1043 of file thermo.hpp.
References quanta::thermo::temperature< Scale, Delta >::temperature().
|
inlineconstexpr |
Definition at line 1065 of file thermo.hpp.
|
default |