|
thermo 1.0.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, 900 > > |
| 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, 900 > > > |
| 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 811 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 813 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 825 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 819 of file thermo.hpp.
Delta with 1 degree precision (Celsius/Kelvin).
Definition at line 462 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 464 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 476 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 470 of file thermo.hpp.
| using thermo::delta_fahrenheit = typedef delta<int64_t, std::ratio<5, 9> > |
Delta with 1°F precision.
Definition at line 474 of file thermo.hpp.
Delta with 1 degree precision (Celsius/Kelvin).
Definition at line 468 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 466 of file thermo.hpp.
| using thermo::delta_millifahrenheit = typedef delta<int64_t, std::ratio<5, 900> > |
Delta with 0.001°F precision.
Definition at line 478 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 472 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 823 of file thermo.hpp.
Kelvin with 1 degree precision.
Definition at line 817 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 815 of file thermo.hpp.
| using thermo::millifahrenheit = typedef temperature<fahrenheit_scale, delta<int64_t, std::ratio<5, 900> >> |
Fahrenheit with 0.001 degree precision.
Definition at line 827 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 821 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 287 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 251 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(), to_string(), to_string(), to_string(), to_string(), to_string(), to_string(), to_string(), to_string(), 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 770 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 308 of file thermo.hpp.
References delta_cast().
|
constexpr |
Returns the remainder of dividing a delta by a scalar.
Definition at line 433 of file thermo.hpp.
References delta_cast().
|
constexpr |
Returns the remainder of dividing two deltas.
Definition at line 442 of file thermo.hpp.
References delta_cast().
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Adds two temperatures on the same scale.
Definition at line 747 of file thermo.hpp.
References delta_cast().
|
constexpr |
|
constexpr |
Returns the difference of two deltas.
Definition at line 389 of file thermo.hpp.
References delta_cast().
|
constexpr |
Subtracts two temperatures on the same scale.
Definition at line 755 of file thermo.hpp.
References delta_cast().
|
constexpr |
Subtracts a delta from a temperature.
Definition at line 793 of file thermo.hpp.
References delta_cast().
|
constexpr |
|
constexpr |
Divides two deltas, returning a scalar.
Definition at line 423 of file thermo.hpp.
References thermo::delta< Rep, Precision >::count(), and delta_cast().
|
constexpr |
Definition at line 456 of file thermo.hpp.
References thermo::delta< Rep, Precision >::count(), and delta_cast().
|
constexpr |
Definition at line 806 of file thermo.hpp.
References delta_cast().
|
constexpr |
Definition at line 449 of file thermo.hpp.
References thermo::delta< Rep, Precision >::count(), and delta_cast().
|
constexpr |
Definition at line 800 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 347 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 705 of file thermo.hpp.
References delta_cast().
|
inline |
Definition at line 829 of file thermo.hpp.
References delta_cast().
|
inline |
Definition at line 833 of file thermo.hpp.
References delta_cast().
|
inline |
Definition at line 857 of file thermo.hpp.
References delta_cast().
Definition at line 480 of file thermo.hpp.
References delta_cast().
Definition at line 484 of file thermo.hpp.
References delta_cast().
Definition at line 488 of file thermo.hpp.
References delta_cast().
|
inline |
Definition at line 496 of file thermo.hpp.
References delta_cast().
|
inline |
Definition at line 492 of file thermo.hpp.
References delta_cast().
|
inline |
Definition at line 500 of file thermo.hpp.
References delta_cast().
|
inline |
Definition at line 853 of file thermo.hpp.
References delta_cast().
|
inline |
Definition at line 841 of file thermo.hpp.
References delta_cast().
|
inline |
Definition at line 861 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 329 of file thermo.hpp.
References delta_cast().