Lumiera  0.pre.03
»edit your freedom«
scope-locator.hpp
Go to the documentation of this file.
1 /*
2  SCOPE-LOCATOR.hpp - management and registration point for the QueryFocus-system
3 
4  Copyright (C) Lumiera.org
5  2009, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
31 #ifndef STEAM_MOBJECT_SESSION_SCOPE_LOCATOR_H
32 #define STEAM_MOBJECT_SESSION_SCOPE_LOCATOR_H
33 
37 #include "lib/iter-source.hpp"
38 #include "lib/depend.hpp"
39 
40 #include <memory>
41 
42 
43 namespace steam {
44 namespace mobject {
45 namespace session {
46 
47  class QueryFocusStack;
48  class ScopePath;
49 
50 
51 
67  {
68  std::unique_ptr<QueryFocusStack> focusStack_;
69 
70  public:
72 
75 
76  template<typename MO>
78  explore (Scope const&);
79 
80  template<typename MO>
82  query (Scope const&);
83 
84  template<typename MO>
86  getRawPath (Scope const&);
87 
89  getRawPath (Scope const&);
90 
92  locate (Scope const& target);
93 
94  size_t stackSize() const;
95 
96 
97  ~ScopeLocator();
98 
99  protected:
100  ScopeLocator();
101 
102  friend class lib::DependencyFactory<ScopeLocator>;
103 
104  private:
106  };
107 
108 
109 
110 
114  template<typename MO>
115  inline typename ScopeQuery<MO>::iterator
117  {
118  return ScopeQuery<MO> (scope.getTop(), CHILDREN).resolveBy (theResolver());
119  }
120 
121 
125  template<typename MO>
126  inline typename ScopeQuery<MO>::iterator
127  ScopeLocator::query (Scope const& scope)
128  {
129  return ScopeQuery<MO> (scope.getTop(), CONTENTS).resolveBy (theResolver());
130  }
131 
132 
142  template<typename MO>
143  inline typename ScopeQuery<MO>::iterator
145  {
146  return ScopeQuery<MO> (scope.getTop(), PATH).resolveBy (theResolver());
147  }
148 
150  ScopeLocator::getRawPath (Scope const& scope)
151  {
152  return ScopeQuery<MObject> (scope.getTop(), PATH).resolveBy (theResolver());
153  }
154 
155 
156 }}} // namespace steam::mobject::session
157 #endif
Query a scope to discover it&#39;s contents or location.
Interface: a facility for resolving (some kind of) queries A concrete subclass has the ability to cre...
ScopeQuery< MO >::iterator explore(Scope const &)
use the contents-resolving facility exposed by the session to enumerate the contents (children) of th...
Core abstraction: placement of a media object into session context.
discover any contained objects depth-first
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:74
Access point to singletons and other kinds of dependencies designated by type.
Definition: depend.hpp:289
Sequence of nested scopes within the high-level model.
Definition: scope-path.hpp:135
A Placement scope within the high-level-model.
Definition: scope.hpp:78
Singleton service establishing a link to relate any compound of nested placement scopes to the curren...
discover the path to root
lumiera::QueryResolver const & theResolver()
Definition: scope.cpp:128
ScopeQuery< MO >::iterator getRawPath(Scope const &)
use the contents-resolving facility exposed by the session to discover the path up from the given sco...
ScopeQuery< MO >::iterator query(Scope const &)
use the contents-resolving facility exposed by the session to discover depth-first any object within ...
lib::IterSource< const Scope >::iterator locate(Scope const &target)
navigate the current QueryFocus scope location.
Definition: scope.cpp:182
Singleton services and Dependency Injection.
ScopePath & pushPath()
push aside the current focus location and open a new ScopePath frame, to serve as current location un...
Definition: scope.cpp:163
ScopePath & currPath()
establishes the current query focus location.
Definition: scope.cpp:152
Specific queries to explore contents of a scope within the high-level model.
Helper to abstract creation and lifecycle of a dependency.
Definition: depend.hpp:134
static lib::Depend< ScopeLocator > instance
Storage holding the single ScopeLocator instance.
discover the immediate children
Extension module to build an opaque data source, accessible as Lumiera Forward Iterator.
Adapter for building an implementation of the »Lumiera Forward Iterator« concept. ...