selectors.cpp
Go to the documentation of this file.
1 #include "selectors.h"
2 
6 
9 
10 
11 namespace dq = ::armarx::armem::query::data;
12 
13 
15 {
16  dq::EntityQuerySeq SnapshotSelector::buildQueries() const
17  {
18  return _queries;
19  }
20 
22  {
23  auto& q = _addQuery<dq::entity::All>();
24  (void) q;
25  return *this;
26  }
27 
29  {
30  auto& q = _addQuery<dq::entity::Single>();
31  toIce(q.timestamp, Time::Invalid());
32  return *this;
33  }
34 
36  {
37  auto& q = _addQuery<dq::entity::Single>();
38  toIce(q.timestamp, timestamp);
39  return *this;
40  }
41 
43  {
44  auto& q = _addQuery<dq::entity::TimeRange>();
45  toIce(q.minTimestamp, min);
46  toIce(q.maxTimestamp, max);
47  return *this;
48  }
49 
51  {
52  auto& q = _addQuery<dq::entity::TimeApprox>();
53  toIce(q.timestamp, timestamp);
54  toIce(q.eps, eps);
55  return *this;
56  }
57 
58 
60  {
61  auto& q = _addQuery<dq::entity::IndexRange>();
62  q.first = first;
63  q.last = last;
64  return *this;
65  }
66 
67 
69  {
70  auto& q = _addQuery<dq::entity::BeforeOrAtTime>();
71  toIce(q.timestamp, timestamp);
72  return *this;
73  }
74 
75 
76  SnapshotSelector& SnapshotSelector::beforeTime(Time timestamp, long maxEntries)
77  {
78  using armarx::toIce;
79 
80  auto& q = _addQuery<dq::entity::BeforeTime>();
81  toIce(q.timestamp, timestamp);
82  toIce(q.maxEntries, maxEntries);
83  return *this;
84  }
85 
87  {
88  return _addChild();
89  }
90 
91  SnapshotSelector& EntitySelector::snapshots(const ChildT& selector)
92  {
93  return _addChild(selector);
94  }
95 
97  {
98  auto& q = _addQuery<dq::provider::All>();
99  (void) q;
100  return *this;
101  }
102 
103  EntitySelector& EntitySelector::withName(const std::string& name)
104  {
105  auto& q = _addQuery<dq::provider::Single>();
106  q.entityName = name;
107  return *this;
108  }
109 
111  {
112  auto& q = _addQuery<dq::provider::Regex>();
113  q.entityNameRegex = regex;
114  return *this;
115  }
116 
117  void EntitySelector::_setChildQueries(dq::ProviderSegmentQueryPtr& query, const dq::EntityQuerySeq& childQueries) const
118  {
119  query->entityQueries = childQueries;
120  }
121 
122 
124  {
125  return _addChild();
126  }
127 
129  {
130  return _addChild(selector);
131  }
132 
134  {
135  auto& q = _addQuery<dq::core::All>();
136  (void) q;
137  return *this;
138  }
139 
141  {
142  auto& q = _addQuery<dq::core::Single>();
143  q.providerSegmentName = name;
144  return *this;
145  }
146 
148  {
149  auto& q = _addQuery<dq::core::Regex>();
150  q.providerSegmentNameRegex = regex;
151  return *this;
152  }
153 
154  void ProviderSegmentSelector::_setChildQueries(dq::CoreSegmentQueryPtr& query, const dq::ProviderSegmentQuerySeq& childQueries) const
155  {
156  query->providerSegmentQueries = childQueries;
157  }
158 
159 
161  {
162  return _addChild();
163  }
164 
166  {
167  return _addChild(selector);
168  }
169 
171  {
172  auto& q = _addQuery<dq::memory::All>();
173  (void) q;
174  return *this;
175  }
176 
178  {
179  auto& q = _addQuery<dq::memory::Single>();
180  q.coreSegmentName = name;
181  return *this;
182  }
184  {
185  auto& q = _addQuery<dq::memory::Regex>();
186  q.coreSegmentNameRegex = regex;
187  return *this;
188  }
189 
190  void CoreSegmentSelector::_setChildQueries(dq::MemoryQueryPtr& query, const dq::CoreSegmentQuerySeq& childQueries) const
191  {
192  query->coreSegmentQueries = childQueries;
193  }
194 
195 }
armarx::armem::client::query::EntitySelector::all
EntitySelector & all() override
Definition: selectors.cpp:96
armarx::armem::client::query::ProviderSegmentSelector
Definition: selectors.h:80
armarx::armem::client::query::ProviderSegmentSelector::withNamesMatching
ProviderSegmentSelector & withNamesMatching(const std::string &regex) override
Definition: selectors.cpp:147
armarx::armem::client::query::SnapshotSelector::latest
SnapshotSelector & latest()
Definition: selectors.cpp:28
armarx::armem::client::query::ProviderSegmentSelector::entities
EntitySelector & entities()
Start specifying entities.
Definition: selectors.cpp:123
armarx::armem::client::query::CoreSegmentSelector::_setChildQueries
void _setChildQueries(armem::query::data::MemoryQueryPtr &query, const armem::query::data::CoreSegmentQuerySeq &childQueries) const override
Definition: selectors.cpp:190
armarx::armem::client::query::SnapshotSelector::timeRange
SnapshotSelector & timeRange(Time min, Time max)
Definition: selectors.cpp:42
armarx::armem::client::query::EntitySelector::snapshots
SnapshotSelector & snapshots()
Start specifying entity snapshots.
Definition: selectors.cpp:86
armarx::max
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
Definition: VectorHelpers.h:267
armarx::armem::client::query::SnapshotSelector::all
SnapshotSelector & all() override
Definition: selectors.cpp:21
ice_conversions.h
armarx::armem::client::query::CoreSegmentSelector::all
CoreSegmentSelector & all() override
Definition: selectors.cpp:170
armarx::armem::client::query::ProviderSegmentSelector::_setChildQueries
void _setChildQueries(armem::query::data::CoreSegmentQueryPtr &query, const armem::query::data::ProviderSegmentQuerySeq &childQueries) const override
Definition: selectors.cpp:154
armarx::armem::client::query::detail::ChildSelectorOps< SnapshotSelector, armem::query::data::EntityQueryPtr >::_queries
std::vector< QueryT > _queries
Definition: SelectorOps.h:52
armarx::armem::client::query::SnapshotSelector::beforeTime
SnapshotSelector & beforeTime(Time timestamp, long maxEntries=1)
Definition: selectors.cpp:76
armarx::armem::client::query::SnapshotSelector
Definition: selectors.h:13
armarx::toIce
void toIce(std::map< IceKeyT, IceValueT > &iceMap, const boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
Definition: ice_conversions_boost_templates.h:15
armarx::armem::client::query
Definition: forward_declarations.h:7
armarx::armem::client::query::EntitySelector::withNamesMatching
EntitySelector & withNamesMatching(const std::string &regex) override
Definition: selectors.cpp:110
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
selectors.h
armarx::armem::client::query::CoreSegmentSelector::withName
CoreSegmentSelector & withName(const std::string &name) override
Definition: selectors.cpp:177
ice_conversions.h
q
#define q
armarx::armem::client::query::SnapshotSelector::atTimeApprox
SnapshotSelector & atTimeApprox(Time timestamp, Duration eps)
Definition: selectors.cpp:50
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::client::query::SnapshotSelector::buildQueries
armem::query::data::EntityQuerySeq buildQueries() const
Definition: selectors.cpp:16
armarx::armem::client::query::EntitySelector::withName
EntitySelector & withName(const std::string &name) override
Definition: selectors.cpp:103
armarx::armem::client::query::ProviderSegmentSelector::withName
ProviderSegmentSelector & withName(const std::string &name) override
Definition: selectors.cpp:140
armarx::armem::client::query::SnapshotSelector::atTime
SnapshotSelector & atTime(Time timestamp)
Definition: selectors.cpp:35
armarx::armem::client::query::CoreSegmentSelector::withNamesMatching
CoreSegmentSelector & withNamesMatching(const std::string &regex) override
Definition: selectors.cpp:183
armarx::armem::client::query::SnapshotSelector::beforeOrAtTime
SnapshotSelector & beforeOrAtTime(Time timestamp)
Definition: selectors.cpp:68
armarx::min
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)
Definition: VectorHelpers.h:294
armarx::armem::client::query::CoreSegmentSelector
Definition: selectors.h:117
armarx::core::time::Duration
Represents a duration.
Definition: Duration.h:17
ice_conversions_templates.h
armarx::armem::client::query::CoreSegmentSelector::providerSegments
ProviderSegmentSelector & providerSegments()
Start specifying provider segments.
Definition: selectors.cpp:160
armarx::armem::client::query::EntitySelector
Definition: selectors.h:42
armarx::armem::client::query::EntitySelector::_setChildQueries
void _setChildQueries(armem::query::data::ProviderSegmentQueryPtr &query, const armem::query::data::EntityQuerySeq &childQueries) const override
Definition: selectors.cpp:117
armarx::armem::client::query::SnapshotSelector::indexRange
SnapshotSelector & indexRange(long first, long last)
Definition: selectors.cpp:59
armarx::armem::client::query::ProviderSegmentSelector::all
ProviderSegmentSelector & all() override
Definition: selectors.cpp:133
armarx::armem::client::query::detail::ParentSelectorOps< EntitySelector, SnapshotSelector >::_addChild
ChildT & _addChild()
Definition: SelectorOps.h:91
armarx::core::time::DateTime::Invalid
static DateTime Invalid()
Definition: DateTime.cpp:60
armarx::armem::client::toIce
void toIce(armem::query::data::Input &ice, const QueryInput &input)
Definition: Query.cpp:47
ice_conversions.h
ice_conversions.h