Builder.cpp
Go to the documentation of this file.
1 #include "Builder.h"
2 
3 
5 {
6 
7  Builder::Builder(armem::query::DataMode dataMode, armem::query::QueryTarget target) : dataMode(dataMode), queryTarget(target)
8  {
9  }
10 
12  {
14  input.memoryQueries = buildMemoryQueries();
15  input.dataMode = dataMode;
16  return input;
17  }
18  armem::query::data::Input Builder::buildQueryInputIce() const
19  {
20  return buildQueryInput().toIce();
21  }
22 
23  armem::query::data::MemoryQuerySeq Builder::buildMemoryQueries() const
24  {
25  armem::query::data::MemoryQuerySeq memoryQueries;
26  for (const CoreSegmentSelector& child : _children)
27  {
28  for (armem::query::data::MemoryQueryPtr& query : child.buildQueries())
29  {
30  toIce(query->target, queryTarget);
31  memoryQueries.push_back(query);
32  }
33  }
34  return memoryQueries;
35  }
36 
37 
39  {
40  return _addChild();
41  }
42 
44  {
45  return _addChild(selector);
46  }
47 
48 
49  void Builder::all()
50  {
51  coreSegments().all()
53  .entities().all()
54  .snapshots().all();
55  }
56 
57 
59  {
60  coreSegments().all()
62  .entities().all()
63  .snapshots().latest();
64  }
65 
66 
68  {
71  .entities().all()
72  .snapshots().all();
73  }
74 
76  {
79  .entities().all()
80  .snapshots().latest();
81  }
82 
83  void Builder::allInProviderSegment(const MemoryID& providerSegmentID)
84  {
85  coreSegments().withName(providerSegmentID.coreSegmentName)
86  .providerSegments().withName(providerSegmentID.providerSegmentName)
87  .entities().all()
88  .snapshots().all();
89  }
90 
91  void Builder::allLatestInProviderSegment(const MemoryID& providerSegmentID)
92  {
93  coreSegments().withName(providerSegmentID.coreSegmentName)
94  .providerSegments().withName(providerSegmentID.providerSegmentName)
95  .entities().all()
96  .snapshots().latest();
97  }
98 
99  void Builder::allEntitySnapshots(const MemoryID& entityID)
100  {
103  .entities().withName(entityID.entityName)
104  .snapshots().all();
105  }
106 
108  {
111  .entities().withName(entityID.entityName)
112  .snapshots().latest();
113  }
114 
115  void Builder::singleEntitySnapshot(const MemoryID& snapshotID)
116  {
119  .entities().withName(snapshotID.entityName)
120  .snapshots().atTime(snapshotID.timestamp);
121  }
122 
123  void Builder::multipleEntitySnapshots(const std::vector<MemoryID>& snapshotIDs)
124  {
125  for (const MemoryID& snapshotID : snapshotIDs)
126  {
127  singleEntitySnapshot(snapshotID);
128  }
129  }
130 
131 }
armarx::armem::client::query::EntitySelector::all
EntitySelector & all() override
Definition: selectors.cpp:96
armarx::armem::client::query::Builder::allLatestInCoreSegment
void allLatestInCoreSegment(const MemoryID &coreSegmentID)
Get latest snapshots from all entities in all provider segments in a core segment.
Definition: Builder.cpp:75
armarx::armem::MemoryID::timestamp
Time timestamp
Definition: MemoryID.h:54
armarx::navigation::graph::coreSegmentID
const armem::MemoryID coreSegmentID
Definition: constants.h:30
armarx::armem::client::query::Builder::allInCoreSegment
void allInCoreSegment(const MemoryID &coreSegmentID)
Get all snapshots from all entities in all provider segments in a core segment.
Definition: Builder.cpp:67
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::Builder::allLatest
void allLatest()
Get all latest snapshots from entities in all segments.
Definition: Builder.cpp:58
armarx::armem::client::query::Builder::singleEntitySnapshot
void singleEntitySnapshot(const MemoryID &snapshotID)
Definition: Builder.cpp:115
armarx::armem::client::query::Builder::allEntitySnapshots
void allEntitySnapshots(const MemoryID &entityID)
Definition: Builder.cpp:99
armarx::armem::MemoryID::providerSegmentName
std::string providerSegmentName
Definition: MemoryID.h:52
armarx::armem::client::query::Builder::buildQueryInput
QueryInput buildQueryInput() const
Definition: Builder.cpp:11
armarx::armem::client::query::EntitySelector::snapshots
SnapshotSelector & snapshots()
Start specifying entity snapshots.
Definition: selectors.cpp:86
boost::target
Vertex target(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:688
armarx::armem::client::query::SnapshotSelector::all
SnapshotSelector & all() override
Definition: selectors.cpp:21
armarx::armem::client::query::Builder::multipleEntitySnapshots
void multipleEntitySnapshots(const std::vector< MemoryID > &snapshotIDs)
Definition: Builder.cpp:123
armarx::armem::client::query::CoreSegmentSelector::all
CoreSegmentSelector & all() override
Definition: selectors.cpp:170
armarx::armem::client::query::Builder::latestEntitySnapshot
void latestEntitySnapshot(const MemoryID &entityID)
Definition: Builder.cpp:107
armarx::armem::MemoryID::coreSegmentName
std::string coreSegmentName
Definition: MemoryID.h:51
armarx::armem::client::query::Builder::dataMode
armem::query::DataMode dataMode
Definition: Builder.h:71
armarx::armem::client::query::Builder::buildQueryInputIce
armem::query::data::Input buildQueryInputIce() const
Definition: Builder.cpp:18
armarx::armem::client::query
Definition: forward_declarations.h:7
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::query::DataMode
DataMode
Definition: DataMode.h:7
armarx::armem::client::query::Builder::coreSegments
CoreSegmentSelector & coreSegments()
Start specifying core segments.
Definition: Builder.cpp:38
armarx::armem::client::QueryInput
A query for parts of a memory.
Definition: Query.h:23
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::armem::client::query::CoreSegmentSelector::withName
CoreSegmentSelector & withName(const std::string &name) override
Definition: selectors.cpp:177
armarx::armem::client::query::Builder::allLatestInProviderSegment
void allLatestInProviderSegment(const MemoryID &providerSegmentID)
Get latest snapshots from all entities in a provider segment.
Definition: Builder.cpp:91
armarx::armem::MemoryID::entityName
std::string entityName
Definition: MemoryID.h:53
armarx::armem::client::query::Builder::queryTarget
armem::query::QueryTarget queryTarget
Definition: Builder.h:72
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
Definition: selectors.h:117
Builder.h
armarx::armem::client::query::CoreSegmentSelector::providerSegments
ProviderSegmentSelector & providerSegments()
Start specifying provider segments.
Definition: selectors.cpp:160
armarx::armem::client::query::Builder::allInProviderSegment
void allInProviderSegment(const MemoryID &providerSegmentID)
Get all snapshots from all entities in a provider segment.
Definition: Builder.cpp:83
armarx::armem::client::query::Builder::all
void all()
Get all snapshots from all entities in all segments.
Definition: Builder.cpp:49
armarx::armem::client::query::ProviderSegmentSelector::all
ProviderSegmentSelector & all() override
Definition: selectors.cpp:133
armarx::armem::client::query::detail::ParentSelectorOps< Builder, CoreSegmentSelector >::_addChild
ChildT & _addChild()
Definition: SelectorOps.h:91
armarx::armem::query::QueryTarget
QueryTarget
Definition: QueryTarget.h:8
armarx::armem::client::query::Builder::buildMemoryQueries
armem::query::data::MemoryQuerySeq buildMemoryQueries() const
Definition: Builder.cpp:23
armarx::armem::client::QueryInput::toIce
armem::query::data::Input toIce() const
Definition: Query.cpp:20
armarx::armem::client::toIce
void toIce(armem::query::data::Input &ice, const QueryInput &input)
Definition: Query.cpp:47
armarx::armem::client::query::Builder::Builder
Builder(armem::query::DataMode dataMode=armem::query::DataMode::WithData, armem::query::QueryTarget target=armem::query::QueryTarget::WM)
Definition: Builder.cpp:7
armarx::armem::client::query::detail::ParentSelectorOps< Builder, CoreSegmentSelector >::_children
std::vector< ChildT > _children
Definition: SelectorOps.h:109