string base_dir;
device_id = device_id_param;
- base_dir = W1Store::get_store_base_dir();
+ base_dir = W1Store::get_base_dir_name();
device_dir = W1Util::concat_paths(base_dir, device_id);
device_ch_dir = W1Util::concat_paths(base_dir, "cache");
device_ch_dir = W1Util::concat_paths(device_ch_dir, device_id);
string W1DataList::get_day_data(Date *date) {
string ret_val;
- ret_val = W1Store::get_store_file_name(device_id, date);
+ ret_val = W1Store::get_file_name(device_id, date);
return ret_val;
}
Date *date_time) {
store_data = NULL;
range_data = NULL;
- store_file_name = get_store_file_name(device_id, date_time);
+ store_file_name = get_file_name(device_id, date_time);
log_debug("data file name: %s\n", store_file_name.c_str());
}
}
}
-void W1Store::set_store_base_dir(string store_param) {
+void W1Store::set_base_dir_name(string store_param) {
int pos;
int b_count;
}
}
-string W1Store::get_store_base_dir() {
+string W1Store::get_base_dir_name() {
return store_base_dir;
}
-string W1Store::get_store_dir_name(string device_id, Date *date_time) {
+string W1Store::get_dir_name(string device_id, Date *date_time) {
string ret_val;
char buffer[30];
return ret_val;
}
-string W1Store::get_store_file_name(string device_id, Date *date_time) {
+string W1Store::get_file_name(string device_id, Date *date_time) {
string ret_val;
string fname;
char buffer[30];
snprintf(buffer, 30, "%d-%02d-%02d", date_time->year, date_time->month, date_time->day);
fname = buffer;
fname = fname + DATAFILE_SUFFIX;
- ret_val = get_store_dir_name(device_id, date_time);
+ ret_val = get_dir_name(device_id, date_time);
ret_val = W1Util::concat_paths(ret_val, fname);
return ret_val;
}
Date *date;
date = new Date();
- f_path = get_store_file_name(device_id, date);
+ f_path = get_file_name(device_id, date);
ostream = W1Util::open_for_writing(f_path.c_str());
// TODO: add mutex to protect string_list while it's read and emptied
if (ostream != NULL) {
plp::Date *date_time);
W1Store(std::string file_name_param);
virtual ~W1Store();
- static std::string get_store_base_dir();
- static void set_store_base_dir(std::string store_param);
- static std::string get_store_dir_name(std::string device_id, plp::Date *ltime);
- static std::string get_store_file_name(std::string device_id, plp::Date *ltime);
+ static std::string get_base_dir_name();
+ static void set_base_dir_name(std::string store_param);
+ static std::string get_dir_name(std::string device_id, plp::Date *ltime);
+ static std::string get_file_name(std::string device_id, plp::Date *ltime);
static void store(std::string device_id, std::list<std::string> *string_list);
void load();
Data *get_delta();
else {
log_warning("No storage location parameter given, using default location: %s\n", loc.c_str());
}
- W1Store::set_store_base_dir(loc.c_str());
+ W1Store::set_base_dir_name(loc);
dlist = new W1DataList("0008014e9e09");
if (dlist != NULL) {
dr = dlist->get_data_range();
try_parse_long(argv[3], &store_interval);
}
log_info("start scanning, data saved to location: %s, scan interval: %d, store interval: %d\n", location.c_str(), scan_interval, store_interval);
- W1Store::set_store_base_dir(location.c_str());
+ W1Store::set_base_dir_name(location);
scanner = new W1Scanner();
device_list = scanner->get_device_list();
round = 0;