00001
00009 #ifndef CLIMATE_CSV_READER_
00010 #define CLIMATE_CSV_READER_
00011
00012 #include "climate.h"
00013 #include "weather.h"
00014 #include "weather_reader.h"
00015
00024 class csv_reader : public weather_reader {
00025 private:
00026 protected:
00027 int read_prop(char *);
00028 int read_header(char *);
00029 int read_line(char *);
00030
00031 int column_ct;
00032 PROPERTY **columns;
00033 TIMESTAMP last_ts;
00034 weather *weather_root, *weather_last;
00035
00036 public:
00037 csv_reader();
00038 csv_reader(MODULE *module);
00039 ~csv_reader();
00040
00041 static CLASS *oclass;
00042
00043 long int index;
00044 TIMESTAMP next_ts;
00045 weather **samples;
00046 long int sample_ct;
00047
00048 char32 city_name;
00049 char32 state_name;
00050 char32 timezone;
00051 double lat_deg;
00052 double lat_min;
00053 double long_deg;
00054 double long_min;
00055 double low_temp;
00056 double high_temp;
00057 double peak_solar;
00058 char32 timefmt;
00059 char256 columns_str;
00060 char256 filename;
00061 typedef enum {
00062 CR_INIT,
00063 CR_OPEN,
00064 CR_ERROR,
00065 } CSVSTATUS;
00066 CSVSTATUS status;
00067
00068 int open(const char *file);
00069 TIMESTAMP get_data(TIMESTAMP t0, double *temp, double *humid, double *direct, double *diffuse, double *global, double *wind, double *rain, double *snow);
00070 };
00071 #endif
00072
00073