21 template <
class _EntityT,
class _Derived>
104 inline const std::string&
191 template <
class EntityFunctionT>
201 template <
class EntityFunctionT>
214 template <
class InstanceFunctionT>
222 id.hasEntityName() ? this->
findEntity(
id.entityName)
229 template <
class InstanceFunctionT>
237 id.hasEntityName() ? this->
findEntity(
id.entityName)
242 std::vector<std::string>
245 return simox::alg::get_keys(this->
_container);
276 UpdateResult ret(entity->update(
update));
277 ret.providerSegmentUpdateType = updateType;
281 template <
class OtherDerivedT>
286 [
this](
const auto& entity)
288 auto it = this->
_container.find(entity.name());
292 .emplace(entity.name(), this->id().withEntityName(entity.name()))
295 it->second.append(entity);
318 const std::string
name = entity.name();
319 return this->
_derived().addEntity(name, std::move(entity));
323 template <
class... Args>
337 if (this->
size() != other.size())
341 for (
const auto& [key, value] : this->
_container)
343 if (not other.hasEntity(key))
348 if (not value.equalsDeep(other.getEntity(key)))
359 return "provider segment";
MemoryID withEntityName(const std::string &name) const
std::string providerSegmentName
Data of a provider segment containing multiple entities.
const EntityT * findEntity(const MemoryID &entityID) const
bool hasEntity(const std::string &name) const
typename EntityT::EntitySnapshotT EntitySnapshotT
ProviderSegmentBase(const MemoryID id, aron::type::ObjectPtr aronType=nullptr, const std::vector< PredictionEngine > &predictionEngines={})
bool forEachInstanceIn(const MemoryID &id, InstanceFunctionT &&func)
const std::string & name() const
EntityT & addEntity(const std::string &name, Args... args)
Insert an entity in-place.
const EntityT & getEntity(const std::string &name) const
ProviderSegmentBase(ProviderSegmentBase &&other)=default
EntityT & getEntity(const std::string &name)
EntityT & getEntity(const MemoryID &entityID)
bool equalsDeep(const DerivedT &other) const
bool forEachEntity(EntityFunctionT &&func) const
ProviderSegmentBase(const std::string &name, const MemoryID parentID, aron::type::ObjectPtr aronType=nullptr, const std::vector< PredictionEngine > &predictionEngines={})
bool forEachEntity(EntityFunctionT &&func)
EntityT * findEntity(const std::string &name)
std::vector< std::string > getEntityNames() const
EntityT & addEntity(EntityT &&entity)
Move and insert an entity.
const EntityT & getEntity(const MemoryID &entityID) const
bool forEachInstanceIn(const MemoryID &id, InstanceFunctionT &&func) const
EntityT & addEntity(const EntityT &entity)
Copy and insert an entity.
EntityT * findEntity(const MemoryID &entityID)
static std::string getLevelName()
EntityT & addEntity(const std::string &name)
Add an empty entity with the given name.
void append(const OtherDerivedT &other)
typename EntitySnapshotT::EntityInstanceT EntityInstanceT
bool hasEntity(const MemoryID &entityID) const
ProviderSegmentBase(const ProviderSegmentBase &other)=default
std::string getKeyString() const
ProviderSegmentBase(const std::string &name, aron::type::ObjectPtr aronType=nullptr, const std::vector< PredictionEngine > &predictionEngines={})
const EntityT * findEntity(const std::string &name) const
UpdateResult update(const EntityUpdate &update)
Updates an entity's history.
ProviderSegmentBase & operator=(const ProviderSegmentBase &other)=default
ProviderSegmentBase & operator=(ProviderSegmentBase &&other)=default
Something with a specific ARON type.
aron::type::ObjectPtr & aronType()
AronTyped(aron::type::ObjectPtr aronType=nullptr)
Provides default implmentations of MemoryContainer, as well as iterators (which requires a template).
bool forEachChild(ChildFunctionT &&func)
std::map< std::string, _EntityT > ContainerT
ChildT & _addChild(const KeyT &key, ChildArgs... childArgs)
void _checkContainerName(const std::string &gottenName, const std::string &actualName, bool emptyOk=true) const
Something that supports a set of prediction engines.
Predictive(const std::vector< PredictionEngine > &engines={})
const std::vector< PredictionEngine > & predictionEngines() const
auto & getChildByKey(const KeyT &key, ContainerT &&container, const ParentT &owner, KeyStringFn &&keyStringFn)
Retrieve a child in a container by its key.
void checkHasEntityName(const MemoryID &entityID)
Throw armem::error::InvalidMemoryID if the given ID has no entity name.
bool forEachInstanceIn(const MemoryID &id, FunctionT &&func, ParentT &parent, bool single, ChildT *child)
auto * findChildByKey(const KeyT &key, ContainerT &&container)
Find a child in a container by its key.
UpdateType
The type of an update.
std::shared_ptr< Object > ObjectPtr
An update of an entity for a specific point in time.
MemoryID entityID
The entity's ID.
std::vector< EntitySnapshotT > updatedSnapshots
armarx::armem::UpdateType entityUpdateType
std::vector< EntitySnapshotT > removedSnapshots
UpdateResult(const typename EntityT::UpdateResult &c)
armarx::armem::UpdateType providerSegmentUpdateType