46 using std::unique_ptr;
51 using lumiera::getResultTypeID;
54 typedef PlacementIndex::ID PID;
55 typedef Goal::QueryID QueryID;
56 typedef QueryID
const& QID;
58 typedef PlacementIndex& PIdx;
59 typedef PlacementIndex::iterator PIter;
78 virtual bool exhausted () =0;
79 virtual Pla& step () =0;
126 std::stack<PIter> scopes_;
131 while (!scopes_.empty() && !scopes_.top())
133 return scopes_.empty();
139 REQUIRE (!scopes_.empty() && scopes_.top());
140 Pla& pos = *scopes_.top();
176 tip_ = &index_.getScope(*tip_);
190 typedef function<bool(Pla const&)> ContentFilter;
191 typedef function<Explorer*()> ExplorerBuilder;
205 ContentFilter acceptable_;
206 ExplorerBuilder buildExploartion_;
207 unique_ptr<Explorer> explore_;
213 explore_.reset (buildExploartion_());
216 exploreNext (cursor);
230 Cursor& cursor =
static_cast<Cursor&
> (res);
232 while (!explore_->exhausted() )
234 Pla& elm (explore_->step());
235 if (acceptable_(elm))
237 cursor.point_at (elm);
242 ASSERT (explore_->exhausted());
250 , buildExploartion_(b)
261 bool acceptAllObjects_(Pla) {
return true; }
264 template<
typename QUERY>
268 return query.contentFilter();
275 static ContentFilter acceptAllObjects = bind (&acceptAllObjects_, _1);
276 return acceptAllObjects;
280 template<
typename MO>
284 QueryID qID(Goal::DISCOVERY, getResultTypeID<
Placement<MO>>());
301 PlacementIndexQueryResolver::PlacementIndexQueryResolver (
PlacementIndex& theIndex)
304 preGenerateInvocationContext();
308 PlacementIndexQueryResolver::PlacementIndexQueryResolver (function<IndexLink>
const& accessIndex)
309 : _getIndex(accessIndex)
311 preGenerateInvocationContext();
316 PlacementIndexQueryResolver::preGenerateInvocationContext()
318 defineHandling<MObject>();
319 defineHandling<Clip>();
320 defineHandling<Effect>();
323 defineHandling<mobject::test::DummyMO >();
324 defineHandling<mobject::test::TestSubMO1 >();
325 defineHandling<mobject::test::TestSubMO2 >();
326 defineHandling<mobject::test::TestSubMO21>();
332 PlacementIndexQueryResolver::canHandleQuery(QID qID)
const 334 return qID.kind == Goal::DISCOVERY
335 &&( qID.type == getResultTypeID<Placement<MObject>>()
337 ||qID.type == getResultTypeID<Placement<Effect>>()
341 ||qID.type == getResultTypeID<Placement<mobject::test::TestSubMO1 >>()
343 ||qID.type == getResultTypeID<Placement<mobject::test::TestSubMO21>>()
349 template<
typename MO>
351 PlacementIndexQueryResolver::defineHandling()
353 installResolutionCase( whenQueryingFor<MO>()
354 , bind (&PlacementIndexQueryResolver::resolutionFunction<MO>,
368 template<
typename MO>
370 PlacementIndexQueryResolver::resolutionFunction (
Goal const& goal)
372 QID qID = goal.getQID();
373 REQUIRE (qID == whenQueryingFor<MO>());
378 PID scopeID = query.searchScope();
381 this, scopeID, direction)
395 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