Physical Quantities  v1.0.0
C++ library of physical quantities, physical models, and units of measure for scientific computing. https://github.com/acodcha/phq
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
PhQ::Temperature< NumericType > Class Template Reference

Temperature. For a temperature difference, see PhQ::TemperatureDifference. For the gradient of temperature, see PhQ::TemperatureGradient. More...

#include "Temperature.hpp"

Public Member Functions

 Temperature ()=default
 Default constructor. Constructs a temperature with an uninitialized value. More...
 
 Temperature (const NumericType value, const Unit::Temperature unit)
 Constructor. Constructs a temperature with a given value expressed in a given temperature unit. More...
 
 ~Temperature () noexcept=default
 Destructor. Destroys this temperature. More...
 
constexpr Temperature (const Temperature< NumericType > &other)=default
 Copy constructor. Constructs a temperature by copying another one. More...
 
template<typename OtherNumericType >
constexpr Temperature (const Temperature< OtherNumericType > &other)
 Copy constructor. Constructs a temperature by copying another one. More...
 
constexpr Temperature (Temperature< NumericType > &&other) noexcept=default
 Move constructor. Constructs a temperature by moving another one. More...
 
constexpr Temperature< NumericType > & operator= (const Temperature< NumericType > &other)=default
 Copy assignment operator. Assigns this temperature by copying another one. More...
 
template<typename OtherNumericType >
constexpr Temperature< NumericType > & operator= (const Temperature< OtherNumericType > &other)
 Copy assignment operator. Assigns this temperature by copying another one. More...
 
