code::W2Unit Class Reference

Inheritance diagram for code::W2Unit:

code::DynDimVal List of all members.

Detailed Description

Convenience wrapper around libudunits.

Author:
Lulin Song (original)

lakshman

Charles Kerr

Date
2009/06/02 20:17:38


Public Member Functions

 W2Unit ()
 W2Unit (double v, const std::string &s)
 Build a W2Unit object given a value along with its unit name.
double value (const std::string &units) const
 Return this W2Unit's value in "units" units.
bool value (const std::string &units, double &setme) const
 Convert the current W2Unit's value into other units.
double value () const
 Return this W2Unit's value in its native units.
std::string unit () const
 Return this W2Unit's units.

Static Public Member Functions

static bool getConverter (const std::string &from, const std::string &to, UnitConverter &setme)
 Get a UnitConverter that converts from one unit to another.
static double value (const UnitConverter &uc, double d)
 Convert a value using a UnitConverter.
static bool isValidUnit (const std::string &unit)
static bool isCompatibleUnit (const std::string &from, const std::string &to)
static double value (const std::string &from, const std::string &to, double fromValue)
 Convert a value from one unit to another.
static bool convert (const std::string &from, const std::string &to, double fromValue, double &setmeToValue)
 Convert a value from one unit to another.

Static Public Attributes

static const std::string Dimensionless
static const std::string Kilometers
static const std::string MetersPerSecond
static const std::string Degrees
static const std::string Seconds

Classes

struct  UnitConverter
 Store slope and intercept used by W2Unit. More...


Constructor & Destructor Documentation

code::W2Unit::W2Unit (  )  [inline]

code::W2Unit::W2Unit ( double  v,
const std::string &  s 
) [inline]

Build a W2Unit object given a value along with its unit name.


Member Function Documentation

static bool code::W2Unit::convert ( const std::string &  from,
const std::string &  to,
double  fromValue,
double &  setmeToValue 
) [static]

Convert a value from one unit to another.

Like value(), but returns a success flag to let callers know whether or not the conversion was successful.

static bool code::W2Unit::getConverter ( const std::string &  from,
const std::string &  to,
UnitConverter setme 
) [static]

Get a UnitConverter that converts from one unit to another.

static bool code::W2Unit::isCompatibleUnit ( const std::string &  from,
const std::string &  to 
) [static]

static bool code::W2Unit::isValidUnit ( const std::string &  unit  )  [static]

std::string code::W2Unit::unit (  )  const [inline]

Return this W2Unit's units.

double code::W2Unit::value (  )  const [inline]

Return this W2Unit's value in its native units.

bool code::W2Unit::value ( const std::string &  units,
double &  setme 
) const [inline]

Convert the current W2Unit's value into other units.

Like value(string), but returns a success flag to let callers know whether or not the conversion was successful.

double code::W2Unit::value ( const std::string &  units  )  const [inline]

Return this W2Unit's value in "units" units.

See also:
value(string,double&);

static double code::W2Unit::value ( const std::string &  from,
const std::string &  to,
double  fromValue 
) [static]

Convert a value from one unit to another.

See also:
convert()

static double code::W2Unit::value ( const UnitConverter uc,
double  d 
) [inline, static]

Convert a value using a UnitConverter.


Member Data Documentation

const std::string code::W2Unit::Degrees [static]

const std::string code::W2Unit::Dimensionless [static]

const std::string code::W2Unit::Kilometers [static]

const std::string code::W2Unit::MetersPerSecond [static]

const std::string code::W2Unit::Seconds [static]


Generated on Fri May 4 13:40:12 2012 for WDSS-IIw2 by  doxygen 1.4.7