37 using std::unique_ptr;
42 using lumiera::getResultTypeID;
45 typedef PlacementIndex::ID PID;
46 typedef Goal::QueryID QueryID;
47 typedef QueryID
const& QID;
49 typedef PlacementIndex& PIdx;
50 typedef PlacementIndex::iterator PIter;
69 virtual bool exhausted () =0;
70 virtual Pla& step () =0;
117 std::stack<PIter> scopes_;
122 while (!scopes_.empty() && !scopes_.top())
124 return scopes_.empty();
130 REQUIRE (!scopes_.empty() && scopes_.top());
131 Pla& pos = *scopes_.top();
167 tip_ = &index_.getScope(*tip_);
181 typedef function<bool(Pla const&)> ContentFilter;
182 typedef function<Explorer*()> ExplorerBuilder;
196 ContentFilter acceptable_;
197 ExplorerBuilder buildExploartion_;
198 unique_ptr<Explorer> explore_;
204 explore_.reset (buildExploartion_());
207 exploreNext (cursor);
221 Cursor& cursor =
static_cast<Cursor&
> (res);
223 while (!explore_->exhausted() )
225 Pla& elm (explore_->step());
226 if (acceptable_(elm))
228 cursor.point_at (elm);
233 ASSERT (explore_->exhausted());
241 , buildExploartion_(b)
252 bool acceptAllObjects_(Pla) {
return true; }
255 template<
typename QUERY>
259 return query.contentFilter();
266 static ContentFilter acceptAllObjects = bind (&acceptAllObjects_, _1);
267 return acceptAllObjects;
271 template<
typename MO>
275 QueryID qID(Goal::DISCOVERY, getResultTypeID<
Placement<MO>>());
292 PlacementIndexQueryResolver::PlacementIndexQueryResolver (
PlacementIndex& theIndex)
295 preGenerateInvocationContext();
299 PlacementIndexQueryResolver::PlacementIndexQueryResolver (function<IndexLink>
const& accessIndex)
300 : _getIndex(accessIndex)
302 preGenerateInvocationContext();
307 PlacementIndexQueryResolver::preGenerateInvocationContext()
309 defineHandling<MObject>();
310 defineHandling<Clip>();
311 defineHandling<Effect>();
314 defineHandling<mobject::test::DummyMO >();
315 defineHandling<mobject::test::TestSubMO1 >();
316 defineHandling<mobject::test::TestSubMO2 >();
317 defineHandling<mobject::test::TestSubMO21>();
323 PlacementIndexQueryResolver::canHandleQuery(QID qID)
const 325 return qID.kind == Goal::DISCOVERY
326 &&( qID.type == getResultTypeID<Placement<MObject>>()
328 ||qID.type == getResultTypeID<Placement<Effect>>()
332 ||qID.type == getResultTypeID<Placement<mobject::test::TestSubMO1 >>()
334 ||qID.type == getResultTypeID<Placement<mobject::test::TestSubMO21>>()
340 template<
typename MO>
342 PlacementIndexQueryResolver::defineHandling()
344 installResolutionCase( whenQueryingFor<MO>()
345 , bind (&PlacementIndexQueryResolver::resolutionFunction<MO>,
359 template<
typename MO>
361 PlacementIndexQueryResolver::resolutionFunction (
Goal const& goal)
363 QID qID = goal.getQID();
364 REQUIRE (qID == whenQueryingFor<MO>());
369 PID scopeID = query.searchScope();
372 this, scopeID, direction)
386 PIdx index = _getIndex();
Query ABC: unspecific goal for resolution or retrieval.
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
Query a scope to discover it's contents or location.
ABC representing the result set of an individual query resolution.
on query, an individual result set is prepared to be explored by the invoking client code...
Core abstraction: placement of a media object into session context.
#define INSTANCEOF(CLASS, EXPR)
shortcut for subclass test, intended for assertions only.
MObject in the Session to represent a clip on the timeline.
Strategy: explore the structure just by following the given iterator; usually this yields an element'...
discover any contained objects depth-first
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
discover the path to root
Derived specific exceptions within Lumiera's exception hierarchy.
discover the enclosing scopes
A hierarchy of simple dummy-Media-Objects for easy unit testing.
Structured compound of Placement instances with lookup capabilities.
Strategy: explore the structure upwards, ascending until reaching the root element.
iterator getReferrers(ID) const
Retrieve all the elements attached to the given entry (scope) Each element (Placement) can act as a s...
Specific queries to explore contents of a scope within the high-level model.
Explorer * setupExploration(PlacementIndex::ID startID, ScopeQueryKind direction)
the builder function used to set up an concrete result set object when issuing the query...
ContentFilter getContentFilter(ScopeQuery< MObject > const &)
especially queries for MObjects need not be filtered
Implementing resolution of "discover contents"-queries based on PlacementIndex.
discover the immediate children
Strategy: explore the structure depth first.
Interface: strategy for exploring the structure.
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
Single Solution, possibly part of a result set.
QueryID whenQueryingFor()
shortcut for a suitable QueryID