Belle II Software development
WrapperModule Class Reference
Inheritance diagram for WrapperModule:
IfModule PyProfilingModule IfStoreArrayPresentModule IfMCParticlesPresentModule IfStoreArrayNotPresentModule

Public Member Functions

def __init__ (self, module)
 
def wrapper_name (self)
 
def param (self)
 
def available_params (self)
 
def compose_wrapped_module_name (self, module)
 
def get_name (self)
 
def initialize (self)
 
def beginRun (self)
 
def event (self)
 
def endRun (self)
 
def terminate (self)
 

Public Attributes

 module
 The wrapped module.
 

Detailed Description

Wrapping module base class that wraps a single module to slightly change its behaviour.

The base implementation does nothing, but forward the relevant methods to the wrapped module.

Note:
  Implements the decorator/wrapper pattern.

Attributes:
  module (basf2.Module): The wrapped module instance.

Definition at line 33 of file metamodules.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  module 
)
Create a new wrapper module around the given module. This base implementation does not change anything,
   so there is no reason to use this base implementation alone.

Reimplemented in IfMCParticlesPresentModule, IfModule, PyProfilingModule, and IfStoreArrayPresentModule.

Definition at line 46 of file metamodules.py.

46 def __init__(self, module):
47 """Create a new wrapper module around the given module. This base implementation does not change anything,
48 so there is no reason to use this base implementation alone."""
49 super().__init__()
50 name = self.compose_wrapped_module_name(module)
51
52
53 self.module = module
54
55 # Forward the logging parameters
56 self.set_debug_level(self.module.logging.debug_level)
57 self.set_abort_level(self.module.logging.abort_level)
58
59 if self.module.logging.log_level != basf2.LogLevel.default:
60 self.set_log_level(self.module.logging.log_level)
61 self.set_log_info(self.module.logging.log_level,
62 self.module.logging.get_info(self.module.logging.log_level))
63
64 # Forward the name of this module to the C++ world
65 self.set_name(name)
66

Member Function Documentation

◆ available_params()

def available_params (   self)
Forwards the available parameters

Definition at line 78 of file metamodules.py.

78 def available_params(self):
79 """Forwards the available parameters"""
80 return self.module.available_params
81

◆ beginRun()

def beginRun (   self)
Begin run method of the module

Definition at line 94 of file metamodules.py.

94 def beginRun(self):
95 """Begin run method of the module"""
96 self.module.beginRun()
97

◆ compose_wrapped_module_name()

def compose_wrapped_module_name (   self,
  module 
)
Compose a name that indicates the wrapped module.

Definition at line 82 of file metamodules.py.

82 def compose_wrapped_module_name(self, module):
83 """Compose a name that indicates the wrapped module."""
84 return f"{self.wrapper_name}({module.name()})"
85

◆ endRun()

def endRun (   self)
End run method of the module

Definition at line 102 of file metamodules.py.

102 def endRun(self):
103 """End run method of the module"""
104 self.module.endRun()
105

◆ event()

def event (   self)
Event method of the module

Reimplemented in PyProfilingModule, and IfModule.

Definition at line 98 of file metamodules.py.

98 def event(self):
99 """Event method of the module"""
100 self.module.event()
101

◆ get_name()

def get_name (   self)
Forwards the name().

Definition at line 86 of file metamodules.py.

86 def get_name(self):
87 """Forwards the name()."""
88 return self.name()
89

◆ initialize()

def initialize (   self)
Initialize method of the module

Reimplemented in PyProfilingModule, and IfStoreArrayPresentModule.

Definition at line 90 of file metamodules.py.

90 def initialize(self):
91 """Initialize method of the module"""
92 self.module.initialize()
93

◆ param()

def param (   self)
Forwards the parameters

Definition at line 73 of file metamodules.py.

73 def param(self):
74 """Forwards the parameters"""
75 return self.module.param
76

◆ terminate()

def terminate (   self)
Terminate method of the module

Reimplemented in PyProfilingModule.

Definition at line 106 of file metamodules.py.

106 def terminate(self):
107 """Terminate method of the module"""
108 self.module.terminate()
109
110

◆ wrapper_name()

def wrapper_name (   self)
Name of the wrapper class.

Definition at line 68 of file metamodules.py.

68 def wrapper_name(self):
69 """Name of the wrapper class."""
70 return self.__class__.__name__
71

Member Data Documentation

◆ module

module

The wrapped module.

Definition at line 53 of file metamodules.py.


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