/**---------------------------------------------------------------------------
 ** 
 ** xtract.h -- 
 ** 
 ** Author          : Pierre Jaccard
 ** Created On      : 1999/07/15 17:37:00
 ** Last Modified By: Pierre Jaccard
 ** Last Modified On: 1999/08/04 19:44:12
 ** Update Count    : 7
 ** Directory       : /home/pego/pcd1/codas3c/gfi/src/libs/db/
 ** Version         : 0.0
 ** Status          : Unknown
 ** ---------------------------------------------------------------------- ** 
 ** DESCRIPTION: 
 ** 
 **    See associated file xtract.c
 ** 
 ** ---------------------------------------------------------------------- ** 
 ** REVISIONS: 
 ** ---------------------------------------------------------------------- ** 
 ** CHANGES: 
 **------------------------------------------------------------------------**/

#ifndef gfilib_db_xtract_already_included
#define gfilib_db_xtract_already_included

#include "geninc.h"
#include "dbglo.h" 
#include "ioserv.h"

#define VAR_NAME_LENGTH     39  /* This is defined by CODAS */
#define VAR_VAL_LIST_LENGTH 80  /* List of data to extract  */
#define MAX_VARS            30  /* Max number of variables  */

#define DEFAULT_VARIABLE_INT_TOLERANCE      0; /* Data bins tolerance   */
#define DEFAULT_VARIABLE_FLOAT_TOLERANCE  1.0; /* Data values tolerance */

/*
  This is the extraction structure. It defines the variable to extract and
  which values to select 
*/
typedef struct
{
	char name[VAR_NAME_LENGTH];     /* Name of variable                   */
	int  code;                      /* User code                          */
	char min_str[VAR_NAME_LENGTH];  /* Name of variable for minimum       */
	char max_str[VAR_NAME_LENGTH];  /* Name of variable for maximum       */
	FLOAT min;                      /* Minimum value                      */
	FLOAT max;                      /* Maximum value                      */
	FLOAT scale;                    /* Scale to use                       */
	STRUCT_DEF_ELEM_TYPE *struc;    /* Pointer to structure definition    */
	FLOAT *data;                    /* Pointer to array of extracted data */
	unsigned int   n;               /* Number of extracted data           */
} EXTRACT_VARIABLE_TYPE;

#if PROTOTYPE_ALLOWED

int init_xtract_prf_var(EXTRACT_VARIABLE_TYPE *xvar);
int free_xtract_prf_var(EXTRACT_VARIABLE_TYPE *xvar);
int extract_prf_var_f(EXTRACT_VARIABLE_TYPE *def, int year_base);
int extract_range_values_f(EXTRACT_VARIABLE_TYPE *xvar, int year_base);

#else

int init_xtract_prf_var();
int free_xtract_prf_var();
int extract_prf_var_f();
int extract_range_values_f();

#endif /* PROTOTYPE_ALLOWED */


#endif /* gfilib_db_xtract_already_included */
