DUECA/DUSIME
Loading...
Searching...
No Matches
InputRatioCalibrator< T, R > Class Template Reference

Class that performs calibration and scaling of an incoming integer value from an A/D converter or other input device. More...

#include <InputRatioCalibrator.hxx>

Public Member Functions

 InputRatioCalibrator (const R in_min, const R in_max, const R in_zero, const T &c, unsigned int idx=0, unsigned idx_ref=0)
 Constructor.
 ~InputRatioCalibrator ()
 Destructor.
 operator double () const
 Obtain the converted value.
R raw () const
 Obtain the raw integer value.
R rawReference () const
 Obtain the raw integer value for the reference.
void newConversion (const R i, const R ref)
 Insert a new converted value set 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.
unsigned int indexReference () const
 The index of the reference signal, for user convenience.
std::ostream & print (std::ostream &os) const
 Print to stream, for debugging purposes.

Detailed Description

template<class T, class R = int>
class InputRatioCalibrator< T, R >

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.

Constructor & Destructor Documentation

◆ InputRatioCalibrator()

template<class T, class R = int>
InputRatioCalibrator< T, R >::InputRatioCalibrator ( const R in_min,
const R in_max,
const R in_zero,
const T & c,
unsigned int idx = 0,
unsigned idx_ref = 0 )

Constructor.

Takes a converter as argument.

Parameters
in_minMinimum integer value
in_maxMaximum integer value
in_zeroZero value for the input and reference
cConverter 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.
idxOptional index to be stored with the calibrator.
idx_refIndex of the reference signal.

Member Function Documentation

◆ bitDifference()

template<class T, class R = int>
R InputRatioCalibrator< T, R >::bitDifference ( const double r) const

Return the difference between the given value and the measured value in bit domain.

Parameters
rValue for comparison
Returns
  • 0 if the difference is 1 bit or less
  • 1 if the value is two bits larger
  • -1 if the value is two bits smaller
  • 2 respectively -2 if the value is three bits or more larger or smaller.

◆ index()

template<class T, class R = int>
unsigned int InputRatioCalibrator< T, R >::index ( ) const
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.

Returns
index value

◆ indexReference()

template<class T, class R = int>
unsigned int InputRatioCalibrator< T, R >::indexReference ( ) const
inline

The index of the reference signal, for user convenience.

Returns
index value

The documentation for this class was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/dueca-4.3.2-build/dueca-4.3.2/extra/InputRatioCalibrator.hxx