Simplify ConfigManager parsing loop
parent
e605885030
commit
30aedc9edf
|
@ -5,7 +5,7 @@
|
||||||
#include "common/SignalHandler.h"
|
#include "common/SignalHandler.h"
|
||||||
|
|
||||||
#include "common/VermontControl.h"
|
#include "common/VermontControl.h"
|
||||||
#include "modules/ConfigManager.h"
|
#include "modules/ConfigManager.hpp"
|
||||||
|
|
||||||
class MainSignalHandler : public SignalInterface
|
class MainSignalHandler : public SignalInterface
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "modules/ConfigManager.h"
|
#include "ConfigManager.hpp"
|
||||||
#include "core/Connector.h"
|
#include "core/Connector.h"
|
||||||
#include "core/CfgNode.h"
|
#include "core/CfgNode.h"
|
||||||
#include "common/defs.h"
|
#include "common/defs.h"
|
||||||
|
@ -156,13 +156,11 @@ void ConfigManager::parseConfig(std::string fileName)
|
||||||
* attached to the node) to the graph
|
* attached to the node) to the graph
|
||||||
*/
|
*/
|
||||||
XMLNode::XMLSet<XMLElement*> rootElements = root->getElementChildren();
|
XMLNode::XMLSet<XMLElement*> rootElements = root->getElementChildren();
|
||||||
for (XMLNode::XMLSet<XMLElement*>::const_iterator it = rootElements.begin();
|
for (const auto& element : rootElements) {
|
||||||
it != rootElements.end();
|
|
||||||
it++) {
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (unsigned int i = 0; i < ARRAY_SIZE(configModules); i++) {
|
for (auto& module : configModules) {
|
||||||
if ((*it)->getName() == configModules[i]->getName()) {
|
if (element->getName() == module->getName()) {
|
||||||
Cfg* cfg = configModules[i]->create(*it);
|
Cfg* cfg = module->create(element);
|
||||||
|
|
||||||
// handle special modules
|
// handle special modules
|
||||||
SensorManagerCfg* smcfg = dynamic_cast<SensorManagerCfg*>(cfg);
|
SensorManagerCfg* smcfg = dynamic_cast<SensorManagerCfg*>(cfg);
|
||||||
|
@ -179,7 +177,7 @@ void ConfigManager::parseConfig(std::string fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
msg(LOG_ERR, "Unknown cfg entry %s found", (*it)->getName().c_str());
|
msg(LOG_ERR, "Unknown cfg entry %s found", element->getName().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "modules/packet/filter//SystematicSampler.h"
|
#include "modules/packet/filter//SystematicSampler.h"
|
||||||
#include "common/msg.h"
|
#include "common/msg.h"
|
||||||
#include "CounterDestination.h"
|
#include "CounterDestination.h"
|
||||||
#include "modules/ConfigManager.h"
|
#include "modules/ConfigManager.hpp"
|
||||||
#include "core/ConnectionSplitter.h"
|
#include "core/ConnectionSplitter.h"
|
||||||
#include "PrinterModule.h"
|
#include "PrinterModule.h"
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include "common/defs.h"
|
#include "common/defs.h"
|
||||||
#include "core/MainSignalHandler.h"
|
#include "core/MainSignalHandler.h"
|
||||||
|
|
||||||
#include "modules/ConfigManager.h"
|
#include "modules/ConfigManager.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue