ss >>ret_val.year >>c >>ret_val.month >>c >>ret_val.day >>ret_val.hour >>c >>ret_val.min >>c >>ret_val.sec;
return ret_val;
}
-
-Data *W1Util::parse_data_line(const string& dataline) {
- stringstream ss(dataline);
- string item;
- double val;
- Data *ret_val;
- int ii;
- bool suc_flg;
- vector<double> v;
- Date date;
-
- ii = 0;
- while(getline(ss, item, '|')) {
- if (ii == 0) {
- // parse date
- date = parse_date_str(item);
- }
- // skip the device type and device id fields
- // TODO: store device type and id to own file
- else if (ii >= 3) {
- suc_flg = string_to_number<double>(val, item, dec);
- if (suc_flg) {
- //log_debug("adding number: %f\n", val);
- v.push_back(val);
- }
- }
- ii++;
- }
- ret_val = new Data(v, &date);
- return ret_val;
-}