| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
GaudiKernel.Configurable.Configurable Class Reference
Inheritance diagram for GaudiKernel.Configurable.Configurable:
[legend]
Collaboration diagram for GaudiKernel.Configurable.Configurable:
[legend]

## Classes
class | DefaultName
| for detecting the default name More...

## Public Member Functions
def | __new__ (cls, args, kwargs)
def | __init__ (self, name=DefaultName)
def | __getstate__ (self)
def | __getnewargs__ (self)
def | __setstate__ (self, dict)
def | __len__ (self)
def | __iter__ (self)
def | __deepcopy__ (self, memo)
def | __iadd__ (self, configs, descr=None)
def | __getattr__ (self, attr)
def | __setattr__ (self, name, value)
def | __delattr__ (self, attr)
def | __nonzero__ (self)
def | remove (self, items)
def | removeAll (self)
def | copyChild (self, child)
def | setParent (self, parentName)
def | getParent (self)
def | hasParent (self, parent)
def | copyChildAndSetParent (self, cfg, parent)
def | getChildren (self)
def | getTools (self)
def | children (self)
def | getAllChildren (self)
def | getSequence (self)
def | setup (self)
def | getProperties (self)
def | getPropertiesWithDescription (self)
def | getValuedProperties (self)
def | properties (self)
def | getDefaultProperties (cls)
def | getDefaultProperty (cls, name)
def | getProp (self, name)
def | setProp (self, name, value)
def | isPropertySet (self, name)
def | getType (cls)
def | getName (self)
def | name (self)
def | getJobOptName (self)
def | isPublic (self)
def | jobOptName (self)
def | getFullName (self)
def | getFullJobOptName (self)
def | getPrintTitle (self)
def | getTitleName (self)
def | setDefaults (cls, handle)
def | clone (self, name=None, kwargs)
def | splitName (self)
def | addTool (self, tool, name=None)
def | __repr__ (self)
def | __str__ (self, indent=0, headerLastIndentUnit=indentUnit)

## Static Public Attributes
| propertyNoValue
string | indentUnit = '| '
int | printHeaderWidth = 100
int | printHeaderPre = 5
dictionary | allConfigurables = {}
dictionary | configurableServices = {}

## Private Member Functions
def | _isInSetDefaults (self)
def | __setupServices (self)
def | __setupDlls (self)
def | __setupDefaults (self)

## Static Private Member Functions
def | _printHeader (indentStr, title)
def | _printFooter (indentStr, title)

## Private Attributes
| __children
| __tools
| _name
| _inSetDefaults
| _initok
| _setupok

## Static Private Attributes
| __metaclass__ = ConfigurableMeta.ConfigurableMeta
tuple | __slots__
bool | _configurationLocked = False

## Detailed Description

    Base class for Gaudi components that implement the IProperty interface.
       Provides most of the boilerplate code, but the actual useful classes
       are its derived ConfigurableAlgorithm, ConfigurableService, and
       ConfigurableAlgTool.

Definition at line 94 of file Configurable.py.

## Constructor & Destructor Documentation

def GaudiKernel.Configurable.Configurable.__init__ | ( |  | self,
|  |  | name = `DefaultName`
| ) |  |

Definition at line 261 of file Configurable.py.

261 def __init__( self, name = DefaultName ):
262 # check class readiness, all required overloads should be there now
263 klass = self.__class__
264
265 # this is an abstract class
266 if klass == Configurable:
267 raise TypeError, "%s is an ABC and can not be instantiated" % str(Configurable)
268
269 # the following methods require overloading
270 #NOT YET meths = { 'getServices' : 1, # retrieve list of services to configure
271 meths = { 'getDlls' : 1, # provide list of Dlls to load
272 'getGaudiType' : 1, # return string describing component class
273 'getHandle' : 1 } # provide access to C++ side component instance
274 # 'getType' : 1 } # return the type of the actual C++ component
275
276 for meth, nArgs in meths.items():
277 try:
278 f = getattr( klass, meth ).im_func
279 except AttributeError:
280 raise NotImplementedError, "%s is missing in class %s" % (meth,str(klass))
281
282 # in addition, verify the number of arguments w/o defaults
283 nargcount = f.func_code.co_argcount
284 ndefaults = f.func_defaults and len(f.func_defaults) or 0
285 if not nargcount - ndefaults <= nArgs <= nargcount:
286 raise TypeError, "%s.%s requires exactly %d arguments" % (klass,meth,nArgs)
287
288 # for using this Configurable as a (Gaudi) sequence
289 self.__children = []
290 self.__tools = {}
291
292 # know who we are
293 if name == Configurable.DefaultName :
294 if hasattr(self.__class__, 'DefaultedName' ) :
295 self._name = self.__class__.DefaultedName
296 else :
297 self._name = self.getType()
298 else :
299 self._name = name
300
301 # set to True when collecting defaults, False otherwise
302 self._inSetDefaults = False
303
304 # for later, in case __init__ itself is overridden
305 self._initok = True
306
307 # for debugging purposes (temporary)
308 self._setupok = False
309
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.__init__
def __init__(self, name=DefaultName)
Definition: Configurable.py:261
GaudiKernel.Configurable.Configurable._initok
_initok
Definition: Configurable.py:305
GaudiKernel.Configurable.Configurable._name
_name
Definition: Configurable.py:295
GaudiKernel.Configurable.Configurable._setupok
_setupok
Definition: Configurable.py:308
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:688
GaudiKernel.Configurable.Configurable.__tools
__tools
Definition: Configurable.py:290
GaudiKernel.Configurable.Configurable._inSetDefaults
_inSetDefaults
Definition: Configurable.py:302
GaudiKernel.Configurable.Configurable.DefaultName
for detecting the default name
Definition: Configurable.py:101

## Member Function Documentation

def GaudiKernel.Configurable.Configurable.__deepcopy__ | ( |  | self,
|  |  | memo
| ) |  |

Definition at line 341 of file Configurable.py.

341 def __deepcopy__( self, memo ):
342 newconf = object.__new__( self.__class__ )
343 self.__class__.__init__( newconf, self.getName() )
344
345 for proxy in self._properties.values():
346 try:
347 proxy.__set__( newconf, proxy.__get__( self ) )
348 except AttributeError:
349 pass # means property was not set for self
350
351 for c in self.__children:
352 newconf += c # processes proper copy semantics
353
354 return newconf
355
GaudiKernel.Configurable.Configurable.__deepcopy__
def __deepcopy__(self, memo)
Definition: Configurable.py:341
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:691

def GaudiKernel.Configurable.Configurable.__delattr__ | ( |  | self,
|  |  | attr
| ) |  |

Definition at line 412 of file Configurable.py.

