4 * Created on: Oct 31, 2010
22 class StoreDay: public plp::Store {
24 StoreDay(std::string device_id_param,
25 plp::Date *date_time_param);
26 StoreDay(std::string file_name_param);
28 static void save(std::string device_id, std::list<plp::Data *> *data_list, int dec_precision);
29 plp::DataRange *get_sum(EnumSummaryPeriod period_type_param);
30 plp::DataRange *get_mean(EnumSummaryPeriod period_type_param);
31 plp::DataRange *get_delta(EnumSummaryPeriod period_type_param);
32 plp::DataRange *get_max(EnumSummaryPeriod period_type_param);
33 plp::DataRange *get_min(EnumSummaryPeriod period_type_param);
34 plp::Data *get_oldest_data();
35 plp::Data *get_latest_data();
36 plp::DataRange *get_oldest_and_latest_data();
38 * Checks whether store file exist.
40 bool exist(bool writable);
41 static bool exist(std::string dev_id,
44 static bool exist_in_month(string device_id,
47 static bool exist_in_year(string device_id,
50 static bool get_next_date_with_data(std::string device_id,
54 std::string store_fname;
56 plp::DataRange *get_max_or_min(EnumSummaryPeriod period_type_param, bool max);
57 static std::string get_dir_name(std::string device_id,
58 plp::Date *date_time_param);
59 static std::string get_year_dir_name(std::string device_id,
60 plp::Date *date_time_param);
61 static std::string get_file_name(std::string device_id,
62 plp::Date *date_time_param);
63 plp::DataRange *get_oldest_and_latest_data(std::string fname_param);
65 * Check whether the given file exist and has either read or write permissions.
67 static bool exist(std::string fname_param, bool writable);
69 * Go through days in month to find out whether daily data file exist.
71 * If data is not found, false is returned and last scanned date is set to next_date.
72 * If data is found true is returned and date is set to next_date.
74 static bool data_day_scan_days_in_month(string dev_id_param,
78 * Go through month dir in year to find out first date with data
79 * after the given date.
81 * If data is not found, false is returned and last scanned date is set to next_date.
82 * If data is found true is returned and date is set to next_date.
84 static bool data_day_scan_month_in_year(string dev_id_param,
88 * Go through year and month directories to find out first date with data
89 * after the given date.
91 * If data is not found, false is returned and last scanned date is set to next_date.
92 * If data is found true is returned and date is set to next_date.
94 static bool data_day_scan_years(string dev_id_param,
100 #endif /* W1STORE_HH_ */