Gazebo Math

API Reference

8.0.0

A class that stores temperature information, and allows conversion between different units. More...

#include <Temperature.hh>

Public Member Functions

 Temperature ()
 Default constructor.
 
 Temperature (double _temp)
 Kelvin value constructor. This is a conversion constructor, and assumes the passed in value is in Kelvin.
 
double Celsius () const
 Get the temperature in Celsius.
 
double Fahrenheit () const
 Get the temperature in Fahrenheit.
 
double Kelvin () const
 Get the temperature in Kelvin.
 
bool operator!= (const Temperature &_temp) const
 Inequality to operator.
 
bool operator!= (double _temp) const
 Inequality to operator, where the value of _temp is assumed to be in Kelvin.
 
double operator() () const
 Accessor operator.
 
Temperature operator* (const Temperature &_temp) const
 Multiplication operator.
 
Temperature operator* (double _temp) const
 Multiplication operator.
 
const Temperatureoperator*= (const Temperature &_temp)
 Multiplication assignment operator.
 
const Temperatureoperator*= (double _temp)
 Multiplication assignment operator.
 
Temperature operator+ (const Temperature &_temp) const
 Addition operator.
 
Temperature operator+ (double _temp) const
 Addition operator.
 
const Temperatureoperator+= (const Temperature &_temp)
 Addition assignment operator.
 
const Temperatureoperator+= (double _temp)
 Addition assignment operator.
 
Temperature operator- (const Temperature &_temp) const
 Subtraction operator.
 
Temperature operator- (double _temp) const
 Subtraction operator.
 
const Temperatureoperator-= (const Temperature &_temp)
 Subtraction assignment operator.
 
const Temperatureoperator-= (double _temp)
 Subtraction assignment operator.
 
Temperature operator/ (const Temperature &_temp) const
 Division operator.
 
Temperature operator/ (double _temp) const
 Division operator.
 
const Temperatureoperator/= (const Temperature &_temp)
 Division assignment operator.
 
const Temperatureoperator/= (double _temp)
 Division assignment operator.
 
bool operator< (const Temperature &_temp) const
 Less than to operator.
 
bool operator< (double _temp) const
 Less than operator, where the value of _temp is assumed to be in Kelvin.
 
bool operator<= (const Temperature &_temp) const
 Less than or equal to operator.
 
bool operator<= (double _temp) const
 Less than or equal operator, where the value of _temp is assumed to be in Kelvin.
 
Temperatureoperator= (double _temp)
 Assignment operator.
 
bool operator== (const Temperature &_temp) const
 Equal to operator.
 
bool operator== (double _temp) const
 Equal to operator, where the value of _temp is assumed to be in Kelvin.
 
bool operator> (const Temperature &_temp) const
 Greater than operator.
 
bool operator> (double _temp) const
 Greater than operator, where the value of _temp is assumed to be in Kelvin.
 
bool operator>= (const Temperature &_temp) const
 Greater than or equal to operator.
 
bool operator>= (double _temp) const
 Greater than equal operator, where the value of _temp is assumed to be in Kelvin.
 
void SetCelsius (double _temp)
 Set the temperature from a Celsius value.
 
void SetFahrenheit (double _temp)
 Set the temperature from a Fahrenheit value.
 
void SetKelvin (double _temp)
 Set the temperature from a Kelvin value.
 

Static Public Member Functions

static double CelsiusToFahrenheit (double _temp)
 Convert Celsius to Fahrenheit.
 
static double CelsiusToKelvin (double _temp)
 Convert Celsius to Kelvin.
 
static double FahrenheitToCelsius (double _temp)
 Convert Fahrenheit to Celsius.
 
static double FahrenheitToKelvin (double _temp)
 Convert Fahrenheit to Kelvin.
 
static double KelvinToCelsius (double _temp)
 Convert Kelvin to Celsius.
 
static double KelvinToFahrenheit (double _temp)
 Convert Kelvin to Fahrenheit.
 

Detailed Description

A class that stores temperature information, and allows conversion between different units.

This class is mostly for convenience. It can be used to easily convert between temperature units and encapsulate temperature values.

