| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- Namespace List
- Namespace Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables
GaudiKernel.PropertyProxy Namespace Reference

## Classes
class | PropertyProxy
class | GaudiHandlePropertyProxyBase
class | GaudiHandlePropertyProxy
class | GaudiHandleArrayPropertyProxy

## Functions
def | derives_from
def | _isCompatible
def | PropertyProxyFactory

## Variables
list | __all__ [ 'PropertyProxy', 'GaudiHandlePropertyProxy', 'GaudiHandleArrayPropertyProxy' ]
| data ------------------------------------------------------------------—
tuple | log logging.getLogger( 'PropertyProxy' )

## Function Documentation

def GaudiKernel.PropertyProxy._isCompatible | ( |  | tp,
|  |  | value
| ) |  |
| private

Definition at line 30 of file PropertyProxy.py.

30
31 def _isCompatible( tp, value ):
32 errmsg = "received an instance of %s, but %s expected" % (type(value),tp)
33
34 if derives_from(value, 'PropertyReference'):
35 # TODO: implement type checking for references
36 return value # references are valid
37 if ( tp is str ):
38 if ( type(value) is str ) or derives_from(value, 'Configurable'):
39 # we can set string properties only from strings or configurables
40 return value
41 else:
42 raise ValueError( errmsg )
43 elif ( tp in [ list, tuple, dict ] ):
44 if ( type(value) is tp ):
45 # We need to check that the types match for lists, tuples and
46 # dictionaries (bug #34769).
47 return value
48 else:
49 raise ValueError( errmsg )
50 elif derives_from(tp, 'Configurable'):
51 return value
52 else:
53 # all other types: accept if conversion allowed
54 try:
55 dummy = tp( value )
56 except (TypeError,ValueError):
57 raise ValueError( errmsg )
58
59 return dummy # in case of e.g. classes with __int__, __iter__, etc. implemented
60

def GaudiKernel.PropertyProxy.derives_from | ( |  | derived,
|  |  | base
| ) |  |

    A string version of isinstance().
    <derived> is either an object instance, or a type
    <base>    is a string containing the name of the base class (or <derived> class)

Definition at line 19 of file PropertyProxy.py.

19
20 def derives_from(derived,base):
21 """A string version of isinstance().
22 <derived> is either an object instance, or a type
23 <base> is a string containing the name of the base class (or <derived> class)"""
24 if not isinstance(derived,type): derived=type(derived)
25 if derived.__name__ == base: return True
26 for b in derived.__bases__:
27 if derives_from(b,base): return True
28
29 return False

def GaudiKernel.PropertyProxy.PropertyProxyFactory | ( |  | descr,
|  |  | doc,
|  |  | default
| ) |  |

Definition at line 348 of file PropertyProxy.py.

348
349 def PropertyProxyFactory( descr, doc, default ):
350 # print "PropertyProxyFactory( %s, %r )" % (descr.__name__,default)
351 if isinstance(default,GaudiHandleArray):
352 return GaudiHandleArrayPropertyProxy( descr, doc, default )
353
354 if isinstance(default,GaudiHandle):
355 return GaudiHandlePropertyProxy( descr, doc, default )
356
357 return PropertyProxy( descr, doc, default )

## Variable Documentation

list GaudiKernel.PropertyProxy.__all__ [ 'PropertyProxy', 'GaudiHandlePropertyProxy', 'GaudiHandleArrayPropertyProxy' ]

data ------------------------------------------------------------------—

Definition at line 6 of file PropertyProxy.py.

tuple GaudiKernel.PropertyProxy.log logging.getLogger( 'PropertyProxy' )

Definition at line 13 of file PropertyProxy.py.