FileLoaderCDF.h
2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef FILELOADERCDF_H
#define FILELOADERCDF_H
#include <list>
#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<string,string> attributes;
} t_CDFVar;
//list of CDF variables
typedef list<t_CDFVar> 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<string,string> 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