unit_converter.h
Go to the documentation of this file.
1 //======================================================================
28 //======================================================================
29 
30 //----------------------------------------------------------------------
31 // System Includes - include with <>
32 //----------------------------------------------------------------------
33 
34 #include <vector>
35 
36 //----------------------------------------------------------------------
37 // Project Includes - include with ""
38 //----------------------------------------------------------------------
39 
40 #include "simplevector.h"
41 #include "sdhlibrary_settings.h"
42 
43 //----------------------------------------------------------------------
44 // Defines, enums, unions, structs,
45 //----------------------------------------------------------------------
46 
48 
49 
50 //----------------------------------------------------------------------
51 // Global variables
52 //----------------------------------------------------------------------
53 
54 
55 //----------------------------------------------------------------------
56 // Function declarations
57 //----------------------------------------------------------------------
58 
59 
60 //----------------------------------------------------------------------
61 // Class declarations
62 //----------------------------------------------------------------------
63 
64 
75 class VCC_EXPORT cUnitConverter
76 {
77 public:
96  cUnitConverter( char const* _kind, char const* _name, char const* _symbol, double _factor = 1.0, double _offset = 0.0, int _decimal_places=1 );
97 
98  //----------------------------------------------------------------------
103  double ToExternal( double internal ) const;
104 
105  //----------------------------------------------------------------------
114  cSimpleVector ToExternal( cSimpleVector& internal ) const;
115 
116 
117  //----------------------------------------------------------------------
124  std::vector<double> ToExternal( std::vector<double> const& internal ) const;
125 
126 
127  //----------------------------------------------------------------------
132  double ToInternal( double external ) const;
133 
134  //----------------------------------------------------------------------
143  cSimpleVector ToInternal( cSimpleVector& external ) const;
144 
145 
146  //----------------------------------------------------------------------
153  std::vector<double> ToInternal( std::vector<double> const& external ) const;
154 
155  //----------------------------------------------------------------------
157  char const* GetKind( void ) const;
158 
159  //----------------------------------------------------------------------
161  char const* GetName( void ) const;
162 
163  //----------------------------------------------------------------------
165  char const* GetSymbol( void ) const;
166 
167  //----------------------------------------------------------------------
168 
170  double GetFactor( void ) const;
171 
172  //----------------------------------------------------------------------
174  double GetOffset( void ) const;
175 
176  //----------------------------------------------------------------------
178  int GetDecimalPlaces( void ) const;
179 
180 
181 protected:
183  char const* kind;
184 
186  char const* name;
187 
189  char const* symbol;
190 
192  double factor;
193 
195  double offset;
196 
199 
200 }; // cUnitConverter
201 //======================================================================
202 
203 
205 extern cUnitConverter const uc_identity;
206 
207 //----------------------------------------------------------------------
209 typedef double (cUnitConverter::*pDoubleUnitConverterFunction) ( double ) const;
210 
211 
213 //typedef std::vector<double> (cUnitConverter::*pDoubleVectorUnitConverterFunction) ( std::vector<double> ) const;
214 
215 
216 //
217 //#####################################################################
218 
220 
221 
222 //======================================================================
223 /*
224  Here are some settings for the emacs/xemacs editor (and can be safely ignored):
225  (e.g. to explicitely set C++ mode for *.h header files)
226 
227  Local Variables:
228  mode:C++
229  mode:ELSE
230  End:
231 */
232 //======================================================================
Unit conversion class to convert values between physical unit systems.
cUnitConverter const uc_identity
Identity converter (internal = external)
char const * symbol
the symbol of the external unit (something like "deg" or "ms")
A simple vector implementation.
Definition: simplevector.h:91
char const * name
the name of the external unit (something like "degrees" or "milliseconds")
#define NAMESPACE_SDH_START
double offset
the conversion offset from internal to external units
int decimal_places
A usefull number of decimal places for printing values in the external unit system.
Interface of class #SDH::cSimpleVector.
double(cUnitConverter::* pDoubleUnitConverterFunction)(double) const
Type of a pointer to a function like &#39;double SDH::cUnitConverter::ToExternal( double ) const&#39; or &#39;dou...
char const * kind
the kind of unit to be converted (something like "angle" or "time")
#define NAMESPACE_SDH_END
This file contains settings to make the SDHLibrary compile on differen systems:
double factor
the conversion factor from internal to external units


sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Mon Feb 28 2022 23:41:51