base
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
base::Temperature Class Reference

#include <Temperature.hpp>

Public Member Functions

 Temperature ()
 
double getKelvin () const
 
double getCelsius () const
 
bool isInRange (const Temperature &left_limit, const Temperature &right_limit) const
 
bool isApprox (Temperature other, double prec=1e-5) const
 
void operator= (const Temperature &other)
 
bool operator== (const Temperature &other) const
 
bool operator< (const Temperature &other) const
 
bool operator> (const Temperature &other) const
 

Static Public Member Functions

static double kelvin2Celsius (double kelvin)
 
static double celsius2Kelvin (double celsius)
 
static Temperature fromKelvin (double kelvin)
 
static Temperature fromCelsius (double celsius)
 

Public Attributes

double kelvin
 

Protected Member Functions

 Temperature (double kelvin)
 

Detailed Description

This class represents a temperature, and can be used instead of double for convenience. The class has a canonical representation of the temperature in kelvin.

Constructor & Destructor Documentation

◆ Temperature() [1/2]

base::Temperature::Temperature ( )

default constructor, which will leave the temperature uninitialized.

◆ Temperature() [2/2]

base::Temperature::Temperature ( double  kelvin)
explicitprotected

Member Function Documentation

◆ celsius2Kelvin()

double base::Temperature::celsius2Kelvin ( double  celsius)
static

static conversion from celsius to kelvin

Parameters
celsiustemperature in celsius
Returns
temperature in kelvin

◆ fromCelsius()

Temperature base::Temperature::fromCelsius ( double  celsius)
static

use this method to get temperature from Celsius

Returns
representation of the given temperature.
Parameters
celsius- temperature in celsius.

◆ fromKelvin()

Temperature base::Temperature::fromKelvin ( double  kelvin)
static

use this method to get temperature from Kelvin.

Returns
representation of the given temperature.
Parameters
kelvin- temperature in Kelvin.

◆ getCelsius()

double base::Temperature::getCelsius ( ) const
Returns
canonical value of the temperature in celsius

◆ getKelvin()

double base::Temperature::getKelvin ( ) const
Returns
canonical value of the temperature in kelvin

◆ isApprox()

bool base::Temperature::isApprox ( Temperature  other,
double  prec = 1e-5 
) const

compare two temperatures for approximate equality

Parameters
other- temperature to compare
prec- precision interval in kelvin
Returns
true if temperature is approximately equal

◆ isInRange()

bool base::Temperature::isInRange ( const Temperature left_limit,
const Temperature right_limit 
) const
Returns
true if the temperature is insight the given interval

◆ kelvin2Celsius()

double base::Temperature::kelvin2Celsius ( double  kelvin)
static

static conversion from kelvin to celsius

Parameters
kelvintemperature in kelvin
Returns
temperature in celsius

◆ operator<()

bool base::Temperature::operator< ( const Temperature other) const

◆ operator=()

void base::Temperature::operator= ( const Temperature other)

◆ operator==()

bool base::Temperature::operator== ( const Temperature other) const

◆ operator>()

bool base::Temperature::operator> ( const Temperature other) const

Member Data Documentation

◆ kelvin

double base::Temperature::kelvin

temperature in kelvins

Note
don't use this value directly. It's only public to allow this class to be used as an interface type.

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