The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
GaudiKernel.ConfigurableDb._CfgDb Class Reference
Inheritance diagram for GaudiKernel.ConfigurableDb._CfgDb:
Collaboration diagram for GaudiKernel.ConfigurableDb._CfgDb:

Public Member Functions

 __init__ (self)
 add (self, configurable, package, module, lib)
 duplicates (self)

Protected Member Functions

 _loadModule (self, fname)

Protected Attributes

dict _duplicates = {}

Static Private Attributes

dict __slots__

Detailed Description

A singleton class holding informations about automatically generated
Configurables.
 --> package holding that Configurable
 --> library holding the components related to that Configurable
 --> python module holding the Configurable
 --> a dictionary of duplicates

Definition at line 36 of file ConfigurableDb.py.

Constructor & Destructor Documentation

◆ __init__()

GaudiKernel.ConfigurableDb._CfgDb.__init__ ( self)

Definition at line 50 of file ConfigurableDb.py.

50 def __init__(self):
51 object.__init__(self)
52 self._duplicates = {}
53

Member Function Documentation

◆ _loadModule()

GaudiKernel.ConfigurableDb._CfgDb._loadModule ( self,
fname )
protected

Definition at line 81 of file ConfigurableDb.py.

81 def _loadModule(self, fname):
82 f = open(fname)
83 for i, ll in enumerate(f):
84 l = ll.strip()
85 if l.startswith("#") or len(l) <= 0:
86 continue
87 try:
88 line = l.split()
89 cname = line[2]
90 pkg = line[0].split(".")[0]
91 module = line[0]
92 lib = line[1]
93 self.add(cname, pkg, module, lib)
94 except IndexError:
95 f.close()
96 raise Exception(f"invalid line format: {fname}:{i + 1}: {ll}")
97 f.close()
98
99

◆ add()

GaudiKernel.ConfigurableDb._CfgDb.add ( self,
configurable,
package,
module,
lib )
Method to populate the Db.
It is called from the auto-generated Xyz_confDb.py files (genconf.cpp)
@param configurable: the name of the configurable being added
@param package: the name of the package which holds this Configurable
@param module: the name of the python module holding the Configurable
@param lib: the name of the library holding the component(s) (ie: the
            C++ Gaudi component which is mapped by the Configurable)

Definition at line 54 of file ConfigurableDb.py.

54 def add(self, configurable, package, module, lib):
55 """Method to populate the Db.
56 It is called from the auto-generated Xyz_confDb.py files (genconf.cpp)
57 @param configurable: the name of the configurable being added
58 @param package: the name of the package which holds this Configurable
59 @param module: the name of the python module holding the Configurable
60 @param lib: the name of the library holding the component(s) (ie: the
61 C++ Gaudi component which is mapped by the Configurable)
62 """
63 cfg = {"package": package, "module": module, "lib": lib}
64 if configurable in self:
65 # check if it comes from the same library...
66 if cfg["lib"] != self[configurable]["lib"]:
67 log.debug(
68 "dup!! [%s] p=%s m=%s lib=%s", configurable, package, module, lib
69 )
70 if configurable in self._duplicates:
71 self._duplicates[configurable] += [cfg]
72 else:
73 self._duplicates[configurable] = [cfg]
74 else:
75 log.debug("added [%s] p=%s m=%s lib=%s", configurable, package, module, lib)
76 self[configurable] = cfg
77

◆ duplicates()

GaudiKernel.ConfigurableDb._CfgDb.duplicates ( self)

Definition at line 78 of file ConfigurableDb.py.

78 def duplicates(self):
79 return self._duplicates
80

Member Data Documentation

◆ __slots__

dict GaudiKernel.ConfigurableDb._CfgDb.__slots__
staticprivate
Initial value:
= {
"_duplicates": {},
}

Definition at line 46 of file ConfigurableDb.py.

◆ _duplicates

dict GaudiKernel.ConfigurableDb._CfgDb._duplicates = {}
protected

Definition at line 52 of file ConfigurableDb.py.


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