]> pilppa.org Git - libplp.git/blob - src/DataReader.hh
w1 independent file cleanups.
[libplp.git] / src / DataReader.hh
1 /*
2  * DataReader.hh
3  *
4  *  Created on: Nov 7, 2010
5  *      Author: lamikr
6  */
7
8 #ifndef DATAREADER_H_
9 #define DATAREADER_H_
10
11 #include <string>
12 #include <vector>
13
14 #include "Data.hh"
15 #include "Date.hh"
16 #include "DeviceConfig.hh"
17
18 #include <time.h>
19
20 namespace plp {
21         class DataReader {
22                 public:
23                         DataReader(std::string device_id);
24                         virtual ~DataReader();
25                         DataRange *get_data_range();
26                         /**
27                          * Get monthly summary data.
28                          * Depending from the device type, it may be daily mean value, daily delta, highest value, etc...
29                          */
30                         DataRange *get_yearly_summary(Date *date, EnumSummaryCalculationType calc_type);
31                         DataRange *get_yearly_summary(Date *date);
32                         DataRange *get_yearly_summary(Date *start_date, Date *end_date);
33                         /**
34                          * Get monthly summary data.
35                          * Depending from the device type, it may be daily mean value, daily delta, highest value, etc...
36                          */
37                         DataRange *get_monthly_summary(Date *date, EnumSummaryCalculationType calc_type);
38                         DataRange *get_monthly_summary(Date *date);
39                         DataRange *get_monthly_summary(Date *start_date, Date *end_date);
40                         /**
41                          * Get daily summary data calculated from the daily data items.
42                          * Depending from the device type, it may be daily mean value, daily delta, highest value, etc...
43                          */
44                         DataRange *get_daily_summary(Date *date, EnumSummaryCalculationType calc_type);
45                         DataRange *get_daily_summary(Date *date);
46                         DataRange *get_daily_summary(Date *start_date, Date *end_date);
47                         DataRange *get_hourly_summary(Date *date, EnumSummaryCalculationType calc_type);
48                         DataRange *get_hourly_summary(Date *date);
49                         DataRange *get_hourly_summary(Date *start_date, Date *end_date);
50                         DataRange *get_data(Date *start_date, Date *end_date);
51                         std::string get_device_id();
52                         std::string get_device_type();
53                         Data *get_latest_data();
54                 protected:
55                         std::string                     device_id;
56                         std::string                     device_dir;
57                         std::string                     device_ch_dir;
58                         DeviceConfig                    *device_config;
59                         EnumSummaryCalculationType      summary_calc_type;
60                         Data *find_oldest_data(std::vector<std::string> year_vector);
61                         Data *find_latest_data(std::vector<std::string> year_vector);
62                         DataRange *get_summary(Date *date_param,
63                                         EnumSummaryCalculationType calc_type_param,
64                                         EnumSummaryPeriod period_type_param);
65         };
66 }
67
68 #endif /* DATAREADER_H_ */