#ifndef FILELOADERCDF_H #define FILELOADERCDF_H #include #include "FileLoaderAbstract.h" #include "cdf.h" namespace TREPS { namespace File { //CDF variable type typedef enum {CDFVT_R,CDFVT_Z} t_CDFVarType; //CDF variable defintion typedef struct { //rVariable or zVariable t_CDFVarType type; //variable number long num; //variable name char name[CDF_VAR_NAME_LEN256+1]; //data type long dataType; //number of bytes for the data type long numBytes; //number of elements (of the data type) long numElts; //number of dimensions long numDims; //dimension sizes long dimSizes[CDF_MAX_DIMS]; //record variance long recVary; //dimension variances long dimVarys[CDF_MAX_DIMS]; //maximum record number long maxRecNum; //field id used by TREPS string fieldId; //field attributes map attributes; } t_CDFVar; //list of CDF variables typedef list t_CDFVarList; class FileLoaderCDFClass : public FileLoaderAbstractClass { public : FileLoaderCDFClass(void); ~FileLoaderCDFClass(void); //open CDF file bool open(const char *file_path); //close CDF file bool close(void); //test if a CDF file is opened bool isOpened(void); //get file format t_FileFormat getFormat(void); //detect frames t_StringList getFrames(const t_FieldList *fields); //detect fields t_FieldList getFields(long int nbRecords); //get number of records in CDF file long int getNbRecords(void); // add CDF specific vectors void addSpecificFormatVectors(const t_FieldList *fields, t_VectorList &vectors); //get general attributes map getAttributes(void); //get data bool getData(int start, int limit, DataRecordListClass *data, int &total); private : //CDF identifier CDFid cdfid; //buffer for CDF status text char cdfbuffer[CDF_STATUSTEXT_LEN+1]; //get information about a CDF variables bool getVarInfo(t_CDFVarType varType, long varNum, t_CDFVar &var); //get CDF variables list t_CDFVarList getVarList(void); //detect the type of a field void getFieldType(long dataType, t_FieldType &fieldType, t_TimeFormat &timeformat); //data extraction string extractValToStr(void *val, const t_CDFVar *var); }; } } #endif