refining the draft for ScopeLocator

This commit is contained in:
Fischlurch 2009-11-20 19:58:22 +01:00
parent 11463da463
commit cdb84a9b16
13 changed files with 128 additions and 75 deletions

View file

@ -17,8 +17,7 @@
<a name="refclass153605"></a>
<p>Declaration :</p><ul><li>C++ : class QueryFocus </li></ul><div class="sub">
<a name="refrelation177797"></a>
<table><tr><td><div class="element">Relation <b>scopes (&lt;unidirectional association&gt;)</b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : # scopes : <a href="class153477.html#refclass153477"><b>ScopePath</b></a></li><li>C++ : protected: <a href="class153477.html#refclass153477"><b>ScopePath</b></a>* scopes</li></ul><p>Stereotype: owns</p>
</div>
<a name="refrelation193029"></a>
<table><tr><td><div class="element">Relation <b>&lt;unidirectional association&gt;</b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : # : <a href="class152965.html#refclass152965"><b>Handle</b></a></li><li>C++ : protected: <a href="class152965.html#refclass152965"><b>Handle</b></a>* </li></ul></div>
</body>
</html>

View file

@ -17,8 +17,7 @@
<a name="refclass153733"></a>
<p>Declaration :</p><ul><li>C++ : class QueryFocusStack </li></ul><div class="sub">
<a name="refrelation177925"></a>
<table><tr><td><div class="element">Relation <b>&lt;directional composition&gt;</b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : # : <a href="class153605.html#refclass153605"><b>QueryFocus</b></a></li><li>C++ : protected: <a href="class153605.html#refclass153605"><b>QueryFocus</b></a> </li></ul><p>Stereotype: vector</p>
</div>
<a name="refrelation192901"></a>
<table><tr><td><div class="element">Relation <b>&lt;directional composition&gt;</b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : # : <a href="class153477.html#refclass153477"><b>ScopePath</b></a></li><li>C++ : protected: <a href="class153477.html#refclass153477"><b>ScopePath</b></a> </li></ul></div>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -60,8 +60,15 @@ namespace session {
ScopePath currentPath() const { return scopes_; }
template<class MO>
typename ContentsQuery<MO>::iterator
typename ScopeQuery<MO>::iterator
query() const
{
ScopeLocator::instance().query<MO> (*this);
}
template<class MO>
typename ScopeQuery<MO>::iterator
explore() const
{
ScopeLocator::instance().explore<MO> (*this);
}

View file

