selectors.cpp
Go to the documentation of this file.
1#include "selectors.h"
2
6
9
10
11namespace dq = ::armarx::armem::query::data;
12
14{
15 dq::EntityQuerySeq
17 {
18 return _queries;
19 }
20
23 {
25 (void)q;
26 return *this;
27 }
28
31 {
33 toIce(q.timestamp, Time::Invalid());
34 return *this;
35 }
36
39 {
41 toIce(q.timestamp, timestamp);
42 return *this;
43 }
44
47 {
49 toIce(q.minTimestamp, min);
50 toIce(q.maxTimestamp, max);
51 return *this;
52 }
53
56 {
58 toIce(q.timestamp, timestamp);
59 toIce(q.eps, eps);
60 return *this;
61 }
62
64 SnapshotSelector::indexRange(long first, long last)
65 {
67 q.first = first;
68 q.last = last;
69 return *this;
70 }
71
79
82 {
83 using armarx::toIce;
84
86 toIce(q.timestamp, timestamp);
87 toIce(q.maxEntries, maxEntries);
88 return *this;
89 }
90
93 {
94 return _addChild();
95 }
96
98 EntitySelector::snapshots(const ChildT& selector)
99 {
100 return _addChild(selector);
101 }
102
103 EntitySelector&
105 {
107 (void)q;
108 return *this;
109 }
110
112 EntitySelector::withName(const std::string& name)
113 {
115 q.entityName = name;
116 return *this;
117 }
118
120 EntitySelector::withNamesMatching(const std::string& regex)
121 {
123 q.entityNameRegex = regex;
124 return *this;
125 }
126
127 void
128 EntitySelector::_setChildQueries(dq::ProviderSegmentQueryPtr& query,
129 const dq::EntityQuerySeq& childQueries) const
130 {
131 query->entityQueries = childQueries;
132 }
133
136 {
137 return _addChild();
138 }
139
142 {
143 return _addChild(selector);
144 }
145
148 {
149 auto& q = _addQuery<dq::core::All>();
150 (void)q;
151 return *this;
152 }
153
155 ProviderSegmentSelector::withName(const std::string& name)
156 {
158 q.providerSegmentName = name;
159 return *this;
160 }
161
164 {
166 q.providerSegmentNameRegex = regex;
167 return *this;
168 }
169
170 void
172 const dq::ProviderSegmentQuerySeq& childQueries) const
173 {
174 query->providerSegmentQueries = childQueries;
175 }
176
182
185 {
186 return _addChild(selector);
187 }
188
191 {
193 (void)q;
194 return *this;
195 }
196
198 CoreSegmentSelector::withName(const std::string& name)
199 {
201 q.coreSegmentName = name;
202 return *this;
203 }
204
207 {
209 q.coreSegmentNameRegex = regex;
210 return *this;
211 }
212
213 void
215 const dq::CoreSegmentQuerySeq& childQueries) const
216 {
217 query->coreSegmentQueries = childQueries;
218 }
219
220} // namespace armarx::armem::client::query
std::string timestamp()
void _setChildQueries(armem::query::data::MemoryQueryPtr &query, const armem::query::data::CoreSegmentQuerySeq &childQueries) const override
CoreSegmentSelector & withNamesMatching(const std::string &regex) override
CoreSegmentSelector & withName(const std::string &name) override
ProviderSegmentSelector & providerSegments()
Start specifying provider segments.
EntitySelector & withName(const std::string &name) override
EntitySelector & withNamesMatching(const std::string &regex) override
SnapshotSelector & snapshots()
Start specifying entity snapshots.
Definition selectors.cpp:92
void _setChildQueries(armem::query::data::ProviderSegmentQueryPtr &query, const armem::query::data::EntityQuerySeq &childQueries) const override
void _setChildQueries(armem::query::data::CoreSegmentQueryPtr &query, const armem::query::data::ProviderSegmentQuerySeq &childQueries) const override
ProviderSegmentSelector & withName(const std::string &name) override
EntitySelector & entities()
Start specifying entities.
ProviderSegmentSelector & all() override
ProviderSegmentSelector & withNamesMatching(const std::string &regex) override
SnapshotSelector & indexRange(long first, long last)
Definition selectors.cpp:64
SnapshotSelector & atTime(Time timestamp)
Definition selectors.cpp:38
SnapshotSelector & beforeOrAtTime(Time timestamp)
Definition selectors.cpp:73
SnapshotSelector & beforeTime(Time timestamp, long maxEntries=1)
Definition selectors.cpp:81
armem::query::data::EntityQuerySeq buildQueries() const
Definition selectors.cpp:16
SnapshotSelector & timeRange(Time min, Time max)
Definition selectors.cpp:46
SnapshotSelector & atTimeApprox(Time timestamp, Duration eps)
Definition selectors.cpp:55
static DateTime Invalid()
Definition DateTime.cpp:57
#define q
void toIce(armem::query::data::Input &ice, const QueryInput &input)
Definition Query.cpp:49
armarx::core::time::DateTime Time
armarx::core::time::Duration Duration
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
void toIce(std::map< IceKeyT, IceValueT > &iceMap, const boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)