NeuroLab
|
A physical unit. More...
Public Member Functions | |
Unit (int exp, int m, int kg, int s, int A, int K, int mol, int cd) | |
Construct a physical unit. More... | |
Unit (string prefix, string name) | |
Construct a physical unit. More... | |
void | set (int exp, int m, int kg, int s, int A, int K, int mol, int cd) |
Set values. More... | |
void | set (int m, int kg, int s, int A, int K, int mol, int cd) |
Set values. More... | |
Unit () | |
Simple constructor. | |
Unit (const Unit &) | |
Copy constructor. | |
string | getSymbol () |
Get name. More... | |
string | getName () |
Get long name. More... | |
void | setPrefix (int n) |
Set the prefix. More... | |
A physical unit.
This is mainly a helper class for the class Physical. It describes physical units such as Volt or Meter.
Unit::Unit | ( | int | exp, |
int | m, | ||
int | kg, | ||
int | s, | ||
int | A, | ||
int | K, | ||
int | mol, | ||
int | cd | ||
) |
Construct a physical unit.
exp | Prefix |
m | Meters |
kg | Kilograms |
s | Seconds |
A | Ampere |
K | Kelvin |
mol | Mole |
cd | Candela Construct a unit. The prefix's exponent (like -3 for milli, 0 for nothing or 3 for kilo), and the exponents of the individual SI units have to be given. Example: if acceleration is given as -3 km/s^2, the constructor must be called as Unit(3, 1,0,-2,0,0,0). |
Unit::Unit | ( | string | prefix, |
string | name | ||
) |
Construct a physical unit.
Unit u('m','V');
string Unit::getName | ( | ) |
Get long name.
This retrieves the complete name, like 'millivolt'. Note that the long name is not always existant. (A unit like s^4 will have no long name.)
string Unit::getSymbol | ( | ) |
Get name.
This retrieves the name as symbol, f.e. 'mV'. Note that you have to set the description for yourself.
void Unit::set | ( | int | exp, |
int | m, | ||
int | kg, | ||
int | s, | ||
int | A, | ||
int | K, | ||
int | mol, | ||
int | cd | ||
) |
Set values.
exp | Prefix |
m | Meters |
kg | Kilograms |
s | Seconds |
A | Ampere |
K | Kelvin |
mol | Mole |
cd | Candela Construct a unit. The prefix's exponent (like -3 for milli, 0 for nothing or 3 for kilo), and the exponents of the individual SI units have to be given. Example: if acceleration is given as -3 km/s^2, the constructor must be called as Unit(3, 1,0,-2,0,0,0). |
void Unit::set | ( | int | m, |
int | kg, | ||
int | s, | ||
int | A, | ||
int | K, | ||
int | mol, | ||
int | cd | ||
) |
Set values.
m | Meters |
kg | Kilograms |
s | Seconds |
A | Ampere |
K | Kelvin |
mol | Mole |
cd | Candela Construct a unit. The prefix's exponent (like -3 for milli, 0 for nothing or 3 for kilo), and the exponents of the individual SI units have to be given. Example: if acceleration is given as -3 km/s^2, the constructor must be called as Unit(3, 1,0,-2,0,0,0). |
void Unit::setPrefix | ( | int | n | ) |
Set the prefix.
Set the prefix by giving an integer from -24 to 24. Should be a multiple of 3, exception: -2,-1,2,1.