The Gaudi Framework  master (594c33fa)
GaudiKernel.ConfigurableDb._CfgDb Class Reference
Inheritance diagram for GaudiKernel.ConfigurableDb._CfgDb:
Collaboration diagram for GaudiKernel.ConfigurableDb._CfgDb:

Public Member Functions

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

Private Member Functions

def _loadModule (self, fname)
 

Private Attributes

 _duplicates
 

Static Private Attributes

 __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 28 of file ConfigurableDb.py.

Constructor & Destructor Documentation

◆ __init__()

def GaudiKernel.ConfigurableDb._CfgDb.__init__ (   self)

Definition at line 42 of file ConfigurableDb.py.

42  def __init__(self):
43  object.__init__(self)
44  self._duplicates = {}
45 

Member Function Documentation

◆ _loadModule()

def GaudiKernel.ConfigurableDb._CfgDb._loadModule (   self,
  fname 
)
private

Definition at line 73 of file ConfigurableDb.py.

73  def _loadModule(self, fname):
74  f = open(fname)
75  for i, ll in enumerate(f):
76  l = ll.strip()
77  if l.startswith("#") or len(l) <= 0:
78  continue
79  try:
80  line = l.split()
81  cname = line[2]
82  pkg = line[0].split(".")[0]
83  module = line[0]
84  lib = line[1]
85  self.add(cname, pkg, module, lib)
86  except IndexError:
87  f.close()
88  raise Exception("invalid line format: %s:%d: %r" % (fname, i + 1, ll))
89  f.close()
90 
91 

◆ add()

def 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 46 of file ConfigurableDb.py.

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

◆ duplicates()

def GaudiKernel.ConfigurableDb._CfgDb.duplicates (   self)

Definition at line 70 of file ConfigurableDb.py.

70  def duplicates(self):
71  return self._duplicates
72 

Member Data Documentation

◆ __slots__

GaudiKernel.ConfigurableDb._CfgDb.__slots__
staticprivate

Definition at line 38 of file ConfigurableDb.py.

◆ _duplicates

GaudiKernel.ConfigurableDb._CfgDb._duplicates
private

Definition at line 44 of file ConfigurableDb.py.


The documentation for this class was generated from the following file:
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:50