Go to the documentation of this file.
18 template <
class _CoreSegmentT,
class _Derived>
39 using EntityT =
typename ProviderSegmentT::EntityT;
97 inline const std::string&
184 template <
class CoreSegmentFunctionT>
194 template <
class CoreSegmentFunctionT>
210 template <
class InstanceFunctionT>
218 id.hasCoreSegmentName(),
219 id.hasCoreSegmentName() ? this->
findCoreSegment(
id.coreSegmentName) :
nullptr);
225 template <
class InstanceFunctionT>
233 id.hasCoreSegmentName(),
234 id.hasCoreSegmentName() ? this->
findCoreSegment(
id.coreSegmentName) :
nullptr);
237 std::vector<std::string>
240 return simox::alg::get_keys(this->
_container);
277 const std::string
name = coreSegment.name();
278 return this->
_derived().addCoreSegment(name, std::move(coreSegment));
282 template <
class... Args>
296 std::vector<UpdateResult>
298 const bool addMissingCoreSegmentDuringUpdate =
false,
299 const bool checkMemoryName =
true)
301 std::vector<UpdateResult> results;
305 this->
update(update, addMissingCoreSegmentDuringUpdate, checkMemoryName));
317 const bool addMissingCoreSegmentDuringUpdate =
false,
318 const bool checkMemoryName =
true)
326 addMissingCoreSegmentDuringUpdate);
329 UpdateResult
ret(coreSeg->update(
update));
345 template <
class OtherDerivedT>
349 other.forEachCoreSegment(
350 [
this](
const auto& coreSeg)
352 auto it = this->
_container.find(coreSeg.name());
355 it = this->_container
356 .emplace(coreSeg.name(),
357 this->id().withCoreSegmentName(coreSeg.name()))
359 it->second.aronType() = coreSeg.aronType();
369 it->second.append(coreSeg);
383 for (
const auto& [key, core] : this->
_container)
411 std::pair<bool, CoreSegmentT*>
413 const bool addMissingCoreSegmentDuringUpdate)
417 auto it = this->
_container.find(coreSegmentName);
420 if (addMissingCoreSegmentDuringUpdate)
424 return {
true, coreSeg};
428 throw error::MissingEntry::create<CoreSegmentT>(coreSegmentName, *
this);
433 coreSeg = &it->second;
434 return {
false, coreSeg};
bool hasCoreSegment(const MemoryID &coreSegmentID) const
const armem::MemoryID coreSegmentID
CoreSegmentT * findCoreSegment(const std::string &name)
ReaderT::InputType T & ret
armarx::armem::UpdateType memoryUpdateType
A bundle of updates to be sent to the memory.
std::vector< std::string > getCoreSegmentNames() const
CoreSegmentT & addCoreSegment(const CoreSegmentT &coreSegment)
Copy and insert a core segment.
CoreSegmentT & getCoreSegment(const std::string &name)
const CoreSegmentT & getCoreSegment(const MemoryID &coreSegmentID) const
bool forEachChild(ChildFunctionT &&func)
const CoreSegmentT * findCoreSegment(const MemoryID &coreSegmentID) const
MemoryBase(const std::string &name, const std::vector< PredictionEngine > &predictionEngines={})
Something that supports a set of prediction engines.
CoreSegmentT & getCoreSegment(const MemoryID &coreSegmentID)
Provides default implmentations of MemoryContainer, as well as iterators (which requires a template).
armarx::armem::UpdateType entityUpdateType
armarx::armem::UpdateType providerSegmentUpdateType
const CoreSegmentT & getCoreSegment(const std::string &name) const
static std::string getLevelName()
std::string coreSegmentName
CoreSegmentT & addCoreSegment(CoreSegmentT &&coreSegment)
Move and insert a core segment.
const std::string & name() const
std::vector< EntityUpdate > updates
The entity updates.
bool forEachCoreSegment(CoreSegmentFunctionT &&func)
bool hasCoreSegment(const std::string &name) const
UpdateResult update(const EntityUpdate &update, const bool addMissingCoreSegmentDuringUpdate=false, const bool checkMemoryName=true)
Store the given update.
CoreSegmentT * findCoreSegment(const MemoryID &coreSegmentID)
MemoryBase(const MemoryID &id, const std::vector< PredictionEngine > &predictionEngines={})
std::string getKeyString() const
UpdateType
The type of an update.
MemoryID withCoreSegmentName(const std::string &name) const
MemoryBase & operator=(const MemoryBase &other)=default
auto * findChildByKey(const KeyT &key, ContainerT &&container)
Find a child in a container by its key.
armarx::armem::UpdateType coreSegmentUpdateType
An update of an entity for a specific point in time.
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.
auto & getChildByKey(const KeyT &key, ContainerT &&container, const ParentT &owner, KeyStringFn &&keyStringFn)
Retrieve a child in a container by its key.
void checkHasCoreSegmentName(const MemoryID &coreSegmentID)
Throw armem::error::InvalidMemoryID if the given ID has core segment name.
typename ProviderSegmentT::EntityT EntityT
Data of a memory consisting of multiple core segments.
bool forEachInstanceIn(const MemoryID &id, FunctionT &&func, ParentT &parent, bool single, ChildT *child)
std::map< std::string, _CoreSegmentT > ContainerT
typename EntitySnapshotT::EntityInstanceT EntityInstanceT
bool equalsDeep(const MemoryBase &other) const
CoreSegmentT & addCoreSegment(const std::string &name, Args... args)
Move and insert a core segment.
typename EntityT::EntitySnapshotT EntitySnapshotT
UpdateResult(const typename CoreSegmentT::UpdateResult &c)
bool forEachInstanceIn(const MemoryID &id, InstanceFunctionT &&func)
void append(const OtherDerivedT &other)
Merge another memory into this one.
const CoreSegmentT * findCoreSegment(const std::string &name) const
bool forEachInstanceIn(const MemoryID &id, InstanceFunctionT &&func) const
std::vector< UpdateResult > update(const Commit &commit, const bool addMissingCoreSegmentDuringUpdate=false, const bool checkMemoryName=true)
Store all updates in commit.
std::shared_ptr< Object > ObjectPtr
const std::vector< PredictionEngine > & predictionEngines() const
bool forEachCoreSegment(CoreSegmentFunctionT &&func) const
MemoryID entityID
The entity's ID.
std::vector< EntitySnapshotT > removedSnapshots
void setName(const std::string &name)
void _checkContainerName(const std::string &gottenName, const std::string &actualName, bool emptyOk=true) const
typename CoreSegmentT::ProviderSegmentT ProviderSegmentT
std::pair< bool, CoreSegmentT * > _addCoreSegmentIfMissing(const std::string &coreSegmentName, const bool addMissingCoreSegmentDuringUpdate)
const armem::MemoryID MemoryID