MemoryToIceAdapter.cpp
Go to the documentation of this file.
1 #include "MemoryToIceAdapter.h"
2 
3 #include <iostream>
4 #include <list>
5 #include <sstream>
6 #include <thread>
7 
12 
20 
22 #include "query_proc/wm/wm.h"
23 
24 namespace armarx::armem::server
25 {
26 
28  server::ltm::Memory* longtermMemory) :
29  workingMemory(workingMemory), longtermMemory(longtermMemory)
30  {
31  }
32 
33  void
34  MemoryToIceAdapter::setMemoryListener(client::MemoryListenerInterfacePrx memoryListener)
35  {
36  this->memoryListenerTopic = memoryListener;
37  }
38 
39  // WRITING
40  data::AddSegmentResult
41  MemoryToIceAdapter::addSegment(const data::AddSegmentInput& input, bool addCoreSegments)
42  {
45 
46  data::AddSegmentResult output;
47 
48  server::wm::CoreSegment* coreSegment = nullptr;
49  try
50  {
51  coreSegment = &workingMemory->getCoreSegment(input.coreSegmentName);
52  }
53  catch (const armem::error::MissingEntry& e)
54  {
55  if (addCoreSegments)
56  {
57  coreSegment = &workingMemory->addCoreSegment(input.coreSegmentName);
58  }
59  else
60  {
61  output.success = false;
62  output.errorMessage = e.what();
63  return output;
64  }
65  }
66  ARMARX_CHECK_NOT_NULL(coreSegment);
67 
68  if (input.providerSegmentName.size() > 0)
69  {
70  coreSegment->doLocked(
71  [&coreSegment, &input]()
72  {
73  try
74  {
75  coreSegment->addProviderSegment(input.providerSegmentName);
76  }
78  {
79  // This is ok.
80  if (input.clearWhenExists)
81  {
82  server::wm::ProviderSegment& provider =
83  coreSegment->getProviderSegment(input.providerSegmentName);
84  provider.clear();
85  }
86  }
87  });
88  }
89 
90  armem::MemoryID segmentID;
91  segmentID.memoryName = workingMemory->name();
92  segmentID.coreSegmentName = input.coreSegmentName;
93  segmentID.providerSegmentName = input.providerSegmentName;
94 
95  output.success = true;
96  output.segmentID = segmentID.str();
97  return output;
98  }
99 
100  data::AddSegmentsResult
101  MemoryToIceAdapter::addSegments(const data::AddSegmentsInput& input, bool addCoreSegments)
102  {
103  ARMARX_TRACE;
105 
106  data::AddSegmentsResult output;
107  for (const auto& i : input)
108  {
109  output.push_back(addSegment(i, addCoreSegments));
110  }
111  return output;
112  }
113 
114  data::CommitResult
115  MemoryToIceAdapter::commit(const data::Commit& commitIce, Time timeArrived)
116  {
117  ARMARX_TRACE;
119  auto handleException = [](const std::string& what)
120  {
121  data::CommitResult result;
122  data::EntityUpdateResult& r = result.results.emplace_back();
123  r.success = false;
124  r.errorMessage = what;
125  return result;
126  };
127 
129  try
130  {
131  ::armarx::armem::fromIce(commitIce, commit, timeArrived);
132  }
133  catch (const aron::error::AronNotValidException& e)
134  {
135  throw;
136  return handleException(e.what());
137  }
138  catch (const Ice::Exception& e)
139  {
140  throw;
141  return handleException(e.what());
142  }
143 
144  armem::CommitResult result = this->commit(commit);
145  data::CommitResult resultIce;
146  toIce(resultIce, result);
147 
148  return resultIce;
149  }
150 
151  data::CommitResult
152  MemoryToIceAdapter::commit(const data::Commit& commitIce)
153  {
154  ARMARX_TRACE;
155  return commit(commitIce, armem::Time::Now());
156  }
157 
160  {
161  ARMARX_TRACE;
162  return this->_commit(commit, false);
163  }
164 
165  data::CommitResult
166  MemoryToIceAdapter::commitLocking(const data::Commit& commitIce, Time timeArrived)
167  {
168  ARMARX_TRACE;
170  auto handleException = [](const std::string& what)
171  {
172  data::CommitResult result;
173  data::EntityUpdateResult& r = result.results.emplace_back();
174  r.success = false;
175  r.errorMessage = what;
176  return result;
177  };
178 
180  try
181  {
182  ::armarx::armem::fromIce(commitIce, commit, timeArrived);
183  }
184  catch (const aron::error::AronNotValidException& e)
185  {
186  throw;
187  return handleException(e.what());
188  }
189  catch (const Ice::Exception& e)
190  {
191  throw;
192  return handleException(e.what());
193  }
194 
195  armem::CommitResult result = this->commitLocking(commit);
196  data::CommitResult resultIce;
197  toIce(resultIce, result);
198 
199  return resultIce;
200  }
201 
202  data::CommitResult
203  MemoryToIceAdapter::commitLocking(const data::Commit& commitIce)
204  {
205  ARMARX_TRACE;
206  return commitLocking(commitIce, armem::Time::Now());
207  }
208 
211  {
212  ARMARX_TRACE;
213  return this->_commit(commit, true);
214  }
215 
217  MemoryToIceAdapter::_commit(const armem::Commit& commit, bool locking)
218  {
219  ARMARX_TRACE;
220  std::vector<data::MemoryID> updatedIDs;
221  const bool publishUpdates = bool(memoryListenerTopic);
222 
223  CommitResult commitResult;
224  for (const EntityUpdate& update : commit.updates)
225  {
226  EntityUpdateResult& result = commitResult.results.emplace_back();
227  try
228  {
229  auto updateResult =
231 
232  result.success = true;
233  result.snapshotID = updateResult.id;
234  result.arrivedTime = update.arrivedTime;
235 
236  for (const auto& snapshot : updateResult.removedSnapshots)
237  {
238  ARMARX_DEBUG << "The id " << snapshot.id() << " was removed from wm";
239  }
240 
241  // Consolidate to ltm(s) if recording mode is CLONE_WM
242  if (longtermMemory->isRecording() &&
245  {
246  // convert removedSnapshots to Memory
248  m.update(update, true, false);
249  //this removes information about segments, because new memory (wm) is used
250 
251  // store memory
252  longtermMemory->store(m);
253  }
254 
255 
256  // Consolidate to ltm(s) if recording mode is CONSOLIDATE_REMOVED
257  if (longtermMemory->isRecording() &&
260  {
261  // convert removedSnapshots to Memory
263  armem::wm::toMemory(m, *workingMemory, updateResult.removedSnapshots);
264  //this removes information about segments, because new memory (wm) is used
265 
266  // store memory
267  longtermMemory->store(m);
268  }
269 
270  if (longtermMemory->isRecording() &&
273  {
274  ARMARX_WARNING << deactivateSpam() << "THIS IS NOT IMPLEMENTED YET!!!";
275  }
276 
277  if (publishUpdates)
278  {
279  data::MemoryID& id = updatedIDs.emplace_back();
280  toIce(id, result.snapshotID);
281  }
282  }
283  catch (const error::ArMemError& e)
284  {
285  result.success = false;
286  result.errorMessage = e.what();
287  }
288  catch (const aron::error::AronException& e)
289  {
290  result.success = false;
291  result.errorMessage = e.what();
292  }
293  catch (const Ice::Exception& e)
294  {
295  result.success = false;
296  result.errorMessage = e.what();
297  }
298  catch (...)
299  {
300  ARMARX_INFO << "Error during LTM consollidation";
301  }
302  }
303 
304  if (publishUpdates)
305  {
306  memoryListenerTopic->memoryUpdated(updatedIDs);
307  }
308 
309  return commitResult;
310  }
311 
312  // READING
313  armem::query::data::Result
314  MemoryToIceAdapter::query(const armem::query::data::Input& input)
315  {
316  ARMARX_TRACE;
319 
320  // Core segment processors will aquire the core segment locks.
323  armem::wm::Memory wmResult = wmServerProcessor.process(input, *workingMemory);
324 
325  armem::query::data::Result result;
326 
327  /*query_proc::ltm_server::MemoryQueryProcessor ltmProcessor;
328  armem::wm::Memory ltmResult = ltmProcessor.process(input, *longtermMemory);
329 
330  if (not ltmResult.empty())
331  {
332 
333  // convert memory ==> meaning resolving references
334  // upon query, the LTM only returns a structure of the data (memory without data)
335  longtermMemory->resolve(ltmResult);
336 
337  // append result to return memory and sanity check
338  wmResult.append(ltmResult);
339  ARMARX_CHECK(not wmResult.empty());
340 
341  // Ist das wirklich notwendig?
342  // query again to limit output size (TODO: Skip if querytype is all)
343  //auto queryInput = armem::client::QueryInput::fromIce(input);
344  //query_proc::wm::MemoryQueryProcessor wm2wmProcessor(armem::query::boolToDataMode(input.withData));
345  //wmResult = wm2wmProcessor.process(queryInput.toIce(), wmResult);
346  //if (wmResult.empty())
347  //{
348  // ARMARX_ERROR << "A merged and postprocessed Memory has no data although at least the LTM result contains data. This indicates that something is wrong.";
349  //}
350 
351  if (longtermMemory->isRecording())
352  {
353  // TODO: also move results of ltm to wm
354  //this->commit(toCommit(ltm_converted));
355 
356  // mark removed entries of wm in viewer
357  // TODO
358  }
359  }*/
360 
361  result.memory = armarx::toIce<data::MemoryPtr>(wmResult);
362 
363  result.success = true;
364  if (result.memory->coreSegments.size() == 0)
365  {
366  ARMARX_DEBUG << "No data in memory found after query.";
367  }
368 
369  return result;
370  }
371 
374  {
375  ARMARX_TRACE;
376  return client::QueryResult::fromIce(query(input.toIce()));
377  }
378 
379  armem::structure::data::GetServerStructureResult
381  {
382  ARMARX_TRACE;
385 
386  armem::structure::data::GetServerStructureResult ret;
387  ret.success = true;
388 
389  wm::Memory structure;
390  structure.id() = workingMemory->id();
391 
392  // Get all info from the WM
394  builder.all();
395  auto query_result = this->query(builder.buildQueryInput());
396  if (query_result.success)
397  {
398  structure.append(query_result.memory);
399  }
400 
401  // Get all info from the LTM
403 
404  ret.serverStructure = armarx::toIce<data::MemoryPtr>(structure);
405 
406  return ret;
407  }
408 
409  // WM LOADING FROM LTM
412  {
413  if (this->longtermMemory->p.importOnStartUp)
414  {
415  ARMARX_INFO << "Reloading of data from LTM into WM triggered";
416  //define which core segments to load and how many snapshots:
417  auto coreNames = this->longtermMemory->p.coreSegmentsToLoad;
418  //convert string to list of names:
419  std::list<std::string> names;
420  std::stringstream ss(coreNames);
421  std::string item;
422 
423  while (std::getline(ss, item, ','))
424  {
425  names.push_back(item);
426  }
427  int maxAmountOfSnapshots = this->longtermMemory->p.maxAmountOfSnapshotsLoaded;
428  //create WM and load latest references
430  this->longtermMemory->loadLatestNReferences(maxAmountOfSnapshots, m, names);
431  ARMARX_DEBUG << "After loading";
432  //construct a commit of the loaded data and commit it to the working memory
433  auto com = armem::toCommit(m);
434  auto res = this->commit(com);
435  ARMARX_DEBUG << "After commit";
436  //the CommitResult contains some information which might be helpful:
437  return res;
438  }
439  else
440  {
441  ARMARX_INFO << "Not loading initial data from LTM due to importOnStartup being "
442  << this->longtermMemory->p.importOnStartUp;
444  return r;
445  }
446  }
447 
448  // LTM STORING AND RECORDING
449  dto::DirectlyStoreResult
450  MemoryToIceAdapter::directlyStore(const dto::DirectlyStoreInput& directlStoreInput)
451  {
452  ARMARX_TRACE;
454 
455  dto::DirectlyStoreResult output;
456  output.success = true;
457 
458  armem::wm::Memory m = armarx::fromIce<armem::wm::Memory>(directlStoreInput.memory);
460 
461  return output;
462  }
463 
464  dto::StartRecordResult
465  MemoryToIceAdapter::startRecord(const dto::StartRecordInput& startRecordInput)
466  {
467  ARMARX_TRACE;
469  ARMARX_IMPORTANT << "Enabling the recording of memory " << longtermMemory->id().str();
471 
472  dto::StartRecordResult ret;
473  ret.success = true;
474 
475  return ret;
476  }
477 
478  dto::StopRecordResult
480  {
481  ARMARX_TRACE;
484  ARMARX_IMPORTANT << "Disabling the recording of memory " << longtermMemory->id().str();
485 
487  { //if true this means when stopping LTM recording leftover snapshots are transferred to WM using the simulated consolidation
488  ARMARX_INFO << "Starting to save left-over WM data into LTM";
490  ARMARX_INFO << "Stored leftover WM data into LTM";
491  }
492  else
493  {
494  ARMARX_INFO << "Not storing WM data into LTM on stop, because storeOnStop is "
496  }
497 
498  //put calling stopRecording into a seperate thread and detach to make sure GUI does not freeze
499  auto ltm = longtermMemory;
500 
501  std::thread stopRecordingThread(
502  [&ltm]()
503  {
504  ltm->stopRecording();
505  ltm->bufferFinished();
506  ARMARX_INFO << "Storing finished";
507  });
508  stopRecordingThread.detach();
509 
511  << "Stopped all LTM recordings, please wait with stopping the component until "
512  "all files are written";
513 
514  dto::StopRecordResult ret;
515  ret.success = true;
516 
517  return ret;
518  }
519 
520  dto::RecordStatusResult
522  {
523  dto::RecordStatusResult ret;
524  ret.success = true;
525 
526  long savedSnapshots;
527  long totalSnapshots;
529  [&savedSnapshots, &totalSnapshots](const auto& c)
530  {
531  c.forEachProviderSegment(
532  [&savedSnapshots, &totalSnapshots](const auto& p)
533  {
534  p.forEachEntity(
535  [&savedSnapshots, &totalSnapshots](const auto& e)
536  {
537  savedSnapshots += e.getStatistics().recordedSnapshots;
538 
539  e.forEachSnapshot([&totalSnapshots](const auto&)
540  { totalSnapshots++; });
541  });
542  });
543  });
544 
545  ret.status.savedSnapshots = savedSnapshots;
546  ret.status.totalSnapshots = totalSnapshots;
547 
548  return ret;
549  }
550 
551  // PREDICTION
552  prediction::data::PredictionResultSeq
553  MemoryToIceAdapter::predict(prediction::data::PredictionRequestSeq requests)
554  {
556  armarx::fromIce<std::vector<PredictionRequest>>(requests));
557  return armarx::toIce<prediction::data::PredictionResultSeq>(res);
558  }
559 
560  prediction::data::EngineSupportMap
562  {
563  prediction::data::EngineSupportMap result;
565 
566  // Uncomment once LTM also supports prediction engines.
567 
568  /*prediction::data::EngineSupportMap ltmMap;
569  armarx::toIce(ltmMap, longtermMemory->getAllPredictionEngines());
570  for (const auto& [memoryID, engines] : ltmMap)
571  {
572  auto entryIter = result.find(memoryID);
573  if (entryIter == result.end())
574  {
575  result.emplace(memoryID, engines);
576  }
577  else
578  {
579  // Merge LTM-supported engines with WM-supported engines, removing duplicates
580  std::set<prediction::data::PredictionEngine> engineSet;
581  engineSet.insert(entryIter->second.begin(), entryIter->second.end());
582  engineSet.insert(engines.begin(), engines.end());
583  entryIter->second.assign(engineSet.begin(), engineSet.end());
584  }
585  }*/
586 
587  return result;
588  }
589 
590 } // namespace armarx::armem::server
armarx::armem::server::MemoryToIceAdapter::workingMemory
server::wm::Memory * workingMemory
Definition: MemoryToIceAdapter.h:65
armarx::armem::server::ltm::detail::MemoryBase::isRecording
bool isRecording() const
Definition: MemoryBase.h:307
armarx::aron::ret
ReaderT::InputType T & ret
Definition: rw.h:13
memory_conversions.h
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:190
armarx::armem::MemoryID::providerSegmentName
std::string providerSegmentName
Definition: MemoryID.h:52
armarx::armem::Commit
A bundle of updates to be sent to the memory.
Definition: Commit.h:84
armarx::armem::client::query::Builder::buildQueryInput
QueryInput buildQueryInput() const
Definition: Builder.cpp:12
armarx::armem::server::ltm::detail::MemoryBase::getRecordingMode
RecordingMode getRecordingMode() const
Definition: MemoryBase.h:90
armarx::core::time::DateTime::Now
static DateTime Now()
Definition: DateTime.cpp:51
armarx::armem::EntityUpdateResult
Result of an EntityUpdate.
Definition: Commit.h:69
armarx::armem::server::ltm::detail::MemoryBase::Properties::coreSegmentsToLoad
std::string coreSegmentsToLoad
Definition: MemoryBase.h:413
armarx::armem::server::MemoryToIceAdapter::longtermMemory
server::ltm::Memory * longtermMemory
Definition: MemoryToIceAdapter.h:66
armarx::armem::EntityUpdateResult::arrivedTime
Time arrivedTime
Definition: Commit.h:74
armarx::armem::base::MemoryBase::getCoreSegment
CoreSegmentT & getCoreSegment(const std::string &name)
Definition: MemoryBase.h:132
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::armem::server::MemoryToIceAdapter::startRecord
dto::StartRecordResult startRecord(const dto::StartRecordInput &startRecordInput)
Definition: MemoryToIceAdapter.cpp:465
armarx::armem::server::MemoryToIceAdapter::memoryListenerTopic
client::MemoryListenerInterfacePrx memoryListenerTopic
Definition: MemoryToIceAdapter.h:68
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::wm::toMemory
void toMemory(Memory &m, const std::vector< CoreSegment > &e)
Definition: memory_conversions.cpp:6
armarx::armem::toIce
void toIce(data::MemoryID &ice, const MemoryID &id)
Definition: ice_conversions.cpp:20
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::armem::server::ltm::detail::MemoryBase::Properties::importOnStartUp
bool importOnStartUp
Definition: MemoryBase.h:411
armarx::armem::query::boolToDataMode
DataMode boolToDataMode(bool withData)
Definition: DataMode.cpp:6
armarx::armem::base::MemoryBase::name
std::string & name()
Definition: MemoryBase.h:92
armarx::armem::server::ltm::detail::MemoryBase::p
struct armarx::armem::server::ltm::detail::MemoryBase::Properties p
ice_conversions.h
ltm.h
armarx::armem::client::QueryResult
Result of a QueryInput.
Definition: Query.h:50
armarx::armem::server::query_proc::wm_server::MemoryQueryProcessor
Definition: wm.h:186
armarx::armem::MemoryID::coreSegmentName
std::string coreSegmentName
Definition: MemoryID.h:51
armarx::armem::server::MemoryToIceAdapter::predict
prediction::data::PredictionResultSeq predict(prediction::data::PredictionRequestSeq requests)
Definition: MemoryToIceAdapter.cpp:553
armarx::armem::server::MemoryToIceAdapter::getServerStructure
armem::structure::data::GetServerStructureResult getServerStructure()
Definition: MemoryToIceAdapter.cpp:380
armarx::armem::server::ltm::Memory
A memory storing data on the hard drive and in mongodb (needs 'armarx memory start' to start the mong...
Definition: Memory.h:19
armarx::toIce
void toIce(std::map< IceKeyT, IceValueT > &iceMap, const boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
Definition: ice_conversions_boost_templates.h:15
deactivateSpam
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition: Logging.cpp:75
armarx::armem::server::MemoryToIceAdapter::reloadFromLTM
armem::CommitResult reloadFromLTM()
Definition: MemoryToIceAdapter.cpp:411
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:77
armarx::armem::server::MemoryToIceAdapter::setMemoryListener
void setMemoryListener(client::MemoryListenerInterfacePrx memoryListenerTopic)
Definition: MemoryToIceAdapter.cpp:34
armarx::armem::server::wm::Memory
Definition: memory_definitions.h:122
armarx::armem::server::query_proc::base::MemoryQueryProcessorBase::process
ResultMemoryT process(const armem::query::data::Input &input, const MemoryT &memory) const
Definition: MemoryQueryProcessorBase.h:43
armarx::armem::server::ltm::detail::MemoryBase::Properties::storeOnStop
bool storeOnStop
Definition: MemoryBase.h:408
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::base::detail::PredictiveContainer::getAllPredictionEngines
std::map< MemoryID, std::vector< PredictionEngine > > getAllPredictionEngines() const
Definition: Predictive.h:94
armarx::core::eigen::fromIce
void fromIce(Eigen::Vector2f &e, const Ice::FloatSeq &ice)
Definition: ice_conversions.cpp:10
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:184
armarx::armem::server::ltm::detail::MemoryBase::loadLatestNReferences
armem::wm::Memory loadLatestNReferences(int n)
Definition: MemoryBase.h:185
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
error.h
armarx::armem::wm::Memory
Client-side working memory.
Definition: memory_definitions.h:133
armarx::armem::server::ltm::detail::MemoryBase::Properties::maxAmountOfSnapshotsLoaded
int maxAmountOfSnapshotsLoaded
Definition: MemoryBase.h:412
wm.h
armarx::aron::error::AronNotValidException
The AronNotValidException class.
Definition: Exception.h:71
armarx::armem::EntityUpdate
An update of an entity for a specific point in time.
Definition: Commit.h:25
armarx::armem::CommitResult
Result of a Commit.
Definition: Commit.h:105
ice_conversions.h
armarx::armem::base::MemoryBase::addCoreSegment
CoreSegmentT & addCoreSegment(const std::string &name, aron::type::ObjectPtr coreSegmentType=nullptr, const std::vector< PredictionEngine > &predictionEngines={})
Add an empty core segment with the given name, type and prediction engines.
Definition: MemoryBase.h:259
armarx::armem::server::ltm::Memory::forEachCoreSegment
bool forEachCoreSegment(std::function< void(CoreSegment &)> func) const final
iterate over all core segments of this ltm
Definition: Memory.cpp:82
armarx::armem::server::MemoryToIceAdapter::getRecordStatus
dto::RecordStatusResult getRecordStatus()
Definition: MemoryToIceAdapter.cpp:521
armarx::armem::server::ltm::detail::mixin::BufferedMemoryMixin::directlyStore
void directlyStore(const armem::wm::Memory &memory, bool simulatedVersion=false)
Definition: BufferedMemoryMixin.h:31
armarx::armem::base::detail::MemoryItem::id
MemoryID & id()
Definition: MemoryItem.h:25
armarx::armem::server::wm::CoreSegment::doLocked
auto doLocked(FunctionT &&function) const
Definition: memory_definitions.h:110
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:68
armarx::armem::EntityUpdateResult::snapshotID
MemoryID snapshotID
Definition: Commit.h:73
armarx::armem::server::ltm::detail::MemoryBase::startRecording
void startRecording()
enable/disable
Definition: MemoryBase.h:292
MemoryToIceAdapter.h
armarx::armem::server::MemoryToIceAdapter::getAvailableEngines
prediction::data::EngineSupportMap getAvailableEngines()
Definition: MemoryToIceAdapter.cpp:561
ice_conversions.h
armarx::armem::server::MemoryToIceAdapter::stopRecord
dto::StopRecordResult stopRecord()
Definition: MemoryToIceAdapter.cpp:479
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::memoryName
std::string memoryName
Definition: MemoryID.h:50
armarx::armem::server
Definition: GraspMemory.cpp:33
armarx::armem::server::MemoryToIceAdapter::directlyStore
dto::DirectlyStoreResult directlyStore(const dto::DirectlyStoreInput &directlStoreInput)
Definition: MemoryToIceAdapter.cpp:450
ExpressionException.h
armarx::armem::server::ltm::RecordingMode::CONSOLIDATE_LATEST
@ CONSOLIDATE_LATEST
armarx::armem::server::wm::CoreSegment
base::CoreSegmentBase
Definition: memory_definitions.h:75
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::server::MemoryToIceAdapter::addSegment
data::AddSegmentResult addSegment(const data::AddSegmentInput &input, bool addCoreSegments=false)
Definition: MemoryToIceAdapter.cpp:41
Exception.h
armarx::armem::server::ltm::detail::MemoryItem::id
MemoryID id() const
Definition: MemoryItem.cpp:37
armarx::viz::data::ElementFlags::names
const simox::meta::IntEnumNames names
Definition: json_elements.cpp:13
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
armarx::armem::server::ltm::detail::MemoryBase::loadAllReferences
armem::wm::Memory loadAllReferences()
return the full ltm as a wm::Memory with only references the ltm may be huge, use with caution
Definition: MemoryBase.h:167
armarx::armem::CommitResult::results
std::vector< EntityUpdateResult > results
Definition: Commit.h:107
armarx::armem::server::MemoryToIceAdapter::addSegments
data::AddSegmentsResult addSegments(const data::AddSegmentsInput &input, bool addCoreSegments=false)
Definition: MemoryToIceAdapter.cpp:101
armarx::armem::server::MemoryToIceAdapter::MemoryToIceAdapter
MemoryToIceAdapter(server::wm::Memory *workingMemory=nullptr, server::ltm::Memory *longtermMemory=nullptr)
Construct an MemoryToIceAdapter from an existing Memory.
Definition: MemoryToIceAdapter.cpp:27
armarx::armem::query::DataMode::NoData
@ NoData
Just get the structure, but no ARON data.
Builder.h
armarx::armem::base::MemoryBase::append
void append(const OtherDerivedT &other)
Merge another memory into this one.
Definition: MemoryBase.h:347
armarx::armem::EntityUpdateResult::errorMessage
std::string errorMessage
Definition: Commit.h:76
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::server::wm::detail::PredictionContainer::dispatchPredictions
std::vector< PredictionResult > dispatchPredictions(const std::vector< PredictionRequest > &requests)
Definition: Prediction.h:168
armarx::armem::base::MemoryBase::update
std::vector< UpdateResult > update(const Commit &commit, const bool addMissingCoreSegmentDuringUpdate=false, const bool checkMemoryName=true)
Store all updates in commit.
Definition: MemoryBase.h:297
armarx::armem::error::ContainerEntryAlreadyExists
Indicates that a name in a given ID does not match a container's own name.
Definition: ArMemError.h:57
Logging.h
armarx::armem::client::query::Builder::all
void all()
Get all snapshots from all entities in all segments.
Definition: Builder.cpp:54
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:193
armarx::armem::server::wm::CoreSegment::addProviderSegment
ProviderSegment & addProviderSegment(const std::string &name, Args... args)
Definition: memory_definitions.h:91
armarx::armem::server::wm::Memory::updateLocking
std::vector< Base::UpdateResult > updateLocking(const Commit &commit)
Perform the commit, locking the core segments.
Definition: memory_definitions.cpp:50
armarx::armem::client::QueryResult::fromIce
static QueryResult fromIce(const armem::query::data::Result &ice)
Definition: Query.cpp:26
armarx::armem::EntityUpdateResult::success
bool success
Definition: Commit.h:71
armarx::armem::server::ltm::RecordingMode::CONSOLIDATE_ALL
@ CONSOLIDATE_ALL
armarx::armem::toCommit
Commit toCommit(const ContainerT &container)
Definition: operations.h:23
armarx::armem::server::MemoryToIceAdapter::commitLocking
data::CommitResult commitLocking(const data::Commit &commitIce, Time timeArrived)
Definition: MemoryToIceAdapter.cpp:166
armarx::armem::server::ltm::RecordingMode::CONSOLIDATE_REMOVED
@ CONSOLIDATE_REMOVED
armarx::armem::server::MemoryToIceAdapter::commit
data::CommitResult commit(const data::Commit &commitIce, Time timeArrived)
Definition: MemoryToIceAdapter.cpp:115
ice_conversions.h
armarx::armem::error::MissingEntry
Indicates that a container did not have an entry under a given name.
Definition: ArMemError.h:74
armarx::armem::server::MemoryToIceAdapter::query
query::data::Result query(const armem::query::data::Input &input)
Definition: MemoryToIceAdapter.cpp:314
armarx::armem::server::ltm::detail::MemoryBase::store
void store(const armem::wm::Memory &memory)
append a wm::Memory instance to the ltm
Definition: MemoryBase.h:240
armarx::armem::server::ltm::detail::MemoryItem::name
std::string name() const
Definition: MemoryItem.cpp:43
armarx::human::MemoryID
const armem::MemoryID MemoryID
Definition: memory_ids.cpp:28