412 def __delattr__( self, attr ):
413 # remove as property, otherwise try as child
414 try:
415 # remove history etc., then reset to default (in case set before)
416 prop = self._properties[ attr ]
417 prop.__delete__( self )
418 prop.__set__( self, prop.default )
419 return # reaches here? was property: done now
420 except KeyError:
421 pass
422 # otherwise, remove the private tool
423 if attr in self.__tools :
424 del self.__tools[attr]
425
426 # otherwise, remove child, if one is so named
427 for c in self.__children:
428 if c.getName() == attr:
429 self.__children.remove( c )
430
431 # potentially, there are left over caches (certain user derived classes)
432 try:
433 del self.__dict__[ attr ]
434 except (AttributeError,KeyError):
435 pass
436
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.__delattr__
def __delattr__(self, attr)
Definition: Configurable.py:412
GaudiKernel.Configurable.Configurable.__tools
__tools
Definition: Configurable.py:290

def GaudiKernel.Configurable.Configurable.__getattr__ | ( |  | self,
|  |  | attr
| ) |  |

Definition at line 389 of file Configurable.py.

389 def __getattr__( self, attr ): # until ToolProperties exist ...
390
391 if attr in self.__tools : return self.__tools[attr]
392
393 if attr in self._properties:
394 if isinstance(self._properties[attr].__get__( self ), DataObjectHandleBase):
395 return self._properties[attr].__get__( self )
396
397 for c in self.__children:
398 if c.getName() == attr:
399 return c
400
401 raise AttributeError( "'%s' object has no attribute '%s'" % (self.__class__,attr) )
402
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.__getattr__
def __getattr__(self, attr)
Definition: Configurable.py:389
GaudiKernel.Configurable.Configurable.__tools
__tools
Definition: Configurable.py:290

def GaudiKernel.Configurable.Configurable.__getnewargs__ | ( |  | self | ) |

Definition at line 324 of file Configurable.py.

324 def __getnewargs__(self) :
325 return (self._name,)
326
GaudiKernel.Configurable.Configurable.__getnewargs__
def __getnewargs__(self)
Definition: Configurable.py:324
GaudiKernel.Configurable.Configurable._name
_name
Definition: Configurable.py:295

def GaudiKernel.Configurable.Configurable.__getstate__ | ( |  | self | ) |

Definition at line 311 of file Configurable.py.

311 def __getstate__ (self):
312 dict = {}
313 for name, proxy in self._properties.items():
314 try:
315 dict[ name ] = proxy.__get__( self )
316 except AttributeError:
317 pass
318
319 dict[ '_Configurable__children' ] = self.__children
320 dict[ '_Configurable__tools' ] = self.__tools
321 dict[ '_name' ] = self._name
322 return dict
323
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable._name
_name
Definition: Configurable.py:295
GaudiKernel.Configurable.Configurable.__getstate__
def __getstate__(self)
Definition: Configurable.py:311
GaudiKernel.Configurable.Configurable.__tools
__tools
Definition: Configurable.py:290

def GaudiKernel.Configurable.Configurable.__iadd__ | ( |  | self,
|  |  | configs,
|  |  | descr = `None`
| ) |  |

Definition at line 357 of file Configurable.py.

357 def __iadd__( self, configs, descr = None ):
358 if not type(configs) in (list,tuple):
359 configs = ( configs, )
360
361 joname = self.getJobOptName()
362
363 for cfg in configs:
364 # prevent type mismatches
365 if not isinstance( cfg, Configurable ):
366 raise TypeError( "'%s' is not a Configurable" % str(cfg) )
367
368 cc = self.copyChildAndSetParent( cfg, joname )
369
370 # filters dupes; usually "ok" (backdoor should catch them)
371 ccjo = cc.getJobOptName()
372 for c in self.__children:
373 if c.getJobOptName() == ccjo:
374 log.error( 'attempt to add a duplicate ... dupe ignored%s', error_explanation )
375 break
376 else:
377 self.__children.append( cc )
378
379 try:
380 if descr: # support for tool properties
381 descr.__set__( self, cc )
382 else:
383 setattr( self, cc.getName(), cc )
384 except AttributeError:
385 pass # to allow free addition of tools/subalgorithms
386
387 return self
388
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.copyChildAndSetParent
def copyChildAndSetParent(self, cfg, parent)
Definition: Configurable.py:463
GaudiKernel.Configurable.Configurable.__iadd__
def __iadd__(self, configs, descr=None)
Definition: Configurable.py:357
gaudirun.type
type
Definition: gaudirun.py:125
GaudiKernel.Configurable.Configurable.getJobOptName
def getJobOptName(self)
Definition: Configurable.py:697

def GaudiKernel.Configurable.Configurable.__iter__ | ( |  | self | ) |

Definition at line 337 of file Configurable.py.

337 def __iter__( self ):
338 return iter( self.__children )
339
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.__iter__
def __iter__(self)
Definition: Configurable.py:337

def GaudiKernel.Configurable.Configurable.__len__ | ( |  | self | ) |

Definition at line 334 of file Configurable.py.

334 def __len__( self ):
335 return len( self.__children )
336
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.__len__
def __len__(self)
Definition: Configurable.py:334

def GaudiKernel.Configurable.Configurable.__new__ | ( |  | cls,
|  |  | args,
|  |  | kwargs
| ) |  |

    To Gaudi, any object with the same type/name is the same object. Hence,
       this is mimicked in the configuration: instantiating a new Configurable
       of a type with the same name will return the same instance.

Definition at line 126 of file Configurable.py.

