ATLAS Offline Software
Loading...
Searching...
No Matches
python.Dso.DsoDb Class Reference
Inheritance diagram for python.Dso.DsoDb:
Collaboration diagram for python.Dso.DsoDb:

Public Member Functions

 __init__ (self)
 has_type (self, typename)
 load_type (self, typename)
 rflx_type (self, typename)
 visit (self, typename, visitor=None, ctx=None)

Public Attributes

 msg = AthenaCommon.Logging.logging.getLogger("AthenaDsoDb")

Protected Attributes

 _rflx_type = cppyy.gbl.RootType.ByName

Detailed Description

The repository of 'rootmap' files (location, content,...) and a set of
operations one can apply on them (load dict, query dicts,...)

Definition at line 73 of file Control/AthenaServices/python/Dso.py.

Constructor & Destructor Documentation

◆ __init__()

python.Dso.DsoDb.__init__ ( self)

Definition at line 78 of file Control/AthenaServices/python/Dso.py.

78 def __init__(self):
79 super(DsoDb, self).__init__('AthenaDsoDb')
80 import AthenaCommon.Logging
81 self.msg = AthenaCommon.Logging.logging.getLogger("AthenaDsoDb")
82 #self.msg.setLevel(AthenaCommon.Logging.logging.VERBOSE)
83
84 # inject the known aliases NOW
85 for k,v in _aliases.iteritems():
86 try:
87 self.db[k] = self.db[v]
88 except KeyError:
89 self.msg.info("could not install alias [%s] -> [%s]", k,v)
90 # make sure we'll be able to load dicts
91 import cppyy
92 #self._load_dict = cppyy.loadDict
93 self._rflx_type = cppyy.gbl.RootType.ByName
94 return
95

Member Function Documentation

◆ has_type()

python.Dso.DsoDb.has_type ( self,
typename )

Definition at line 96 of file Control/AthenaServices/python/Dso.py.

96 def has_type (self, typename):
97 if typename in _cpp_builtins:
98 return True
99 # need to massage a bit the typename to match ROOT naming convention
100 typename = self._to_rootmap_name (typename)
101 return self.db.has_key (typename) or \
102 self.pf.has_key (typename)
103

◆ load_type()

python.Dso.DsoDb.load_type ( self,
typename )

Definition at line 104 of file Control/AthenaServices/python/Dso.py.

104 def load_type (self, typename):
105 rflx_type = self.rflx_type(typename)
106 if rflx_type is not None:
107 rflx_name = rflx_type.Name(RflxEnums.DICTSCOPE)
108 if rflx_name != '':
109 return rflx_name
110 return None
111

◆ rflx_type()

python.Dso.DsoDb.rflx_type ( self,
typename )

Definition at line 112 of file Control/AthenaServices/python/Dso.py.

112 def rflx_type(self, typename):
113 _rootmap_name = self._to_rootmap_name (typename)
114 _rflx_name = self._to_rflx_name (typename)
115 self.msg.verbose("------- loading type [%s]...", typename)
116
117 if typename in _cpp_builtins:
118 self.msg.verbose(" ==> [ok] (builtin)")
119 return self._rflx_type (_rflx_name)
120
121 if not self.has_type (_rootmap_name):
122 self.msg.verbose(" ==> [err] (no '%s')",_rootmap_name)
123 return None
124 libs = (self.db.get(_rootmap_name) or
125 self.pf.get(_rootmap_name))
126 if libs is None or len(libs) <= 0:
127 return None
128 from ctypes import cdll
129 _load = cdll.LoadLibrary
130 from cppyy import loadDict as _load
131 lib = libs[0]
132 self.msg.verbose("... %s",lib)
133 _load (os.path.basename(lib.strip()))
134 self.msg.verbose("... %s [done]",lib)
135 self.msg.verbose(" ==> [ok]")
136
137 # give the non-massaged name to reflex as this is what it expects
138 # ...ROOT is sooo self-consistent...
139 rflx_type = self._rflx_type (_rflx_name)
140 if rflx_type.Name() != '':
141 return rflx_type
142 return None
143
144
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132
bool verbose
Definition hcg.cxx:75

◆ visit()

python.Dso.DsoDb.visit ( self,
typename,
visitor = None,
ctx = None )

Definition at line 145 of file Control/AthenaServices/python/Dso.py.

145 def visit(self, typename, visitor=None, ctx=None):
146 self.msg.verbose("=== visiting %s", typename)
147 if ctx is None:
148 ctx = set()
149 if isinstance (typename, str):
150 rflx_type = self.load_type (typename)
151 typename = rflx_type.Name (RflxEnums.DICTSCOPE)
152 else:
153 rflx_type = typename
154
155 if not rflx_type:
156 self.msg.verbose("**warning** no dict for [%s] !!", typename)
157 return ctx
158
159 ctx.add (typename)
160 if visitor:
161 visitor (rflx_type)
162
163 if rflx_type.IsClass() or rflx_type.IsStruct():
164 for i in range(rflx_type.BaseSize()):
165 itype = rflx_type.BaseAt(i).ToType()
166 itype_name = itype.Name(RflxEnums.DICTSCOPE)
167 if itype_name != '' and not (itype_name in ctx):
168 self.load_type (itype_name)
169 ctx.add (itype_name)
170 ctx.update (self.visit (itype, visitor, ctx))
171
172 for i in range(rflx_type.DataMemberSize()):
173 itype = rflx_type.DataMemberAt (i).TypeOf()
174 itype = itype.RawType() if itype.IsPointer() else itype
175 itype_name = itype.Name(RflxEnums.DICTSCOPE)
176 if itype_name != '' and not (itype_name in ctx):
177 self.load_type (itype_name)
178 ctx.add (itype_name)
179 # restore original type
180 itype = rflx_type.DataMemberAt (i).TypeOf()
181 itype_name = itype.Name(RflxEnums.DICTSCOPE)
182 ctx.update (self.visit (itype, visitor, ctx))
183 return ctx
184
STL class.

Member Data Documentation

◆ _rflx_type

python.Dso.DsoDb._rflx_type = cppyy.gbl.RootType.ByName
protected

Definition at line 93 of file Control/AthenaServices/python/Dso.py.

◆ msg

python.Dso.DsoDb.msg = AthenaCommon.Logging.logging.getLogger("AthenaDsoDb")

Definition at line 81 of file Control/AthenaServices/python/Dso.py.


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