6#include "roo_logging.h"
9#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
22class TemperatureDelta;
41 bool isUnknown()
const {
return std::isnan(tempC_); }
44 return tempC_ < other.tempC_;
48 return tempC_ == other.tempC_;
52 return other.tempC_ < tempC_;
56 return !(other.tempC_ < tempC_);
60 return !(tempC_ < other.tempC_);
64 return !(tempC_ == other.tempC_);
70#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
73 std::string asString()
const;
77 String asArduinoString()
const;
87 explicit Temperature(
float tempC) : tempC_(tempC) {}
113 return tempC_ < other.tempC_;
117 return tempC_ == other.tempC_;
121 return other.tempC_ < tempC_;
125 return !(other.tempC_ < tempC_);
129 return !(tempC_ < other.tempC_);
133 return !(tempC_ == other.tempC_);
156#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
159 std::string asString()
const;
163 String asArduinoString()
const;
180roo_logging::Stream &
operator<<(roo_logging::Stream &os,
const Temperature &t);
181roo_logging::Stream &
operator<<(roo_logging::Stream &os,
182 const TemperatureDelta &t);
bool operator<=(const TemperatureDelta &other) const
TemperatureDelta & operator-=(const TemperatureDelta &other)
float degKelvin() const
Returns the temperature delta in degrees Kelvin.
float degFahrenheit() const
Returns the temperature delta in degrees Fahrenheit.
TemperatureDelta()
Creates a temperature delta object representing an 'unknown' temperature delta.
bool operator!=(const TemperatureDelta &other) const
TemperatureDelta & operator*=(float multi)
bool operator==(const TemperatureDelta &other) const
bool operator>(const TemperatureDelta &other) const
TemperatureDelta & operator+=(const TemperatureDelta &other)
bool operator>=(const TemperatureDelta &other) const
friend TemperatureDelta TemperatureDeltaDegKelvin(float)
Returns a temperature delta object equivalent to the specified temperature delta expressed in Kelvin ...
bool isUnknown() const
Returns whether the object represents an unknown temperature delta.
friend TemperatureDelta TemperatureDeltaDegCelcius(float)
Returns a temperature delta object equivalent to the specified temperature expressed in Celcius degre...
float degCelcius() const
Returns the temperature delta in degrees Celcius.
TemperatureDelta & operator/=(float div)
bool operator<(const TemperatureDelta &other) const
friend TemperatureDelta UnknownTemperatureDelta()
Returns a temperature object representing an unknown temperature delta.
friend TemperatureDelta TemperatureDeltaDegFahrenheit(float)
Returns a temperature delta object approximately equal to the specified temperature delta expressed i...
Representation of a temperature, internally stored as floating-point Celsius degrees.
bool operator<(const Temperature &other) const
float degCelcius() const
Returns the temperature in degrees Celcius.
friend Temperature TemperatureDegFahrenheit(float)
Returns a temperature object approximately equal to the specified temperature expressed in Fahrenheit...
friend Temperature TemperatureDegCelcius(float)
Returns a temperature object equivalent to the specified temperature expressed in Celcius degrees.
bool operator>=(const Temperature &other) const
friend Temperature TemperatureDegKelvin(float)
Returns a temperature object equivalent to the specified temperature expressed in Kelvin degrees.
bool isUnknown() const
Returns whether the object represents an unknown temperature.
bool operator!=(const Temperature &other) const
float degFahrenheit() const
Returns the temperature in degrees Fahrenheit.
bool operator<=(const Temperature &other) const
friend Temperature UnknownTemperature()
Returns a temperature object representing an unknown temperature.
Temperature & operator+=(const TemperatureDelta &other)
float degKelvin() const
Returns the temperature in degrees Kelvin.
Temperature & operator-=(const TemperatureDelta &other)
bool operator>(const Temperature &other) const
bool operator==(const Temperature &other) const
Temperature()
Creates a temperature object representing an 'unknown' temperature.
For convenience conversion from roo_time::Duration.
Temperature TemperatureDegFahrenheit(float tempF)
Returns a temperature object approximately equal to the specified temperature expressed in Fahrenheit...
TemperatureDelta TemperatureDeltaDegCelcius(float tempC)
Returns a temperature delta object equivalent to the specified temperature expressed in Celcius degre...
TemperatureDelta TemperatureDeltaDegKelvin(float tempK)
Returns a temperature delta object equivalent to the specified temperature delta expressed in Kelvin ...
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Temperature TemperatureDegCelcius(float tempC)
Returns a temperature object equivalent to the specified temperature expressed in Celcius degrees.
Area operator+(Area a, Area b)
TemperatureDelta TemperatureDeltaDegFahrenheit(float tempF)
Returns a temperature delta object approximately equal to the specified temperature delta expressed i...
Temperature TemperatureDegKelvin(float tempK)
Returns a temperature object equivalent to the specified temperature expressed in Kelvin degrees.
Area operator-(Area a, Area b)
TemperatureDelta UnknownTemperatureDelta()
Returns a temperature object representing an unknown temperature delta.
Area operator/(Area a, float b)
Area operator*(Area a, float b)
Temperature UnknownTemperature()
Returns a temperature object representing an unknown temperature.
ROO_DECLARE_FLAG(char, roo_quantity_default_temperature_unit)