Belle II Software development
DependencyMap Class Reference

Collect information about the dependencies between modules. More...

#include <DependencyMap.h>

Classes

struct  ModuleInfo
 Stores information on inputs/outputs of a module, as obtained by requireInput()/optionalInput()/registerEntry();. More...
 

Public Types

enum  EEntryType {
  c_Input ,
  c_OptionalInput ,
  c_Output ,
  c_NEntryTypes
}
 Possible types of entries/relations for a module. More...
 

Public Member Functions

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 setModule (const Module &mod)
 Set the current module (for getCurrentModuleInfo())
 
ModuleInfogetCurrentModuleInfo ()
 Get info for current module.
 
const std::map< std::string, ModuleInfo > & getModuleInfoMap () const
 return information on inputs/outputs of each module, as obtained by requireInput()/optionalInput()/registerEntry();
 
void clear ()
 Reset all collected data.
 

Static Public Member Functions

static std::string getModuleID (const Module &mod)
 Return unique ID for given module.
 

Private Attributes

std::map< std::string, ModuleInfom_moduleInfo
 Stores information on inputs/outputs of each module, as obtained by requireInput()/optionalInput()/registerEntry();.
 
std::string m_currentModule
 Stores the current module, used to fill m_moduleInfo.
 

Detailed Description

Collect information about the dependencies between modules.

Filled inside DataStore during register/require/optional, and used by the –visualize-dataflow and –module-io arguments to basf2 to create graphs of data dependencies.

See also
DataFlowVisualization

Definition at line 29 of file DependencyMap.h.

Member Enumeration Documentation

◆ EEntryType

enum EEntryType

Possible types of entries/relations for a module.

Enumerator
c_Input 

required input.

c_OptionalInput 

optional input.

c_Output 

registered output.

c_NEntryTypes 

size of this enum.

Definition at line 32 of file DependencyMap.h.

32 {
33 c_Input,
35 c_Output,
38 };
@ 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

Member Function Documentation

◆ clear()

void clear ( )
inline

Reset all collected data.

Definition at line 69 of file DependencyMap.h.

69{ m_moduleInfo.clear(); m_currentModule.clear(); }
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
std::string m_currentModule
Stores the current module, used to fill m_moduleInfo.
Definition: DependencyMap.h:76

◆ getCurrentModuleInfo()

ModuleInfo & getCurrentModuleInfo ( )
inline

Get info for current module.

Definition at line 63 of file DependencyMap.h.

◆ getModuleID()

std::string getModuleID ( const Module mod)
static

Return unique ID for given module.

Definition at line 16 of file DependencyMap.cc.

17{
18 return mod.getType() + std::to_string(long(&mod));
19}

◆ getModuleInfoMap()

const std::map< std::string, ModuleInfo > & getModuleInfoMap ( ) const
inline

return information on inputs/outputs of each module, as obtained by requireInput()/optionalInput()/registerEntry();

Definition at line 66 of file DependencyMap.h.

66{ return m_moduleInfo; }

◆ 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)?

E.g. is('EventMetaData', c_Output) asks if EventMetaData was registered, is('EventMetaData', c_Input) asks if any module has it as required input.

Definition at line 29 of file DependencyMap.cc.

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}

◆ setModule()

void setModule ( const Module mod)
inline

Set the current module (for getCurrentModuleInfo())

Definition at line 60 of file DependencyMap.h.

static std::string getModuleID(const Module &mod)
Return unique ID for given module.

Member Data Documentation

◆ m_currentModule

std::string m_currentModule
private

Stores the current module, used to fill m_moduleInfo.

Definition at line 76 of file DependencyMap.h.

◆ m_moduleInfo

std::map<std::string, ModuleInfo> m_moduleInfo
private

Stores information on inputs/outputs of each module, as obtained by requireInput()/optionalInput()/registerEntry();.

Definition at line 73 of file DependencyMap.h.


The documentation for this class was generated from the following files: