Go to the documentation of this file.
21 template <
class _Prov
iderSegmentT,
class _Derived>
41 using EntityT =
typename ProviderSegmentT::EntityT;
110 inline const std::string&
197 return this->
findEntity(entityName) !=
nullptr;
217 template <
class Prov
iderSegmentFunctionT>
227 template <
class Prov
iderSegmentFunctionT>
242 template <
class InstanceFunctionT>
249 id.hasProviderSegmentName(),
250 id.hasProviderSegmentName()
258 template <
class InstanceFunctionT>
265 id.hasProviderSegmentName(),
266 id.hasProviderSegmentName()
272 std::vector<std::string>
275 return simox::alg::get_keys(this->
_container);
290 auto [inserted, provSeg] =
295 UpdateResult
ret(provSeg->update(
update));
307 template <
class OtherDerivedT>
311 other.forEachProviderSegment(
312 [
this](
const auto& provSeg)
314 auto it = this->
_container.find(provSeg.name());
317 it = this->_container
318 .emplace(provSeg.name(),
319 this->id().withProviderSegmentName(provSeg.name()))
321 it->second.aronType() = provSeg.aronType();
332 it->second.append(provSeg);
351 providerSegmentType ? providerSegmentType : this->
aronType();
359 return this->
_derived().addProviderSegment(providerSegment.name(),
367 const std::string
name = providerSegment.name();
368 return this->
_derived().addProviderSegment(name, std::move(providerSegment));
372 template <
class... Args>
376 ChildT& child = this->
template _addChild<ChildT>(
name, args...);
387 if (this->
size() != other.size())
391 for (
const auto& [key, provider] : this->
_container)
393 if (not other.hasProviderSegment(key))
397 if (not provider.equalsDeep(other.getProviderSegment(key)))
408 return "core segment";
419 template <
class ParentT>
423 decltype(parent.findEntity(entityName)) result =
nullptr;
424 parent.forEachProviderSegment(
425 [&result, &entityName](
auto& provSeg)
427 result = provSeg.findEntity(entityName);
428 return result ==
nullptr;
433 std::pair<bool, ProviderSegmentT*>
438 auto it = this->
_container.find(providerSegmentName);
441 if (_addMissingProviderSegmentDuringUpdate)
445 return {
true, provSeg};
449 throw error::MissingEntry::create<ProviderSegmentT>(providerSegmentName, *
this);
454 provSeg = &it->second;
455 return {
false, provSeg};
461 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)
std::vector< EntitySnapshotT > updatedSnapshots
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