The default unit is Kelvin. Most functions that accept a double value will assume the double is Kelvin. The exceptions are a few of the conversion functions, such as CelsiusToFahrenheit. Similarly, most doubles that are returned will be in Kelvin.

Examples

Constructor & Destructor Documentation

◆ Temperature() [1/2]

Default constructor.

◆ Temperature() [2/2]

Temperature ( double  _temp)

Kelvin value constructor. This is a conversion constructor, and assumes the passed in value is in Kelvin.

Parameters
[in]_tempTemperature in Kelvin.

Member Function Documentation

◆ Celsius()

double Celsius ( ) const

Get the temperature in Celsius.

Returns
Temperature in Celsius.

◆ CelsiusToFahrenheit()

static double CelsiusToFahrenheit ( double  _temp)
static

Convert Celsius to Fahrenheit.

Parameters
[in]_tempTemperature in Celsius.
Returns
Temperature in Fahrenheit.

◆ CelsiusToKelvin()

static double CelsiusToKelvin ( double  _temp)
static

Convert Celsius to Kelvin.

Parameters
[in]_tempTemperature in Celsius
Returns
Temperature in Kelvin

◆ Fahrenheit()

double Fahrenheit ( ) const

Get the temperature in Fahrenheit.

Returns
Temperature in Fahrenheit.

◆ FahrenheitToCelsius()

static double FahrenheitToCelsius ( double  _temp)
static

Convert Fahrenheit to Celsius.

Parameters
[in]_tempTemperature in Fahrenheit
Returns
Temperature in Celsius

◆ FahrenheitToKelvin()

static double FahrenheitToKelvin ( double  _temp)
static

Convert Fahrenheit to Kelvin.

Parameters
[in]_tempTemperature in Fahrenheit
Returns
Temperature in Kelvin

◆ Kelvin()

double Kelvin ( ) const

Get the temperature in Kelvin.

Returns
Temperature in Kelvin.

◆ KelvinToCelsius()

static double KelvinToCelsius ( double  _temp)
static

Convert Kelvin to Celsius.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Temperature in Celsius.

◆ KelvinToFahrenheit()

static double KelvinToFahrenheit ( double  _temp)
static

Convert Kelvin to Fahrenheit.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Temperature in Fahrenheit.

◆ operator!=() [1/2]

bool operator!= ( const Temperature _temp) const

Inequality to operator.

Parameters
[in]_tempThe temperature to compare.
Returns
False if the temperatures are the same, true otherwise.

◆ operator!=() [2/2]

bool operator!= ( double  _temp) const

Inequality to operator, where the value of _temp is assumed to be in Kelvin.

Parameters
[in]_tempThe temperature (in Kelvin) to compare.
Returns
False if the temperatures are the same, true otherwise.

◆ operator()()

double operator() ( ) const

Accessor operator.

Returns
Temperature in Kelvin.
See also
Kelvin().

◆ operator*() [1/2]

Temperature operator* ( const Temperature _temp) const

Multiplication operator.

Parameters
[in]_tempTemperature object.
Returns
Resulting temperature.

◆ operator*() [2/2]

Temperature operator* ( double  _temp) const

Multiplication operator.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Resulting temperature.

◆ operator*=() [1/2]

Multiplication assignment operator.

Parameters
[in]_tempTemperature object.
Returns
Reference to this instance.

◆ operator*=() [2/2]

const Temperature & operator*= ( double  _temp)

Multiplication assignment operator.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Reference to this instance.

◆ operator+() [1/2]

Temperature operator+ ( const Temperature _temp) const

Addition operator.

Parameters
[in]_tempTemperature object.
Returns
Resulting temperature.

◆ operator+() [2/2]

Temperature operator+ ( double  _temp) const

Addition operator.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Resulting temperature.

◆ operator+=() [1/2]

Addition assignment operator.

Parameters
[in]_tempTemperature object.
Returns
Reference to this instance.

◆ operator+=() [2/2]

const Temperature & operator+= ( double  _temp)

Addition assignment operator.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Reference to this instance.

◆ operator-() [1/2]

Temperature operator- ( const Temperature _temp) const

