16 const std::string& exportName,
18 const std::shared_ptr<Processors>&
filters,
19 const std::shared_ptr<persistence::MemoryPersistenceStrategy>& persistenceStrategy) :
20 EntitySnapshotBase(exportName, memoryId,
filters), persistenceStrategy_(persistenceStrategy)
32 for (
auto& entityInstanceKey : persistenceStrategy_->getContainerKeys(
id()))
34 std::shared_ptr<persistence::MemoryPersistenceStrategy>
35 entityInstancePersistenceStrategy(persistenceStrategy_);
51 return persistenceStrategy_->containsContainer(
id(), std::to_string(entityInstanceIndex));
54 std::shared_ptr<EntityInstance>
65 id().withInstanceIndex(entityInstanceIndex),
67 persistenceStrategy_);
89 [&](
auto& wmEntityInstance)
91 std::shared_ptr<persistence::MemoryPersistenceStrategy>
92 entityInstancePersistanceStrategy(persistenceStrategy_);
96 id().withInstanceIndex(wmEntityInstance.id().instanceIndex),
98 entityInstancePersistanceStrategy);
101 ltmEntityInstance.
resolve(wmEntityInstance);
118 <<
"During storage of segment '" << wmEntitySnapshot.
id().
str()
119 <<
"' I noticed that the corresponding LTM has no id set. "
120 <<
"I set the id of the LTM to the same name, however this should not happen!";
134 [&](
const auto& wmEntityInstance)
136 std::shared_ptr<persistence::MemoryPersistenceStrategy>
137 entityInstancePersistenceStrategy(persistenceStrategy_);
140 id().withInstanceIndex(wmEntityInstance.id().instanceIndex),
142 entityInstancePersistenceStrategy);
143 c.store(wmEntityInstance);
MemoryID getEntitySnapshotID() const
std::string str(bool escapeDelimiters=true) const
Get a string representation of this memory ID.
MemoryID withInstanceIndex(int index) const
bool forEachInstance(InstanceFunctionT &&func)
void _store(const armem::wm::EntitySnapshot &wmEntitySnapshot) override
EntitySnapshot(const std::string &exportName, const MemoryID &memoryId, const std::shared_ptr< Processors > &filters, const std::shared_ptr< persistence::MemoryPersistenceStrategy > &persistenceStrategy)
bool _implForEachInstance(std::function< void(EntityInstance &)> func) const override
void _resolve(armem::wm::EntitySnapshot &wmEntitySnapshot) const override
bool _implHasInstance(const int entityInstanceIndex) const override
std::shared_ptr< EntityInstance > _implFindInstance(const int entityInstanceIndex) const override
void _loadAllReferences(armem::wm::EntitySnapshot &wmEntitySnapshot) const override
void resolve(armem::wm::EntityInstance &e) const
convert the references of the input into a wm::Memory
void loadAllReferences(armem::wm::EntitySnapshot &e) const
return the full sub-ltm as a wm::EntitySnapshot with only references the ltm may be huge,...
virtual std::string getExportName() const
std::shared_ptr< Processors > processors
Client-side working memory entity snapshot.
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.