126 def __new__ ( cls, *args, **kwargs ):
127 """To Gaudi, any object with the same type/name is the same object. Hence,
128 this is mimicked in the configuration: instantiating a new Configurable
129 of a type with the same name will return the same instance."""
130
131 global log
132 # try to get the name of the Configurable (having a name is compulsory)
133 if 'name' in kwargs:
134 # simple keyword (by far the easiest)
135 name = kwargs[ 'name' ]
136 elif 'name' in cls.__init__.func_code.co_varnames:
137 # either positional in args, or default
138 index = list(cls.__init__.func_code.co_varnames).index( 'name' )
139 try:
140 # var names index is offset by one as __init__ is to be called with self
141 name = args[ index - 1 ]
142 except IndexError:
143 # retrieve default value, then
144 name = cls.__init__.func_defaults[ index - (len(args)+1) ]
145 else:
146 # positional index is assumed (will work most of the time)
147 try:
148 name = args[1] # '0' is for self
149 except (IndexError,TypeError):
150 raise TypeError( 'no "name" argument while instantiating "%s"' % cls.__name__ )
151
152 argname = name
153 if name == Configurable.DefaultName :
154 if hasattr(cls, 'DefaultedName' ) :
155 name = cls.DefaultedName
156 else :
157 name = cls.getType()
158 elif not name or type(name) != str:
159 # unnamed, highly specialized user code, etc. ... unacceptable
160 raise TypeError( 'could not retrieve name from %s.__init__ arguments' % cls.__name__ )
161
162 # Handle the case of global tools to prepend ToolSvc in the name.
163 # This is needed for compatibility with old JobOptions files being read
164 if issubclass( cls, ConfigurableAlgTool) and '.' not in name :
165 name = 'ToolSvc.' + name
166
167 # close backdoor access to otherwise private subalgs/tools
168 #PM if 0 <= name.find( '.' ):
169 #PM # temp protection for old style types
170 #PM from OldStyleConfig import GenericConfigurable
171 #PM if not issubclass( cls, GenericConfigurable ): # except raised for new types only
172 #PM raise NameError( '"%s": backdoor access to private configurables not allowed' % name )
173
174 # ordinary recycle case
175 if name in cls.configurables:
176 conf = cls.configurables[ name ]
177 if name != argname: # special case: user derived <-> real ... make same
178 cls.configurables[ conf.getType() ] = conf
179 #---PM: Initialize additional properties
180 for n,v in kwargs.items():
181 if n != "name": # it should not be confused with a normal property
182 setattr(conf, n, v)
183 if not cls._configurationLocked and not "_enabled" in kwargs and isinstance(conf, ConfigurableUser):
184 # Ensure that the ConfigurableUser gets enabled if nothing is
185 # specified in the constructor.
186 setattr(conf, "_enabled", True)
187 return conf
188
189 # a couple of special cases (note that these cases don't mix)
190 spos = name.find( '/' )
191 ti_name = None
192 if spos < 0:
193 ti_name = "%s/%s" % (name,name)
194 if ti_name in cls.configurables:
195 # support for old-style name as type/name lookup where name==type
196 return cls.configurables[ ti_name ]
197
198 i_name = None
199 if spos > 0:
200 i_name = name[:spos]
201 if i_name == name[spos+1:] and i_name in cls.configurables:
202 # this is the opposite of the above special case
203 return cls.configurables[ i_name ]
204
205 # the following is purely for debugging support and should realistically bomb
206 conf = cls.allConfigurables.get( name, None ) or\
207 (spos < 0 and cls.allConfigurables.get( ti_name, None )) or\
208 (spos > 0 and i_name == name[spos+1:] and cls.allConfigurables.get( i_name, None ))
209 if conf: # wrong type used?
210 if conf.__class__ is ConfigurableGeneric :
211 # If the instance found is ConfigurableGeneric then
212 # we create a new one with the proper type and fill with
213 # the contents of the generic one
214 newconf = object.__new__( cls )
215 cls.__init__( newconf, *args, **kwargs )
216 # initialize with the properties of generic configurable
217 # (we map the names of the properties to lowercase versions because
218 # old options are not case sensitive)
219 names = {}
220 for n in newconf.__slots__:
221 names[n.lower()] = n
222 for n in conf._properties:
223 if names[n.lower()] != n:
224 log.warning( "Option '%s' was used for %s, but the correct spelling is '%s'"%(n,name,names[n.lower()]) )
225 setattr(newconf, names[n.lower()], getattr( conf, n ) )
226 for n,v in kwargs.items():
227 setattr(newconf, n, v)
228 cls.configurables[ name ] = newconf
229 cls.allConfigurables[ name ] = newconf
230 return newconf
231 else :
232 # will be an actual error in the future (now only report as such)
233 log.error( 'attempt to redefine type of "%s" (was: %s, new: %s)%s',
234 name, conf.__class__.__name__, cls.__name__, error_explanation )
235 # in the future:
236 # return None # will bomb on use (or go unharmed on non-use)
237 # for now, allow use through allConfigurables lookup
238 #---PM: Initialize additional properties
239 for n,v in kwargs.items():
240 setattr(conf, n, v)
241 return conf
242
243 # still here: create a new instance and initialize it
244 conf = object.__new__(cls)
245 cls.__init__( conf, *args, **kwargs )
246
247 # update normal, per-class cache
248 cls.configurables[ name ] = conf
249
250 for base in cls.__bases__:
251 if base.__name__ == 'ConfigurableService':
252 cls.configurableServices[ name ] = conf
253
254 # update generics super-cache, if needed
255 cls.allConfigurables[ name ] = conf
256 #-->PM#if hasattr( cls, 'getType' ) and name.find('/') < 0:
257 #-->PM# cls.allConfigurables[ cls.getType() + '/' + name ] = conf
258
259 return conf
260
GaudiKernel.Configurable.Configurable.allConfigurables
dictionary allConfigurables
Definition: Configurable.py:120
GaudiKernel.Configurable.Configurable.configurableServices
dictionary configurableServices
Definition: Configurable.py:121
GaudiKernel.Configurable.Configurable.__new__
def __new__(cls, args, kwargs)
Definition: Configurable.py:126
GaudiKernel.Configurable.Configurable.__init__
def __init__(self, name=DefaultName)
Definition: Configurable.py:261
gaudirun.type
type
Definition: gaudirun.py:125
GaudiKernel.Configurable.Configurable._configurationLocked
bool _configurationLocked
Definition: Configurable.py:124
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:688
GaudiKernel.Configurable.Configurable.DefaultName
for detecting the default name
Definition: Configurable.py:101

def GaudiKernel.Configurable.Configurable.__nonzero__ | ( |  | self | ) |

Definition at line 437 of file Configurable.py.

437 def __nonzero__(self):
438 return True
439
440
GaudiKernel.Configurable.Configurable.__nonzero__
def __nonzero__(self)
Definition: Configurable.py:437

def GaudiKernel.Configurable.Configurable.__repr__ | ( |  | self | ) |

Definition at line 845 of file Configurable.py.

845 def __repr__(self):
846 return '{0}({1!r})'.format(self.__class__.__name__, self.name())
847
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
GaudiKernel.Configurable.Configurable.name
def name(self)
Definition: Configurable.py:694
GaudiKernel.Configurable.Configurable.__repr__
def __repr__(self)
Definition: Configurable.py:845

def GaudiKernel.Configurable.Configurable.__setattr__ | ( |  | self,
|  |  | name,
|  |  | value
| ) |  |

Definition at line 403 of file Configurable.py.

