Commit fee8cc37 authored by Alessio Netti's avatar Alessio Netti
Browse files

ProcFS and Tester bugfixes

- Fixed template management when configuring ProcFS and Tester instances:
sensors are not inherited from the template, preventing inconsistencies
- Fixed a bug that caused the "global" config block to be not recognized
anymore in plugins
parent 189ec008
......@@ -233,7 +233,7 @@ public:
delete group;
}
}
} else {
} else if( !boost::iequals(val.first, "global") ) {
LOG(error) << "\"" << val.first << "\": unknown construct!";
return false;
}
......
......@@ -206,7 +206,7 @@ bool PerfeventConfigurator::readConfig(std::string cfgPath) {
LOG(warning) << "Single " << _baseName << " \"" << val.second.data() << "\" has bad values! Ignoring...";
}
}
} else {
} else if( !boost::iequals(val.first, "global") ) {
LOG(error) << "\"" << val.first << "\": unknown construct!";
return false;
}
......
......@@ -69,6 +69,9 @@ bool ProcfsConfigurator::readConfig(std::string cfgPath) {
LOG(warning) << _groupName << " \"" << val.second.data() << "\" has bad values! Ignoring...";
}
}
} else if( !boost::iequals(val.first, "global") ) {
LOG(error) << "\"" << val.first << "\": unknown construct!";
return false;
}
}
return true;
......
......@@ -7,6 +7,18 @@
#include "ProcfsSensorGroup.h"
// Overriding assignment operator so that sensors are not copy-constructed
ProcfsSensorGroup& ProcfsSensorGroup::operator=(const ProcfsSensorGroup& other) {
SensorGroupInterface::operator=(other);
for(auto s : _sensors) {
delete s;
}
_sensors.clear();
_baseSensors.clear();
return *this;
}
/**
* Class destructor.
*
......
......@@ -22,6 +22,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
public:
// Constructor and destructor
ProcfsSensorGroup(const std::string& name) : SensorGroupTemplate(name) { this->_parser = NULL; }
ProcfsSensorGroup& operator=(const ProcfsSensorGroup& other);
virtual ~ProcfsSensorGroup();
// Methods inherited from SensorGroupTemplate
......
......@@ -9,6 +9,8 @@
TesterConfigurator::TesterConfigurator() {
_groupName = "group";
_baseName = "INVALID";
_entityName = "INVALID";
}
TesterConfigurator::~TesterConfigurator() {}
......
......@@ -16,6 +16,18 @@ TesterSensorGroup::TesterSensorGroup(const std::string& name) :
SensorGroupTemplate(name),
_value(0) {}
// Overriding assignment operator so that sensors are not copy-constructed
TesterSensorGroup& TesterSensorGroup::operator=(const TesterSensorGroup& other) {
SensorGroupInterface::operator=(other);
for(auto s : _sensors) {
delete s;
}
_sensors.clear();
_baseSensors.clear();
return *this;
}
TesterSensorGroup::~TesterSensorGroup() {}
void TesterSensorGroup::start() {
......
......@@ -15,6 +15,7 @@ class TesterSensorGroup : public SensorGroupTemplate<TesterSensorBase> {
public:
TesterSensorGroup(const std::string& name);
TesterSensorGroup& operator=(const TesterSensorGroup& other);
virtual ~TesterSensorGroup();
void start() override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment