selectors.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <RobotAPI/interface/armem/query.h>
4 
6 
8 #include "detail/SelectorOps.h"
9 
10 
12 {
14  public detail::ChildSelectorOps<SnapshotSelector, armem::query::data::EntityQueryPtr>
15  {
16  public:
17 
18  SnapshotSelector() = default;
19 
20  armem::query::data::EntityQuerySeq buildQueries() const;
21 
22 
23  SnapshotSelector& all() override;
24  SnapshotSelector& withID(const MemoryID& id) override
25  {
26  return atTime(id.timestamp);
27  }
28 
30  SnapshotSelector& atTime(Time timestamp);
31  SnapshotSelector& atTimeApprox(Time timestamp, Duration eps);
32 
33  SnapshotSelector& beforeTime(Time timestamp, long maxEntries = 1);
35 
37  SnapshotSelector& indexRange(long first, long last);
38 
39  };
40 
41 
43  public detail::InnerSelectorOps<EntitySelector, armem::query::data::ProviderSegmentQueryPtr, SnapshotSelector>
44  , public detail::NameSelectorOps<EntitySelector>
45 
46  {
47  public:
48 
49  EntitySelector() = default;
50 
51  /// Start specifying entity snapshots.
54 
55  template <class ...Ts>
57  {
58  return _addChild(args...);
59  }
60 
61 
62  EntitySelector& all() override;
63  EntitySelector& withID(const MemoryID& id) override
64  {
65  return withName(id.entityName);
66  }
67 
68  EntitySelector& withName(const std::string& name) override;
69  EntitySelector& withNamesMatching(const std::string& regex) override;
71 
72 
73  protected:
74  void _setChildQueries(armem::query::data::ProviderSegmentQueryPtr& query, const armem::query::data::EntityQuerySeq& childQueries) const override;
75 
76  };
77 
78 
79 
81  public detail::InnerSelectorOps<ProviderSegmentSelector, armem::query::data::CoreSegmentQueryPtr, EntitySelector>
82  , public detail::NameSelectorOps<ProviderSegmentSelector>
83  {
84  public:
85 
86  ProviderSegmentSelector() = default;
87 
88  /// Start specifying entities.
90  EntitySelector& entities(const EntitySelector& selector);
91 
92  template <class ...Ts>
93  EntitySelector& entities(Ts... args)
94  {
95  return _addChild(args...);
96  }
97 
98 
99  ProviderSegmentSelector& all() override;
101  {
102  return withName(id.providerSegmentName);
103  }
104 
105  ProviderSegmentSelector& withName(const std::string& name) override;
106  ProviderSegmentSelector& withNamesMatching(const std::string& regex) override;
108 
109 
110  protected:
111  void _setChildQueries(armem::query::data::CoreSegmentQueryPtr& query, const armem::query::data::ProviderSegmentQuerySeq& childQueries) const override;
112 
113  };
114 
115 
116 
118  public detail::InnerSelectorOps<CoreSegmentSelector, armem::query::data::MemoryQueryPtr, ProviderSegmentSelector>
119  , public detail::NameSelectorOps<CoreSegmentSelector>
120  {
121  public:
122 
123  CoreSegmentSelector() = default;
124 
125  /// Start specifying provider segments.
128 
129  template <class ...Ts>
131  {
132  return _addChild(args...);
133  }
134 
135 
136  CoreSegmentSelector& all() override;
137  CoreSegmentSelector& withID(const MemoryID& id) override
138  {
139  return withName(id.coreSegmentName);
140  }
141 
142  CoreSegmentSelector& withName(const std::string& name) override;
143  CoreSegmentSelector& withNamesMatching(const std::string& regex) override;
145 
146 
147  protected:
148  void _setChildQueries(armem::query::data::MemoryQueryPtr& query, const armem::query::data::CoreSegmentQuerySeq& childQueries) const override;
149 
150  };
151 
152 }
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::armem::client::query::EntitySelector::EntitySelector
EntitySelector()=default
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
NameSelectorOps.h
SelectorOps.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::EntitySelector::withID
EntitySelector & withID(const MemoryID &id) override
Definition: selectors.h:63
armarx::armem::client::query::ProviderSegmentSelector::withID
ProviderSegmentSelector & withID(const MemoryID &id) override
Definition: selectors.h:100
armarx::armem::client::query::SnapshotSelector::beforeTime
SnapshotSelector & beforeTime(Time timestamp, long maxEntries=1)
Definition: selectors.cpp:76
armarx::armem::client::query::SnapshotSelector::SnapshotSelector
SnapshotSelector()=default
armarx::armem::client::query::SnapshotSelector
Definition: selectors.h:13
armarx::armem::client::query
Definition: forward_declarations.h:7
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::client::query::EntitySelector::withNamesMatching
EntitySelector & withNamesMatching(const std::string &regex) override
Definition: selectors.cpp:110
armarx::armem::client::query::detail::NameSelectorOps
Definition: NameSelectorOps.h:11
armarx::armem::client::query::CoreSegmentSelector::withName
CoreSegmentSelector & withName(const std::string &name) override
Definition: selectors.cpp:177
armarx::armem::client::query::CoreSegmentSelector::withID
CoreSegmentSelector & withID(const MemoryID &id) override
Definition: selectors.h:137
armarx::armem::client::query::detail::InnerSelectorOps
Definition: SelectorOps.h:115
armarx::armem::client::query::SnapshotSelector::withID
SnapshotSelector & withID(const MemoryID &id) override
Definition: selectors.h:24
armarx::armem::client::query::SnapshotSelector::atTimeApprox
SnapshotSelector & atTimeApprox(Time timestamp, Duration eps)
Definition: selectors.cpp:50
armarx::armem::client::query_fns::withNames
auto withNames(const std::vector< std::string > &names)
Definition: query_fns.h:48
armarx::armem::client::query::CoreSegmentSelector::CoreSegmentSelector
CoreSegmentSelector()=default
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
Time.h
armarx::armem::client::query::EntitySelector::snapshots
SnapshotSelector & snapshots(Ts... args)
Definition: selectors.h:56
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::ProviderSegmentSelector::entities
EntitySelector & entities(Ts... args)
Definition: selectors.h:93
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::armem::client::query::ProviderSegmentSelector::ProviderSegmentSelector
ProviderSegmentSelector()=default
armarx::armem::client::query::detail::ChildSelectorOps
Definition: SelectorOps.h:15
armarx::armem::client::query::CoreSegmentSelector::providerSegments
ProviderSegmentSelector & providerSegments(Ts... args)
Definition: selectors.h:130