Belle II Software  release-05-02-19
DependencyMap.h
1 #pragma once
2 
3 #include <map>
4 #include <set>
5 #include <string>
6 
7 namespace Belle2 {
12  class Module;
13 
22  class DependencyMap {
23  public:
25  enum EEntryType {
31  };
32 
34  struct ModuleInfo {
35  std::set<std::string> entries[c_NEntryTypes];
36  std::set<std::string> relations[c_NEntryTypes];
39  void addEntry(const std::string& name, EEntryType type, bool isRelation);
40  };
41 
43  static std::string getModuleID(const Module& mod);
44 
50  bool isUsedAs(const std::string& branchName, EEntryType type) const;
51 
53  void setModule(const Module& mod) { m_currentModule = getModuleID(mod); }
54 
57 
59  const std::map<std::string, ModuleInfo>& getModuleInfoMap() const { return m_moduleInfo; }
60 
62  void clear() { m_moduleInfo.clear(); m_currentModule.clear(); }
63 
64  private:
66  std::map<std::string, ModuleInfo> m_moduleInfo;
67 
69  std::string m_currentModule;
70  };
72 }
Belle2::DependencyMap::clear
void clear()
Reset all collected data.
Definition: DependencyMap.h:62
Belle2::DependencyMap::m_moduleInfo
std::map< std::string, ModuleInfo > m_moduleInfo
Stores information on inputs/outputs of each module, as obtained by requireInput()/optionalInput()/re...
Definition: DependencyMap.h:66
Belle2::DependencyMap
Collect information about the dependencies between modules.
Definition: DependencyMap.h:22
Belle2::DependencyMap::c_Output
@ c_Output
registered output.
Definition: DependencyMap.h:28
Belle2::DependencyMap::setModule
void setModule(const Module &mod)
Set the current module (for getCurrentModuleInfo())
Definition: DependencyMap.h:53
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::DependencyMap::ModuleInfo::addEntry
void addEntry(const std::string &name, EEntryType type, bool isRelation)
Adds given entry/relation.
Definition: DependencyMap.cc:14
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::DependencyMap::c_NEntryTypes
@ c_NEntryTypes
size of this enum.
Definition: DependencyMap.h:30
Belle2::DependencyMap::getCurrentModuleInfo
ModuleInfo & getCurrentModuleInfo()
Get info for current module.
Definition: DependencyMap.h:56
Belle2::DependencyMap::getModuleID
static std::string getModuleID(const Module &mod)
Return unique ID for given module.
Definition: DependencyMap.cc:9
Belle2::DependencyMap::isUsedAs
bool isUsedAs(const std::string &branchName, EEntryType type) const
Is the object/array/relation with given name used as specified input/output type (in any module)?
Definition: DependencyMap.cc:22
Belle2::DependencyMap::c_Input
@ c_Input
required input.
Definition: DependencyMap.h:26
Belle2::DependencyMap::getModuleInfoMap
const std::map< std::string, ModuleInfo > & getModuleInfoMap() const
return information on inputs/outputs of each module, as obtained by requireInput()/optionalInput()/re...
Definition: DependencyMap.h:59
Belle2::DependencyMap::m_currentModule
std::string m_currentModule
Stores the current module, used to fill m_moduleInfo.
Definition: DependencyMap.h:69
Belle2::DependencyMap::EEntryType
EEntryType
Possible types of entries/relations for a module.
Definition: DependencyMap.h:25
Belle2::DependencyMap::c_OptionalInput
@ c_OptionalInput
optional input.
Definition: DependencyMap.h:27
Belle2::DependencyMap::ModuleInfo::relations
std::set< std::string > relations[c_NEntryTypes]
relations between them.
Definition: DependencyMap.h:36
Belle2::DependencyMap::ModuleInfo
Stores information on inputs/outputs of a module, as obtained by requireInput()/optionalInput()/regis...
Definition: DependencyMap.h:34
Belle2::DependencyMap::ModuleInfo::entries
std::set< std::string > entries[c_NEntryTypes]
objects/arrays.
Definition: DependencyMap.h:35