![]() |
Belle II Software
release-05-02-19
|
Class for type safe access to objects that are referred to in relations. More...
#include <RelationVector.h>
Public Types | |
typedef ArrayIterator< RelationVector< T >, T > | iterator |
STL-like iterator over the T objects (not T* ). | |
typedef ArrayIterator< RelationVector< T >, const T > | const_iterator |
STL-like const_iterator over the T objects (not T* ). | |
Public Member Functions | |
RelationVector (const RelationVectorBase &b) | |
Constructor. More... | |
const std::vector< Belle2::RelationEntry > & | relations () const |
Accessor for the relations vector. More... | |
size_t | size () const |
Get number of relations. More... | |
T * | object (int index) const |
Get object with index. More... | |
T * | operator[] (int index) const |
Get object with index. More... | |
float | weight (int index) const |
Get weight with index. More... | |
void | remove (int index) |
Remove relation at given index. More... | |
void | setWeight (int index, float weight) |
Set a new weight for the given relation. | |
iterator | begin () |
Return iterator to first entry. | |
iterator | end () |
Return iterator to last entry +1. | |
const_iterator | begin () const |
Return const_iterator to first entry. | |
const_iterator | end () const |
Return const_iterator to last entry +1. | |
Class for type safe access to objects that are referred to in relations.
Objects of this class are returned by RelationsObject functinons to provide type safe access to the objects in a vector of relations returned by the data store.
Besides accessing objects/weights directly using operator[](int) and weight(int), you can also iterate over the objects directly:
If you want to modify the related objects in the loop body, you can use a non-const reference instead.
Use setWeight() to modify the weight of a single relation. Use remove() to delete a relation.
Definition at line 38 of file DataStore.h.
|
inlineexplicit |
Constructor.
b | Not type-safe base class containing the data |
Definition at line 89 of file RelationVector.h.
|
inline |
Get object with index.
index | Index of relation. |
Definition at line 106 of file RelationVector.h.
|
inline |
Get object with index.
index | Index of relation. |
Definition at line 113 of file RelationVector.h.
|
inline |
Accessor for the relations vector.
Definition at line 95 of file RelationVector.h.
|
inline |
Remove relation at given index.
This will decrease size() by one. Iterators pointing beyond given index will be invalidated when calling this function.
Definition at line 129 of file RelationVector.h.
|
inline |
|
inline |
Get weight with index.
index | Index of relation. |
Definition at line 120 of file RelationVector.h.