#include <Dimension.h>

Public Types

typedef std::map< std::string, std::pair< double, double > > conversion_t
 

Public Member Functions

 Dimension (std::string desc, std::string SIu, int kmol, int rad, int A, int m, int cd, int kg, int K, int s, int eur)
 
 Dimension (const Dimension &)
 
void addUnit (std::string unit, double factor, double offset=0.0)
 
const std::string & description (void) const
 Returns the unit name. More...
 
const std::string & SIunit (void) const
 Returns the SI unit. More...
 
const UnitArrayunitArray (void) const
 returns the unit of measurement encoded as an array of integers More...
 
conversion_t::const_iterator begin (void) const
 
conversion_t::const_iterator next (void) const
 
conversion_t::const_iterator end (void) const
 
void printUnits (void) const
 diagnostic print More...
 
double fromSI (double v, std::string destinationUnit) const
 
double toSI (double v, std::string sourceUnit) const
 
int size (void)
 return number of units More...
 

Detailed Description

Physical Dimension with units of measurements and their conversions

#include <libpf/value/Dimension.h>

Remarks
Warning
Thread safe:
Extendable:
Platform dependencies:

Member Typedef Documentation

◆ conversion_t

typedef std::map<std::string, std::pair<double, double> > Dimension::conversion_t

Constructor & Destructor Documentation

◆ Dimension() [1/2]

Dimension::Dimension ( std::string  desc,
std::string  SIu,
int  kmol,
int  rad,
int  A,
int  m,
int  cd,
int  kg,
int  K,
int  s,
int  eur 
)
Parameters
descdescription of the Dimension such as "power"
SIubase unit in SI for the Dimension
kmolexponent of the amount of substance SI fundamental unit
radexponent of the angular measure SI fundamental unit
Aexponent of the electric current SI fundamental unit
mexponent of the length SI fundamental unit
cdexponent of the luminous intensity SI fundamental unit
kgexponent of the mass SI fundamental unit
Kexponent of the temperature SI fundamental units
sexponent of the time SI fundamental units
eurexponent of the economic value unit

◆ Dimension() [2/2]

Dimension::Dimension ( const Dimension )

Member Function Documentation

◆ addUnit()

void Dimension::addUnit ( std::string  unit,
double  factor,
double  offset = 0.0 
)

add a new unit to the Dimensions

Parameters
unitunit name
factorfirst multiply by factor ...
offsetthen add offset to convert to base SI unit: SI_value = unit_value*factor + offset; examples of usage: addUnit("power", "kW", 1000.0); addUnit("pressure", "barg", 100000.0, 101325.0);

◆ begin()

conversion_t::const_iterator Dimension::begin ( void  ) const

◆ description()

const std::string & Dimension::description ( void  ) const

Returns the unit name.

◆ end()

conversion_t::const_iterator Dimension::end ( void  ) const

◆ fromSI()

double Dimension::fromSI ( double  v,
std::string  destinationUnit 
) const

convert v from SI to destinationUnit i.e. fromSI(1, "kW") = 0.001 i.e. fromSI(100, "C") = -173.15 fromSI = (v - offset)/factor

◆ next()

conversion_t::const_iterator Dimension::next ( void  ) const

◆ printUnits()

void Dimension::printUnits ( void  ) const

diagnostic print

◆ SIunit()

const std::string & Dimension::SIunit ( void  ) const

Returns the SI unit.

◆ size()

int Dimension::size ( void  )

return number of units

◆ toSI()

double Dimension::toSI ( double  v,
std::string  sourceUnit 
) const

convert v from sourceUnit to SI base unit i.e. toSI(1, "kW") = 1000.0 i.e. toSI(100, "C") = 373.15 toSI = v*factor + offset;

◆ unitArray()

const UnitArray & Dimension::unitArray ( void  ) const

returns the unit of measurement encoded as an array of integers


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