Commit 74af8523 authored by Axel Auweter's avatar Axel Auweter
Browse files

Cleanups in unitconv.

parent 0cc896ec
...@@ -23,6 +23,10 @@ typedef enum { ...@@ -23,6 +23,10 @@ typedef enum {
DCDBUnit_Watt, DCDBUnit_Watt,
DCDBUnit_Volt, DCDBUnit_Volt,
/* Others */
DCDBUnit_Celsius,
DCDBUnit_Fahrenheit,
/* 1e-3 */ /* 1e-3 */
DCDBUnit_MilliMeter, DCDBUnit_MilliMeter,
DCDBUnit_MilliSecond, DCDBUnit_MilliSecond,
...@@ -30,6 +34,7 @@ typedef enum { ...@@ -30,6 +34,7 @@ typedef enum {
DCDBUnit_MilliKelvin, DCDBUnit_MilliKelvin,
DCDBUnit_MilliWatt, DCDBUnit_MilliWatt,
DCDBUnit_MilliVolt, DCDBUnit_MilliVolt,
DCDBUnit_MilliCelsius,
/* 1e-6 */ /* 1e-6 */
DCDBUnit_MicroMeter, DCDBUnit_MicroMeter,
...@@ -38,12 +43,8 @@ typedef enum { ...@@ -38,12 +43,8 @@ typedef enum {
DCDBUnit_MicroKelvin, DCDBUnit_MicroKelvin,
DCDBUnit_MicroWatt, DCDBUnit_MicroWatt,
DCDBUnit_MicroVolt, DCDBUnit_MicroVolt,
DCDBUnit_MicroCelsius,
/* Others */
DCDBUnit_Celsius,
DCDBUnit_Fahrenheit,
DCDBUnit_MilliCelsius,
} DCDBUnit; } DCDBUnit;
class UnitConv class UnitConv
......
...@@ -10,33 +10,38 @@ ...@@ -10,33 +10,38 @@
#include <list> #include <list>
/* /*
Base units Undefined
DCDBUnit_Meter, DCDBUnit_None,
DCDBUnit_Second,
DCDBUnit_Ampere, Base units
DCDBUnit_Kelvin, DCDBUnit_Meter,
DCDBUnit_Watt, DCDBUnit_Second,
DCDBUnit_Volt, DCDBUnit_Ampere,
DCDBUnit_Kelvin,
1e-3 DCDBUnit_Watt,
DCDBUnit_MilliMeter, DCDBUnit_Volt,
DCDBUnit_MilliSecond,
DCDBUnit_MilliAmpere, Others
DCDBUnit_MilliKelvin, DCDBUnit_Celsius,
DCDBUnit_MilliWatt, DCDBUnit_Fahrenheit,
DCDBUnit_MilliVolt,
1e-3
1e-6 DCDBUnit_MilliMeter,
DCDBUnit_MicroMeter, DCDBUnit_MilliSecond,
DCDBUnit_MicroSecond, DCDBUnit_MilliAmpere,
DCDBUnit_MicroAmpere, DCDBUnit_MilliKelvin,
DCDBUnit_MicroKelvin, DCDBUnit_MilliWatt,
DCDBUnit_MicroWatt, DCDBUnit_MilliVolt,
DCDBUnit_MicroVolt, DCDBUnit_MilliCelsius,
Others 1e-6
DCDBUnit_Celsius, DCDBUnit_MicroMeter,
DCDBUnit_Fahrenheit DCDBUnit_MicroSecond,
DCDBUnit_MicroAmpere,
DCDBUnit_MicroKelvin,
DCDBUnit_MicroWatt,
DCDBUnit_MicroVolt,
DCDBUnit_MicroCelsius,
*/ */
typedef struct { typedef struct {
...@@ -72,8 +77,9 @@ ConversionTableEntry conversionTable[] = { ...@@ -72,8 +77,9 @@ ConversionTableEntry conversionTable[] = {
/* 17 */ { DCDBUnit_MilliVolt, "mV", DCDBUnit_Volt, -1000, 0 }, /* 17 */ { DCDBUnit_MilliVolt, "mV", DCDBUnit_Volt, -1000, 0 },
/* 18 */ { DCDBUnit_MicroVolt, "uV", DCDBUnit_Volt, -1000000, 0 }, /* 18 */ { DCDBUnit_MicroVolt, "uV", DCDBUnit_Volt, -1000000, 0 },
/* 19 */ { DCDBUnit_Celsius, "C", DCDBUnit_MilliKelvin, 1000, 273150 }, /* 19 */ { DCDBUnit_Celsius, "C", DCDBUnit_MilliKelvin, 1000, 273150 },
/* 20 */ { DCDBUnit_Fahrenheit, "F", DCDBUnit_MilliKelvin, 555, 255116 }, /* 20 */ { DCDBUnit_MilliCelsius, "mC", DCDBUnit_Celsius, -1000, 0 },
/* 21 */ { DCDBUnit_MilliCelsius, "mC", DCDBUnit_Celsius, -1000, 0 }, /* 21 */ { DCDBUnit_MicroCelsius, "uC", DCDBUnit_Celsius, -1000000, 0},
/* 22 */ { DCDBUnit_Fahrenheit, "F", DCDBUnit_MilliKelvin, 555, 255116 },
}; };
#define ConversionTableSize ((int)(sizeof(conversionTable)/sizeof(ConversionTableEntry))) #define ConversionTableSize ((int)(sizeof(conversionTable)/sizeof(ConversionTableEntry)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment