Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
element-query.hpp
Go to the documentation of this file.
1/*
2 ELEMENT-QUERY.hpp - session sub-interface to query and retrieve elements
3
4 Copyright (C)
5 2010, 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
23#ifndef STEAM_MOBJECT_SESSION_ELEMENT_QUERY_H
24#define STEAM_MOBJECT_SESSION_ELEMENT_QUERY_H
25
26
31#include "lib/nocopy.hpp"
32
33#include <functional>
34
35
36
37namespace steam {
38namespace mobject {
39namespace session {
40
41
42 using std::function;
43
44
45 namespace { // type matching helper
47 template<class PRED>
48 struct _PickRes;
49
50 template<class MO>
51 struct _PickRes<function<bool(Placement<MO> const&)> >
52 {
53 using Type = MO;
56 };
57
58 template<class MO>
59 struct _PickRes<bool(&)(Placement<MO> const&)>
60 {
61 using Type = MO;
64 };
65
66 template<class MO>
67 struct _PickRes<bool(*)(Placement<MO> const&)>
68 {
69 using Type = MO;
72 };
73 }
74
75
76
77
95 {
96
97 public:
98
108 template<typename PRED>
109 _PickRes<PRED>::Result
110 pick (PRED const& searchPredicate)
111 {
112 using ResultRef = _PickRes<PRED>::Result;
113 using Iterator = _PickRes<PRED>::Iterator;
114
116 , searchPredicate
118 ));
119 ResultRef found;
120 if (iter) // in case there is an result
121 found.activate(*iter); // pick the first element found...
122 return found; // or return an empty MObjectRef else
123 }
124
125 };
126
127
128
129}}} // namespace steam::mobject::session
130#endif
An active (smart-ptr like) external reference to a specifically placed MObject "instance" within the ...
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
Access point to session global search and query functions.
_PickRes< PRED >::Result pick(PRED const &searchPredicate)
pick the first element from session satisfying a predicate.
Any copy and copy construction prohibited.
Definition nocopy.hpp:38
External MObject/Placement reference.
Namespace of Session and user visible high-level objects.
Definition sequence.hpp:65
_PickResult< FUNC >::FilterQuery pickAllSuitable(PlacementMO const &scope, FUNC predicate)
convenience shortcut to issue a SpecificContentsQuery, figuring out the actual return/filter type aut...
Steam-Layer implementation namespace root.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Core abstraction: placement of a media object into session context.
Implementation level session API: query a scope.
Implementation facility to query and retrieve session context with filtering conditions.
static lumiera::QueryResolver const & getResolver()