Lumiera
0.pre.03
»edit your freedom«
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) Lumiera.org
5
2010, 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
32
#ifndef STEAM_MOBJECT_SESSION_ELEMENT_QUERY_H
33
#define STEAM_MOBJECT_SESSION_ELEMENT_QUERY_H
34
35
36
#include "
steam/mobject/placement.hpp
"
37
#include "
steam/mobject/mobject-ref.hpp
"
38
#include "
steam/mobject/session/specific-contents-query.hpp
"
39
#include "
steam/mobject/session/session-service-explore-scope.hpp
"
40
#include "
lib/nocopy.hpp
"
41
42
#include <functional>
43
44
45
46
namespace
steam
{
47
namespace
mobject {
48
namespace
session
{
49
50
51
using
std::function;
52
53
54
namespace
{
// type matching helper
56
template
<
class
PRED>
57
struct
_PickRes
;
58
59
template
<
class
MO>
60
struct
_PickRes
<function<bool(
Placement
<MO> const&)> >
61
{
62
typedef
MO Type;
63
typedef
MORef<MO>
Result
;
64
typedef
typename
ScopeQuery<MO>::iterator
Iterator
;
65
};
66
67
template
<
class
MO>
68
struct
_PickRes
<bool(&)(
Placement<MO>
const
&)>
69
{
70
typedef
MO Type;
71
typedef
MORef<MO>
Result
;
72
typedef
typename
ScopeQuery<MO>::iterator
Iterator
;
73
};
74
75
template
<
class
MO>
76
struct
_PickRes
<bool(*)(
Placement<MO>
const
&)>
77
{
78
typedef
MO Type;
79
typedef
MORef<MO>
Result
;
80
typedef
typename
ScopeQuery<MO>::iterator
Iterator
;
81
};
82
}
83
84
85
86
102
class
ElementQuery
103
:
util::NonCopyable
104
{
105
106
public
:
107
117
template
<
typename
PRED>
118
typename
_PickRes<PRED>::Result
119
pick
(PRED
const
& searchPredicate)
120
{
121
typedef
typename
_PickRes<PRED>::Result
ResultRef;
122
typedef
typename
_PickRes<PRED>::Iterator Iterator;
123
124
Iterator
iter
(
pickAllSuitable
(
SessionServiceExploreScope::getScopeRoot
()
125
, searchPredicate
126
,
SessionServiceExploreScope::getResolver
()
127
));
128
ResultRef found;
129
if
(iter)
// in case there is an result
130
found.activate(*iter);
// pick the first element found...
131
return
found;
// or return an empty MObjectRef else
132
}
133
134
};
135
136
137
138
}}}
// namespace steam::mobject::session
139
#endif
steam::mobject::session::ElementQuery::pick
_PickRes< PRED >::Result pick(PRED const &searchPredicate)
pick the first element from session satisfying a predicate.
Definition:
element-query.hpp:119
steam::mobject::Placement
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
Definition:
trait.hpp:91
session-service-explore-scope.hpp
Implementation level session API: query a scope.
lib::Result
Result(VAL &&) -> Result< VAL >
deduction guide: allow perfect forwarding of a any result into the ctor call.
steam::mobject::MORef
An active (smart-ptr like) external reference to a specifically placed MObject "instance" within the ...
Definition:
mobject-ref.hpp:94
steam::mobject::session::SessionServiceExploreScope::getResolver
static lumiera::QueryResolver const & getResolver()
Definition:
session-services.cpp:172
placement.hpp
Core abstraction: placement of a media object into session context.
steam::mobject::session::pickAllSuitable
_PickResult< FUNC >::FilterQuery pickAllSuitable(PlacementMO const &scope, FUNC predicate)
convenience shortcut to issue a SpecificContentsQuery, figuring out the actual return/filter type aut...
Definition:
specific-contents-query.hpp:163
util::NonCopyable
Any copy and copy construction prohibited.
Definition:
nocopy.hpp:46
steam
Steam-Layer implementation namespace root.
Definition:
dummy-player-facade.h:46
steam::mobject::session
Namespace of Session and user visible high-level objects.
Definition:
sequence.hpp:74
steam::mobject::session::SessionServiceExploreScope::getScopeRoot
static PlacementMO & getScopeRoot()
Definition:
session-services.cpp:195
specific-contents-query.hpp
Implementation facility to query and retrieve session context with filtering conditions.
lib::iter_stl
Definition:
iter-adapter-stl.hpp:51
nocopy.hpp
Mix-Ins to allow or prohibit various degrees of copying and cloning.
mobject-ref.hpp
External MObject/Placement reference.
steam::mobject::session::anonymous_namespace{element-query.hpp}::_PickRes
Definition:
element-query.hpp:57
lib::IterAdapter
Adapter for building an implementation of the »Lumiera Forward Iterator« concept. ...
Definition:
iter-adapter.hpp:185
steam::mobject::session::ElementQuery
Access point to session global search and query functions.
Definition:
element-query.hpp:102
steam
mobject
session
element-query.hpp
Generated on Sat Apr 20 2024 02:03:39 for Lumiera by
1.8.13