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