23 template <
class _EntityInstanceT,
class _Derived>
74 return not this->
empty();
102 const size_t si =
static_cast<size_t>(
index);
176 template <
class InstanceFunctionT>
186 template <
class InstanceFunctionT>
196 template <
class InstanceFunctionT>
200 if (
id.hasInstanceIndex())
214 template <
class InstanceFunctionT>
218 if (
id.hasInstanceIndex())
233 std::vector<int> indices;
234 indices.reserve(this->
size());
235 for (
size_t i = 0; i < this->
size(); ++i)
237 indices.push_back(
static_cast<int>(i));
272 if (instance.index() > 0 &&
273 static_cast<size_t>(instance.index()) > this->_container.size())
276 std::to_string(instance.index()),
277 "EntitySnapshot::addInstance",
278 "Cannot add an EntityInstance because its index is too big.");
281 int index = instance.index();
292 int index =
static_cast<int>(
305 if (this->
size() != other.size())
312 if (not instance.equalsDeep(other.getInstance(i)))
330 return "entity snapshot";
MemoryID withInstanceIndex(int index) const
Data of an entity at one point in time.
bool hasInstance(const MemoryID &instanceID) const
bool forEachInstanceIn(const MemoryID &id, InstanceFunctionT &&func)
const Time & time() const
EntityInstanceT & addInstance(EntityInstanceT &&instance)
bool hasInstance(int index) const
bool equalsDeep(const DerivedT &other) const
EntityInstanceT & addInstance(const EntityInstanceT &instance)
Add a single instance with data.
EntityInstanceT * findInstance(int index)
const EntityInstanceT * findInstance(const MemoryID &instanceID) const
EntitySnapshotBase(const EntitySnapshotBase &other)=default
bool forEachInstanceIn(const MemoryID &id, InstanceFunctionT &&func) const
bool forEachInstance(InstanceFunctionT &&func)
EntityInstanceT & getInstance(int index)
Get the given instance.
const EntityInstanceT * findInstance(int index) const
static std::string getLevelName()
EntityInstanceT * findInstance(const MemoryID &instanceID)
EntitySnapshotBase & operator=(EntitySnapshotBase &&other)=default
EntityInstanceT & getInstance(const MemoryID &instanceID)
Get the given instance.
const EntityInstanceT & getInstance(const MemoryID &instanceID) const
EntityInstanceT & addInstance()
bool hasInstances() const
Indicate whether this snapshot has any instances.
EntitySnapshotBase(Time time, const MemoryID &parentID={})
void update(const EntityUpdate &update)
std::string getKeyString() const
EntitySnapshotBase(EntitySnapshotBase &&other)=default
EntitySnapshotBase(const MemoryID &id)
bool forEachInstance(InstanceFunctionT &&func) const
const EntityInstanceT & getInstance(int index) const
EntitySnapshotBase & operator=(const EntitySnapshotBase &other)=default
_EntityInstanceT EntityInstanceT
std::vector< int > getInstanceIndices() const
Provides default implmentations of MemoryContainer, as well as iterators (which requires a template).
bool forEachChild(ChildFunctionT &&func)
std::vector< _EntityInstanceT > ContainerT
Indicates that an argument was invalid.
static MissingEntry create(const std::string &missingKey, const ContainerT &container)
void checkHasInstanceIndex(const MemoryID &instanceID)
Throw armem::error::InvalidMemoryID if the given ID has no instance index.
void throwIfNotEqual(const Time &ownTime, const Time &updateTime)
bool call(FunctionT &&func, ChildT &&child)
std::string toDateTimeMilliSeconds(const Time &time, int decimals=6)
Returns timeas e.g.
armarx::core::time::DateTime Time
An update of an entity for a specific point in time.