|
thermo 2.1.1
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 905 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 907 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 919 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 913 of file thermo.hpp.
Delta with 1 degree precision (Celsius/Kelvin).
Definition at line 464 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 466 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 478 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 472 of file thermo.hpp.
| using thermo::delta_fahrenheit = typedef delta<int64_t, std::ratio<5, 9> > |
Delta with 1°F precision.
Definition at line 476 of file thermo.hpp.
Delta with 1 degree precision (Celsius/Kelvin).
Definition at line 470 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 468 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 480 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 474 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 917 of file thermo.hpp.
Kelvin with 1 degree precision.
Definition at line 911 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 909 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 921 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 915 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 289 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 253 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 864 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 310 of file thermo.hpp.
References delta_cast().
|
constexpr |
Returns the remainder of dividing a delta by a scalar.
Definition at line 435 of file thermo.hpp.
References delta_cast().
|
constexpr |
Returns the remainder of dividing two deltas.
Definition at line 444 of file thermo.hpp.
References delta_cast().
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Adds two temperatures on the same scale.
Definition at line 841 of file thermo.hpp.
References delta_cast().
|
constexpr |
|
constexpr |
Returns the difference of two deltas.
Definition at line 391 of file thermo.hpp.
References delta_cast().
|
constexpr |
Subtracts two temperatures on the same scale.
Definition at line 849 of file thermo.hpp.
References delta_cast().
|
constexpr |
Subtracts a delta from a temperature.
Definition at line 887 of file thermo.hpp.
References delta_cast().
|
constexpr |
|
constexpr |
Divides two deltas, returning a scalar.
Definition at line 425 of file thermo.hpp.
References thermo::delta< Rep, Precision >::count(), and delta_cast().
|
constexpr |
Definition at line 458 of file thermo.hpp.
References thermo::delta< Rep, Precision >::count(), and delta_cast().
|
constexpr |
Definition at line 900 of file thermo.hpp.
References delta_cast().
|
constexpr |
Definition at line 451 of file thermo.hpp.
References thermo::delta< Rep, Precision >::count(), and delta_cast().
|
constexpr |
Definition at line 894 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 349 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 799 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 564 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 929 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 331 of file thermo.hpp.
References delta_cast().