Go to the documentation of this file.
21 template <
class _Prov
iderSegmentT,
class _Derived>
41 using EntityT =
typename ProviderSegmentT::EntityT;
108 inline const std::string&
195 return this->
findEntity(entityName) !=
nullptr;
215 template <
class Prov
iderSegmentFunctionT>
225 template <
class Prov
iderSegmentFunctionT>
240 template <
class InstanceFunctionT>
247 id.hasProviderSegmentName(),
248 id.hasProviderSegmentName()
256 template <
class InstanceFunctionT>
263 id.hasProviderSegmentName(),
264 id.hasProviderSegmentName()
270 std::vector<std::string>
273 return simox::alg::get_keys(this->
_container);
288 auto [inserted, provSeg] =
293 UpdateResult
ret(provSeg->update(
update));
305 template <
class OtherDerivedT>
309 other.forEachProviderSegment(
310 [
this](
const auto& provSeg)
312 auto it = this->
_container.find(provSeg.name());
315 it = this->_container
316 .emplace(provSeg.name(),
317 this->id().withProviderSegmentName(provSeg.name()))
319 it->second.aronType() = provSeg.aronType();
330 it->second.append(provSeg);
349 providerSegmentType ? providerSegmentType : this->
aronType();
357 return this->
_derived().addProviderSegment(providerSegment.name(),
365 const std::string
name = providerSegment.name();
366 return this->
_derived().addProviderSegment(name, std::move(providerSegment));
370 template <
class... Args>
374 ChildT& child = this->
template _addChild<ChildT>(
name, args...);
385 if (this->
size() != other.size())
389 for (
const auto& [key, provider] : this->
_container)
391 if (not other.hasProviderSegment(key))
395 if (not provider.equalsDeep(other.getProviderSegment(key)))
406 return "core segment";
417 template <
class ParentT>
421 decltype(parent.findEntity(entityName)) result =
nullptr;
422 parent.forEachProviderSegment(
423 [&result, &entityName](
auto& provSeg)
425 result = provSeg.findEntity(entityName);
426 return result ==
nullptr;
431 std::pair<bool, ProviderSegmentT*>
436 auto it = this->
_container.find(providerSegmentName);
439 if (_addMissingProviderSegmentDuringUpdate)
443 return {
true, provSeg};
447 throw error::MissingEntry::create<ProviderSegmentT>(providerSegmentName, *
this);
452 provSeg = &it->second;
453 return {
false, provSeg};
459 bool _addMissingProviderSegmentDuringUpdate =
true;
void checkHasProviderSegmentName(const MemoryID &providerSegmentID)
Throw armem::error::InvalidMemoryID if the given ID has provider segment name.
EntityT * findEntity(const std::string &entityName)
ReaderT::InputType T & ret
const ProviderSegmentT & getProviderSegment(const MemoryID &providerSegmentID) const
std::string getKeyString() const
CoreSegmentBase(const std::string &name, const MemoryID &parentID, aron::type::ObjectPtr aronType=nullptr, const std::vector< PredictionEngine > &predictionEngines={})
CoreSegmentBase(const std::string &name, aron::type::ObjectPtr aronType=nullptr, const std::vector< PredictionEngine > &predictionEngines={})
std::string providerSegmentName
AronTyped(aron::type::ObjectPtr aronType=nullptr)
bool hasProviderSegment(const std::string &name) const
bool forEachChild(ChildFunctionT &&func)
aron::type::ObjectPtr & aronType()
Something that supports a set of prediction engines.
static auto * _findEntity(ParentT &&parent, const std::string &entityName)
Provides default implmentations of MemoryContainer, as well as iterators (which requires a template).
ProviderSegmentT * findProviderSegment(const std::string &name)
bool equalsDeep(const DerivedT &other) const
std::string coreSegmentName
std::vector< std::string > getProviderSegmentNames() const
Data of a core segment containing multiple provider segments.
const EntityT * findEntity(const std::string &entityName) const
MemoryID withProviderSegmentName(const std::string &name) const
ProviderSegment ProviderSegmentT
void append(const OtherDerivedT &other)
bool forEachInstanceIn(const MemoryID &id, InstanceFunctionT &&func)
UpdateType
The type of an update.
MemoryID withCoreSegmentName(const std::string &name) const
bool hasProviderSegment(const MemoryID &providerSegmentID) const
auto * findChildByKey(const KeyT &key, ContainerT &&container)
Find a child in a container by its key.
bool forEachInstanceIn(const MemoryID &id, InstanceFunctionT &&func) const
bool forEachProviderSegment(ProviderSegmentFunctionT &&func)
UpdateResult update(const EntityUpdate &update)
Updates an entity's history.
ProviderSegmentT & addProviderSegment(const std::string &name, aron::type::ObjectPtr providerSegmentType=nullptr, const std::vector< PredictionEngine > &predictionEngines={})
Add an empty provider segment with the given name, optional provider segment type and prediction engi...
An update of an entity for a specific point in time.
ProviderSegmentT & getProviderSegment(const std::string &name)
armarx::armem::UpdateType providerSegmentUpdateType
ProviderSegmentT & addProviderSegment(const ProviderSegmentT &providerSegment)
Copy and insert a provider segment.
armarx::armem::UpdateType entityUpdateType
const std::string & name() const
auto & getChildByKey(const KeyT &key, ContainerT &&container, const ParentT &owner, KeyStringFn &&keyStringFn)
Retrieve a child in a container by its key.
bool forEachProviderSegment(ProviderSegmentFunctionT &&func) const
typename ProviderSegmentT::EntityT EntityT
bool forEachInstanceIn(const MemoryID &id, FunctionT &&func, ParentT &parent, bool single, ChildT *child)
std::map< std::string, _ProviderSegmentT > ContainerT
CoreSegmentBase & operator=(const CoreSegmentBase &other)=default
ProviderSegmentT & addProviderSegment(ProviderSegmentT &&providerSegment)
Move and insert a provider segment.
std::vector< EntitySnapshotT > removedSnapshots
armarx::armem::UpdateType coreSegmentUpdateType
const ProviderSegmentT & getProviderSegment(const std::string &name) const
ProviderSegmentT & addProviderSegment(const std::string &name, Args... args)
Insert a provider segment in-place.
typename EntityT::EntitySnapshotT EntitySnapshotT
Something with a specific ARON type.
const ProviderSegmentT * findProviderSegment(const std::string &name) const
ProviderSegmentT & getProviderSegment(const MemoryID &providerSegmentID)
CoreSegmentBase(const MemoryID &id, aron::type::ObjectPtr aronType=nullptr, const std::vector< PredictionEngine > &predictionEngines={})
std::pair< bool, ProviderSegmentT * > _addProviderSegmentIfMissing(const std::string &providerSegmentName)
ProviderSegmentT * findProviderSegment(const MemoryID &providerSegmentID)
typename EntitySnapshotT::EntityInstanceT EntityInstanceT
bool hasEntity(const std::string &entityName) const
std::shared_ptr< Object > ObjectPtr
const std::vector< PredictionEngine > & predictionEngines() const
static std::string getLevelName()
MemoryID entityID
The entity's ID.
UpdateResult(const typename ProviderSegmentT::UpdateResult &c)
const ProviderSegmentT * findProviderSegment(const MemoryID &providerSegmentID) const
void _checkContainerName(const std::string &gottenName, const std::string &actualName, bool emptyOk=true) const
const armem::MemoryID MemoryID