403 def __setattr__( self, name, value ) :
404 if self._configurationLocked:
405 raise RuntimeError("%s: Configuration cannot be modified after the ApplicationMgr has been started."%self.name())
406 try :
407 super( Configurable, self ).__setattr__( name, value )
408 except AttributeError:
409 raise AttributeError( "Configurable '%s' does not have property '%s'."
410 % ( self.__class__.__name__, name) )
411
GaudiKernel.Configurable.Configurable.name
def name(self)
Definition: Configurable.py:694
GaudiKernel.Configurable.Configurable._configurationLocked
bool _configurationLocked
Definition: Configurable.py:124
GaudiKernel.Configurable.Configurable.__setattr__
def __setattr__(self, name, value)
Definition: Configurable.py:403

def GaudiKernel.Configurable.Configurable.__setstate__ | ( |  | self,
|  |  | dict
| ) |  |

Definition at line 327 of file Configurable.py.

327 def __setstate__ ( self, dict ):
328 self._initok = True
329 for n, v in dict.items():
330 setattr (self, n, v)
331 return
332
GaudiKernel.Configurable.Configurable.__setstate__
def __setstate__(self, dict)
Definition: Configurable.py:327
GaudiKernel.Configurable.Configurable._initok
_initok
Definition: Configurable.py:305

def GaudiKernel.Configurable.Configurable.__setupDefaults | ( |  | self | ) |
| private

Definition at line 824 of file Configurable.py.

824 def __setupDefaults( self ):
825 # set handle defaults flags to inform __setattr__ that it is being
826 # called during setDefaults of the concrete Configurable
827 self._inSetDefaults = True
828 self.setDefaults( self )
829 self._inSetDefaults = False
830
GaudiKernel.Configurable.Configurable.__setupDefaults
def __setupDefaults(self)
Definition: Configurable.py:824
GaudiKernel.Configurable.Configurable.setDefaults
def setDefaults(cls, handle)
Definition: Configurable.py:724
GaudiKernel.Configurable.Configurable._inSetDefaults
_inSetDefaults
Definition: Configurable.py:302

def GaudiKernel.Configurable.Configurable.__setupDlls | ( |  | self | ) |
| private

Definition at line 813 of file Configurable.py.

813 def __setupDlls( self ):
814 dlls = self.getDlls()
815 if not dlls:
816 dlls = []
817 elif type(dlls) == types.StringType:
818 dlls = [ dlls ]
819
820 from __main__ import theApp
821 dlls = filter( lambda d: d not in theApp.Dlls, dlls )
822 if dlls: theApp.Dlls += dlls
823
GaudiKernel.Configurable.Configurable.__setupDlls
def __setupDlls(self)
Definition: Configurable.py:813
gaudirun.type
type
Definition: gaudirun.py:125

def GaudiKernel.Configurable.Configurable.__setupServices | ( |  | self | ) |
| private

Definition at line 796 of file Configurable.py.

796 def __setupServices( self ):
797 #svcs = self.getServices()
798 #if not svcs:
799 svcs = []
800 #elif type(svcs) == types.StringType:
801 # svcs = [ svcs ]
802
803 import __main__
804 for svc in svcs:
805 handle = __main__.Service( svc )
806 # services should be configurables as well, but aren't for now
807 # handle.setup()
808
809 # allow Configurable to make some changes
810 if hasattr( self, 'configure' + svc ):
811 eval( 'self.configure' + svc + '( handle )' )
812
GaudiKernel.Configurable.Configurable.__setupServices
def __setupServices(self)
Definition: Configurable.py:796

def GaudiKernel.Configurable.Configurable.__str__ | ( |  | self,
|  |  | indent = `0`,
|  |  | headerLastIndentUnit = `indentUnit`
| ) |  |

Definition at line 848 of file Configurable.py.

848 def __str__( self, indent = 0, headerLastIndentUnit=indentUnit ):
849 global log # to print some info depending on output level
850 indentStr = indent*Configurable.indentUnit
851 # print header
852 title = self.getPrintTitle()
853 # print line to easily see start-of-configurable
854 if indent > 0:
855 headerIndent = (indent-1)*Configurable.indentUnit + headerLastIndentUnit
856 else:
857 headerIndent = ''
858 rep = Configurable._printHeader( headerIndent, title )
859 rep += os.linesep
860 # print own properties
861 props = self.getProperties()
862 defs = self.getDefaultProperties()
863 if not props:
864 rep += indentStr + '|-<no properties>' + os.linesep
865 else:
866 # get property name with
867 nameWidth = 0
868 for p in props.keys():
869 nameWidth=max(nameWidth,len(p))
870 for p, v in props.items():
871 # start with indent and property name
872 prefix = indentStr + '|-%-*s' % (nameWidth,p)
873 # add memory address for debugging (not for defaults)
874 if log.isEnabledFor( logging.DEBUG ):
875 if v != Configurable.propertyNoValue:
876 address = ' @%11s' % hex(id(v))
877 else:
878 address = 13*' '
879 prefix += address
880 # add value and default
881 default = defs.get(p)
882 if v == Configurable.propertyNoValue:
883 # show default value as value, and no extra 'default'
884 strVal = repr(default)
885 strDef = None
886 else:
887 # convert configurable to handle
888 if hasattr(v,"getGaudiHandle"):
889 vv = v.getGaudiHandle()
890 else:
891 vv = v
892 if isinstance(vv,GaudiHandle) or isinstance(vv,GaudiHandleArray):
893 strVal = repr(vv)
894 if hasattr(default,"toStringProperty"): # the default may not be a GaudiHandle (?)
895 strDef = repr(default.toStringProperty())
896 else:
897 strDef = repr(default)
898 if strDef == repr(vv.toStringProperty()):
899 strDef = None
900 else:
901 strVal = repr(vv)
902 strDef = repr(default)
903 # add the value
904 line = prefix + ' = ' + strVal
905 # add default if present
906 if strDef is not None:
907 # put default on new line if too big
908 if len(line) + len(strDef) > Configurable.printHeaderWidth:
909 line += os.linesep + indentStr + '| ' + (len(prefix)-len(indentStr)-3)*' '
910 line += ' (default: %s)' % (strDef,)
911 # add the line to the total string
912 rep += line + os.linesep
913 # print out full private configurables
GaudiKernel.Configurable.Configurable.getPrintTitle
def getPrintTitle(self)
Definition: Configurable.py:715
MSG::hex
MsgStream & hex(MsgStream &log)
Definition: MsgStream.h:332
GaudiKernel.Configurable.Configurable.getProperties
def getProperties(self)
Definition: Configurable.py:572
GaudiKernel.Configurable.Configurable.getDefaultProperties
def getDefaultProperties(cls)
Definition: Configurable.py:623
GaudiKernel.Configurable.Configurable.__str__
def __str__(self, indent=0, headerLastIndentUnit=indentUnit)
Definition: Configurable.py:848

