summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-09-01 23:19:14 +0000
committerrandomdan <randomdan@localhost>2011-09-01 23:19:14 +0000
commit46a5045956a821c33aea7a98681fb388e0f4b64c (patch)
tree136d4d10259705948cd4c021e19206932aa8df9f
parentAdd more precompiled headers (diff)
downloadproject2-46a5045956a821c33aea7a98681fb388e0f4b64c.tar.bz2
project2-46a5045956a821c33aea7a98681fb388e0f4b64c.tar.xz
project2-46a5045956a821c33aea7a98681fb388e0f4b64c.zip
Allow low preference caches to refill higher ones
-rw-r--r--project2/common/cache.cpp2
-rw-r--r--project2/common/rowProcessor.cpp23
-rw-r--r--project2/common/rowProcessor.h4
3 files changed, 17 insertions, 12 deletions
diff --git a/project2/common/cache.cpp b/project2/common/cache.cpp
index 1c078fb..7ad4053 100644
--- a/project2/common/cache.cpp
+++ b/project2/common/cache.cpp
@@ -17,7 +17,7 @@ bool Cache::checkAndExecute(const Glib::ustring & n, const Glib::ustring & f, co
RowSetCPtr cached = getCachedRowSet(n, f, rp);
if (cached) {
try {
- Logger()->messagef(LOG_ERR, "Executing from cache");
+ Logger()->messagef(LOG_DEBUG, "Executing from cache '%s'", name.c_str());
cached->execute(f, rp);
return true;
}
diff --git a/project2/common/rowProcessor.cpp b/project2/common/rowProcessor.cpp
index 8161aaf..71fdd76 100644
--- a/project2/common/rowProcessor.cpp
+++ b/project2/common/rowProcessor.cpp
@@ -28,30 +28,33 @@ RowProcessor::execute() const
ScopeObject _ihp(boost::bind(&IHaveParameters::pop, this));
BOOST_FOREACH(const CachePtr & c, caches) {
if (c->checkAndExecute(source->name, filter, this)) {
+ BOOST_FOREACH(const TargetCaches::value_type & c, tc) {
+ c->get<1>()->close(source->name, filter, this);
+ }
+ tc.clear();
return;
}
- }
- BOOST_FOREACH(const CachePtr & c, caches) {
PresenterPtr p = c->openFor(source->name, filter, this);
if (p) {
- tc.insert(p);
+ tc.insert(TargetCachePtr(new TargetCache(p, c)));
}
}
+ Logger()->messagef(LOG_DEBUG, "Executing from source '%s'", source->name.c_str());
source->execute(filter, this);
- tc.clear();
- BOOST_FOREACH(const CachePtr & c, caches) {
- c->close(source->name, filter, this);
+ BOOST_FOREACH(const TargetCaches::value_type & c, tc) {
+ c->get<1>()->close(source->name, filter, this);
}
+ tc.clear();
}
void
RowProcessor::rowReadyInternal(const RowState * rs) const
{
BOOST_FOREACH(const TargetCaches::value_type & c, tc) {
- c->pushSub(filter.empty() ? "row" : filter);
- rs->foreachColumn(boost::bind(&Presenter::addField, c, _2, _3));
- rs->foreachAttr(boost::bind(&Presenter::addAttr, c, _1, _2));
- c->popSub();
+ c->get<0>()->pushSub(filter.empty() ? "row" : filter);
+ rs->foreachColumn(boost::bind(&Presenter::addField, c->get<0>(), _2, _3));
+ rs->foreachAttr(boost::bind(&Presenter::addAttr, c->get<0>(), _1, _2));
+ c->get<0>()->popSub();
}
rowReady(rs);
}
diff --git a/project2/common/rowProcessor.h b/project2/common/rowProcessor.h
index c25dc73..3f39d19 100644
--- a/project2/common/rowProcessor.h
+++ b/project2/common/rowProcessor.h
@@ -29,7 +29,9 @@ class RowProcessor : public IHaveParameters {
virtual void rowReady(const RowState *) const = 0;
typedef ANONORDEREDSTORAGEOF(Cache) Caches;
Caches caches;
- typedef std::set<PresenterPtr> TargetCaches;
+ typedef boost::tuple<PresenterPtr, CachePtr> TargetCache;
+ typedef boost::shared_ptr<TargetCache> TargetCachePtr;
+ typedef std::set<TargetCachePtr> TargetCaches;
mutable TargetCaches tc;
};