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)
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
27
#include "
steam/mobject/placement.hpp
"
28
#include "
steam/mobject/mobject-ref.hpp
"
29
#include "
steam/mobject/session/specific-contents-query.hpp
"
30
#include "
steam/mobject/session/session-service-explore-scope.hpp
"
31
#include "
lib/nocopy.hpp
"
32
33
#include <functional>
34
35
36
37
namespace
steam
{
38
namespace
mobject {
39
namespace
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
typedef
MO Type;
54
typedef
MORef<MO>
Result
;
55
typedef
typename
ScopeQuery<MO>::iterator
Iterator
;
56
};
57
58
template
<
class
MO>
59
struct
_PickRes
<bool(&)(
Placement<MO>
const
&)>
60
{
61
typedef
MO Type;
62
typedef
MORef<MO>
Result
;
63
typedef
typename
ScopeQuery<MO>::iterator
Iterator
;
64
};
65
66
template
<
class
MO>
67
struct
_PickRes
<bool(*)(
Placement<MO>
const
&)>
68
{
69
typedef
MO Type;
70
typedef
MORef<MO>
Result
;
71
typedef
typename
ScopeQuery<MO>::iterator
Iterator
;
72
};
73
}
74
75
76
77
93
class
ElementQuery
94
:
util::NonCopyable
95
{
96
97
public
:
98
108
template
<
typename
PRED>
109
typename
_PickRes<PRED>::Result
110
pick
(PRED
const
& searchPredicate)
111
{
112
typedef
typename
_PickRes<PRED>::Result
ResultRef;
113
typedef
typename
_PickRes<PRED>::Iterator Iterator;
114
115
Iterator
iter
(
pickAllSuitable
(
SessionServiceExploreScope::getScopeRoot
()
116
, searchPredicate
117
,
SessionServiceExploreScope::getResolver
()
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
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:110
steam::mobject::Placement
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
Definition:
trait.hpp:82
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:85
steam::mobject::session::SessionServiceExploreScope::getResolver
static lumiera::QueryResolver const & getResolver()
Definition:
session-services.cpp:163
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:154
util::NonCopyable
Any copy and copy construction prohibited.
Definition:
nocopy.hpp:37
steam
Steam-Layer implementation namespace root.
Definition:
dummy-player-facade.h:37
steam::mobject::session
Namespace of Session and user visible high-level objects.
Definition:
sequence.hpp:65
steam::mobject::session::SessionServiceExploreScope::getScopeRoot
static PlacementMO & getScopeRoot()
Definition:
session-services.cpp:186
specific-contents-query.hpp
Implementation facility to query and retrieve session context with filtering conditions.
lib::iter_stl
Definition:
iter-adapter-stl.hpp:42
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:48
lib::IterAdapter
Adapter for building an implementation of the »Lumiera Forward Iterator« concept. ...
Definition:
iter-adapter.hpp:206
steam::mobject::session::ElementQuery
Access point to session global search and query functions.
Definition:
element-query.hpp:93
steam
mobject
session
element-query.hpp
Generated on Fri Dec 13 2024 05:05:33 for Lumiera by
1.8.13