def GaudiKernel.Configurable.Configurable._isInSetDefaults | ( |  | self | ) |
| private

Definition at line 793 of file Configurable.py.

793 def _isInSetDefaults( self ):
794 return self._inSetDefaults
795
GaudiKernel.Configurable.Configurable._isInSetDefaults
def _isInSetDefaults(self)
Definition: Configurable.py:793
GaudiKernel.Configurable.Configurable._inSetDefaults
_inSetDefaults
Definition: Configurable.py:302

def GaudiKernel.Configurable.Configurable._printFooter | ( |  | indentStr,
|  |  | title
| ) |  |
| static private

Definition at line 839 of file Configurable.py.

839 def _printFooter( indentStr, title ):
840 preLen = Configurable.printHeaderPre
841 postLen = Configurable.printHeaderWidth - preLen - 12 - len(title)# - len(indentStr)
842 postLen = max(preLen,postLen)
843 return indentStr + '\\%s (End of %s) %s' % (preLen*'-',title,postLen*'-')
844
GaudiKernel.Configurable.Configurable._printFooter
def _printFooter(indentStr, title)
Definition: Configurable.py:839

def GaudiKernel.Configurable.Configurable._printHeader | ( |  | indentStr,
|  |  | title
| ) |  |
| static private

Definition at line 832 of file Configurable.py.

832 def _printHeader( indentStr, title ):
833 preLen = Configurable.printHeaderPre
834 postLen = Configurable.printHeaderWidth - preLen - 3 - len(title)# - len(indentStr)
835 postLen = max(preLen,postLen)
836 return indentStr + '/%s %s %s' % (preLen*'*',title,postLen*'*')
837
GaudiKernel.Configurable.Configurable._printHeader
def _printHeader(indentStr, title)
Definition: Configurable.py:832

def GaudiKernel.Configurable.Configurable.addTool | ( |  | self,
|  |  | tool,
|  |  | name = `None`
| ) |  |

Definition at line 772 of file Configurable.py.

772 def addTool( self, tool, name = None ) :
773 if isclass(tool) and issubclass(tool, ConfigurableAlgTool):
774 if name is None:
775 name = tool.__name__
776 priv_tool = tool( self.getName()+ '.' + name )
777 elif isinstance(tool, ConfigurableAlgTool):
778 if name is None:
779 name = tool.splitName()[1]
780 priv_tool = tool.clone( self.getName()+ '.' + name )
781 else:
782 if isclass(tool):
783 classname = tool.__name__
784 else:
785 classname = type(tool).__name__
786 raise TypeError, "addTool requires AlgTool configurable. Got %s type" % classname
787 self.__tools[name] = priv_tool
788 if name in self.__slots__:
789 # this is to avoid that the property hides the tool
790 setattr(self,name,self.__tools[name])
791 return self.__tools[name]
792
GaudiKernel.Configurable.Configurable.addTool
def addTool(self, tool, name=None)
Definition: Configurable.py:772
gaudirun.type
type
Definition: gaudirun.py:125
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:691
GaudiKernel.Configurable.Configurable.__slots__
tuple __slots__
Definition: Configurable.py:111
GaudiKernel.Configurable.Configurable.__tools
__tools
Definition: Configurable.py:290

def GaudiKernel.Configurable.Configurable.children | ( |  | self | ) |

Definition at line 489 of file Configurable.py.

489 def children( self ):
490 log.error( "children() is deprecated, use getChildren() instead for consistency" )
491 log.error( "getChildren() returns a copy; to add a child, use 'parent += child'%s",
492 error_explanation )
493 return self.__children # by ref, for compatibility
494
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.children
def children(self)
Definition: Configurable.py:489

def GaudiKernel.Configurable.Configurable.clone | ( |  | self,
|  |  | name = `None`,
|  |  | kwargs
| ) |  |

Definition at line 727 of file Configurable.py.

727 def clone( self, name = None, **kwargs ) :
728 if not name :
729 if hasattr(self, 'DefaultedName' ) : name = self.DefaultedName
730 else : name = self.getType()
731
732 newconf = Configurable.__new__( self.__class__, name )
733 self.__class__.__init__( newconf, name )
734
735 for proxy in self._properties.values():
736 try :
737 value = proxy.__get__( self )
738 if type(value) in [ str, list, dict, tuple ]:
739 # clone the values of the properties for basic types
740 value = type(value)(value)
741 proxy.__set__( newconf, value )
742 except AttributeError:
743 pass
744
745 for c in self.__children:
746 newconf += c # processes proper copy semantics
747
748 for n , t in self.__tools.items():
749 newconf.addTool(t, n)
750
751 for name, value in kwargs.items():
752 setattr(newconf, name, value)
753
754 return newconf
755
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.clone
def clone(self, name=None, kwargs)
Definition: Configurable.py:727
gaudirun.type
type
Definition: gaudirun.py:125
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:688

def GaudiKernel.Configurable.Configurable.copyChild | ( |  | self,
|  |  | child
| ) |  |

Definition at line 451 of file Configurable.py.

451 def copyChild( self, child ):
452 return copy.deepcopy( child )
453
GaudiKernel.Configurable.Configurable.copyChild
def copyChild(self, child)
Definition: Configurable.py:451

def GaudiKernel.Configurable.Configurable.copyChildAndSetParent | ( |  | self,
|  |  | cfg,
|  |  | parent
| ) |  |

Definition at line 463 of file Configurable.py.

463 def copyChildAndSetParent(self,cfg,parent):
464 cc = self.copyChild( cfg )
465
466 if hasattr( cc, 'setParent' ) and parent:
467 try:
468 cc.setParent( parent )
469 except RuntimeError, e:
470 # temporary backdoor resolution for compatibility
471 log.error( str(e) + '%s', error_explanation )
472 ccbd = cc.configurables[ cc.getJobOptName() ]
473
474 # merge properties, new over pre-existing
475 for proxy in self._properties.values():
476 if proxy.history.has_key( cc ):
477 proxy.__set__( ccbd, proxy.__get__( cc ) )
478
479 # consolidate
480 cc = ccbd
481 return cc
482
GaudiKernel.Configurable.Configurable.copyChildAndSetParent
def copyChildAndSetParent(self, cfg, parent)
Definition: Configurable.py:463
GaudiKernel.Configurable.Configurable.copyChild
def copyChild(self, child)
Definition: Configurable.py:451

def GaudiKernel.Configurable.Configurable.getAllChildren | ( |  | self | ) |

    Get all (private) configurable children, both explicit ones (added with +=)
    and the ones in the private GaudiHandle properties

Definition at line 495 of file Configurable.py.

