Reader.cpp
Go to the documentation of this file.
1 #include "Reader.h"
2 
3 #include <mutex>
4 #include <sstream>
5 
6 #include <Ice/LocalException.h>
7 
10 
11 #include <RobotAPI/libraries/armem/aron/MemoryLink.aron.generated.h>
18 
19 #include "query/Builder.h"
20 #include "query/query_fns.h"
21 
22 namespace armarx::armem::client
23 {
24 
25  Reader::Reader(server::ReadingMemoryInterfacePrx readingMemory,
26  server::PredictingMemoryInterfacePrx predictingMemory,
27  server::ReadingLongTermMemoryInterfacePrx readingLtmMemory) :
28  readingPrx(readingMemory), predictionPrx(predictingMemory), readingLtmPrx(readingLtmMemory)
29  {
30  }
31 
33  Reader::queryLTM(const QueryInput& input, bool storeIntoWM) const
34  {
35  return QueryResult::fromIce(queryLTM(input.toIce(), storeIntoWM));
36  }
37 
38  armem::query::data::Result
39  Reader::queryLTM(const armem::query::data::Input& input, bool storeIntoWM) const
40  {
41  armem::query::data::Result result;
42  if (!readingPrx)
43  {
44  throw error::ProxyNotSet("ReadingMemoryInterfacePrx",
45  "Reading interface proxy must be set to perform a query.");
46  }
47 
48  try
49  {
50  result = readingLtmPrx->queryLTM(input, storeIntoWM);
51  }
52  catch (const ::Ice::ConnectionRefusedException& e)
53  {
54  // the proxy is invalid. we must perform a reconnect
55  ARMARX_INFO << "Trying to reconnect ...";
56  }
57  catch (const Ice::LocalException& e)
58  {
59  std::stringstream sstream;
60  sstream << "Memory query failed.\nReason: " << e.what();
61  result.errorMessage = sstream.str();
62 
63  ARMARX_VERBOSE << result.errorMessage;
64  }
65  return result;
66  }
67 
70  {
71  return QueryResult::fromIce(query(input.toIce()));
72  }
73 
74  armem::query::data::Result
75  Reader::query(const armem::query::data::Input& input) const
76  {
77  armem::query::data::Result result;
78  if (!readingPrx)
79  {
80  throw error::ProxyNotSet("ReadingMemoryInterfacePrx",
81  "Reading interface proxy must be set to perform a query.");
82  }
83 
84  try
85  {
86  result = readingPrx->query(input);
87  }
88  catch (const ::Ice::ConnectionRefusedException& e)
89  {
90  // the proxy is invalid. we must perform a reconnect
91  ARMARX_INFO << "Trying to reconnect ...";
92  }
93  catch (const Ice::LocalException& e)
94  {
95  std::stringstream sstream;
96  sstream << "Memory query failed.\nReason: " << e.what();
97  result.errorMessage = sstream.str();
98 
99  ARMARX_VERBOSE << result.errorMessage;
100  }
101  return result;
102  }
103 
105  Reader::query(armem::query::data::MemoryQueryPtr query, armem::query::DataMode dataMode) const
106  {
107  return this->query(armem::query::data::MemoryQuerySeq{query}, dataMode);
108  }
109 
111  Reader::query(const armem::query::data::MemoryQuerySeq& queries,
112  armem::query::DataMode dataMode) const
113  {
115  input.memoryQueries = queries;
116  input.dataMode = dataMode;
117  return this->query(input);
118  }
119 
121  Reader::query(const QueryBuilder& queryBuilder) const
122  {
123  return this->query(queryBuilder.buildQueryInput());
124  }
125 
129  int recursionDepth) const
130  {
131  return QueryResult::fromIce(query(input.toIce(), mns, recursionDepth));
132  }
133 
134  armem::query::data::Result
135  Reader::query(const armem::query::data::Input& input,
137  int recursionDepth) const
138  {
139  if (!readingPrx)
140  {
141  throw error::ProxyNotSet("ReadingMemoryInterfacePrx",
142  "Reading interface proxy must be set to perform a query.");
143  }
144 
145  armem::query::data::Result result;
146  try
147  {
148  result = readingPrx->query(input);
149  QueryResult bObj = QueryResult::fromIce(result);
150  bObj.memory.forEachInstance(
151  [&bObj, &mns, recursionDepth](armem::wm::EntityInstance& instance)
152  { resolveMemoryLinks(instance, bObj.memory, mns, recursionDepth); });
153  result = bObj.toIce();
154  }
155  catch (const Ice::LocalException& e)
156  {
157  std::stringstream sstream;
158  sstream << "Memory query failed.\nReason: " << e.what();
159  result.errorMessage = sstream.str();
160  }
162  {
163  std::stringstream sstream;
164  sstream << "Encountered malformed MemoryLink: " << e.what();
165  result.errorMessage = sstream.str();
166  }
167 
168  return result;
169  }
170 
172  Reader::query(armem::query::data::MemoryQueryPtr query, // NOLINT
174  int recursionDepth) const
175  {
176  return this->query(armem::query::data::MemoryQuerySeq{query}, mns, recursionDepth);
177  }
178 
180  Reader::query(const armem::query::data::MemoryQuerySeq& queries,
182  int recursionDepth) const
183  {
185  input.memoryQueries = queries;
186  return this->query(input, mns, recursionDepth);
187  }
188 
190  Reader::query(const QueryBuilder& queryBuilder,
192  int recursionDepth) const
193  {
194  return this->query(queryBuilder.buildQueryInput(), mns, recursionDepth);
195  }
196 
197  /**
198  * Get the MemoryID and data required to fill in the given MemoryLink.
199  *
200  * Returns nothing if the data could not be retrieved or its type does not
201  * match the MemoryLink's template type.
202  *
203  * @param linkData the data object of the MemoryLink
204  * @param linkType the type object of the MemoryLink
205  * @return a pair of memoryID and data to fill in a MemoryLink, or nothing if not available
206  */
207  std::optional<std::pair<MemoryID, aron::data::VariantPtr>>
209  const aron::type::VariantPtr& linkType,
211  {
212  static const aron::Path memoryLinkIDPath{{"memoryID"}};
213  static const aron::Path memoryLinkDataPath{{"data"}};
215  auto memoryIDDict =
216  aron::data::Dict::DynamicCastAndCheck(linkData->navigateAbsolute(memoryLinkIDPath));
217  dto.fromAron(memoryIDDict);
218  auto memoryID = aron::fromAron<armem::MemoryID>(dto);
220  {
221  ARMARX_INFO << "Encountered unresolvable MemoryID '" << memoryID.str()
222  << "', ignoring.";
223  return {};
224  }
225 
226  auto nextMemory = resolveID(mns, memoryID);
227  if (!nextMemory)
228  {
229  ARMARX_WARNING << "Could not retrieve data for " << memoryID.str() << ", skipping...";
230  return {};
231  }
232  auto nextDataAndType = extractDataAndType(nextMemory.value(), memoryID);
233  if (!nextDataAndType)
234  {
235  ARMARX_WARNING << "Data or type for " << memoryID.str()
236  << " not available in memory containing that MemoryID.";
237  return {};
238  }
239  auto [nextData, nextType] = nextDataAndType.value();
240  auto linkTemplate =
241  aron::type::Object::DynamicCastAndCheck(linkType)->getTemplateInstantiations().at(0);
242  std::string nextObjectName = nextType->getObjectNameWithTemplateInstantiations();
243  if (nextType->getObjectName() != linkTemplate)
244  {
245  ARMARX_WARNING << "Linked object " << memoryID.str() << " is of the type "
246  << nextType->getObjectName() << ", but the link requires the type "
247  << linkTemplate;
248  return {};
249  }
250  return {{memoryID,
251  // This is currently the only method to prefix the path to the data correctly.
253  nextData->toAronDTO(),
254  linkData->getPath().withElement(memoryLinkDataPath.toString()))}};
255  }
256 
257  void
258  Reader::resolveMemoryLinks(armem::wm::EntityInstance& instance,
261  int recursionDepth)
262  {
263  static const aron::Path memoryLinkDataPath{{"data"}};
264  // MemoryID is used for the template instantiation as a placeholder -
265  // you could use any type here.
266  static const std::string linkType =
267  arondto::MemoryLink<arondto::MemoryID>::ToAronType()->getFullName();
268 
269  std::set<armem::MemoryID> seenIDs{instance.id()};
270  std::vector<aron::Path> currentPaths{{{""}}};
271  std::vector<aron::Path> nextPaths;
272  int depth = 0;
273 
274  auto dataAndType = extractDataAndType(input, instance.id());
275  if (!dataAndType)
276  {
277  ARMARX_INFO << "Instance '" << instance.id().str() << "' does not have a defined type.";
278  return;
279  }
280  auto [instanceData, instanceType] = dataAndType.value();
281  while (!currentPaths.empty() && (recursionDepth == -1 || depth < recursionDepth))
282  {
283  for (const auto& path : currentPaths)
284  {
285  aron::SubObjectFinder finder(linkType);
286  if (path.getFirstElement().empty())
287  {
288  armarx::aron::data::visitRecursive(finder, instanceData, instanceType);
289  }
290  else
291  {
293  instanceData->navigateAbsolute(path),
294  instanceType->navigateAbsolute(path));
295  }
296 
297  for (auto& [linkPathStr, linkDataAndType] : finder.getFoundObjects()) // NOLINT
298  {
299  auto [linkData, linkType] = linkDataAndType;
300  auto result = findDataForLink(linkData, linkType, mns);
301  if (result)
302  {
303  auto [memoryID, dataToAppend] = result.value();
304  if (seenIDs.find(memoryID) != seenIDs.end())
305  {
306  continue;
307  }
308  seenIDs.insert(memoryID);
309 
310  aron::data::Dict::DynamicCastAndCheck(linkData)->setElement(
311  memoryLinkDataPath.toString(), dataToAppend);
312  nextPaths.push_back(
313  linkData->getPath().withElement(memoryLinkDataPath.toString()));
314  }
315  }
316  }
317  currentPaths = std::move(nextPaths);
318  nextPaths.clear();
319  ++depth;
320  }
321  }
322 
323  QueryResult
324  Reader::queryMemoryIDs(const std::vector<MemoryID>& ids, armem::query::DataMode dataMode) const
325  {
326  using namespace client::query_fns;
327 
328  query::Builder qb(dataMode);
329  for (const MemoryID& id : ids)
330  {
331  query::EntitySelector& entity =
333 
334  if (id.hasTimestamp())
335  {
336  entity.snapshots(withID(id));
337  }
338  else
339  {
340  entity.snapshots(latest());
341  }
342  }
343  return query(qb);
344  }
345 
346  std::optional<wm::EntitySnapshot>
347  Reader::getLatestSnapshotOf(const std::vector<MemoryID>& _snapshotIDs) const
348  {
349  std::vector<MemoryID> snapshotIDs = _snapshotIDs;
350 
351  client::QueryResult result = this->queryMemoryIDs(snapshotIDs);
352  if (result.success)
353  {
354  std::sort(snapshotIDs.begin(), snapshotIDs.end(), compareTimestampDecreasing);
355  for (const MemoryID& snapshotID : snapshotIDs)
356  {
357  try
358  {
359  wm::EntitySnapshot& snapshot = result.memory.getSnapshot(snapshotID);
360  return snapshot;
361  }
362  catch (const armem::error::ArMemError&)
363  {
364  }
365  }
366  return std::nullopt;
367  }
368  else
369  {
370  ARMARX_INFO << "Error querying " << snapshotIDs.size() << " STT snapshots:\n"
371  << result.errorMessage;
372  return std::nullopt;
373  }
374  }
375 
378  {
379  using namespace client::query_fns;
380  if (!id.isWellDefined())
381  {
382  throw armem::error::InvalidMemoryID(id, "ID must be well defined, but was not.");
383  }
384 
385  query::Builder qb(dataMode);
387  id.hasCoreSegmentName() ? qb.coreSegments(withID(id)) : qb.coreSegments(all());
388  query::ProviderSegmentSelector& prov = id.hasProviderSegmentName()
389  ? core.providerSegments(withID(id))
390  : core.providerSegments(all());
391  query::EntitySelector& entity =
392  id.hasEntityName() ? prov.entities(withID(id)) : prov.entities(all());
393  entity.snapshots(latest());
394 
395  return query(qb);
396  }
397 
398  std::optional<wm::EntitySnapshot>
400  {
401  client::QueryResult result = getLatestSnapshotsIn(id, dataMode);
402  if (result.success)
403  {
404  std::optional<wm::EntitySnapshot> latest = std::nullopt;
405  result.memory.forEachEntity(
406  [&latest](const wm::Entity& entity)
407  {
408  if (not entity.empty())
409  {
410  const wm::EntitySnapshot& snapshot = entity.getLatestSnapshot();
411  if (not latest.has_value() or latest->time() < snapshot.time())
412  {
413  latest = snapshot;
414  }
415  }
416  return true;
417  });
418  return latest;
419  }
420  else
421  {
422  ARMARX_INFO << "Error querying latest snapshot in " << id;
423  return std::nullopt;
424  }
425  }
426 
427  QueryResult
429  {
430  using namespace client::query_fns;
431 
432  query::Builder qb(dataMode);
434 
435  return this->query(qb);
436  }
437 
440  {
441  using namespace client::query_fns;
442 
443  query::Builder qb(dataMode);
445 
446  return this->query(qb);
447  }
448 
449  server::dto::DirectlyStoreResult
450  Reader::directlyStore(const server::dto::DirectlyStoreInput& input) const
451  {
452  server::RecordingMemoryInterfacePrx storingMemoryPrx =
453  server::RecordingMemoryInterfacePrx::checkedCast(readingPrx);
454  if (storingMemoryPrx)
455  {
456  return storingMemoryPrx->directlyStore(input);
457  }
458  else
459  {
460  ARMARX_WARNING << "Could not store a query into the LTM. It seems like the Memory does "
461  "not implement the StoringMemoryInterface.";
462  return {};
463  }
464  }
465 
466  void
468  {
469  server::RecordingMemoryInterfacePrx storingMemoryPrx =
470  server::RecordingMemoryInterfacePrx::checkedCast(readingPrx);
471  if (storingMemoryPrx)
472  {
473  server::dto::StartRecordInput i;
474  i.executionTime = armarx::core::time::dto::DateTime();
475  i.startTime = armarx::core::time::dto::DateTime();
476  i.recordingID = "";
477  i.configuration.clear();
478 
479  storingMemoryPrx->startRecord(i);
480  return;
481  }
482  else
483  {
484  ARMARX_WARNING << "Could not store a query into the LTM. It seems like the Memory does "
485  "not implement the StoringMemoryInterface.";
486  }
487  }
488 
489  void
491  {
492  server::RecordingMemoryInterfacePrx storingMemoryPrx =
493  server::RecordingMemoryInterfacePrx::checkedCast(readingPrx);
494  if (storingMemoryPrx)
495  {
496  storingMemoryPrx->stopRecord();
497  return;
498  }
499  else
500  {
501  ARMARX_WARNING << "Could not store a query into the LTM. It seems like the Memory does "
502  "not implement the StoringMemoryInterface.";
503  }
504  }
505 
506  void
507  Reader::setReadingMemory(server::ReadingMemoryInterfacePrx readingMemory)
508  {
509  this->readingPrx = readingMemory;
510  }
511 
512  void
513  Reader::setPredictingMemory(server::PredictingMemoryInterfacePrx predictingMemory)
514  {
515  this->predictionPrx = predictingMemory;
516  }
517 
518  std::vector<PredictionResult>
519  Reader::predict(const std::vector<PredictionRequest>& requests) const
520  {
521  if (!predictionPrx)
522  {
523  throw error::ProxyNotSet(
524  "PredictingMemoryInterfacePrx",
525  "Prediction interface proxy must be set to request a prediction.");
526  }
527 
528  armem::prediction::data::PredictionRequestSeq iceRequests;
529  for (const auto& request : requests)
530  {
531  iceRequests.push_back(request.toIce());
532  }
533 
534  armem::prediction::data::PredictionResultSeq results;
535  try
536  {
537  results = predictionPrx->predict(iceRequests);
538  }
539  catch (const Ice::LocalException& e)
540  {
541  armem::prediction::data::PredictionResult failure;
542  failure.success = false;
543  std::stringstream sstream;
544  sstream << "Prediction request failed. Reason: " << e.what();
545  failure.errorMessage = sstream.str();
546 
547  for (size_t i = 0; i < requests.size(); ++i)
548  {
549  results.push_back(failure);
550  }
551  }
552 
553  std::vector<PredictionResult> boResults;
554  for (const auto& result : results)
555  {
556  boResults.push_back(PredictionResult::fromIce(result));
557  }
558 
559  return boResults;
560  }
561 
562  std::map<MemoryID, std::vector<PredictionEngine>>
564  {
565  if (!predictionPrx)
566  {
567  throw error::ProxyNotSet(
568  "PredictingMemoryInterfacePrx",
569  "Prediction interface proxy must be set to request a prediction.");
570  }
571 
572  armem::prediction::data::EngineSupportMap engines;
573  try
574  {
575  engines = predictionPrx->getAvailableEngines();
576  }
577  catch (const Ice::LocalException& e)
578  {
579  // Just leave engines empty in this case.
580  }
581 
582  std::map<MemoryID, std::vector<PredictionEngine>> boMap;
583  armarx::fromIce(engines, boMap);
584 
585  return boMap;
586  }
587 } // namespace armarx::armem::client
armarx::armem::client::Reader::readingLtmPrx
server::ReadingLongTermMemoryInterfacePrx readingLtmPrx
Definition: Reader.h:229
armarx::armem::detail::SuccessHeader::success
bool success
Definition: SuccessHeader.h:19
armarx::armem::client::query::ProviderSegmentSelector
Definition: selectors.h:79
armarx::armem::base::detail::MemoryContainerBase::empty
bool empty() const
Definition: MemoryContainerBase.h:41
armarx::armem::MemoryID::isWellDefined
bool isWellDefined() const
Indicate whether this ID is well-defined.
Definition: MemoryID.cpp:182
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:187
armarx::aron::type::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
armarx::armem::client::query::ProviderSegmentSelector::entities
EntitySelector & entities()
Start specifying entities.
Definition: selectors.cpp:135
Reader.h
armarx::armem::client::QueryResult::memory
wm::Memory memory
The slice of the memory that matched the query.
Definition: Query.h:58
armarx::armem::client::Reader::getLatestSnapshotsIn
QueryResult getLatestSnapshotsIn(const MemoryID &id, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
Get the latest snapshots under the given memory ID.
Definition: Reader.cpp:377
armarx::aron::data::Variant::FromAronDTO
static VariantPtr FromAronDTO(const data::dto::GenericDataPtr &, const Path &=Path())
create a variant from a dto object
Definition: Variant.cpp:39
armarx::armem::wm::EntityInstance
Client-side working entity instance.
Definition: memory_definitions.h:32
armarx::armem::client::query::Builder::buildQueryInput
QueryInput buildQueryInput() const
Definition: Builder.cpp:12
armarx::armem::client::Reader::setPredictingMemory
void setPredictingMemory(server::PredictingMemoryInterfacePrx predictingMemory)
Definition: Reader.cpp:513
armarx::armem::client::query::EntitySelector::snapshots
SnapshotSelector & snapshots()
Start specifying entity snapshots.
Definition: selectors.cpp:92
armarx::armem::client::Reader::stopRecording
void stopRecording() const
Definition: Reader.cpp:490
armarx::armem::MemoryID::str
std::string str(bool escapeDelimiters=true) const
Get a string representation of this memory ID.
Definition: MemoryID.cpp:102
armarx::armem::client::Reader::Reader
Reader(const Reader &)=default
Construct a memory reader.
armarx::armem::client
This file is part of ArmarX.
Definition: Configurator.cpp:5
armarx::armem::client::Reader::predictionPrx
server::PredictingMemoryInterfacePrx predictionPrx
Definition: Reader.h:228
armarx::armem::error::ArMemError
Base class for all exceptions thrown by the armem library.
Definition: ArMemError.h:18
MemoryID_operators.h
query_fns.h
armarx::armem::client::QueryResult
Result of a QueryInput.
Definition: Query.h:50
armarx::armem::base::detail::GetFindSnapshotMixin::getSnapshot
auto & getSnapshot(const MemoryID &snapshotID)
Retrieve an entity snapshot.
Definition: lookup_mixins.h:286
armarx::aron::data::detail::SpecializedVariantBase< data::dto::Dict, Dict >::DynamicCastAndCheck
static PointerType DynamicCastAndCheck(const VariantPtr &n)
Definition: SpecializedVariant.h:134
armarx::armem::server::wm::Entity
Definition: memory_definitions.h:27
armarx::status::failure
@ failure
armarx::armem::base::detail::ForEachEntityMixin::forEachEntity
bool forEachEntity(FunctionT &&func)
Definition: iteration_mixins.h:259
armarx::armem::resolveID
std::optional< armarx::armem::wm::Memory > resolveID(armarx::armem::client::MemoryNameSystem &mns, const armarx::armem::MemoryID &memoryID)
resolve a single MemoryID with the given MemoryNameSystem.
Definition: util.cpp:10
armarx::armem::PredictionResult::fromIce
static PredictionResult fromIce(const armem::prediction::data::PredictionResult &ice)
Definition: Prediction.cpp:68
armarx::armem::error::ProxyNotSet
Indicates that a proxy required for an operation wasn't usable.
Definition: ArMemError.h:215
armarx::armem::client::Reader::getAllLatestSnapshots
QueryResult getAllLatestSnapshots(armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
Get all latest snapshots in the memory.
Definition: Reader.cpp:428
armarx::aron::Path
The Path class.
Definition: Path.h:35
armarx::armem::client::Reader::queryMemoryIDs
QueryResult queryMemoryIDs(const std::vector< MemoryID > &ids, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
Query a specific set of memory IDs.
Definition: Reader.cpp:324
armarx::aron::data::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
armarx::armem::client::Reader::predict
std::vector< PredictionResult > predict(const std::vector< PredictionRequest > &requests) const
Get a prediction for the state of multiple entity instances in the future.
Definition: Reader.cpp:519
armarx::armem::client::query_fns::all
auto all()
Definition: query_fns.h:9
armarx::armem::detail::SuccessHeader::errorMessage
std::string errorMessage
Definition: SuccessHeader.h:20
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::query::DataMode
DataMode
Definition: DataMode.h:6
armarx::armem::client::query::Builder::coreSegments
CoreSegmentSelector & coreSegments()
Start specifying core segments.
Definition: Builder.cpp:42
armarx::armem::client::Reader::directlyStore
server::dto::DirectlyStoreResult directlyStore(const server::dto::DirectlyStoreInput &input) const
Definition: Reader.cpp:450
RecursiveVisitor.h
armarx::armem::client::QueryInput
A query for parts of a memory.
Definition: Query.h:23
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:12
armarx::armem::client::Reader::getAll
QueryResult getAll(armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
Get the whole memory content.
Definition: Reader.cpp:439
armarx::armem::wm::Memory
Client-side working memory.
Definition: memory_definitions.h:133
object_finders.h
armarx::armem::client::Reader::startRecording
void startRecording() const
Definition: Reader.cpp:467
armarx::armem::client::Reader::getAvailablePredictionEngines
std::map< MemoryID, std::vector< PredictionEngine > > getAvailablePredictionEngines() const
Get the list of prediction engines supported by the memory.
Definition: Reader.cpp:563
armarx::armem::compareTimestampDecreasing
bool compareTimestampDecreasing(const MemoryID &lhs, const MemoryID &rhs)
lhs.timestamp > rhs.timstamp
Definition: MemoryID_operators.cpp:23
armarx::armem::wm::EntitySnapshot
Client-side working memory entity snapshot.
Definition: memory_definitions.h:80
armarx::armem::base::detail::MemoryItem::id
MemoryID & id()
Definition: MemoryItem.h:25
aron_conversions.h
memory_definitions.h
armarx::armem::client::findDataForLink
std::optional< std::pair< MemoryID, aron::data::VariantPtr > > findDataForLink(const aron::data::VariantPtr &linkData, const aron::type::VariantPtr &linkType, armem::client::MemoryNameSystem &mns)
Get the MemoryID and data required to fill in the given MemoryLink.
Definition: Reader.cpp:208
armarx::fromIce
void fromIce(const std::map< IceKeyT, IceValueT > &iceMap, boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
Definition: ice_conversions_boost_templates.h:27
armarx::armem::MemoryID::hasEntityName
bool hasEntityName() const
Definition: MemoryID.h:121
armarx::armem::client::query_fns::latest
std::function< void(query::SnapshotSelector &)> latest()
Definition: query_fns.h:81
armarx::armem::error::InvalidMemoryID
Indicates that a memory ID is invalid, e.g.
Definition: ArMemError.h:151
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
armarx::armem::client::QueryResult::toIce
armem::query::data::Result toIce() const
Definition: Query.cpp:32
armarx::armem::client::Reader::setReadingMemory
void setReadingMemory(server::ReadingMemoryInterfacePrx readingMemory)
Definition: Reader.cpp:507
armarx::armem::client::query::CoreSegmentSelector
Definition: selectors.h:118
armarx::armem::index::memoryID
const MemoryID memoryID
Definition: memory_ids.cpp:28
armarx::aron::data::visitRecursive
requires isRecursiveVisitor< RecursiveVisitorImplementation, typename RecursiveVisitorImplementation::Input > void visitRecursive(RecursiveVisitorImplementation &v, typename RecursiveVisitorImplementation::Input &o)
Definition: RecursiveVisitor.h:161
armarx::armem::base::detail::ForEachEntityInstanceMixin::forEachInstance
bool forEachInstance(InstanceFunctionT &&func)
Definition: iteration_mixins.h:147
Builder.h
armarx::aron::type::detail::SpecializedVariantBase< type::dto::AronObject, Object >::DynamicCastAndCheck
static std::shared_ptr< Object > DynamicCastAndCheck(const VariantPtr &n)
Definition: SpecializedVariant.h:119
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:73
armarx::armem::client::query::Builder
The query::Builder class provides a fluent-style specification of hierarchical queries.
Definition: Builder.h:21
ice_conversions_templates.h
armarx::armem::client::query::CoreSegmentSelector::providerSegments
ProviderSegmentSelector & providerSegments()
Start specifying provider segments.
Definition: selectors.cpp:178
util.h
armarx::armem::client::query::EntitySelector
Definition: selectors.h:39
armarx::exceptions::local::ExpressionException
This exception is thrown if the macro ARMARX_CHECK_EXPRESSION is used.
Definition: ExpressionException.h:39
armarx::armem::client::Reader::queryLTM
QueryResult queryLTM(const QueryInput &input, bool storeIntoWM=false) const
Queries the linked ltms.
Definition: Reader.cpp:33
Logging.h
armarx::armem::client::Reader::readingPrx
server::ReadingMemoryInterfacePrx readingPrx
Definition: Reader.h:227
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:193
armarx::armem::client::QueryResult::fromIce
static QueryResult fromIce(const armem::query::data::Result &ice)
Definition: Query.cpp:26
armarx::armem::extractDataAndType
std::optional< std::pair< armarx::aron::data::DictPtr, armarx::aron::type::ObjectPtr > > extractDataAndType(const armarx::armem::wm::Memory &memory, const armarx::armem::MemoryID &memoryID)
get the data and type of the given MemoryID in the given Memory.
Definition: util.cpp:34
armarx::armem::client::Reader::getLatestSnapshotIn
std::optional< wm::EntitySnapshot > getLatestSnapshotIn(const MemoryID &id, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
Get the latest snapshot under the given memory ID.
Definition: Reader.cpp:399
armarx::armem::client::query_fns::withID
auto withID(const MemoryID &id)
Definition: query_fns.h:15
armarx::armem::client::Reader::query
QueryResult query(const QueryInput &input) const
Perform a query on the WM.
Definition: Reader.cpp:69
armarx::armem::client::Reader::getLatestSnapshotOf
std::optional< wm::EntitySnapshot > getLatestSnapshotOf(const std::vector< MemoryID > &snapshotIDs) const
Query the given snapshot and return the latest existing snapshot.
Definition: Reader.cpp:347
armarx::human::MemoryID
const armem::MemoryID MemoryID
Definition: memory_ids.cpp:28