ADTF
unitconversion.h
Go to the documentation of this file.
1 
8 #ifndef _UNITCONVERSION_H_
9 #define _UNITCONVERSION_H_
10 
11 namespace A_UTILS_NS
12 {
13 
51 class DOEXPORT cUnitConversion
52 {
54 
55 public:
56 
57  enum {
58  UNIT_NONE = 0,
59  UNIT_MILLIMETRE,
60  UNIT_CENTIMETRE,
61  UNIT_METRE,
62  UNIT_KILOMETRE,
63  UNIT_MILES,
64  UNIT_MICROSECOND,
65  UNIT_MILLISECOND,
66  UNIT_SECOND,
67  UNIT_MINUTE,
68  UNIT_HOUR,
69  UNIT_METRES_PER_SECOND,
70  UNIT_KILOMETRES_PER_HOUR,
71  UNIT_MILES_PER_HOUR,
72  UNIT_METRES_PER_SECOND_SQUARED,
73  UNIT_GRAVITATION,
74  UNIT_MILLIGRAVITATION,
75  UNIT_RADIAN,
76  UNIT_DEGREE,
77  UNIT_RADIANS_PER_SECOND,
78  UNIT_DEGREES_PER_SECOND,
79  UNIT_DEGREE_CELSIUS,
80  UNIT_DEGREE_FAHRENHEIT,
81  UNIT_SI = 999,
82  UNIT_USER_OFFSET = 1000
83  };
84 
86 
99  tResult Convert(tFloat64* pf64Value,
100  const cString& strUnitSource,
101  const cString& strUnitDestination = "SI");
102 
116  tUInt eUnitSource,
117  tUInt eUnitDestination = UNIT_SI);
118 
129  tResult AddNewUnitString(tUInt eUnitIdentifier, const cString& strUnitString);
130 
139 
157  tFloat64 fNumerator, tFloat64 fDenominator = 1.0,
158  tFloat64 fOffset = 0.0);
159 
160 
171  tUInt GetUnitIdentifier(const cString& strUnit);
172 
173 };
174 
175 } // namespace A_UTILS_NS
176 
177 #endif
unsigned int tUInt
type definition for unsigned integer value (platform and compiler dependent type).
double tFloat64
type definition for Float64 (64bit double values) (platform and compiler independent type).
Class for unit conversions.
tUInt GetUnitIdentifier(const cString &strUnit)
This method returns the handle of the unit corresponding to the input string.
tResult AddNewUnitString(tUInt eUnitIdentifier, const cString &strUnitString)
This method adds a new identifier string for a unit.
tUInt AddNewDerivedUnit(tUInt eUnitBase, tFloat64 fNumerator, tFloat64 fDenominator=1.0, tFloat64 fOffset=0.0)
This method adds a derived unit to the UnitConverter.
tResult Convert(tFloat64 *pf64Value, tUInt eUnitSource, tUInt eUnitDestination=UNIT_SI)
Unit Conversion.
tResult Convert(tFloat64 *pf64Value, const cString &strUnitSource, const cString &strUnitDestination="SI")
Unit Conversion.
tUInt AddNewBaseUnit()
This method adds a base unit to the UnitConverter and returns the created identifier handle.
#define A_UTILS_D(__pclassname_)
Helper macro for d-pattern definitions.
Definition: d_ptr.h:270
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11