Subtraction operator.

Parameters
[in]_tempTemperature object.
Returns
Resulting temperature.

◆ operator-() [2/2]

Temperature operator- ( double  _temp) const

Subtraction operator.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Resulting temperature.

◆ operator-=() [1/2]

Subtraction assignment operator.

Parameters
[in]_tempTemperature object.
Returns
Reference to this instance.

◆ operator-=() [2/2]

const Temperature & operator-= ( double  _temp)

Subtraction assignment operator.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Reference to this instance.

◆ operator/() [1/2]

Temperature operator/ ( const Temperature _temp) const

Division operator.

Parameters
[in]_tempTemperature object.
Returns
Resulting temperature.

◆ operator/() [2/2]

Temperature operator/ ( double  _temp) const

Division operator.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Resulting temperature.

◆ operator/=() [1/2]

Division assignment operator.

Parameters
[in]_tempTemperature object.
Returns
Reference to this instance.

◆ operator/=() [2/2]

const Temperature & operator/= ( double  _temp)

Division assignment operator.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Reference to this instance.

◆ operator<() [1/2]

bool operator< ( const Temperature _temp) const

Less than to operator.

Parameters
[in]_tempThe temperature to compare.
Returns
True if this is less than _temp.

◆ operator<() [2/2]

bool operator< ( double  _temp) const

Less than operator, where the value of _temp is assumed to be in Kelvin.

Parameters
[in]_tempThe temperature (in Kelvin) to compare.
Returns
True if this is less than _temp.

◆ operator<=() [1/2]

bool operator<= ( const Temperature _temp) const

Less than or equal to operator.

Parameters
[in]_tempThe temperature to compare.
Returns
True if this is less than or equal _temp.

◆ operator<=() [2/2]

bool operator<= ( double  _temp) const

Less than or equal operator, where the value of _temp is assumed to be in Kelvin.

Parameters
[in]_tempThe temperature (in Kelvin) to compare.
Returns
True if this is less than or equal to _temp.

◆ operator=()

Temperature & operator= ( double  _temp)

Assignment operator.

Parameters
[in]_tempTemperature in Kelvin.
Returns
Reference to this instance.

◆ operator==() [1/2]

bool operator== ( const Temperature _temp) const

Equal to operator.

Parameters
[in]_tempThe temperature to compare.
Returns
True if the temperatures are the same, false otherwise.

◆ operator==() [2/2]

bool operator== ( double  _temp) const

Equal to operator, where the value of _temp is assumed to be in Kelvin.

Parameters
[in]_tempThe temperature (in Kelvin) to compare.
Returns
True if the temperatures are the same, false otherwise.

◆ operator>() [1/2]

bool operator> ( const Temperature _temp) const

Greater than operator.

Parameters
[in]_tempThe temperature to compare.
Returns
True if this is greater than _temp.

◆ operator>() [2/2]

bool operator> ( double  _temp) const

Greater than operator, where the value of _temp is assumed to be in Kelvin.

Parameters
[in]_tempThe temperature (in Kelvin) to compare.
Returns
True if this is greater than _temp.

◆ operator>=() [1/2]

bool operator>= ( const Temperature _temp) const

Greater than or equal to operator.

Parameters
[in]_tempThe temperature to compare.
Returns
True if this is greater than or equal to _temp.

◆ operator>=() [2/2]

bool operator>= ( double  _temp) const

Greater than equal operator, where the value of _temp is assumed to be in Kelvin.

Parameters
[in]_tempThe temperature (in Kelvin) to compare.
Returns
True if this is greater than or equal to _temp.

◆ SetCelsius()

void SetCelsius ( double  _temp)

Set the temperature from a Celsius value.

Parameters
[in]_tempTemperature in Celsius.

◆ SetFahrenheit()

void SetFahrenheit ( double  _temp)

Set the temperature from a Fahrenheit value.

Parameters
[in]_tempTemperature in Fahrenheit.

◆ SetKelvin()

void SetKelvin ( double  _temp)

Set the temperature from a Kelvin value.

Parameters
[in]_tempTemperature in Kelvin.

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