#include <Dimension.h>
|
| typedef std::map< std::string, std::pair< double, double > > | conversion_t |
| |
|
| | 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 UnitArray & | unitArray (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...
|
| |
Physical Dimension with units of measurements and their conversions
#include <libpf/value/Dimension.h>
- Warning
-
Thread safe:
-
Extendable:
-
Platform dependencies:
◆ conversion_t
◆ 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
-
| desc | description of the Dimension such as "power" |
| SIu | base unit in SI for the Dimension |
| kmol | exponent of the amount of substance SI fundamental unit |
| rad | exponent of the angular measure SI fundamental unit |
| A | exponent of the electric current SI fundamental unit |
| m | exponent of the length SI fundamental unit |
| cd | exponent of the luminous intensity SI fundamental unit |
| kg | exponent of the mass SI fundamental unit |
| K | exponent of the temperature SI fundamental units |
| s | exponent of the time SI fundamental units |
| eur | exponent of the economic value unit |
◆ Dimension() [2/2]
◆ addUnit()
| void Dimension::addUnit |
( |
std::string |
unit, |
|
|
double |
factor, |
|
|
double |
offset = 0.0 |
|
) |
| |
add a new unit to the Dimensions
- Parameters
-
| unit | unit name |
| factor | first multiply by factor ... |
| offset | then 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 |
◆ 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 |
◆ SIunit()
| const std::string & Dimension::SIunit |
( |
void |
| ) |
const |
◆ size()
| int Dimension::size |
( |
void |
| ) |
|
◆ 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: