Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
scope-query.hpp
Go to the documentation of this file.
1/*
2 SCOPE-QUERY.hpp - query to discover the contents of a container-like part of the model
3
4 Copyright (C)
5 2009, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
32#ifndef STEAM_MOBJECT_SESSION_SCOPE_QUERY_H
33#define STEAM_MOBJECT_SESSION_SCOPE_QUERY_H
34
35
38#include "lib/format-string.hpp"
39
40#include <functional>
41
42
43namespace steam {
44namespace mobject {
45namespace session {
46
47 using std::bind;
48 using std::function;
49 using std::placeholders::_1;
50
51 using lumiera::Goal;
52 using lumiera::Query;
53
54
55
64 template<class MO>
66 : public Query<Placement<MO>>
67 {
69
70
71 public:
73 using ContentFilter = function<bool(PlacementMO const&)>;
74
75
78 {
79 return buildContentFilter();
80 }
81
82 protected:
85
86
87
88
91 , lib::QueryText("")) // syntactic representation supplied on demand
92 { }
93
94 private:
97 };
98
99
106
107
133 template<class MO>
135 : public DiscoveryQuery<MO>
136 {
139
140
141 PlacementMO::ID startPoint_;
143
144 public:
145 using iterator = _Parent::iterator ;
146 using ContentFilter = _Parent::ContentFilter;
147
148
149 ScopeQuery (PlacementMO const& scope,
150 ScopeQueryKind direction)
151 : startPoint_(scope)
152 , to_discover_(direction)
153 { }
154
155
156
157 PlacementMO::ID const&
158 searchScope () const
159 {
160 return startPoint_;
161 }
162
165 {
166 return to_discover_;
167 }
168
169
170
171 private:
180 {
181 return bind (&PlacementMO::isCompatible<MO>, _1 );
182 }
183
192 {
193 using util::_Fmt;
194 TODO ("valid syntactic representation of scope queries");
195 return lib::QueryText (_Fmt ("scope(X, %08X), scopeRelation(X, %d)")
197 % uint(searchDirection()));
198 }
199 };
200
201
202 template<class MO>
204 : ScopeQuery<MO>
205 {
207 : ScopeQuery<MO> (scope, CONTENTS)
208 { }
209
210 };
211
212
213 template<class MO>
215 : ScopeQuery<MO>
216 {
217 PathQuery (PlacementMO const& scope)
218 : ScopeQuery<MO> (scope, PARENTS)
219 { }
220
221 };
222
223
224
225
226}}} // namespace steam::mobject::session
227#endif
Adapter for building an implementation of the »Lumiera Forward Iterator« concept.
Syntactical query representation.
Query ABC: unspecific goal for resolution or retrieval.
Definition query.hpp:118
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
Definition query.hpp:254
static QueryID defineQueryTypeID(Kind queryType=Goal::GENERIC)
Definition query.hpp:260
lib::IterAdapter< Cursor, PReso > iterator
Definition query.hpp:349
friend size_t hash_value(Query const &q)
Definition query.hpp:356
ABC to build Queries for placement-attached objects.
virtual ContentFilter buildContentFilter() const =0
yield additional filter to be applied to the result set.
function< bool(PlacementMO const &)> ContentFilter
DiscoveryQuery const & operator=(DiscoveryQuery const &)
Assignment explicitly disallowed (but copy ctor is ok)
Query a scope to discover it's contents or location.
ScopeQuery(PlacementMO const &scope, ScopeQueryKind direction)
_Parent::ContentFilter ContentFilter
ScopeQueryKind searchDirection() const
ContentFilter buildContentFilter() const
the default implementation of the content filtering builds on the downcast-function available on each...
lib::QueryText buildSyntacticRepresentation() const
supplement a syntactic representation (as generic query in predicate form).
PlacementMO::ID const & searchScope() const
A front-end for using printf-style formatting.
Front-end for printf-style string template interpolation.
unsigned int uint
Definition integral.hpp:29
Implementation namespace for support and library code.
Namespace of Session and user visible high-level objects.
Definition sequence.hpp:65
@ CONTENTS
discover any contained objects depth-first
@ PARENTS
discover the enclosing scopes
@ CHILDREN
discover the immediate children
@ PATH
discover the path to root
function< bool(Pla const &)> ContentFilter
Steam-Layer implementation namespace root.
Core abstraction: placement of a media object into session context.
framework and to resolve logical queries.
ContentsQuery(PlacementMO const &scope)
PathQuery(PlacementMO const &scope)