00001 //====================================================================== 00028 //====================================================================== 00029 00030 //---------------------------------------------------------------------- 00031 // System Includes - include with <> 00032 //---------------------------------------------------------------------- 00033 00034 #include <vector> 00035 00036 //---------------------------------------------------------------------- 00037 // Project Includes - include with "" 00038 //---------------------------------------------------------------------- 00039 00040 #include "simplevector.h" 00041 #include "sdhlibrary_settings.h" 00042 00043 //---------------------------------------------------------------------- 00044 // Defines, enums, unions, structs, 00045 //---------------------------------------------------------------------- 00046 00047 NAMESPACE_SDH_START 00048 00049 00050 //---------------------------------------------------------------------- 00051 // Global variables 00052 //---------------------------------------------------------------------- 00053 00054 00055 //---------------------------------------------------------------------- 00056 // Function declarations 00057 //---------------------------------------------------------------------- 00058 00059 00060 //---------------------------------------------------------------------- 00061 // Class declarations 00062 //---------------------------------------------------------------------- 00063 00064 00075 class VCC_EXPORT cUnitConverter 00076 { 00077 public: 00096 cUnitConverter( char const* _kind, char const* _name, char const* _symbol, double _factor = 1.0, double _offset = 0.0, int _decimal_places=1 ); 00097 00098 //---------------------------------------------------------------------- 00103 double ToExternal( double internal ) const; 00104 00105 //---------------------------------------------------------------------- 00114 cSimpleVector ToExternal( cSimpleVector& internal ) const; 00115 00116 00117 //---------------------------------------------------------------------- 00124 std::vector<double> ToExternal( std::vector<double> const& internal ) const; 00125 00126 00127 //---------------------------------------------------------------------- 00132 double ToInternal( double external ) const; 00133 00134 //---------------------------------------------------------------------- 00143 cSimpleVector ToInternal( cSimpleVector& external ) const; 00144 00145 00146 //---------------------------------------------------------------------- 00153 std::vector<double> ToInternal( std::vector<double> const& external ) const; 00154 00155 //---------------------------------------------------------------------- 00157 char const* GetKind( void ) const; 00158 00159 //---------------------------------------------------------------------- 00161 char const* GetName( void ) const; 00162 00163 //---------------------------------------------------------------------- 00165 char const* GetSymbol( void ) const; 00166 00167 //---------------------------------------------------------------------- 00168 00170 double GetFactor( void ) const; 00171 00172 //---------------------------------------------------------------------- 00174 double GetOffset( void ) const; 00175 00176 //---------------------------------------------------------------------- 00178 int GetDecimalPlaces( void ) const; 00179 00180 00181 protected: 00183 char const* kind; 00184 00186 char const* name; 00187 00189 char const* symbol; 00190 00192 double factor; 00193 00195 double offset; 00196 00198 int decimal_places; 00199 00200 }; // cUnitConverter 00201 //====================================================================== 00202 00203 00205 extern cUnitConverter const uc_identity; 00206 00207 //---------------------------------------------------------------------- 00209 typedef double (cUnitConverter::*pDoubleUnitConverterFunction) ( double ) const; 00210 00211 00213 //typedef std::vector<double> (cUnitConverter::*pDoubleVectorUnitConverterFunction) ( std::vector<double> ) const; 00214 00215 00216 // 00217 //##################################################################### 00218 00219 NAMESPACE_SDH_END 00220 00221 00222 //====================================================================== 00223 /* 00224 Here are some settings for the emacs/xemacs editor (and can be safely ignored): 00225 (e.g. to explicitely set C++ mode for *.h header files) 00226 00227 Local Variables: 00228 mode:C++ 00229 mode:ELSE 00230 End: 00231 */ 00232 //======================================================================