This class is based on the GNU units library.
More...
#include <carma/services/Units.h>
|
double | centi () const |
| times one hundredth More...
|
|
double | convert (const char *convertFrom, const char *convertTo) const |
| Convert value and units to new units. More...
|
|
double | convert (const std::string &convertFrom, const std::string &convertTo) const |
|
double | convert (double value, const char *convertFrom, const char *convertTo) const |
| Convert a value from one unit to another conformablie unit. More...
|
|
double | convert (double value, const std::string &convertFrom, const std::string &convertTo) const |
|
double | deca () const |
| times ten More...
|
|
double | deci () const |
| times one tenth More...
|
|
double | giga () const |
| times one billion More...
|
|
double | hecto () const |
| times one hundred More...
|
|
double | kilo () const |
| times one thousand More...
|
|
double | mega () const |
| times one million More...
|
|
double | micro () const |
| times one million More...
|
|
double | milli () const |
| times one thousandth More...
|
|
double | nano () const |
| times one billionth More...
|
|
template<typename T > |
int | numericLimit () |
|
double | pico () const |
| times one trillionth More...
|
|
double | tera () const |
| times one trillion More...
|
|
| Units () |
| Constructor. More...
|
|
virtual | ~Units () |
| Destructor. More...
|
|
This class is based on the GNU units library.
- See Also
- http://www.cam.cornell.edu/~adrian/units.html
Definition at line 46 of file Units.h.
carma::services::Units::Units |
( |
| ) |
|
virtual carma::services::Units::~Units |
( |
| ) |
|
|
virtual |
double carma::services::Units::centi |
( |
| ) |
const |
times one hundredth
Definition at line 126 of file Units.h.
double carma::services::Units::convert |
( |
const char * |
convertFrom, |
|
|
const char * |
convertTo |
|
) |
| const |
Convert value and units to new units.
This method will convert a value and units to a value in any conformable units. If no value is given, the value is understood to be unity. convert("radian","degree") // convert 1 radian to degrees
convert("2*pi radians","degrees")
convert("5 jansky","W/m^2 Hz")
convert("miles","quarts") // throws ConformabilityException
Note the unit type understands plurals, so that "radians" is the same as "radian". (However "rad" would mean the radiation dosage unit!)
- Parameters
-
convertFrom | current unit type (and possibly a value) |
convertTo | unit type desired |
- Returns
- value of conversion in new units
- Exceptions
-
- See Also
- GNU units man pages
double carma::services::Units::convert |
( |
double |
value, |
|
|
const char * |
convertFrom, |
|
|
const char * |
convertTo |
|
) |
| const |
Convert a value from one unit to another conformablie unit.
- Parameters
-
value | The value of current unit type |
convertFrom | The current unit type |
convertTo | The unit type desired |
- Returns
- value of conversion in new units
- Exceptions
-
double carma::services::Units::deca |
( |
| ) |
const |
double carma::services::Units::deci |
( |
| ) |
const |
times one tenth
Definition at line 123 of file Units.h.
double carma::services::Units::giga |
( |
| ) |
const |
times one billion
Definition at line 108 of file Units.h.
double carma::services::Units::hecto |
( |
| ) |
const |
times one hundred
Definition at line 117 of file Units.h.
double carma::services::Units::kilo |
( |
| ) |
const |
times one thousand
Definition at line 114 of file Units.h.
double carma::services::Units::mega |
( |
| ) |
const |
times one million
Definition at line 111 of file Units.h.
double carma::services::Units::micro |
( |
| ) |
const |
times one million
Definition at line 132 of file Units.h.
double carma::services::Units::milli |
( |
| ) |
const |
times one thousandth
Definition at line 129 of file Units.h.
double carma::services::Units::nano |
( |
| ) |
const |
times one billionth
Definition at line 135 of file Units.h.
double carma::services::Units::pico |
( |
| ) |
const |
times one trillionth
Definition at line 138 of file Units.h.
double carma::services::Units::tera |
( |
| ) |
const |
times one trillion
Definition at line 105 of file Units.h.
The documentation for this class was generated from the following file: