diff options
Diffstat (limited to 'project2/iterate.cpp')
-rw-r--r-- | project2/iterate.cpp | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/project2/iterate.cpp b/project2/iterate.cpp index d114acb..7e86c4b 100644 --- a/project2/iterate.cpp +++ b/project2/iterate.cpp @@ -3,9 +3,12 @@ #include <syslog.h> #include "xmlObjectLoader.h" +ElementLoaderImpl<_Iterate> iterateLoader("iterate"); + _Iterate::_Iterate(const xmlpp::Element * p) : _SourceObject(p), - _NoOutputExecute(p) + _NoOutputExecute(p), + RowProcessor(p) { LoaderBase loader("http://project2.randomdan.homeip.net", true); loader.supportedStorers.insert(Storer::into(&subNOEs)); @@ -17,18 +20,50 @@ _Iterate::~_Iterate() } void -_Iterate::executeChildren() const +_Iterate::loadComplete(const CommonObjects * co) +{ + RowProcessor::loadComplete(co); +} + +void +_Iterate::rowReady() const { + executeChildren(); + source->rowChanged(); +} + +void +_Iterate::execute() const +{ + PerRowValues::beginRow(source.get()); try { - PerRowValues::beginRow(this); - BOOST_FOREACH(NoOutputExecutes::value_type sq, subNOEs) { - sq.second->execute(); - } - PerRowValues::endRow(this); + source->execute(this); + PerRowValues::endRow(source.get()); } catch (...) { - PerRowValues::endRow(this); + PerRowValues::endRow(source.get()); throw; } } +void +_Iterate::executeChildren() const +{ + BOOST_FOREACH(NoOutputExecutes::value_type sq, subNOEs) { + if (dynamic_cast<const RowProcessor *>(sq.second.get())) { + sq.second->execute(); + } + else { + PerRowValues::beginRow(NULL); + try { + sq.second->execute(); + PerRowValues::endRow(NULL); + } + catch (...) { + PerRowValues::endRow(NULL); + throw; + } + } + } +} + |