diff options
author | Wim van Aarle <wimvanaarle@gmail.com> | 2015-05-26 15:43:08 +0200 |
---|---|---|
committer | Wim van Aarle <wimvanaarle@gmail.com> | 2015-05-26 15:43:08 +0200 |
commit | 3117c7a61a83ca28ba00211d1eb65eaf13a7307a (patch) | |
tree | 4851ae878cf499deb2ae2f77575b3c48ecaf5d04 /src/Config.cpp | |
parent | 9e884e760b71be354c08892f6bce2efe723917b3 (diff) | |
parent | 57668bcdd086145eb14598e32fd5d0dca711865c (diff) | |
download | astra-3117c7a61a83ca28ba00211d1eb65eaf13a7307a.tar.gz astra-3117c7a61a83ca28ba00211d1eb65eaf13a7307a.tar.bz2 astra-3117c7a61a83ca28ba00211d1eb65eaf13a7307a.tar.xz astra-3117c7a61a83ca28ba00211d1eb65eaf13a7307a.zip |
Merge remote-tracking branch 'upstream/master' into parallel_vec
Conflicts:
astra_vc11.vcxproj.filters
python/astra/functions.py
src/ParallelBeamBlobKernelProjector2D.cpp
src/ProjectionGeometry2D.cpp
Diffstat (limited to 'src/Config.cpp')
-rw-r--r-- | src/Config.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/Config.cpp b/src/Config.cpp index 653935e..395080b 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -37,36 +37,41 @@ $Id$ #include "astra/Projector2D.h" #include "astra/Projector3D.h" +#include "astra/Logging.h" +#include <sstream> + using namespace astra; using namespace std; //----------------------------------------------------------------------------- // default constructor -Config::Config() +Config::Config() : self() { - self = 0; + _doc = 0; } //----------------------------------------------------------------------------- // not so default constructor -Config::Config(XMLNode* _self) +Config::Config(XMLNode _self) { self = _self; + _doc = 0; } //----------------------------------------------------------------------------- Config::~Config() { - delete self; - self = 0; + delete _doc; + _doc = 0; } //----------------------------------------------------------------------------- void Config::initialize(std::string rootname) { - if (self == 0) { + if (!self) { XMLDocument* doc = XMLDocument::createDocument(rootname); self = doc->getRootNode(); + _doc = doc; } } @@ -121,13 +126,13 @@ bool ConfigStackCheck<T>::stopParsing() std::string errors; - std::list<XMLNode*> nodes = cfg->self->getNodes(); - for (std::list<XMLNode*>::iterator i = nodes.begin(); i != nodes.end(); ++i) + std::list<XMLNode> nodes = cfg->self.getNodes(); + for (std::list<XMLNode>::iterator i = nodes.begin(); i != nodes.end(); ++i) { - std::string nodeName = (*i)->getName(); + std::string nodeName = i->getName(); if (nodeName == "Option") { - nodeName = (*i)->getAttribute("key", ""); + nodeName = i->getAttribute("key", ""); if (object->configCheckData->parsedOptions.find(nodeName) == object->configCheckData->parsedOptions.end()) { if (!errors.empty()) errors += ", "; errors += nodeName; @@ -139,12 +144,12 @@ bool ConfigStackCheck<T>::stopParsing() } } } - for (std::list<XMLNode*>::iterator i = nodes.begin(); i != nodes.end(); ++i) - delete (*i); nodes.clear(); if (!errors.empty()) { - cout << "Warning: " << name << ": unused configuration options: " << errors << std::endl; + ostringstream os; + os << name << ": unused configuration options: " << errors; + ASTRA_WARN(os.str().c_str()); return false; } |