/*****************************************************************************
Copyright 1998 MBARI                                                      
******************************************************************************
Summary  : Calibration table class
Filename : Calibration.h
Author   : Michael B. Matthews                                                
Project  : iView                                                       
Version  : 3.8                                                         
Created  : 23.3.98  
Modified :  
Notes    : Used to be part of device.h in versions before V3.8
****************************************************************************/

#ifndef calibration_h
#define calibration_h

enum 
{
  CALIBRATION_TABLE_CALIBRATE_MODE,
  CALIBRATION_TABLE_NORMAL_MODE,
  CALIBRATION_TABLE_BYPASS_MODE
};


/*****************************************************************************
Class   : C A L I B R A T I O N   T A B L E
Purpose : Provides calibration table function
Notes   : 
******************************************************************************/

class CalibrationTable 
{
private:
  Int16 mode;
  Int16 size;
  Flt32* y;		// function range  y = f(x)
  Flt32* x;		// function domain
  Flt32* z;		// auxiliary field

public:
  CalibrationTable(String&);
  ~CalibrationTable() { if (size) { delete x; delete y; delete z; } }
  Flt32 LinearPiecewiseInterpolationX(Flt32);
  Flt32 LinearPiecewiseInterpolationY(Flt32);
  Int16 FindIndexX(Flt32 s);
  Int16 FindIndexY(Flt32 s);
};

#endif

