Go to the documentation of this file.
70 assert(_factor != 0.0);
77 decimal_places = _decimal_places;
84 return internal * factor + offset;
93 for (
int i = 0; i <
internal.eNUMBER_OF_ELEMENTS; i++ )
95 if (
internal.Valid( i ) )
96 rv[i] =
internal[i] * factor + offset;
105 std::vector<double> rv;
107 for ( std::vector<double>::const_iterator vi =
internal.begin();
108 vi !=
internal.end();
111 rv.push_back( *vi * factor + offset );
120 return (external - offset) / factor;
131 if ( external.
Valid( i ) )
132 rv[i] = (external[i] - offset) / factor;
141 std::vector<double> rv;
143 for ( std::vector<double>::const_iterator vi = external.begin();
144 vi != external.end();
147 rv.push_back( ( *vi - offset) / factor );
193 return decimal_places;
NAMESPACE_SDH_START const cUnitConverter uc_identity("any", "any", "?", 1.0, 0.0, 4)
#define USING_NAMESPACE_SDH
char const * GetSymbol(void) const
Return the symbol of the external unit (something like "deg" or "ms")
#define NAMESPACE_SDH_END
A simple vector implementation.
Interface of class #SDH::cUnitConverter.
double ToInternal(double external) const
@ eNUMBER_OF_ELEMENTS
number of elements in vector
double GetFactor(void) const
Return the conversion factor from internal to external units.
#define NAMESPACE_SDH_START
int GetDecimalPlaces(void) const
Return the number of decimal places for printing values in the external unit system.
double ToExternal(double internal) const
cUnitConverter(char const *_kind, char const *_name, char const *_symbol, double _factor=1.0, double _offset=0.0, int _decimal_places=1)
double GetOffset(void) const
Return the conversion offset from internal to external units.
bool Valid(unsigned int index) const
Return true if vector element index is valid (has been accessed at least once)
char const * GetName(void) const
Return the name of the external unit (something like "degrees" or "milliseconds")
Unit conversion class to convert values between physical unit systems.
char const * GetKind(void) const
Return the kind of unit converted (something like "angle" or "time")
sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Wed Mar 2 2022 01:00:58