495 def getAllChildren( self ):
496 """Get all (private) configurable children, both explicit ones (added with +=)
497 and the ones in the private GaudiHandle properties"""
498 childs = []
499 # add private configurable properties (also inside handles)
500 for proxy in self._properties.values():
501 try:
502 c = proxy.__get__( self )
503 except AttributeError:
504 pass
505 else:
506 if isinstance(c,Configurable) and not c.isPublic():
507 childs.append(c)
508 elif isinstance(c,GaudiHandle):
509 try:
510 conf = c.configurable
511 except AttributeError:
512 pass
513 else:
514 if not conf.isPublic():
515 childs.append(conf)
516 elif isinstance(c,GaudiHandleArray):
517 # only setup private arrays
518 if not c.isPublic():
519 for ci in c:
520 if isinstance(ci,Configurable):
521 childs.append(ci)
522 else:
523 try:
524 conf = ci.configurable
525 except AttributeError:
526 pass
527 else:
528 childs.append(conf)
529
530 # add explicit children
531 childs += self.__children
532 return childs
533
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.getAllChildren
def getAllChildren(self)
Definition: Configurable.py:495

def GaudiKernel.Configurable.Configurable.getChildren | ( |  | self | ) |

Definition at line 483 of file Configurable.py.

483 def getChildren( self ):
484 return self.__children[:] # read only
485
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.getChildren
def getChildren(self)
Definition: Configurable.py:483

def GaudiKernel.Configurable.Configurable.getDefaultProperties | ( |  | cls | ) |

Definition at line 623 of file Configurable.py.

623 def getDefaultProperties( cls ):
624 class collector:
625 pass
626
627 # user provided defaults
628 c = collector()
629 cls.setDefaults( c )
630
631 # defaults from C++
632 for k,v in cls._properties.items():
633 if not k in c.__dict__ and hasattr( v, 'default' ):
634 c.__dict__[ k ] = v.default
635
636 return c.__dict__
637
GaudiKernel.Configurable.Configurable.getDefaultProperties
def getDefaultProperties(cls)
Definition: Configurable.py:623

def GaudiKernel.Configurable.Configurable.getDefaultProperty | ( |  | cls,
|  |  | name
| ) |  |

Definition at line 639 of file Configurable.py.

639 def getDefaultProperty( cls, name ):
640 class collector:
641 pass
642
643 # user provided defaults
644 c = collector()
645 cls.setDefaults( c )
646
647 if name in c.__dict__:
648 return c.__dict__[ name ]
649
650 # defaults from C++
651 try:
652 v = cls._properties[name]
653 if hasattr( v, 'default' ):
654 return v.default
655 except KeyError:
656 pass
657
658 return None
659
GaudiKernel.Configurable.Configurable.getDefaultProperty
def getDefaultProperty(cls, name)
Definition: Configurable.py:639

def GaudiKernel.Configurable.Configurable.getFullJobOptName | ( |  | self | ) |

Definition at line 712 of file Configurable.py.

712 def getFullJobOptName( self ):
713 return "%s/%s" % (self.getType(),self.getJobOptName() or self.getName())
714
GaudiKernel.Configurable.Configurable.getJobOptName
def getJobOptName(self)
Definition: Configurable.py:697
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:691
GaudiKernel.Configurable.Configurable.getFullJobOptName
def getFullJobOptName(self)
Definition: Configurable.py:712
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:688

def GaudiKernel.Configurable.Configurable.getFullName | ( |  | self | ) |

Definition at line 709 of file Configurable.py.

709 def getFullName( self ) :
710 return str( self.getType() + '/' + self.getName() )
711
GaudiKernel.Configurable.Configurable.getFullName
def getFullName(self)
Definition: Configurable.py:709
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:691
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:688

def GaudiKernel.Configurable.Configurable.getJobOptName | ( |  | self | ) |

Definition at line 697 of file Configurable.py.

697 def getJobOptName( self ): # full hierachical name
698 return self.getName()
699
GaudiKernel.Configurable.Configurable.getJobOptName
def getJobOptName(self)
Definition: Configurable.py:697
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:691

def GaudiKernel.Configurable.Configurable.getName | ( |  | self | ) |

Definition at line 691 of file Configurable.py.

691 def getName( self ):
692 return self._name
693
GaudiKernel.Configurable.Configurable._name
_name
Definition: Configurable.py:295
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:691

def GaudiKernel.Configurable.Configurable.getParent | ( |  | self | ) |

Definition at line 457 of file Configurable.py.

457 def getParent( self ):
458 return ""
459
GaudiKernel.Configurable.Configurable.getParent
def getParent(self)
Definition: Configurable.py:457

def GaudiKernel.Configurable.Configurable.getPrintTitle | ( |  | self | ) |

Definition at line 715 of file Configurable.py.

715 def getPrintTitle(self):
716 return self.getGaudiType() + ' ' + self.getTitleName()
717
GaudiKernel.Configurable.Configurable.getTitleName
def getTitleName(self)
Definition: Configurable.py:718
GaudiKernel.Configurable.Configurable.getPrintTitle
def getPrintTitle(self)
Definition: Configurable.py:715

def GaudiKernel.Configurable.Configurable.getProp | ( |  | self,
|  |  | name
| ) |  |

    Returns the value of the given property.

Definition at line 660 of file Configurable.py.

660 def getProp(self, name):
661 """Returns the value of the given property.
662 """
663 if hasattr(self, name):
664 return getattr(self, name)
665 else:
666 return self.getDefaultProperties()[name]
667
GaudiKernel.Configurable.Configurable.getProp
def getProp(self, name)
Definition: Configurable.py:660
GaudiKernel.Configurable.Configurable.getDefaultProperties
def getDefaultProperties(cls)
Definition: Configurable.py:623

def GaudiKernel.Configurable.Configurable.getProperties | ( |  | self | ) |

Definition at line 572 of file Configurable.py.

572 def getProperties( self ):
573 props = {}
574 for name, proxy in self._properties.items():
575 try:
576 props[ name ] = proxy.__get__( self )
577 except AttributeError:
578 props[ name ] = Configurable.propertyNoValue
579
580 return props
581
GaudiKernel.Configurable.Configurable.getProperties
def getProperties(self)
Definition: Configurable.py:572

def GaudiKernel.Configurable.Configurable.getPropertiesWithDescription | ( |  | self | ) |

    Get all properties with their description string as { name : (value, desc) }.

Definition at line 582 of file Configurable.py.

