Data *ret_val;
vector<double> *vect;
+ log_debug("get_data() started\n");
ret_val = NULL;
vect = get_raw_data();
if (vect != NULL) {
+ log_debug("get_data() got raw data\n");
ret_val = new Data(vect, get_unit());
cache(ret_val);
delete(vect);
+ log_debug("get_data() got raw data done\n");
}
else {
+ log_debug("get_data() try to read old already saved data\n");
// read old data already saved
ret_val = reader->get_latest_data();
+ log_debug("get_data() try to read old already saved data done\n");
}
return ret_val;
}
#include <plp/Date.hh>
#include <plp/DataReader.hh>
#include <plp/DeviceConfig.hh>
+#include <plp/Device.hh>
+#include <plp/SensorDevice.hh>
#include "Factory.hh"
Data *fdata;
Data *ldata;
DataReader *reader;
- Device *device;
+ Device *dev;
+ SensorDevice *device;
DataRange *dr;
DataRange *dr2;
list<Device *> dev_lst;
}
dev_lst = Factory::get_device_list();
for(list_iter = dev_lst.begin(); list_iter != dev_lst.end(); list_iter++) {
- device = (Device *)*list_iter;
- if (device != NULL) {
- reader = device->get_device_data();
- if (reader != NULL) {
- dr = reader->get_data_range();
- if (dr != NULL) {
- fdata = dr->get_first();
- if (fdata != NULL) {
- fdata->printout();
- ldata = dr->get_last();
- if (ldata != NULL) {
- ldata->printout();
- plp::Date d1;
- plp::Date d2;
+ dev = (Device *)*list_iter;
+ if (dev != NULL) {
+ device = dynamic_cast<SensorDevice *>(dev);
+ if (device != NULL) {
+ reader = device->get_device_data();
+ if (reader != NULL) {
+ dr = reader->get_data_range();
+ if (dr != NULL) {
+ fdata = dr->get_first();
+ if (fdata != NULL) {
+ fdata->printout();
+ ldata = dr->get_last();
+ if (ldata != NULL) {
+ ldata->printout();
+ plp::Date d1;
+ plp::Date d2;
- d1 = fdata->get_date();
- d2 = ldata->get_date();
- dr2 = reader->get_data(&d1, &d2);
- if (dr2 != NULL) {
- dr2->printout();
- delete(dr2);
+ d1 = fdata->get_date();
+ d2 = ldata->get_date();
+ dr2 = reader->get_data(&d1, &d2);
+ if (dr2 != NULL) {
+ dr2->printout();
+ delete(dr2);
+ }
+ delete(ldata);
}
- delete(ldata);
+ delete(fdata);
}
- delete(fdata);
+ delete(dr);
}
- delete(dr);
+ delete(reader);
}
- delete(reader);
}
}
}