roo_quantity
API Documentation for roo_quantity
Loading...
Searching...
No Matches
roo_quantity::Temperature Class Reference

Representation of a temperature, internally stored as floating-point Celsius degrees. More...

#include <temperature.h>

Public Member Functions

 Temperature ()
 Creates a temperature object representing an 'unknown' temperature.
 
float degCelcius () const
 Returns the temperature in degrees Celcius.
 
float degKelvin () const
 Returns the temperature in degrees Kelvin.
 
float degFahrenheit () const
 Returns the temperature in degrees Fahrenheit.
 
bool isUnknown () const
 Returns whether the object represents an unknown temperature.
 
bool operator< (const Temperature &other) const
 
bool operator== (const Temperature &other) const
 
bool operator> (const Temperature &other) const
 
bool operator<= (const Temperature &other) const
 
bool operator>= (const Temperature &other) const
 
bool operator!= (const Temperature &other) const
 
Temperatureoperator+= (const TemperatureDelta &other)
 
Temperatureoperator-= (const TemperatureDelta &other)
 

Friends

Temperature UnknownTemperature ()
 Returns a temperature object representing an unknown temperature.
 
Temperature TemperatureDegCelcius (float)
 Returns a temperature object equivalent to the specified temperature expressed in Celcius degrees.
 
Temperature TemperatureDegKelvin (float)
 Returns a temperature object equivalent to the specified temperature expressed in Kelvin degrees.
 
Temperature TemperatureDegFahrenheit (float)
 Returns a temperature object approximately equal to the specified temperature expressed in Fahrenheit degrees.
 

Detailed Description

Representation of a temperature, internally stored as floating-point Celsius degrees.

Definition at line 26 of file temperature.h.

Constructor & Destructor Documentation

◆ Temperature()

roo_quantity::Temperature::Temperature ( )
inline

Creates a temperature object representing an 'unknown' temperature.

Definition at line 29 of file temperature.h.

Member Function Documentation

◆ degCelcius()

float roo_quantity::Temperature::degCelcius ( ) const
inline

Returns the temperature in degrees Celcius.

Definition at line 32 of file temperature.h.

Referenced by roo_quantity::operator+(), roo_quantity::operator+(), roo_quantity::operator-(), and roo_quantity::operator-().

◆ degFahrenheit()

float roo_quantity::Temperature::degFahrenheit ( ) const
inline

Returns the temperature in degrees Fahrenheit.

Definition at line 38 of file temperature.h.

◆ degKelvin()

float roo_quantity::Temperature::degKelvin ( ) const
inline

Returns the temperature in degrees Kelvin.

Definition at line 35 of file temperature.h.

◆ isUnknown()

bool roo_quantity::Temperature::isUnknown ( ) const
inline

Returns whether the object represents an unknown temperature.

Definition at line 41 of file temperature.h.

◆ operator!=()

bool roo_quantity::Temperature::operator!= ( const Temperature other) const
inline

Definition at line 63 of file temperature.h.

◆ operator+=()

Temperature & roo_quantity::Temperature::operator+= ( const TemperatureDelta other)
inline

Definition at line 239 of file temperature.h.

References roo_quantity::TemperatureDelta::degCelcius().

◆ operator-=()

Temperature & roo_quantity::Temperature::operator-= ( const TemperatureDelta other)
inline

Definition at line 244 of file temperature.h.

References roo_quantity::TemperatureDelta::degCelcius().

◆ operator<()

bool roo_quantity::Temperature::operator< ( const Temperature other) const
inline

Definition at line 43 of file temperature.h.

◆ operator<=()

bool roo_quantity::Temperature::operator<= ( const Temperature other) const
inline

Definition at line 55 of file temperature.h.

◆ operator==()

bool roo_quantity::Temperature::operator== ( const Temperature other) const
inline

Definition at line 47 of file temperature.h.

◆ operator>()

bool roo_quantity::Temperature::operator> ( const Temperature other) const
inline

Definition at line 51 of file temperature.h.

◆ operator>=()

bool roo_quantity::Temperature::operator>= ( const Temperature other) const
inline

Definition at line 59 of file temperature.h.

Friends And Related Symbol Documentation

◆ TemperatureDegCelcius

Temperature TemperatureDegCelcius ( float  tempC)
friend

Returns a temperature object equivalent to the specified temperature expressed in Celcius degrees.

Definition at line 189 of file temperature.h.

◆ TemperatureDegFahrenheit

Temperature TemperatureDegFahrenheit ( float  tempF)
friend

Returns a temperature object approximately equal to the specified temperature expressed in Fahrenheit degrees.

Due to floating-point rounding errors, and since the temperature is internally stored in Celcius degrees, generally, DegFahrenheit(x).degFahrenheit() != x.

Definition at line 209 of file temperature.h.

◆ TemperatureDegKelvin

Temperature TemperatureDegKelvin ( float  tempK)
friend

Returns a temperature object equivalent to the specified temperature expressed in Kelvin degrees.

Due to floating-point rounding errors, and since the temperature is internally stored in Celcius degrees, generally, DegKelvin(x).degKelvin() != x.

Definition at line 199 of file temperature.h.

◆ UnknownTemperature

Temperature UnknownTemperature ( )
friend

Returns a temperature object representing an unknown temperature.

Definition at line 185 of file temperature.h.


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