Go to the documentation of this file.
21 template <
class _Prov
iderSegmentT,
class _Derived>
41 using EntityT =
typename ProviderSegmentT::EntityT;
104 inline const std::string&
name()
const
176 return this->
findEntity(entityName) !=
nullptr;
193 template <
class Prov
iderSegmentFunctionT>
201 template <
class Prov
iderSegmentFunctionT>
215 template <
class InstanceFunctionT>
220 id.hasProviderSegmentName(),
221 id.hasProviderSegmentName() ? this->
findProviderSegment(
id.providerSegmentName) :
nullptr);
226 template <
class InstanceFunctionT>
231 id.hasProviderSegmentName(),
232 id.hasProviderSegmentName() ? this->
findProviderSegment(
id.providerSegmentName) :
nullptr);
239 return simox::alg::get_keys(this->
_container);
258 UpdateResult
ret(provSeg->update(
update));
271 template <
class OtherDerivedT>
274 other.forEachProviderSegment([
this](
const auto& provSeg)
276 auto it = this->
_container.find(provSeg.name());
279 it = this->_container.emplace(provSeg.name(), this->id().withProviderSegmentName(provSeg.name())).first;
281 it->second.append(provSeg);
312 const std::string
name = providerSegment.name();
313 return this->
_derived().addProviderSegment(name, std::move(providerSegment));
317 template <
class ...Args>
320 ChildT& child = this->
template _addChild<ChildT>(
name, args...);
331 if (this->
size() != other.size())
335 for (
const auto& [key, provider] : this->
_container)
337 if (not other.hasProviderSegment(key))
341 if (not provider.equalsDeep(other.getProviderSegment(key)))
351 return "core segment";
362 template <
class ParentT>
367 decltype(parent.findEntity(entityName)) result =
nullptr;
368 parent.forEachProviderSegment([&result, &entityName](
auto & provSeg)
370 result = provSeg.findEntity(entityName);
371 return result ==
nullptr;
377 std::pair<bool, ProviderSegmentT*>
382 auto it = this->
_container.find(providerSegmentName);
385 if (_addMissingProviderSegmentDuringUpdate)
389 return {
true, provSeg};
393 throw error::MissingEntry::create<ProviderSegmentT>(providerSegmentName, *
this);
398 provSeg = &it->second;
399 return {
false, provSeg};
406 bool _addMissingProviderSegmentDuringUpdate =
true;
void checkHasProviderSegmentName(const MemoryID &providerSegmentID)
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)
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
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
auto & getChildByKey(const KeyT &key, ContainerT &&container, const ParentT &parent, KeyStringFn &&keyStringFn)
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