constexpr Temperature< NumericType > & operator= (Temperature< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this temperature by moving another one. More...
 
constexpr Temperature< NumericType > operator+ (const Temperature< NumericType > &temperature) const
 
constexpr Temperature< NumericType > operator+ (const TemperatureDifference< NumericType > &temperature_difference) const
 
constexpr TemperatureDifference< NumericType > operator- (const Temperature< NumericType > &temperature) const
 
constexpr Temperature< NumericType > operator- (const TemperatureDifference< NumericType > &temperature_difference) const
 
constexpr Temperature< NumericType > operator* (const NumericType number) const
 
constexpr Temperature< NumericType > operator/ (const NumericType number) const
 
constexpr NumericType operator/ (const Temperature< NumericType > &temperature) const noexcept
 
constexpr void operator+= (const Temperature< NumericType > &temperature) noexcept
 
constexpr void operator+= (const TemperatureDifference< NumericType > &temperature_difference) noexcept
 
constexpr void operator-= (const Temperature< NumericType > &temperature) noexcept
 
constexpr void operator-= (const TemperatureDifference< NumericType > &temperature_difference) noexcept
 
constexpr void operator*= (const NumericType number) noexcept
 
constexpr void operator/= (const NumericType number) noexcept
 
constexpr double Value () const noexcept
 Value of this physical quantity expressed in its standard unit of measure. More...
 
double Value (const Unit::Temperature unit) const
 Value of this physical quantity expressed in a given unit of measure. More...
 
constexpr double StaticValue () const
 Value of this physical quantity expressed in a given unit of measure. This method can be evaluated statically at compile-time. More...
 
constexpr double & MutableValue () noexcept
 Returns the value of this physical quantity expressed in its standard unit of measure as a mutable value. More...
 
constexpr void SetValue (const double value) noexcept
 Sets the value of this physical quantity expressed in its standard unit of measure to the given value. More...
 
std::string Print () const
 Prints this physical quantity as a string. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string Print (const Unit::Temperature unit) const
 Prints this physical quantity as a string. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string JSON () const
 Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string JSON (const Unit::Temperature unit) const
 Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string XML () const
 Serializes this physical quantity as an XML message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string XML (const Unit::Temperature unit) const
 Serializes this physical quantity as an XML message. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string YAML () const
 Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string YAML (const Unit::Temperature unit) const
 Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in the given unit of measure. More...
 

Static Public Member Functions

static constexpr Temperature< NumericType > Zero ()
 Statically creates a temperature of absolute zero. More...
 
template<Unit::Temperature Unit>
static constexpr Temperature< NumericType > Create (const NumericType value)
 Statically creates a temperature with a given value expressed in a given temperature unit. More...
 
static constexpr const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr Unit::Temperature Unit ()
 Standard unit of measure for this physical quantity. This physical quantity's value is stored internally in this unit of measure. More...
 

Protected Attributes

double value
 Value of this physical quantity expressed in its standard unit of measure. More...
 

Private Member Functions

constexpr Temperature (const NumericType value)
 Constructor. Constructs a temperature with a given value expressed in the standard temperature unit. More...
 

Friends

template<typename OtherNumericType >
class TemperatureDifference
 Temperature difference units. Not to be confused with temperature units. For example, a temperature difference of +20 °C corresponds to a temperature difference of +36 °F, whereas a temperature of 20 °C corresponds to a temperature of 68 °F. More...
 

Detailed Description

template<typename NumericType = double>
class PhQ::Temperature< NumericType >

Temperature. For a temperature difference, see PhQ::TemperatureDifference. For the gradient of temperature, see PhQ::TemperatureGradient.

Definition at line 41 of file Temperature.hpp.

Constructor & Destructor Documentation

◆ Temperature() [1/6]

template<typename NumericType = double>
PhQ::Temperature< NumericType >::Temperature ( )
default

Default constructor. Constructs a temperature with an uninitialized value.

◆ Temperature() [2/6]

template<typename NumericType = double>
PhQ::Temperature< NumericType >::Temperature ( const NumericType  value,
const Unit::Temperature< NumericType >  unit 
)
inline

Constructor. Constructs a temperature with a given value expressed in a given temperature unit.

Definition at line 48 of file Temperature.hpp.

◆ ~Temperature()

template<typename NumericType = double>
PhQ::Temperature< NumericType >::~Temperature ( )
defaultnoexcept

Destructor. Destroys this temperature.

◆ Temperature() [3/6]

template<typename NumericType = double>
constexpr PhQ::Temperature< NumericType >::Temperature ( const Temperature< NumericType > &  other)
constexprdefault

Copy constructor. Constructs a temperature by copying another one.

◆ Temperature() [4/6]

template<typename NumericType = double>
template<typename OtherNumericType >
constexpr PhQ::Temperature< NumericType >::Temperature ( const Temperature< OtherNumericType > &  other)
inlineexplicitconstexpr

Copy constructor. Constructs a temperature by copying another one.

Definition at line 59 of file Temperature.hpp.

◆ Temperature() [5/6]

template<typename NumericType = double>
constexpr PhQ::Temperature< NumericType >::Temperature ( Temperature< NumericType > &&  other)
constexprdefaultnoexcept

Move constructor. Constructs a temperature by moving another one.

◆ Temperature() [6/6]

template<typename NumericType = double>
constexpr PhQ::Temperature< NumericType >::Temperature ( const NumericType  value)
inlineexplicitconstexprprivate

Constructor. Constructs a temperature with a given value expressed in the standard temperature unit.

Definition at line 152 of file Temperature.hpp.

Member Function Documentation

◆ Create()

template<typename NumericType = double>
template<Unit::Temperature Unit>
static constexpr Temperature<NumericType> PhQ::Temperature< NumericType >::Create ( const NumericType  value)
inlinestaticconstexpr

Statically creates a temperature with a given value expressed in a given temperature unit.

Definition at line 87 of file Temperature.hpp.

References PhQ::DimensionalScalar< Unit::Temperature, double >::value.

◆ Dimensions()

static constexpr const PhQ::Dimensions& PhQ::DimensionalScalar< Unit::Temperature , double >::Dimensions ( )
inlinestaticconstexprinherited

Physical dimension set of this physical quantity.

Definition at line 54 of file DimensionalScalar.hpp.

◆ JSON() [1/2]

std::string PhQ::DimensionalScalar< Unit::Temperature , double >::JSON ( ) const
inlineinherited

Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 107 of file DimensionalScalar.hpp.

◆ JSON() [2/2]

std::string PhQ::DimensionalScalar< Unit::Temperature , double >::JSON ( const Unit::Temperature  unit) const
inlineinherited

Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 117 of file DimensionalScalar.hpp.

◆ MutableValue()

constexpr double & PhQ::DimensionalScalar< Unit::Temperature , double >::MutableValue ( )
inlineconstexprnoexceptinherited

Returns the value of this physical quantity expressed in its standard unit of measure as a mutable value.

Definition at line 83 of file DimensionalScalar.hpp.

◆ operator*()

template<typename NumericType = double>
constexpr Temperature<NumericType> PhQ::Temperature< NumericType >::operator* ( const NumericType  number) const
inlineconstexpr

◆ operator*=()

template<typename NumericType = double>
constexpr void PhQ::Temperature< NumericType >::operator*= ( const NumericType  number)
inlineconstexprnoexcept

◆ operator+() [1/2]

template<typename NumericType = double>
constexpr Temperature<NumericType> PhQ::Temperature< NumericType >::operator+ ( const Temperature< NumericType > &  temperature) const
inlineconstexpr

◆ operator+() [2/2]

template<typename NumericType = double>
constexpr Temperature<NumericType> PhQ::Temperature< NumericType >::operator+ ( const TemperatureDifference< NumericType > &  temperature_difference) const
inlineconstexpr

◆ operator+=() [1/2]

template<typename NumericType = double>
constexpr void PhQ::Temperature< NumericType >::operator+= ( const Temperature< NumericType > &  temperature)
inlineconstexprnoexcept

◆ operator+=() [2/2]

template<typename NumericType = double>
constexpr void PhQ::Temperature< NumericType >::operator+= ( const TemperatureDifference< NumericType > &  temperature_difference)
inlineconstexprnoexcept

◆ operator-() [1/2]

template<typename NumericType = double>
constexpr TemperatureDifference<NumericType> PhQ::Temperature< NumericType >::operator- ( const Temperature< NumericType > &  temperature) const
inlineconstexpr

◆ operator-() [2/2]

template<typename NumericType = double>
constexpr Temperature<NumericType> PhQ::Temperature< NumericType >::operator- ( const TemperatureDifference< NumericType > &  temperature_difference) const
inlineconstexpr

◆ operator-=() [1/2]

template<typename NumericType = double>
constexpr void PhQ::Temperature< NumericType >::operator-= ( const Temperature< NumericType > &  temperature)
inlineconstexprnoexcept

◆ operator-=() [2/2]

template<typename NumericType = double>
constexpr void PhQ::Temperature< NumericType >::operator-= ( const TemperatureDifference< NumericType > &  temperature_difference)
inlineconstexprnoexcept

◆ operator/() [1/2]

template<typename NumericType = double>
constexpr Temperature<NumericType> PhQ::Temperature< NumericType >::operator/ ( const NumericType  number) const
inlineconstexpr

◆ operator/() [2/2]

template<typename NumericType = double>
constexpr NumericType PhQ::Temperature< NumericType >::operator/ ( const Temperature< NumericType > &  temperature) const
inlineconstexprnoexcept

◆ operator/=()

template<typename NumericType = double>
constexpr void PhQ::Temperature< NumericType >::operator/= ( const NumericType  number)
inlineconstexprnoexcept

◆ operator=() [1/3]

template<typename NumericType = double>
constexpr Temperature<NumericType>& PhQ::Temperature< NumericType >::operator= ( const Temperature< NumericType > &  other)
constexprdefault

Copy assignment operator. Assigns this temperature by copying another one.

◆ operator=() [2/3]

template<typename NumericType = double>
template<typename OtherNumericType >
constexpr Temperature<NumericType>& PhQ::Temperature< NumericType >::operator= ( const Temperature< OtherNumericType > &  other)
inlineconstexpr

Copy assignment operator. Assigns this temperature by copying another one.

Definition at line 70 of file Temperature.hpp.

References PhQ::DimensionalScalar< UnitType, NumericType >::Value(), and PhQ::DimensionalScalar< Unit::Temperature, double >::value.

◆ operator=() [3/3]

template<typename NumericType = double>
constexpr Temperature<NumericType>& PhQ::Temperature< NumericType >::operator= ( Temperature< NumericType > &&  other)
constexprdefaultnoexcept

Move assignment operator. Assigns this temperature by moving another one.

◆ Print() [1/2]

std::string PhQ::DimensionalScalar< Unit::Temperature , double >::Print ( ) const
inlineinherited

Prints this physical quantity as a string. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 95 of file DimensionalScalar.hpp.

◆ Print() [2/2]

std::string PhQ::DimensionalScalar< Unit::Temperature , double >::Print ( const Unit::Temperature  unit) const
inlineinherited

Prints this physical quantity as a string. This physical quantity's value is expressed in the given unit of measure.

Definition at line 101 of file DimensionalScalar.hpp.

◆ SetValue()

constexpr void PhQ::DimensionalScalar< Unit::Temperature , double >::SetValue ( const double  value)
inlineconstexprnoexceptinherited

Sets the value of this physical quantity expressed in its standard unit of measure to the given value.

Definition at line 89 of file DimensionalScalar.hpp.

◆ StaticValue()

constexpr double PhQ::DimensionalScalar< Unit::Temperature , double >::StaticValue ( ) const
inlineconstexprinherited

Value of this physical quantity expressed in a given unit of measure. This method can be evaluated statically at compile-time.

Definition at line 77 of file DimensionalScalar.hpp.

◆ Unit()

static constexpr Unit::Temperature PhQ::DimensionalScalar< Unit::Temperature , double >::Unit ( )
inlinestaticconstexprinherited

Standard unit of measure for this physical quantity. This physical quantity's value is stored internally in this unit of measure.

Definition at line 60 of file DimensionalScalar.hpp.

◆ Value() [1/2]

constexpr double PhQ::DimensionalScalar< Unit::Temperature , double >::Value ( ) const
inlineconstexprnoexceptinherited

Value of this physical quantity expressed in its standard unit of measure.

Definition at line 65 of file DimensionalScalar.hpp.

◆ Value() [2/2]

double PhQ::DimensionalScalar< Unit::Temperature , double >::Value ( const Unit::Temperature  unit) const
inlineinherited

Value of this physical quantity expressed in a given unit of measure.

Definition at line 70 of file DimensionalScalar.hpp.

◆ XML() [1/2]

std::string PhQ::DimensionalScalar< Unit::Temperature , double >::XML ( ) const
inlineinherited

Serializes this physical quantity as an XML message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 127 of file DimensionalScalar.hpp.

◆ XML() [2/2]

std::string PhQ::DimensionalScalar< Unit::Temperature , double >::XML ( const Unit::Temperature  unit) const
inlineinherited

Serializes this physical quantity as an XML message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 137 of file DimensionalScalar.hpp.

◆ YAML() [1/2]

std::string PhQ::DimensionalScalar< Unit::Temperature , double >::YAML ( ) const
inlineinherited

Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 147 of file DimensionalScalar.hpp.

◆ YAML() [2/2]

std::string PhQ::DimensionalScalar< Unit::Temperature , double >::YAML ( const Unit::Temperature  unit) const
inlineinherited

Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 157 of file DimensionalScalar.hpp.

◆ Zero()

template<typename NumericType = double>
static constexpr Temperature<NumericType> PhQ::Temperature< NumericType >::Zero ( )
inlinestaticconstexpr

Statically creates a temperature of absolute zero.

Definition at line 80 of file Temperature.hpp.

Friends And Related Function Documentation

◆ TemperatureDifference

template<typename NumericType = double>
template<typename OtherNumericType >
friend class TemperatureDifference
friend

Temperature difference units. Not to be confused with temperature units. For example, a temperature difference of +20 °C corresponds to a temperature difference of +36 °F, whereas a temperature of 20 °C corresponds to a temperature of 68 °F.

Definition at line 156 of file Temperature.hpp.

Member Data Documentation

◆ value

double PhQ::DimensionalScalar< Unit::Temperature , double >::value
protectedinherited

Value of this physical quantity expressed in its standard unit of measure.

Definition at line 221 of file DimensionalScalar.hpp.


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