back out that caching query, it's nonsense

defeating the whole purpose of that interface
This commit is contained in:
Fischlurch 2010-10-05 01:11:32 +02:00
parent 001a45f64a
commit 9593d388cc

View file

@ -209,72 +209,6 @@ namespace session {
};
/**
* Exposes an opaque MObject result set
* similar to a DiscoveryQuery, including the
* ability to filter/downcast to a specific
* kind of MObject
*/
template<class MO>
class CachedQuery
: Query<Placement<MO> >
{
typedef Placement<MO> PMO;
typedef Query<PMO> _Query;
typedef typename _Query::Result Result;
typedef typename _Query::Cursor Cursor;
public:
typedef typename _Query::iterator iterator;
class Snapshot
: public Resolution
{
//////////////TODO: it would be *nice* if we could build something similar to the scope-query Resolution
//////////////TODO: *requirement* is that it must not pull in anything beyond <function> and iter-adapters.hpp
//////////////TODO: but if that's too expensive to implement, just ditch the ability of subclassing and just yield MObjects, or even just Scopes
vector<PMO*> results_;
Result
prepareResolution()
{
UNIMPLEMENTED ("hook up first result");
}
void
nextResult(Result& pos)
{
UNIMPLEMENTED ("how to advance embedded pointer");
}
public:
template<typename IT>
Snapshot(IT const& iter)
{
for(IT ii(iter); ii; ++ii)
results_.push_back(*ii);
}
};
Snapshot resultset_;
template<typename IT>
CachedQuery (IT const& results)
: resultset_(results)
{ }
iterator
resolve () const
{
PReso resultSet(new Snapshot(resultset_));
Result first = resultSet->prepareResolution();
Cursor& start = static_cast<Cursor&> (first); // note: type RES must be compatible!
return iterator (resultSet, start);
}
};
}} // namespace mobject::session