582 def getPropertiesWithDescription( self ):
583 """Get all properties with their description string as { name : (value, desc) }."""
584 props = {}
585 for name, proxy in self._properties.items():
586 try:
587 props[ name ] = ( proxy.__get__( self ), proxy.__doc__)
588 except AttributeError:
589 props[ name ] = ( Configurable.propertyNoValue, proxy.__doc__)
590 return props
591
GaudiKernel.Configurable.Configurable.getPropertiesWithDescription
def getPropertiesWithDescription(self)
Definition: Configurable.py:582

def GaudiKernel.Configurable.Configurable.getSequence | ( |  | self | ) |

Definition at line 534 of file Configurable.py.

534 def getSequence( self ):
535 elems = []
536 for c in self.__children:
537 elems.append( c.getFullName() )
538 return elems
539
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.getSequence
def getSequence(self)
Definition: Configurable.py:534

def GaudiKernel.Configurable.Configurable.getTitleName | ( |  | self | ) |

Definition at line 718 of file Configurable.py.

718 def getTitleName( self ):
719 if log.isEnabledFor( logging.DEBUG ):
720 return self.getFullJobOptName()
721 else:
722 return self.getFullName()
723
GaudiKernel.Configurable.Configurable.getTitleName
def getTitleName(self)
Definition: Configurable.py:718
GaudiKernel.Configurable.Configurable.getFullName
def getFullName(self)
Definition: Configurable.py:709
GaudiKernel.Configurable.Configurable.getFullJobOptName
def getFullJobOptName(self)
Definition: Configurable.py:712

def GaudiKernel.Configurable.Configurable.getTools | ( |  | self | ) |

Definition at line 486 of file Configurable.py.

486 def getTools( self ):
487 return self.__tools.values() # read only
488
GaudiKernel.Configurable.Configurable.getTools
def getTools(self)
Definition: Configurable.py:486

def GaudiKernel.Configurable.Configurable.getType | ( |  | cls | ) |

Definition at line 688 of file Configurable.py.

688 def getType( cls ):
689 return cls.__name__
690
GaudiKernel.Configurable.Configurable.getType
def getType(cls)
Definition: Configurable.py:688

def GaudiKernel.Configurable.Configurable.getValuedProperties | ( |  | self | ) |

Definition at line 592 of file Configurable.py.

592 def getValuedProperties( self ):
593 props = {}
594 for name, proxy in self._properties.items():
595 if self.isPropertySet(name):
596 value = proxy.__get__( self )
597 if hasattr(value, 'getFullName') :
598 value = value.getFullName()
599 elif type(value) in [list, tuple]:
600 new_value = []
601 for i in value:
602 if hasattr(i, 'getFullName'):
603 new_value.append(i.getFullName())
604 else:
605 new_value.append(i)
606 value = type(value)(new_value)
607 elif type(value) is dict:
608 new_value = {}
609 for i in value:
610 if hasattr(value[i], 'getFullName'):
611 new_value[i] = value[i].getFullName()
612 else:
613 new_value[i] = value[i]
614 value = new_value
615 props[ name ] = value
616
617 return props
618
GaudiKernel.Configurable.Configurable.getFullName
def getFullName(self)
Definition: Configurable.py:709
gaudirun.type
type
Definition: gaudirun.py:125
GaudiKernel.Configurable.Configurable.isPropertySet
def isPropertySet(self, name)
Definition: Configurable.py:673
GaudiKernel.Configurable.Configurable.getValuedProperties
def getValuedProperties(self)
Definition: Configurable.py:592

def GaudiKernel.Configurable.Configurable.hasParent | ( |  | self,
|  |  | parent
| ) |  |

Definition at line 460 of file Configurable.py.

460 def hasParent( self, parent ):
461 return False
462
GaudiKernel.Configurable.Configurable.hasParent
def hasParent(self, parent)
Definition: Configurable.py:460

def GaudiKernel.Configurable.Configurable.isPropertySet | ( |  | self,
|  |  | name
| ) |  |

    Tell if the property 'name' has been set or not.

    Because of a problem with list and dictionary properties, in those cases
    if the value is equal to the default, the property is considered as not
    set.

Definition at line 673 of file Configurable.py.

673 def isPropertySet(self, name):
674 """Tell if the property 'name' has been set or not.
675
676 Because of a problem with list and dictionary properties, in those cases
677 if the value is equal to the default, the property is considered as not
678 set.
679 """
680 if not hasattr(self, name):
681 return False
682 default = self.getDefaultProperty(name)
683 if isinstance(default, (list, dict, DataObjectHandleBase)):
684 value = getattr(self, name)
685 return value != default
686 return True
687
GaudiKernel.Configurable.Configurable.isPropertySet
def isPropertySet(self, name)
Definition: Configurable.py:673
GaudiKernel.Configurable.Configurable.getDefaultProperty
def getDefaultProperty(cls, name)
Definition: Configurable.py:639

def GaudiKernel.Configurable.Configurable.isPublic | ( |  | self | ) |

Definition at line 700 of file Configurable.py.

700 def isPublic( self ):
701 return True
702
GaudiKernel.Configurable.Configurable.isPublic
def isPublic(self)
Definition: Configurable.py:700

def GaudiKernel.Configurable.Configurable.jobOptName | ( |  | self | ) |

Definition at line 704 of file Configurable.py.

704 def jobOptName( self ):
705 log.error( "jobOptName() is deprecated, use getJobOptName() instead for consistency%s",
706 error_explanation )
707 return self.getJobOptName() # compatibility
708
GaudiKernel.Configurable.Configurable.getJobOptName
def getJobOptName(self)
Definition: Configurable.py:697
GaudiKernel.Configurable.Configurable.jobOptName
def jobOptName(self)
Definition: Configurable.py:704

def GaudiKernel.Configurable.Configurable.name | ( |  | self | ) |

Definition at line 694 of file Configurable.py.

694 def name( self ):
695 return self.getName()
696
GaudiKernel.Configurable.Configurable.name
def name(self)
Definition: Configurable.py:694
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:691

def GaudiKernel.Configurable.Configurable.properties | ( |  | self | ) |

Definition at line 619 of file Configurable.py.

619 def properties( self ):
620 return self.getProperties() # compatibility
621
GaudiKernel.Configurable.Configurable.properties
def properties(self)
Definition: Configurable.py:619
GaudiKernel.Configurable.Configurable.getProperties
def getProperties(self)
Definition: Configurable.py:572

def GaudiKernel.Configurable.Configurable.remove | ( |  | self,
|  |  | items
| ) |  |

Definition at line 441 of file Configurable.py.

441 def remove( self, items ):
442 if type(items) != list and type(items) != tuple:
443 items = [ items ]
444
445 self.__children = [ e for e in self.__children if not e in items ]
446
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.remove
def remove(self, items)
Definition: Configurable.py:441
gaudirun.type
type
Definition: gaudirun.py:125

