11#include <framework/datastore/RelationEntry.h>
12#include <framework/utilities/ArrayIterator.h>
30 RelationVectorBase(
const std::string& name,
int index,
const std::vector<Belle2::RelationEntry>& relations,
38 void apply(
int index,
const std::function<
void(std::vector<unsigned int>&, std::vector<float>&,
size_t)>& f);
121 apply(index, [](std::vector<unsigned int>& indices, std::vector<float>& weights,
123 indices.erase(indices.begin() + elidx);
124 weights.erase(weights.begin() + elidx);
133 apply(index, [
weight](std::vector<unsigned int>&, std::vector<float>& weights,
size_t elidx) {
Generic iterator class for arrays, allowing use of STL algorithms, range-based for etc.
In the store you can park objects that have to be accessed by various modules.
base class for RelationVector<T>
RelationVectorBase(const std::string &name, int index, const std::vector< Belle2::RelationEntry > &relations, const std::vector< std::string > &names)
Constructor.
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.
Class for type safe access to objects that are referred to in relations.
void setWeight(int index, float weight)
Set a new weight for the given relation.
T * object(int index) const
Get object with index.
size_t size() const
Get number of relations.
const_iterator begin() const
Return const_iterator to first entry.
void remove(int index)
Remove relation at given index.
ArrayIterator< RelationVector< T >, const T > const_iterator
STL-like const_iterator over the T objects (not T* ).
RelationVector(const RelationVectorBase &b)
Constructor.
ArrayIterator< RelationVector< T >, T > iterator
STL-like iterator over the T objects (not T* ).
iterator end()
Return iterator to last entry +1.
const_iterator end() const
Return const_iterator to last entry +1.
T * operator[](int index) const
Get object with index.
iterator begin()
Return iterator to first entry.
float weight(int index) const
Get weight with index.
const std::vector< Belle2::RelationEntry > & relations() const
Accessor for the relations vector.
Abstract base class for different kinds of events.