8#include <framework/datastore/RelationVector.h>
9#include <framework/datastore/RelationArray.h>
14 const std::function<
void(std::vector<RelationElement::index_type>&, std::vector<RelationElement::weight_type>&,
size_t)>& f)
23 unsigned int fromIndex, toIndex;
27 B2FATAL(
"RelationVectorBase points to object not in DataStore?");
34 fromIndex = otherIndex;
41 if (rel[i].getFromIndex() == fromIndex) {
42 auto& toIndices =
const_cast<std::vector<RelationElement::index_type>&
>(rel[i].getToIndices());
43 auto& toWeights =
const_cast<std::vector<RelationElement::weight_type>&
>(rel[i].getWeights());
44 for (
size_t j = 0; j < toIndices.size(); j++) {
46 if (toIndices[j] == toIndex and toWeights[j] == objweight) {
47 f(toIndices, toWeights, j);
56 B2FATAL(
"RelationVectorBase and DataStore differ!??");
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
static DataStore & Instance()
Instance of singleton Store.
Low-level class to create/modify relations between StoreArrays.
const AccessorParams & getFromAccessorParams() const
Return the AccessorParams the attached relation points from.
const AccessorParams & getToAccessorParams() const
Return the AccessorParams the attached relation points to.
void setModified(bool modified)
Set modified flag of underlying container.
int getEntries() const
Get the number of elements.
void apply(int index, const std::function< void(std::vector< unsigned int > &, std::vector< float > &, size_t)> &f)
apply function to the relation associated with the RelationEntry at given index.
void add(const RelationVectorBase &other)
add another list of relations.
std::vector< RelationEntry > m_relations
The vector of relation entries.
RelationVectorBase()
Construct empty set.
int m_index
index of object these relations belong to.
std::string m_name
entry name of array containing object these relations belong to.
std::vector< std::string > m_relationNames
Names of associated relations.
Abstract base class for different kinds of events.
Wraps a stored array/object, stored under unique (name, durability) key.
std::string name
Name of the entry.