DUECA/DUSIME
|
Class that performs calibration and scaling of an incoming integer value from an A/D converter or other input device. More...
#include <InputCalibrator.hxx>
Public Member Functions | |
InputCalibrator (const R in_min, const R in_max, const T &c, unsigned int idx=0) | |
Constructor. | |
~InputCalibrator () | |
Destructor. | |
operator double () const | |
Obtain the converted value. | |
R | raw () const |
Obtain the raw integer value. | |
void | newConversion (const R i) |
Insert a new converted value into the calibrator. | |
R | bitDifference (const double r) const |
Return the difference between the given value and the measured value in bit domain. | |
unsigned int | index () const |
The index is a variable for user convenience, e.g. | |
std::ostream & | print (std::ostream &os) const |
Print to stream, for debugging purposes. | |
Class that performs calibration and scaling of an incoming integer value from an A/D converter or other input device.
It is a templated class, and the template parameter must be a class capable of scaling the incoming values.
InputCalibrator< T, R >::InputCalibrator | ( | const R | in_min, |
const R | in_max, | ||
const T & | c, | ||
unsigned int | idx = 0 ) |
Constructor.
Takes a converter as argument.
in_min | Minimum integer value |
in_max | Maximum integer value |
c | Converter of (template) type T, the operation operator() (const double x) should exist for values between in_min and in_max, and should produce the required converted/scaled value. |
idx | Optional index to be stored with the calibrator. |
R InputCalibrator< T, R >::bitDifference | ( | const double | r | ) | const |
Return the difference between the given value and the measured value in bit domain.
r | Value for comparison |
|
inline |
The index is a variable for user convenience, e.g.
to remember where in an array of raw data the input value is stored.