thermo 1.0.0
Type-safe temperature handling library modeled after std::chrono
Loading...
Searching...
No Matches
thermo::temperature< Scale, Delta > Class Template Reference

An absolute temperature on a given scale. More...

#include <thermo/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>) && (treat_as_inexact_v<rep> || (_harmonic_precision<typename Delta2::precision, typename Delta::precision> && !treat_as_inexact_v<typename Delta2::rep>))
constexpr temperature (const temperature< Scale, Delta2 > &t)
 
template<typename Delta2 >
requires (!std::is_same_v<Delta, Delta2>) && (!treat_as_inexact_v<rep>) && (!_harmonic_precision<typename Delta2::precision, typename Delta::precision>)
constexpr temperature (const temperature< Scale, Delta2 > &t)
 
template<typename Scale2 , typename Delta2 >
requires (!std::is_same_v<temperature, temperature<Scale2, Delta2>>) && _lossless_temperature_conversion<Scale2, Delta2, Scale, Delta> && (treat_as_inexact_v<rep> || !treat_as_inexact_v<typename Delta2::rep>)
constexpr temperature (const temperature< Scale2, Delta2 > &t)
 
template<typename Scale2 , typename Delta2 >
requires (!std::is_same_v<temperature, temperature<Scale2, Delta2>>) && (!_lossless_temperature_conversion<Scale2, Delta2, Scale, Delta>)
constexpr temperature (const temperature< Scale2, Delta2 > &t)
 
 ~temperature ()=default
 
temperatureoperator= (const temperature &)=default
 
constexpr rep count () const
 Returns the tick count.
 
constexpr temperatureoperator++ ()
 
constexpr temperature operator++ (int)
 
constexpr temperatureoperator-- ()
 
constexpr temperature operator-- (int)
 
template<typename Rep2 , typename Precision2 >
constexpr temperatureoperator+= (const delta< Rep2, Precision2 > &d)
 
template<typename Rep2 , typename Precision2 >
constexpr temperatureoperator-= (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.
 

Detailed Description

template<typename Scale, typename Delta>
class thermo::temperature< Scale, Delta >

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.

Template Parameters
ScaleThe temperature scale (celsius_scale, kelvin_scale, fahrenheit_scale).
DeltaThe delta type for precision (default: delta<int64_t>).

Definition at line 599 of file thermo.hpp.

Member Typedef Documentation

◆ delta_type

The delta type.

Definition at line 606 of file thermo.hpp.

◆ rep

The representation type.

Definition at line 608 of file thermo.hpp.

◆ scale

The temperature scale.

Definition at line 604 of file thermo.hpp.

Constructor & Destructor Documentation

◆ temperature() [1/8]

◆ temperature() [2/8]

template<typename Scale , typename Delta >
thermo::temperature< Scale, Delta >::temperature ( const temperature< Scale, Delta > &  )
default

◆ temperature() [3/8]

template<typename Scale , typename Delta >
template<typename Rep2 >
requires std::convertible_to<const Rep2&, rep> && (treat_as_inexact_v<rep> || !treat_as_inexact_v<Rep2>)
constexpr thermo::temperature< Scale, Delta >::temperature ( const Rep2 r)
inlineexplicitconstexpr

Constructs from a tick count.

Template Parameters
Rep2The source representation type.
Parameters
rThe tick count in scale units.

Definition at line 621 of file thermo.hpp.

◆ temperature() [4/8]

template<typename Scale , typename Delta >
constexpr thermo::temperature< Scale, Delta >::temperature ( const Delta d)
inlineexplicitconstexpr

Constructs from a delta.

Parameters
dThe delta from the scale's zero point.

Definition at line 628 of file thermo.hpp.

◆ temperature() [5/8]

template<typename Scale , typename Delta >
template<typename Delta2 >
requires (!std::is_same_v<Delta, Delta2>) && (treat_as_inexact_v<rep> || (_harmonic_precision<typename Delta2::precision, typename Delta::precision> && !treat_as_inexact_v<typename Delta2::rep>))
constexpr thermo::temperature< Scale, Delta >::temperature ( const temperature< Scale, Delta2 > &  t)
inlineconstexpr

Definition at line 637 of file thermo.hpp.

◆ temperature() [6/8]

template<typename Scale , typename Delta >
template<typename Delta2 >
requires (!std::is_same_v<Delta, Delta2>) && (!treat_as_inexact_v<rep>) && (!_harmonic_precision<typename Delta2::precision, typename Delta::precision>)
constexpr thermo::temperature< Scale, Delta >::temperature ( const temperature< Scale, Delta2 > &  t)
inlineexplicitconstexpr

Definition at line 644 of file thermo.hpp.

◆ temperature() [7/8]

Definition at line 652 of file thermo.hpp.

◆ temperature() [8/8]

template<typename Scale , typename Delta >
constexpr thermo::temperature< Scale, Delta >::temperature ( const temperature< Scale2, Delta2 > &  t)
inlineexplicitconstexpr

Definition at line 659 of file thermo.hpp.

◆ ~temperature()

Member Function Documentation

◆ count()

template<typename Scale , typename Delta >
constexpr rep thermo::temperature< Scale, Delta >::count ( ) const
inlineconstexpr

Returns the tick count.

Definition at line 666 of file thermo.hpp.

◆ max()

template<typename Scale , typename Delta >
static constexpr temperature thermo::temperature< Scale, Delta >::max ( )
inlinestaticconstexprnoexcept

Returns the maximum representable temperature.

Definition at line 698 of file thermo.hpp.

References thermo::temperature< Scale, Delta >::temperature().

◆ min()

template<typename Scale , typename Delta >
static constexpr temperature thermo::temperature< Scale, Delta >::min ( )
inlinestaticconstexprnoexcept

Returns the minimum representable temperature.

Definition at line 695 of file thermo.hpp.

References thermo::temperature< Scale, Delta >::temperature().

◆ operator++() [1/2]

Definition at line 668 of file thermo.hpp.

◆ operator++() [2/2]

◆ operator+=()

Definition at line 683 of file thermo.hpp.

References thermo::delta_cast().

◆ operator--() [1/2]

Definition at line 675 of file thermo.hpp.

◆ operator--() [2/2]

◆ operator-=()

Definition at line 689 of file thermo.hpp.

References thermo::delta_cast().

◆ operator=()


The documentation for this class was generated from the following file: