X-Git-Url: http://pilppa.org/gitweb/?p=libplp.git;a=blobdiff_plain;f=src%2FDeviceData.cc;fp=src%2FDeviceData.cc;h=fa57a5213706fc3cfd113d42f51bf976dd4e77e7;hp=9deed93682a228abee52a6c5831bc72e7eca8d92;hb=0fa52fa51ad87bfb7871956f2cca83434f3bff7e;hpb=97671ad08a864c833fab1b3827e3d91749c0e9d7 diff --git a/src/DeviceData.cc b/src/DeviceData.cc index 9deed93..fa57a52 100644 --- a/src/DeviceData.cc +++ b/src/DeviceData.cc @@ -20,12 +20,16 @@ DeviceData::DeviceData(string id_param, string type_param, string name_param, EnumDeviceLifeCycleStatus status_param, - Data *latest_data) : Device(id_param, type_param, name_param, status_param) { - _latest_data = latest_data; + Data *data_param) : Device(id_param, type_param, name_param, status_param) { + //if (latest_data != NULL) + // _latest_data = latest_data->clone(); + _latest_data = data_param; } DeviceData::~DeviceData() { - delete(_latest_data); + if (_latest_data != NULL) + delete(_latest_data); + _latest_data = NULL; } void DeviceData::printout() { @@ -37,9 +41,10 @@ void DeviceData::printout() { log_debug("\tname: %s\n", get_name().c_str()); log_debug("\ttype: %s\n", get_type().c_str()); log_debug("\tlifecycle state: %d\n", get_lifecycle_state()); - if (_latest_data != NULL) + if (_latest_data != NULL) { log_debug("data not null\n"); + _latest_data->printout(); + } else log_debug("data null\n"); - _latest_data->printout(); }