def GaudiKernel.Configurable.Configurable.removeAll | ( |  | self | ) |

Definition at line 447 of file Configurable.py.

447 def removeAll( self ):
448 self.remove( self.__children )
449
GaudiKernel.Configurable.Configurable.__children
__children
Definition: Configurable.py:289
GaudiKernel.Configurable.Configurable.removeAll
def removeAll(self)
Definition: Configurable.py:447
GaudiKernel.Configurable.Configurable.remove
def remove(self, items)
Definition: Configurable.py:441

def GaudiKernel.Configurable.Configurable.setDefaults | ( |  | cls,
|  |  | handle
| ) |  |

Definition at line 724 of file Configurable.py.

724 def setDefaults( cls, handle ):
725 pass
726
GaudiKernel.Configurable.Configurable.setDefaults
def setDefaults(cls, handle)
Definition: Configurable.py:724

def GaudiKernel.Configurable.Configurable.setParent | ( |  | self,
|  |  | parentName
| ) |  |

Definition at line 454 of file Configurable.py.

454 def setParent( self, parentName ):
455 pass
456
GaudiKernel.Configurable.Configurable.setParent
def setParent(self, parentName)
Definition: Configurable.py:454

def GaudiKernel.Configurable.Configurable.setProp | ( |  | self,
|  |  | name,
|  |  | value
| ) |  |

    Set the value of a given property

Definition at line 668 of file Configurable.py.

668 def setProp(self, name, value):
669 """Set the value of a given property
670 """
671 return setattr(self, name, value)
672
GaudiKernel.Configurable.Configurable.setProp
def setProp(self, name, value)
Definition: Configurable.py:668

def GaudiKernel.Configurable.Configurable.setup | ( |  | self | ) |

Definition at line 540 of file Configurable.py.

540 def setup( self ):
541 # make sure base class init has been called
542 if not hasattr(self,'_initok') or not self._initok:
543 # could check more, but this is the only explanation
544 raise TypeError, \
545 "Configurable.__init__ not called in %s override" % self.__class__.__name__
546
547 # log.debug("calling setup() on " + self.getFullJobOptName())
548
549 # setup self: this collects all values on the python side
550 self.__setupServices()
551 self.__setupDlls()
552 self.__setupDefaults()
553
554 # setup children
555 for c in self.getAllChildren():
556 c.setup()
557
558 # now get handle to work with for moving properties into the catalogue
559 handle = self.getHandle()
560 if not handle:
561 log.debug( 'no handle for %s: not transporting properties', self._name )
562 return # allowed, done early
563
564 # pass final set of properties on to handle on the C++ side or JobOptSvc
565 for name in self._properties.keys():
566 if hasattr( self, name ): # means property has python-side value/default
567 setattr( handle, name, getattr(self,name) )
568
569 # for debugging purposes
570 self._setupok = True
571
GaudiKernel.Configurable.Configurable.setup
def setup(self)
Definition: Configurable.py:540
GaudiKernel.Configurable.Configurable.__setupDefaults
def __setupDefaults(self)
Definition: Configurable.py:824
GaudiKernel.Configurable.Configurable._initok
_initok
Definition: Configurable.py:305
GaudiKernel.Configurable.Configurable.__setupDlls
def __setupDlls(self)
Definition: Configurable.py:813
GaudiKernel.Configurable.Configurable._name
_name
Definition: Configurable.py:295
GaudiKernel.Configurable.Configurable._setupok
_setupok
Definition: Configurable.py:308
GaudiKernel.Configurable.Configurable.__setupServices
def __setupServices(self)
Definition: Configurable.py:796
GaudiKernel.Configurable.Configurable.getAllChildren
def getAllChildren(self)
Definition: Configurable.py:495

def GaudiKernel.Configurable.Configurable.splitName | ( |  | self | ) |

Definition at line 756 of file Configurable.py.

756 def splitName( self ) :
757 fullname = self.getName()
758 dot = fullname.find('.')
759 if dot != -1 :
760 parentname = fullname[:dot]
761 longname = fullname[dot+1:]
762 else :
763 parentname = ''
764 longname = fullname
765 dot = longname.find('.')
766 if dot != -1 :
767 name = longname[:dot]
768 else :
769 name = longname
770 return parentname, name, longname
771
GaudiKernel.Configurable.Configurable.splitName
def splitName(self)
Definition: Configurable.py:756
GaudiKernel.Configurable.Configurable.getName
def getName(self)
Definition: Configurable.py:691

## Member Data Documentation

GaudiKernel.Configurable.Configurable.__children
| private

Definition at line 289 of file Configurable.py.

GaudiKernel.Configurable.Configurable.__metaclass__ = ConfigurableMeta.ConfigurableMeta
| static private

Definition at line 109 of file Configurable.py.

tuple GaudiKernel.Configurable.Configurable.__slots__
| static private

Initial value:
1 = (
2 '__children', # controlled components, e.g. private AlgTools
3 '__tools', # private AlgTools (#PM-->)
4 '_name', # the (unqualified) component name
5 '_inSetDefaults', # currently setting default values
6 '_initok', # used to enforce base class init
7 '_setupok' # for debugging purposes (temporary)
8 )

Definition at line 111 of file Configurable.py.

GaudiKernel.Configurable.Configurable.__tools
| private

Definition at line 290 of file Configurable.py.

bool GaudiKernel.Configurable.Configurable._configurationLocked = False
| static private

Definition at line 124 of file Configurable.py.

GaudiKernel.Configurable.Configurable._initok
| private

Definition at line 305 of file Configurable.py.

GaudiKernel.Configurable.Configurable._inSetDefaults
| private

Definition at line 302 of file Configurable.py.

GaudiKernel.Configurable.Configurable._name
| private

Definition at line 295 of file Configurable.py.

GaudiKernel.Configurable.Configurable._setupok
| private

Definition at line 308 of file Configurable.py.

dictionary GaudiKernel.Configurable.Configurable.allConfigurables = {}
| static

Definition at line 120 of file Configurable.py.

dictionary GaudiKernel.Configurable.Configurable.configurableServices = {}
| static

Definition at line 121 of file Configurable.py.

string GaudiKernel.Configurable.Configurable.indentUnit = '| '
| static

Definition at line 105 of file Configurable.py.

int GaudiKernel.Configurable.Configurable.printHeaderPre = 5
| static

Definition at line 107 of file Configurable.py.

int GaudiKernel.Configurable.Configurable.printHeaderWidth = 100
| static

Definition at line 106 of file Configurable.py.

GaudiKernel.Configurable.Configurable.propertyNoValue
| static

Definition at line 104 of file Configurable.py.

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

- GaudiKernel/python/GaudiKernel/Configurable.py