From 1d7f596ebb523f1ccfeba47ab18d696b2d135a65 Mon Sep 17 00:00:00 2001 From: Mika Laitio Date: Mon, 13 Aug 2012 01:37:40 +0300 Subject: [PATCH] cleanups Signed-off-by: Mika Laitio --- src/DeviceData.cc | 24 +++++++++++++++++++++--- src/DeviceData.hh | 9 ++++++++- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/DeviceData.cc b/src/DeviceData.cc index 1621d05..59aa0ad 100644 --- a/src/DeviceData.cc +++ b/src/DeviceData.cc @@ -5,7 +5,9 @@ * Author: lamikr */ +#include "Data.hh" #include "DeviceData.hh" +#include "log.h" using namespace std; using namespace plp; @@ -13,13 +15,29 @@ using namespace plp; DeviceData::DeviceData(string id_param, string type_param) : Device(id_param, type_param) { } -DeviceData::DeviceData(string id_param, string type_param, string name_param, EnumDeviceLifeCycleStatus status_param) : Device(id_param, type_param, name_param, status_param) { - +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; } DeviceData::~DeviceData() { } void DeviceData::printout() { - + string id; + + log_debug("--- device data --- \n"); + id = get_id(); + log_debug("\tid: %s\n", id.c_str()); + 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) + log_debug("data not null\n"); + else + log_debug("data null\n"); + _latest_data->printout(); } diff --git a/src/DeviceData.hh b/src/DeviceData.hh index 5b11047..8e9335e 100644 --- a/src/DeviceData.hh +++ b/src/DeviceData.hh @@ -8,15 +8,22 @@ #ifndef DEVICEDATA_HH_ #define DEVICEDATA_HH_ +#include "Data.hh" #include "Device.hh" namespace plp { class DeviceData : public Device { public: DeviceData(std::string id_param, std::string type_param); - DeviceData(std::string id_param, std::string type_param, std::string name_param, plp::EnumDeviceLifeCycleStatus status_param); + DeviceData(std::string id_param, + std::string type_param, + std::string name_param, + plp::EnumDeviceLifeCycleStatus status_param, + Data *latest_data); ~DeviceData(); void printout(); + private: + Data *_latest_data; }; } -- 2.41.1