]> pilppa.org Git - libplp.git/blob - src/DataReader.hh
api fixes and 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                         /**
42                          * Get daily summary data calculated from the daily data items.
43                          * Depending from the device type, it may be daily mean value, daily delta, highest value, etc...
44                          */
45                         /*
46                          * Get Daily summary from the latest date
47                          */
48                         DataRange *get_daily_summary();
49                         /*
50                          * Get Daily summary specified by the calc_type from the latest date.
51                          */
52                         DataRange *get_daily_summary(EnumSummaryCalculationType calc_type);
53                         DataRange *get_daily_summary(Date *date, EnumSummaryCalculationType calc_type);
54                         DataRange *get_daily_summary(Date *date);
55                         DataRange *get_daily_summary(Date *start_date, Date *end_date);
56
57                         DataRange *get_hourly_summary(Date *date, EnumSummaryCalculationType calc_type);
58                         DataRange *get_hourly_summary(Date *date);
59                         DataRange *get_hourly_summary(Date *start_date, Date *end_date);
60
61                         DataRange *get_data(Date *start_date, Date *end_date);
62                         std::string get_device_id();
63                         bool get_device_type(std::string& type_param);
64                         Data *get_latest_data();
65                 protected:
66                         std::string                     device_id;
67                         std::string                     device_dir;
68                         std::string                     device_ch_dir;
69                         DeviceConfig                    *device_config;
70                         EnumSummaryCalculationType      summary_calc_type;
71                         Data *find_oldest_data(std::vector<std::string> year_vector);
72                         Data *find_latest_data(std::vector<std::string> year_vector);
73                         DataRange *get_summary(Date *date_param,
74                                         EnumSummaryCalculationType calc_type_param,
75                                         EnumSummaryPeriod period_type_param);
76         };
77 }
78
79 #endif /* DATAREADER_H_ */