MI - Fimex
|
#include <fimex/Units.h>
Public Member Functions | |
Units () | |
Units (const Units &rhs) | |
Units & | operator= (const Units &rhs) |
virtual | ~Units () |
void | convert (const std::string &from, const std::string &to, double &slope, double &offset) |
boost::shared_ptr< UnitsConverter > | getConverter (const std::string &from, const std::string &to) |
bool | areConvertible (const std::string &unit1, const std::string &unit2) const |
test if two units are convertible to each others More... | |
bool | isTime (const std::string &timeUnit) const |
test if unit is a time More... | |
Static Public Member Functions | |
static bool | unload (bool force=false) throw (UnitException) |
Friends | |
class | TimeUnit |
The class Units describes a units-system, not a single unit. Different units can be compared and converted if comparable within the system.
MetNoFimex::Units::Units | ( | ) |
initialization of unit handling, i.e. parsing of unit file etc if required the unit file is installation-dependent on the underlying units-package (udunits or udunits2) and can be controlled through UDUNITS_PATH environment
MetNoFimex::Units::Units | ( | const Units & | rhs | ) |
|
virtual |
bool MetNoFimex::Units::areConvertible | ( | const std::string & | unit1, |
const std::string & | unit2 | ||
) | const |
test if two units are convertible to each others
unit1 | first unit |
unit2 | second unit |
void MetNoFimex::Units::convert | ( | const std::string & | from, |
const std::string & | to, | ||
double & | slope, | ||
double & | offset | ||
) |
calculate the linear unit conversion: newVal (in to unit) = oldVal (in from unit) * slope + offset
from | unit |
to | unit |
slope | return value of the slope |
offset | return value of the offset |
UnitException |
boost::shared_ptr<UnitsConverter> MetNoFimex::Units::getConverter | ( | const std::string & | from, |
const std::string & | to | ||
) |
Get a UnitsConverter which translates from 'from' unit to 'to' unit.
from | |
to |
UnitException |
bool MetNoFimex::Units::isTime | ( | const std::string & | timeUnit | ) | const |
test if unit is a time
timeUnit |
|
static |
Units initialize themselve on first using the default unix-file path and keep the internal datastructure until the end of the program, or this function is used.
force | unload units-setup, even if some objects exist, defaults to false |
|
friend |