/* * DataReader.hh * * Created on: Nov 7, 2010 * Author: lamikr */ #ifndef DATAREADER_H_ #define DATAREADER_H_ #include #include #include "Data.hh" #include "Date.hh" #include "DeviceConfig.hh" #include namespace plp { /** * DataReader is able to read old data from the device. */ class DataReader { public: DataReader(std::string device_id); virtual ~DataReader(); DataRange *get_data_range(); /** * Get monthly summary data. * Depending from the device type, it may be daily mean value, daily delta, highest value, etc... */ DataRange *get_yearly_summary(Date *date, EnumSummaryCalculationType calc_type); DataRange *get_yearly_summary(Date *date); DataRange *get_yearly_summary(Date *start_date, Date *end_date); /** * Get monthly summary data. * Depending from the device type, it may be daily mean value, daily delta, highest value, etc... */ DataRange *get_monthly_summary(Date *date, EnumSummaryCalculationType calc_type); DataRange *get_monthly_summary(Date *date); DataRange *get_monthly_summary(Date *start_date, Date *end_date); /** * Get daily summary data calculated from the daily data items. * Depending from the device type, it may be daily mean value, daily delta, highest value, etc... */ /* * Get Daily summary from the latest date */ DataRange *get_daily_summary(); /* * Get Daily summary specified by the calc_type from the latest date. */ DataRange *get_daily_summary(EnumSummaryCalculationType calc_type); DataRange *get_daily_summary(Date *date, EnumSummaryCalculationType calc_type); DataRange *get_daily_summary(Date *date); DataRange *get_daily_summary(Date *start_date, Date *end_date); DataRange *get_hourly_summary(Date *date, EnumSummaryCalculationType calc_type); DataRange *get_hourly_summary(Date *date); DataRange *get_hourly_summary(Date *start_date, Date *end_date); DataRange *get_data(Date *start_date, Date *end_date); std::string get_device_id(); bool get_device_type(std::string& type_param); Data *get_latest_data(); protected: std::string device_id; std::string device_dir; std::string device_ch_dir; DeviceConfig *device_config; EnumSummaryCalculationType summary_calc_type; Data *find_oldest_data(std::vector year_vector); Data *find_latest_data(std::vector year_vector); DataRange *get_summary(Date *date_param, EnumSummaryCalculationType calc_type_param, EnumSummaryPeriod period_type_param); }; } #endif /* DATAREADER_H_ */