diff options
Diffstat (limited to 'project2/common/variables/lookup.cpp')
-rw-r--r-- | project2/common/variables/lookup.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/project2/common/variables/lookup.cpp b/project2/common/variables/lookup.cpp index 2a96338..b3f9002 100644 --- a/project2/common/variables/lookup.cpp +++ b/project2/common/variables/lookup.cpp @@ -33,38 +33,38 @@ class VariableLookup : public VariableImplDyn, public RowProcessor { VariableLookup(ScriptNodePtr e) : VariableImplDyn(e), RowProcessor(e), - name(e->value("name").as<Glib::ustring>()) + name(e->value("name", NULL).as<Glib::ustring>()) { e->script->loader.addLoadTarget(e, Storer::into<ElementLoader>(&rowSets)); } - VariableType value() const + VariableType value(ExecContext * ec) const { if (map.empty()) { - fillCache(); + fillCache(ec); } Key k; k.reserve(parameters.size()); BOOST_FOREACH(const Parameters::value_type & p, parameters) { - k.push_back(p.second); + k.push_back(p.second(ec)); } return safeMapLookup<NotFound>(map, k); } private: - void fillCache() const + void fillCache(ExecContext * ec) const { BOOST_FOREACH(const RowSets::value_type & rs, rowSets) { - rs->execute(filter, this); + rs->execute(filter, boost::bind(&VariableLookup::rowReady, this, _1, ec), ec); } Logger()->messagef(LOG_DEBUG, "%s: %s has filled cached with %zu items", __PRETTY_FUNCTION__, name.c_str(), map.size()); } - void rowReady(const RowState * rs) const + void rowReady(const RowState * rs, ExecContext * ec) const { Key k; BOOST_FOREACH(const Parameters::value_type & p, parameters) { - k.push_back(rs->getCurrentValue(p.first)); + k.push_back(rs->getCurrentValue(ec, p.first)); } - map[k] = rs->getCurrentValue(name); + map[k] = rs->getCurrentValue(ec, name); } mutable Map map; typedef ANONSTORAGEOF(RowSet) RowSets; |