CARMA C++
|
The Temperature class represents a temperature in any unit. More...
#include <carma/services/Temperature.h>
Public Member Functions | |
double | celsius () const |
Convenience method that returns the value of this temperature in Celsius. More... | |
double | fahrenheit () const |
Convenience method that returns the value of this temperature in fahrenheit. More... | |
double | kelvin () const |
Convenience method that returns the value of this temperature in Kelvin. More... | |
const Temperature | operator+ (const Temperature &t) const |
Add two Temperatures. More... | |
Temperature & | operator+= (const Temperature &t) |
Increment temperature. More... | |
const Temperature | operator- (const Temperature &t) const |
Subtract two temperatures. More... | |
Temperature & | operator-= (const Temperature &t) |
Decrement temperature. More... | |
bool | operator< (const Temperature &t) const |
Compare two temperatures. More... | |
bool | operator> (const Temperature &t) const |
Compare two temperature. More... | |
void | reset (double value, const std::string &units) |
Override parent method. More... | |
Temperature (double value, const std::string &units) | |
Construct a Temperature given a value and units. More... | |
virtual | ~Temperature () |
Destructor. More... | |
![]() | |
ConformableQuantity (double value, const std::string &units) | |
Construct an ConformableQuantity given a value and units. More... | |
virtual double | convert (const std::string &convertTo) const |
Converts this quantity to any conformable units. More... | |
virtual std::string | getUnits () const |
double | getValue () const |
virtual const ConformableQuantity | operator+ (const ConformableQuantity &quantity) const |
Add two ConformableQuantities. More... | |
virtual ConformableQuantity & | operator+= (const ConformableQuantity &quantity) |
Add ConformableQuantity to itself. More... | |
virtual const ConformableQuantity | operator- (const ConformableQuantity &quantity) const |
Subtract two ConformableQuantities. More... | |
virtual ConformableQuantity & | operator-= (const ConformableQuantity &quantity) |
Subtract ConformableQuantity from itself. More... | |
virtual | ~ConformableQuantity () |
Destructor. More... | |
Additional Inherited Members | |
![]() | |
Units | u_ |
Used for converting between units. More... | |
The Temperature class represents a temperature in any unit.
It uses the Units class internally to handle conversion of any temperature unit to any other temperature unit. For example,
Temperature t1(32,"F")
both
Temperature t2(0,"C")
t1
and t2
represent the same physical quantity. Binary operations + and - are supported, as is the stream operation <<.
Definition at line 39 of file Temperature.h.
carma::services::Temperature::Temperature | ( | double | value, |
const std::string & | units | ||
) |
Construct a Temperature given a value and units.
value | The value of this temperature |
units | The units of the value. |
carma::util::IllegalArgumentException | if the value is converts to less than 0 on the Kelvin scale. |
|
virtual |
Destructor.
double carma::services::Temperature::celsius | ( | ) | const |
Convenience method that returns the value of this temperature in Celsius.
double carma::services::Temperature::fahrenheit | ( | ) | const |
Convenience method that returns the value of this temperature in fahrenheit.
double carma::services::Temperature::kelvin | ( | ) | const |
Convenience method that returns the value of this temperature in Kelvin.
const Temperature carma::services::Temperature::operator+ | ( | const Temperature & | t | ) | const |
Add two Temperatures.
ConformabilityException |
Temperature& carma::services::Temperature::operator+= | ( | const Temperature & | t | ) |
Increment temperature.
const Temperature carma::services::Temperature::operator- | ( | const Temperature & | t | ) | const |
Subtract two temperatures.
ConformabilityException |
Temperature& carma::services::Temperature::operator-= | ( | const Temperature & | t | ) |
Decrement temperature.
bool carma::services::Temperature::operator< | ( | const Temperature & | t | ) | const |
Compare two temperatures.
ConformabilityException |
bool carma::services::Temperature::operator> | ( | const Temperature & | t | ) | const |
Compare two temperature.
ConformabilityException |
|
virtual |
Override parent method.
value | The value of this temperature |
units | The units of the value. |
carma::util::IllegalArgumentException | if the value is converts to less than 0 on the Kelvin scale. |
Reimplemented from carma::services::ConformableQuantity.