Belle II Software  release-05-01-25
DependencyMap.cc
1 #include <framework/datastore/DependencyMap.h>
2 #include <framework/core/Module.h>
3 
4 #include <algorithm>
5 
6 using namespace std;
7 using namespace Belle2;
8 
9 std::string DependencyMap::getModuleID(const Module& mod)
10 {
11  return mod.getType() + std::to_string(long(&mod));
12 }
13 
14 void DependencyMap::ModuleInfo::addEntry(const std::string& name, EEntryType type, bool isRelation)
15 {
16  if (isRelation)
17  relations[type].insert(name);
18  else
19  entries[type].insert(name);
20 }
21 
22 bool DependencyMap::isUsedAs(const std::string& branchName, EEntryType type) const
23 {
24  return any_of(m_moduleInfo.begin(), m_moduleInfo.end(),
25  [branchName, type](const pair<string, ModuleInfo>& info) {
26  if (info.second.entries[type].count(branchName))
27  return true;
28  return (bool)info.second.relations[type].count(branchName);
29  });
30 }
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::DependencyMap::EEntryType
EEntryType
Possible types of entries/relations for a module.
Definition: DependencyMap.h:25