|
thermo 2.1.0
Type-safe temperature handling library modeled after std::chrono
|
Temperature types and utilities. More...
Classes | |
| class | delta |
| A temperature difference with a representation and precision. More... | |
| struct | is_delta |
| Trait to detect delta specializations. More... | |
| struct | is_delta< delta< Rep, Precision > > |
| class | temperature |
| An absolute temperature on a given scale. More... | |
Typedefs | |
| using | delta_celsius = delta< int64_t > |
| Delta with 1 degree precision (Celsius/Kelvin). | |
| using | delta_decicelsius = delta< int64_t, std::deci > |
| Delta with 0.1 degree precision (Celsius/Kelvin). | |
| using | delta_millicelsius = delta< int64_t, std::milli > |
| Delta with 0.001 degree precision (Celsius/Kelvin). | |
| using | delta_kelvin = delta< int64_t > |
| Delta with 1 degree precision (Celsius/Kelvin). | |
| using | delta_decikelvin = delta< int64_t, std::deci > |
| Delta with 0.1 degree precision (Celsius/Kelvin). | |
| using | delta_millikelvin = delta< int64_t, std::milli > |
| Delta with 0.001 degree precision (Celsius/Kelvin). | |
| using | delta_fahrenheit = delta< int64_t, std::ratio< 5, 9 > > |
| Delta with 1°F precision. | |
| using | delta_decifahrenheit = delta< int64_t, std::ratio< 5, 90 > > |
| Delta with 0.1°F precision. | |
| using | delta_millifahrenheit = delta< int64_t, std::ratio< 5, 9000 > > |
| Delta with 0.001°F precision. | |
| using | celsius = temperature< celsius_scale > |
| Celsius with 1 degree precision. | |
| using | decicelsius = temperature< celsius_scale, delta< int64_t, std::deci > > |
| Celsius with 0.1 degree precision. | |
| using | millicelsius = temperature< celsius_scale, delta< int64_t, std::milli > > |
| Celsius with 0.001 degree precision. | |
| using | kelvin = temperature< kelvin_scale > |
| Kelvin with 1 degree precision. | |
| using | decikelvin = temperature< kelvin_scale, delta< int64_t, std::deci > > |
| Kelvin with 0.1 degree precision. | |
| using | millikelvin = temperature< kelvin_scale, delta< int64_t, std::milli > > |
| Kelvin with 0.001 degree precision. | |
| using | fahrenheit = temperature< fahrenheit_scale, delta< int64_t, std::ratio< 5, 9 > > > |
| Fahrenheit with 1 degree precision. | |
| using | decifahrenheit = temperature< fahrenheit_scale, delta< int64_t, std::ratio< 5, 90 > > > |
| Fahrenheit with 0.1 degree precision. | |
| using | millifahrenheit = temperature< fahrenheit_scale, delta< int64_t, std::ratio< 5, 9000 > > > |
| Fahrenheit with 0.001 degree precision. | |
Temperature types and utilities.
This library provides type-safe temperature handling with support for multiple scales (Celsius, Kelvin, Fahrenheit) and precisions, following the design of std::chrono. It distinguishes between absolute temperatures and temperature differences (deltas).
Celsius with 1 degree precision.
Definition at line 885 of file thermo.hpp.
| using thermo::decicelsius = typedef temperature<celsius_scale, delta<int64_t, std::deci> > |
Celsius with 0.1 degree precision.
Definition at line 887 of file thermo.hpp.
| using thermo::decifahrenheit = typedef temperature<fahrenheit_scale, delta<int64_t, std::ratio<5, 90> >> |
Fahrenheit with 0.1 degree precision.
Definition at line 899 of file thermo.hpp.
| using thermo::decikelvin = typedef temperature<kelvin_scale, delta<int64_t, std::deci> > |
Kelvin with 0.1 degree precision.
Definition at line 893 of file thermo.hpp.
Delta with 1 degree precision (Celsius/Kelvin).
Definition at line 463 of file thermo.hpp.
| using thermo::delta_decicelsius = typedef delta<int64_t, std::deci> |
Delta with 0.1 degree precision (Celsius/Kelvin).
Definition at line 465 of file thermo.hpp.
| using thermo::delta_decifahrenheit = typedef delta<int64_t, std::ratio<5, 90> > |
Delta with 0.1°F precision.
Definition at line 477 of file thermo.hpp.
| using thermo::delta_decikelvin = typedef delta<int64_t, std::deci> |
Delta with 0.1 degree precision (Celsius/Kelvin).
Definition at line 471 of file thermo.hpp.
| using thermo::delta_fahrenheit = typedef delta<int64_t, std::ratio<5, 9> > |
Delta with 1°F precision.
Definition at line 475 of file thermo.hpp.
Delta with 1 degree precision (Celsius/Kelvin).
Definition at line 469 of file thermo.hpp.
| using thermo::delta_millicelsius = typedef delta<int64_t, std::milli> |
Delta with 0.001 degree precision (Celsius/Kelvin).
Definition at line 467 of file thermo.hpp.
| using thermo::delta_millifahrenheit = typedef delta<int64_t, std::ratio<5, 9000> > |
Delta with 0.001°F precision.
Definition at line 479 of file thermo.hpp.
| using thermo::delta_millikelvin = typedef delta<int64_t, std::milli> |
Delta with 0.001 degree precision (Celsius/Kelvin).
Definition at line 473 of file thermo.hpp.
| using thermo::fahrenheit = typedef temperature<fahrenheit_scale, delta<int64_t, std::ratio<5, 9> >> |
Fahrenheit with 1 degree precision.
Definition at line 897 of file thermo.hpp.
Kelvin with 1 degree precision.
Definition at line 891 of file thermo.hpp.
| using thermo::millicelsius = typedef temperature<celsius_scale, delta<int64_t, std::milli> > |
Celsius with 0.001 degree precision.
Definition at line 889 of file thermo.hpp.
| using thermo::millifahrenheit = typedef temperature<fahrenheit_scale, delta<int64_t, std::ratio<5, 9000> >> |
Fahrenheit with 0.001 degree precision.
Definition at line 901 of file thermo.hpp.
| using thermo::millikelvin = typedef temperature<kelvin_scale, delta<int64_t, std::milli> > |
Kelvin with 0.001 degree precision.
Definition at line 895 of file thermo.hpp.
Rounds a delta up to the nearest representable value in the target precision.
Returns the smallest value of type ToDelta that is greater than or equal to d. When converting to the same or finer precision, returns the exact conversion.
| ToDelta | Target delta type. |
| Rep | Source representation type. |
| Precision | Source precision. |
| d | The delta to round. |
Definition at line 288 of file thermo.hpp.
References delta_cast().
|
constexpr |
Converts a delta to a different precision or representation.
| ToDelta | The target delta type. |
| Rep | Source representation type. |
| Precision | Source precision. |
| d | The delta to convert. |
Definition at line 252 of file thermo.hpp.
References thermo::delta< Rep, Precision >::count().
Referenced by ceil(), difference(), floor(), operator%(), operator%(), operator*(), operator*(), operator+(), operator+(), operator+(), operator+(), thermo::temperature< Scale, Delta >::operator+=(), operator-(), operator-(), operator-(), thermo::temperature< Scale, Delta >::operator-=(), operator/(), operator/(), operator<=>(), operator<=>(), operator==(), operator==(), round(), temperature_cast(), to_string(), to_string(), and trunc().
|
constexpr |
Returns the difference between two temperatures as a delta.
| lhs | First temperature. |
| rhs | Second temperature. |
Definition at line 844 of file thermo.hpp.
References delta_cast().
Rounds a delta down to the nearest representable value in the target precision.
Returns the largest value of type ToDelta that is less than or equal to d. When converting to the same or finer precision, returns the exact conversion.
| ToDelta | Target delta type. |
| Rep | Source representation type. |
| Precision | Source precision. |
| d | The delta to round. |
Definition at line 309 of file thermo.hpp.
References delta_cast().
|
constexpr |
Returns the remainder of dividing a delta by a scalar.
Definition at line 434 of file thermo.hpp.
References delta_cast().
|
constexpr |
Returns the remainder of dividing two deltas.
Definition at line 443 of file thermo.hpp.
References delta_cast().
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Adds two temperatures on the same scale.
Definition at line 821 of file thermo.hpp.
References delta_cast().
|
constexpr |
|
constexpr |
Returns the difference of two deltas.
Definition at line 390 of file thermo.hpp.
References delta_cast().
|
constexpr |
Subtracts two temperatures on the same scale.
Definition at line 829 of file thermo.hpp.
References delta_cast().
|
constexpr |
Subtracts a delta from a temperature.
Definition at line 867 of file thermo.hpp.
References delta_cast().
|
constexpr |
|
constexpr |
Divides two deltas, returning a scalar.
Definition at line 424 of file thermo.hpp.
References thermo::delta< Rep, Precision >::count(), and delta_cast().
|
constexpr |
Definition at line 457 of file thermo.hpp.
References thermo::delta< Rep, Precision >::count(), and delta_cast().
|
constexpr |
Definition at line 880 of file thermo.hpp.
References delta_cast().
|
constexpr |
Definition at line 450 of file thermo.hpp.
References thermo::delta< Rep, Precision >::count(), and delta_cast().
|
constexpr |
Definition at line 874 of file thermo.hpp.
References delta_cast().
Rounds a delta to the nearest representable value in the target precision.
Returns the value of type ToDelta that is nearest to d. When exactly halfway between two values, rounds away from zero. When converting to the same or finer precision, returns the exact conversion.
| ToDelta | Target delta type. |
| Rep | Source representation type. |
| Precision | Source precision. |
| d | The delta to round. |
Definition at line 348 of file thermo.hpp.
References delta_cast().
Converts a temperature to a different scale or precision.
| ToTemp | The target temperature type. |
| Scale | Source scale. |
| Delta | Source delta type. |
| t | The temperature to convert. |
Definition at line 779 of file thermo.hpp.
References delta_cast().
Renders a delta as its exact count with a precision-qualified unit, e.g.
to_string(delta_millicelsius(1500)) == "1500Δm°C".
Definition at line 544 of file thermo.hpp.
References delta_cast().
Renders a temperature as its exact count with a precision-qualified unit, e.g.
to_string(millicelsius(22500)) == "22500m°C".
Definition at line 909 of file thermo.hpp.
References delta_cast().
Rounds a delta toward zero to the nearest representable value in the target precision.
Returns the value of type ToDelta that is closest to zero. When converting to the same or finer precision, returns the exact conversion.
| ToDelta | Target delta type. |
| Rep | Source representation type. |
| Precision | Source precision. |
| d | The delta to round. |
Definition at line 330 of file thermo.hpp.
References delta_cast().