Belle II Software development
StoreArray.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <framework/datastore/StoreArray.h>
10
11#include <framework/datastore/RelationArray.h>
12
13using namespace std;
14using namespace Belle2;
15
17{
18 auto related_arrays = DataStore::Instance().getListOfRelatedArrays(array);
19
20 for (const std::string& other_name : related_arrays) {
21 RelationArray a(DataStore::relationName(other_name, array.getName()), array.getDurability());
22 RelationArray b(DataStore::relationName(array.getName(), other_name), array.getDurability());
23 if (a.isValid())
24 a.clear();
25 if (b.isValid())
26 b.clear();
27 }
28}
std::vector< std::string > getListOfRelatedArrays(const StoreAccessorBase &array) const
Returns a list of names of arrays which have registered relations that point to or from 'array'.
Definition: DataStore.cc:640
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
static std::string relationName(const std::string &fromName, const std::string &toName, std::string const &namedRelation="")
Return storage name for a relation between two arrays of the given names.
Definition: DataStore.h:180
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:62
Base class for StoreObjPtr and StoreArray for easier common treatment.
DataStore::EDurability getDurability() const
Return durability with which the object is saved in the DataStore.
const std::string & getName() const
Return name under which the object is saved in the DataStore.
void clearRelations(const StoreAccessorBase &array)
clear all relations touching the given array.
Definition: StoreArray.cc:16
Abstract base class for different kinds of events.
STL namespace.