@ -54,52 +54,52 @@ namespace session {
class ScopeLocator
{
scoped_ptr<QueryFocusStack> focusStack_;
shared_ptr<QueryResolver> index_;
public:
static lib::Singleton<ScopeLocator> instance;
void
activate (shared_ptr<QueryResolver> resolvingFacility);
QueryFocus currFocus();
template<typename MO>
typename ContentsQuery<MO>::iterator
typename ScopeQuery<MO>::iterator
explore (Scope);
template<typename MO>
typename ScopeQuery<MO>::iterator
query (Scope);
protected:
ScopeLocator();
friend class lib::singleton::StaticCreate<ScopeLocator>;
private:
QueryResolver const& theResolver();
};
///////////////////////////TODO currently just fleshing the API
/** activate or de-activate the QueryFocus system.
* This is done by a link to a contents-query resolving facility,
* typically the PlacementIndex within the current session.
/** use the currently installed contents-resolving facility
* to enumerate the contents (children) of the given scope
*/
inline void
ScopeLocator::activate (shared_ptr<QueryResolver> resolvingFacility)
template<typename MO>
inline typename ScopeQuery<MO>::iterator
ScopeLocator::explore (Scope scope)
{
index_ = resolvingFacility;
if (index_)
INFO (config, "Enabling Scope resolution by %s.", cStr(*index_));
else
INFO (config, "Disabling Scope resolution.");
return ScopeQuery<MO> (theResolver(), scope.getTop(), CHILDREN);
}
/** use the currently installed contents-resolving facility
* to enumerate the contents of the given scope
* to discover depth-first any object within this scope
*/
template<typename MO>
inline typename ContentsQuery<MO>::iterator
ScopeLocator::explore (Scope scope)
inline typename ScopeQuery<MO>::iterator
ScopeLocator::query (Scope scope)
{
REQUIRE (index_);
return ContentsQuery<MO> (*index_, scope.getTop());
return ScopeQuery<MO> (theResolver(), scope.getTop(), CONTENTS);
}

View file

@ -94,18 +94,18 @@ namespace session {
* Currently (11/09), there is a special, hard-wired Query-kind-ID
* \c Goal::DISCOVERY to distinguish this special kind of a Query.
*
* Contrary to the usual handling of a generic query, a ContentsQuery
* Contrary to the usual handling of a generic query, a ScopeQuery
* object holds it's own discovery iterator and thus is completely
* self contained. The query is issued automatically on construction,
* thus the embedded iterator immediately points at the first result.
* Moreover, as any Lumiera Forward Iterator is \c bool checkable,
* a ContentsQuery not yielding any results will evaluate to \c false
* a ScopeQuery not yielding any results will evaluate to \c false
* immediately after construction, allowing convenient inline checks.
* The query can be re-issued by the function operator, and the
* embedded result iterator can of course be copied to a bare
* iterator instance, e.g. for passing it on (ContentsQuery
* itself is intended to be used polymorphically and thus
* defined to be non-copyable)
* iterator instance, e.g. for passing it on (ScopeQuery
* itself is intended to be used polymorphically and
* thus defined to be not assignable)
*/
template<class MO>
class ScopeQuery

View file

@ -24,6 +24,7 @@
#include "proc/mobject/session/scope.hpp"
#include "proc/mobject/session/scope-locator.hpp"
#include "proc/mobject/session/query-focus-stack.hpp"
#include "proc/mobject/session/session-service-explore-scope.hpp"
#include "proc/mobject/mobject.hpp"
//#include "proc/mobject/session/track.hpp"
//#include "proc/mobject/placement.hpp"
@ -74,6 +75,26 @@ namespace session {
lib::Singleton<ScopeLocator> ScopeLocator::instance;
/** @internal the one (and only) access point
* actually to link the system of Scope and QueryFocus
* to the current session, by delegating resolution
* of contents discovery queries to the PlacementIndex
* managed within the session
*/
QueryResolver const&
ScopeLocator::theResolver()
{
return SessionServiceExploreScope::getResolver();
}
/** TODO */
QueryFocus
ScopeLocator::currFocus()
{
UNIMPLEMENTED ("how to access and handle the current focus");
}
/** discover the enclosing scope of a given Placement */
Scope const&

View file

@ -36,7 +36,6 @@ namespace mobject {
namespace session {
namespace test {
using session::ContentsQuery;
using std::string;
using std::cout;
using std::endl;

View file

@ -1,6 +1,6 @@
format 58
"Placement" // ProcessingLayer::MObject::Placement
revision 3
revision 4
modified_by 5 "hiv"
// class settings
//class diagram settings
@ -125,14 +125,13 @@ ${inlines}
idl_decl ""
explicit_switch_type ""
classrelation 177797 // scopes (<unidirectional association>)
relation 167813 --->
stereotype "owns"
a role_name "scopes" protected
classrelation 193029 // <unidirectional association>
relation 182661 --->
a role_name "" protected
cpp default " ${comment}${static}${mutable}${volatile}${const}${type}* ${name}${value};
"
classrelation_ref 177797 // scopes (<unidirectional association>)
b parent class_ref 153477 // ScopePath
classrelation_ref 193029 // <unidirectional association>
b parent class_ref 152965 // Handle
end
end
@ -149,14 +148,13 @@ ${inlines}
idl_decl ""
explicit_switch_type ""
classrelation 177925 // <directional composition>
relation 167941 *-->
stereotype "vector"
classrelation 192901 // <directional composition>
relation 182533 *-->
a role_name "" protected
cpp default " ${comment}${static}${mutable}${volatile}${const}${type} ${name}${value};
"
classrelation_ref 177925 // <directional composition>
b parent class_ref 153605 // QueryFocus
classrelation_ref 192901 // <directional composition>
b parent class_ref 153477 // ScopePath
end
end

View file

@ -14,15 +14,15 @@ classcanvas 128261 class_ref 153349 // Scope
end
classcanvas 128517 class_ref 153477 // ScopePath
draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default
xyz 46 212 2000
xyz 58 213 2000
end
classcanvas 128773 class_ref 153605 // QueryFocus
draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default
xyz 42 140 2000
xyz 22 20 2005
end
classcanvas 129029 class_ref 153733 // QueryFocusStack
draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default
xyz 114 77 2000
xyz 120 75 2010
end
classcanvas 129413 class_ref 152069 // PlacementIndex
draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default
@ -33,36 +33,33 @@ implemented through the:"
xyzwh 241 308 2000 140 45
classcanvas 129797 class_ref 153861 // ScopeLocator
draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default
xyz 196 17 2000
xyz 196 17 2005
end
classcanvas 130437 class_ref 153989 // QueryResolver
draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default
xyz 452 107 2000
end
note 131333 "this connection is established by the current session"
xyzwh 361 39 2000 158 47
note 131333 "service provided
by the current session"
xyzwh 360 41 2000 129 46
textcanvas 131461 "the \"scope top\""
xyzwh 357 180 2010 73 13
classcanvas 132101 class_ref 152965 // Handle
draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default
xyz 22 76 2004
end
textcanvas 132997 "current focus"
xyzwh 118 27 2004 61 13
textcanvas 134277 "manage"
xyzwh 72 72 2009 39 13
relationcanvas 128389 relation_ref 167557 // <unidirectional association>
from ref 128261 z 1999 stereotype "<<holds>>" xyz 281 219 3000 to ref 128133
no_role_a no_role_b
multiplicity_a_pos 328 237 3000 multiplicity_b_pos 278 237 3000
end
relationcanvas 128645 relation_ref 167685 // <directional composition>
from ref 128517 z 1999 stereotype "<<vector>>" xyz 130 231 3000 to ref 128261
role_a_pos 166 214 3000 no_role_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 128901 relation_ref 167813 // <unidirectional association>
from ref 128773 z 1999 stereotype "<<owns>>" xyz 54 182 3000 to ref 128517
role_a_pos 88 194 3000 no_role_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 129157 relation_ref 167941 // <directional composition>
geometry VHr
from ref 129029 z 1999 stereotype "<<vector>>" xyz 51 80 3000 to point 76 94
line 129925 z 1999 to ref 128773
no_role_a no_role_b
from ref 128517 z 1999 stereotype "<<vector>>" xyz 136 232 3000 to ref 128261
role_a_pos 166 215 3000 no_role_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 129285 relation_ref 168069 // <dependency>
@ -77,7 +74,7 @@ relationcanvas 129541 relation_ref 167045 // <dependency>
end
relationcanvas 130053 relation_ref 168197 // <unidirectional association>
geometry VHr
from ref 129797 z 1999 to point 162 43
from ref 129797 z 1999 to point 168 43
line 130181 z 1999 to ref 129029
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
@ -98,5 +95,29 @@ relationcanvas 131205 relation_ref 168581 // <unidirectional association>
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 131845 relation_ref 182533 // <directional composition>
geometry VHr
from ref 129029 z 1999 to point 88 92
line 131973 z 1999 to ref 128517
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 132229 relation_ref 182661 // <unidirectional association>
geometry VHr
from ref 128773 z 1999 to point 43 37
line 132485 z 1999 to ref 132101
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
line 132741 -_-_ geometry HV
from ref 128773 z 1999 to point 234 37
line 132869 z 1999 to ref 129797
line 133125 -_-_ geometry VHV unfixed
from ref 132101 z 1999 to point 43 83
line 134021 z 1999 to point 168 83
line 134149 z 1999 to ref 129029
line 134405 -_-_
from ref 132101 z 1999 to point 43 114
line 134533 z 1999 to ref 128517
preferred_whz 582 515 1
end

View file

@ -1,9 +1,7 @@
window_sizes 1302 1004 270 1022 856 71
diagrams
classdiagram_ref 136325 // Focus of Query
active classdiagram_ref 136325 // Focus of Query
582 515 100 4 0 0
active classdiagram_ref 137733 // Query Interface
612 547 100 4 0 0
end
show_stereotypes
selected
@ -17,7 +15,7 @@ open
classview_ref 128389 // Controller Workings
classview_ref 131973 // Object ref
class_ref 152069 // PlacementIndex
classview_ref 131845 // Scopes
class_ref 153733 // QueryFocusStack
classview_ref 128261 // Builder Workings
usecaseview_ref 128261 // config examples
class_ref 133253 // Frame
@ -31,7 +29,7 @@ open
class_ref 155141 // Query
class_ref 155525 // ResolvingFacility
class_ref 158085 // ResultSet
classview_ref 132229 // Custom holders
class_ref 152965 // Handle
classview_ref 128266 // SmartPointers
end
end

View file

@ -1,6 +1,6 @@
format 58
"lumiera"
revision 58
revision 59
modified_by 5 "hiv"
cpp_root_dir "../../src/"

View file

@ -3469,7 +3469,7 @@ For decoupling the query invocation from the facility actually processing the qu
See also the notes on &amp;rarr; QueryImplProlog
</pre>
</div>
<div title="QueryFocus" modifier="Ichthyostega" modified="200911050236" created="200910140244" tags="def spec img" changecount="19">
<div title="QueryFocus" modifier="Ichthyostega" modified="200911192106" created="200910140244" tags="def spec img" changecount="21">
<pre>When querying contents of the session or sub-containers within the session, the QueryFocus follows the current point-of-query. As such queries can be issued to explore the content of container-like objects holding other MObjects, the focus is always attached to a container, which also acts as [[scope|PlacementScope]] for the contained objects. QueryFocus is an implicit state (the current point of interrest). This sate especially remembers the path down from the root of the HighLevelModel, which was used to access the current scope. Because this path constitutes a hierarchy of scopes, it can be relevant for querying and resolving placement properties. (&amp;rarr; SessionStructureQuery)
!provided operations
@ -3484,9 +3484,9 @@ See also the notes on &amp;rarr; QueryImplProlog
There is a tight integration with PlacementScope through the ScopeLocator, which establishes the //current scope.// But QueryFocus is more of a //binding// &amp;mdash; it links or focusses the current state into a specific scope with a ScopePath in turn depending on this current state. Thus, while Scope is just a passive container allowing to locate and navigate, QueryFocus by virtue of this binding allows to [[Query]] at this current location.
!implementation notes
we provide a static access API, meaning that there is a singleton behind the scenes, which manages the mentioned scope stack. Moreover, there is an link to the current session. This link works by the current session contacting the query focus system (~ScopeLocator) and attaching to it. This attachment is shallow, i.e. the QueryFocus doesn't have knowledge about the session, which allows the focus to be unit tested.
we provide a static access API, meaning that there is a singleton (the ScopeLocator) behind the scenes, which manages the mentioned scope stack. Moreover, there is an link to the current session. But this link is kept opaque; it works by the current session exposing an [[query service|QueryResolver]], while QueryFocus doesn't rely on knowledge about the session, allowing the focus to be unit tested.
The stack of scopes must not be confused with the ScopePath. Each single frame on the stack is a QueryFocus and as such contains a current ScopePath. The purpose of the stack is to make the scope handling mostly transparent; especially this stack allows to write dedicated query functions directed at a given object: they work by pushing and then navigating to the object to use as new starting point. Not every placement is a scope, but every placement has an immediately enclosing scope, which is used as //current scope.//
The stack of scopes must not be confused with the ScopePath. Each single frame on the stack is a QueryFocus and as such contains a current ScopePath. The purpose of the stack is to make the scope handling mostly transparent; especially this stack allows to write dedicated query functions directed at a given object: they work by pushing and then navigating to the object to use as starting point for the query, i.e. the //current scope.//
!!!simplifications
The full implementation of this scope navigation is tricky, especially when it comes to determining the relation of two positions. It should be ''postponed'' and replaced by a ''dummy'' (no-op) implementation for the first integration round.
@ -3916,6 +3916,17 @@ Later on we expect a distinct __query subsystem__ to emerge, presumably embeddin
<div title="STypeManager" modifier="Ichthyostega" created="200809220230" changecount="1">
<pre>A facility allowing the Proc-Layer to work with abstracted [[media stream types|StreamType]], linking (abstract or opaque) [[type tags|StreamTypeDescriptor]] to an [[library|MediaImplLib]], which provides functionality for acutally dealing with data of this media stream type. Thus, the stream type manager is a kind of registry of all the external libraries which can be bridged and accessed by Lumiera (for working with media data, that is). The most basic set of libraries is instelled here automatically at application start, most notably the [[GAVL]] library for working with uncompressed video and audio data. //Later on, when plugins will introduce further external libraries, these need to be registered here too.//</pre>
</div>
<div title="ScopeLocator" modifier="Ichthyostega" modified="200911192150" created="200911192145" tags="def SessionLogic" changecount="2">
<pre>A link to relate a compound of [[nested placement scopes|PlacementScope]] to the //current// session and the //current// [[focus for querying|QueryFocus]] and exploring the structure. ScopeLocator is a singleton service, allowing to ''explore'' a [[Placement]] as a scope, i.e. discover any other placements within this scope, and allowing to locate the position of this scope by navigating the ScopePath up to finally reach the root scope of the HighLevelModel.
In the general case, this user visible model of the [[objects|MObject]] within the session allows for more than tree-like associations, as a given [[Sequence|EDL]] might be bound into multiple [[timelines|Timeline]]. Effectively, this makes the ScopePath context dependent. The ScopeLocator is the point where the strictly tree-like hierarchy of placements is connected to this more elaborate scope and path structure.
&amp;rarr; see BindingScopeProblem
&amp;rarr; see TimelineSequences
!!a note about concurrency
While there //is// a &quot;current state&quot; involved, the effect of concurrent access deliberately remains unspecified, because it is expected to be serialised on a higher level. If this assumption were to break, then probably the ScopeLocator will involve some thread local state.
</pre>
</div>
<div title="Session" modifier="Ichthyostega" modified="200911071800" created="200712100525" tags="def SessionLogic" changecount="8">
<pre>The Session contains all informations, state and objects to be edited by the User. From a users view, the Session is synonymous to the //current Project//. It can be [[saved and loaded|SessionLifecycle]]. The individual Objects within the Session, i.e. Clips, Media, Effects, are contained in one (or several) collections within the Session, which we call [[EDL (Edit Decision List)|EDL]].
&amp;rarr; [[Session design overview|SessionOverview]]