Belle II Software development
DependencyMap.h
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#pragma once
9
10#include <map>
11#include <set>
12#include <string>
13
14namespace Belle2 {
19 class Module;
20
30 public:
38 };
39
41 struct ModuleInfo {
42 std::set<std::string> entries[c_NEntryTypes];
43 std::set<std::string> relations[c_NEntryTypes];
46 void addEntry(const std::string& name, EEntryType type, bool isRelation);
47 };
48
50 static std::string getModuleID(const Module& mod);
51
57 bool isUsedAs(const std::string& branchName, EEntryType type) const;
58
60 void setModule(const Module& mod) { m_currentModule = getModuleID(mod); }
61
64
66 const std::map<std::string, ModuleInfo>& getModuleInfoMap() const { return m_moduleInfo; }
67
69 void clear() { m_moduleInfo.clear(); m_currentModule.clear(); }
70
71 private:
73 std::map<std::string, ModuleInfo> m_moduleInfo;
74
76 std::string m_currentModule;
77 };
79}
Collect information about the dependencies between modules.
Definition: DependencyMap.h:29
EEntryType
Possible types of entries/relations for a module.
Definition: DependencyMap.h:32
@ c_Input
required input.
Definition: DependencyMap.h:33
@ c_NEntryTypes
size of this enum.
Definition: DependencyMap.h:37
@ c_Output
registered output.
Definition: DependencyMap.h:35
@ c_OptionalInput
optional input.
Definition: DependencyMap.h:34
ModuleInfo & getCurrentModuleInfo()
Get info for current module.
Definition: DependencyMap.h:63
void setModule(const Module &mod)
Set the current module (for getCurrentModuleInfo())
Definition: DependencyMap.h:60
std::map< std::string, ModuleInfo > m_moduleInfo
Stores information on inputs/outputs of each module, as obtained by requireInput()/optionalInput()/re...
Definition: DependencyMap.h:73
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:66
static std::string getModuleID(const Module &mod)
Return unique ID for given module.
std::string m_currentModule
Stores the current module, used to fill m_moduleInfo.
Definition: DependencyMap.h:76
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)?
void clear()
Reset all collected data.
Definition: DependencyMap.h:69
Base class for Modules.
Definition: Module.h:72
Abstract base class for different kinds of events.
Stores information on inputs/outputs of a module, as obtained by requireInput()/optionalInput()/regis...
Definition: DependencyMap.h:41
std::set< std::string > entries[c_NEntryTypes]
objects/arrays.
Definition: DependencyMap.h:42
std::set< std::string > relations[c_NEntryTypes]
relations between them.
Definition: DependencyMap.h:43
void addEntry(const std::string &name, EEntryType type, bool isRelation)
Adds given entry/relation.