| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

PropertyProxy::GaudiHandleArrayPropertyProxy Class Reference

Inheritance diagram for PropertyProxy::GaudiHandleArrayPropertyProxy:
[legend]
Collaboration diagram for PropertyProxy::GaudiHandleArrayPropertyProxy:
[legend]
List of all members.

Public Member Functions

def __init__
def checkType
def convertDefaultToBeSet
def convertValueToBeSet
def __init__
def __get__
def __set__
def isHandle
def isConfig
def getDefaultConfigurable
def setDefault
def getDefault
def fullPropertyName
def __delete__

Public Attributes

 arrayType
 default
 history
 descr

Static Public Attributes

tuple default = property( getDefault, setDefault )

Detailed Description

Definition at line 308 of file PropertyProxy.py.


Member Function Documentation

def PropertyProxy::GaudiHandleArrayPropertyProxy::__init__ (   self,
  descr,
  docString,
  default 
)

Reimplemented from PropertyProxy::PropertyProxy.

Definition at line 309 of file PropertyProxy.py.

00309                                                   :
00310       """<descr>: the real property in the object instance (from __slots__)
00311       <confTypeName>: string indicating the (base) class of allowed Configurables to be assigned.
00312       <handleType>: real python handle type (e.g. PublicToolHandle, PrivateToolHandle, ...)
00313       """
00314       GaudiHandlePropertyProxyBase.__init__( self, descr, docString, default, type(default).handleType, GaudiHandleArray )
      self.arrayType = type(default)

def PropertyProxy::GaudiHandleArrayPropertyProxy::checkType (   self,
  obj,
  value 
)

Definition at line 315 of file PropertyProxy.py.

00318                                     :
00319       if not isinstance( value, list ) and not isinstance( value, self.arrayType ):
00320          raise TypeError( "%s: Value %r is not a list nor a %s" % \
                          ( self.fullPropertyName(obj), value, self.arrayType.__name__ ) )

def PropertyProxy::GaudiHandleArrayPropertyProxy::convertDefaultToBeSet (   self,
  obj,
  default 
)

Reimplemented from PropertyProxy::GaudiHandlePropertyProxyBase.

Definition at line 321 of file PropertyProxy.py.

00324                                                   :
00325       self.checkType( obj, default )
00326       newDefault = self.arrayType()
00327       for d in default:
00328          cd = GaudiHandlePropertyProxyBase.convertDefaultToBeSet( self, obj, d )
00329          if cd: newDefault.append( cd )
00330 
      return newDefault

def PropertyProxy::GaudiHandleArrayPropertyProxy::convertValueToBeSet (   self,
  obj,
  value 
)

Reimplemented from PropertyProxy::GaudiHandlePropertyProxyBase.

Definition at line 331 of file PropertyProxy.py.

00334                                               :
00335       self.checkType( obj, value )
00336       newValue = self.arrayType()
00337       for v in value:
00338          cv = GaudiHandlePropertyProxyBase.convertValueToBeSet( self, obj, v )
00339          if cv: newValue.append( cv )
00340 
00341       return newValue

def PropertyProxy::GaudiHandlePropertyProxyBase::__init__ (   self,
  descr,
  docString,
  default,
  handleType,
  allowedType 
) [inherited]

<descr>: the real property in the object instance (from __slots__)
<docString>: the documentation string of this property
<default>: default value from C++ (via python generated by genconf)
<handleType>: real python handle type (e.g. PublicToolHandle, PrivateToolHandle, ...)
<allowedType>: allowed instance type for default

Definition at line 154 of file PropertyProxy.py.

00154                                                                           :
00155       """<descr>: the real property in the object instance (from __slots__)
00156       <docString>: the documentation string of this property
00157       <default>: default value from C++ (via python generated by genconf)
00158       <handleType>: real python handle type (e.g. PublicToolHandle, PrivateToolHandle, ...)
00159       <allowedType>: allowed instance type for default
00160       """
00161       # check that default is of allowed type for this proxy
00162       if not isinstance(default,allowedType):
00163          raise TypeError( "%s: %s default: %r is not a %s" % \
00164                           ( descr.__name__, self.__class__.__name__, default, allowedType.__name__ ) )
00165       PropertyProxy.__init__( self, descr, docString, default )
00166       self._handleType = handleType
00167       self._confTypeName = 'Configurable' + handleType.componentType
00168 #      print "%s: %r (%s)" % (self.__class__.__name__,self._handleType,self._confTypeName)
00169 
00170 
   def __get__( self, obj, type = None ):

def PropertyProxy::GaudiHandlePropertyProxyBase::__get__ (   self,
  obj,
  type = None 
) [inherited]

Reimplemented from PropertyProxy::PropertyProxy.

Definition at line 171 of file PropertyProxy.py.

00171                                         :
00172       try:
00173          return self.descr.__get__( obj, type )
00174       except AttributeError:
00175          # Get default
00176          try:
00177             default = obj.__class__.getDefaultProperty( self.descr.__name__ )
00178             default = self.convertDefaultToBeSet( obj, default )
00179             self.__set__( obj, default )
00180          except AttributeError,e:
00181             # change type of exception to avoid false error message
00182             raise RuntimeError(*e.args)
00183 
00184       return self.descr.__get__( obj, type )
00185 
00186 
   def __set__( self, obj, value ):

def PropertyProxy::GaudiHandlePropertyProxyBase::__set__ (   self,
  obj,
  value 
) [inherited]

Reimplemented from PropertyProxy::PropertyProxy.

Definition at line 187 of file PropertyProxy.py.

00187                                   :
00188     # allow a property to be set if we're in non-default mode, or if it
00189     # simply hasn't been set before
00190       if not obj._isInSetDefaults() or not obj in self.history:
00191          value = self.convertValueToBeSet( obj, value )
00192          # assign the value
00193          self.descr.__set__( obj, value )
00194          log.debug( "Setting %s = %r", self.fullPropertyName( obj ), value )
00195          self.history.setdefault( obj, [] ).append( value )
00196 
00197 
00198 
   def isHandle(self,value):

def PropertyProxy::GaudiHandlePropertyProxyBase::isHandle (   self,
  value 
) [inherited]

Check if <value> is a handle of the correct type

Definition at line 199 of file PropertyProxy.py.

00199                            :
00200       """Check if <value> is a handle of the correct type"""
00201       return isinstance(value,self._handleType)
00202 
00203 
   def isConfig(self,value):

def PropertyProxy::GaudiHandlePropertyProxyBase::isConfig (   self,
  value 
) [inherited]

Check if <value> is a configurable of the correct type

Definition at line 204 of file PropertyProxy.py.

00204                            :
00205       """Check if <value> is a configurable of the correct type"""
00206       return derives_from(value,self._confTypeName)
00207 
00208 
   def getDefaultConfigurable(self,typeAndName,requester):

def PropertyProxy::GaudiHandlePropertyProxyBase::getDefaultConfigurable (   self,
  typeAndName,
  requester 
) [inherited]

Return the configurable instance corresponding to the toolhandle if possible.
Otherwise return None

Definition at line 209 of file PropertyProxy.py.

00209                                                          :
00210       """Return the configurable instance corresponding to the toolhandle if possible.
00211       Otherwise return None"""
00212       global log
00213       # find the module
00214       typeAndNameTuple = typeAndName.split('/')
00215       confType = typeAndNameTuple[0]
00216       confClass=ConfigurableDb.getConfigurable(confType)
00217       # check the type of the configurable
00218       if not derives_from(confClass,self._confTypeName):
00219          log.error( "%s: Configurable %s is not a %s",
00220                     requester, confType, self._confTypeName )
00221          return None
00222       try:
00223          confName = typeAndNameTuple[1]
00224       except IndexError:
00225          return confClass() # use default name
00226       else:
00227          return confClass(confName)
00228 
00229 
   def convertDefaultToBeSet( self, obj, default ):

def PropertyProxy::PropertyProxy::setDefault (   self,
  value 
) [inherited]

Definition at line 71 of file PropertyProxy.py.

00071                                 :
00072       self.__default = value
00073 
   def getDefault( self ):

def PropertyProxy::PropertyProxy::getDefault (   self  )  [inherited]

Definition at line 74 of file PropertyProxy.py.

00074                          :
00075       return self.__default
00076 
   default = property( getDefault, setDefault )

def PropertyProxy::PropertyProxy::fullPropertyName (   self,
  obj 
) [inherited]

Definition at line 79 of file PropertyProxy.py.

00079                                     :
00080       return (obj.getJobOptName() or obj.getName()) + '.' + self.descr.__name__
00081 
   def __get__( self, obj, type = None ):

def PropertyProxy::PropertyProxy::__delete__ (   self,
  obj 
) [inherited]

Definition at line 144 of file PropertyProxy.py.

00144                               :
00145       if obj in self.history:
00146          del self.history[ obj ]
00147       self.descr.__delete__( obj )
00148 
00149 
00150 
class GaudiHandlePropertyProxyBase(PropertyProxy):


Member Data Documentation

PropertyProxy::GaudiHandleArrayPropertyProxy::arrayType

Definition at line 312 of file PropertyProxy.py.

tuple PropertyProxy::PropertyProxy::default = property( getDefault, setDefault ) [static, inherited]

Definition at line 77 of file PropertyProxy.py.

PropertyProxy::PropertyProxy::default [inherited]

Definition at line 68 of file PropertyProxy.py.

PropertyProxy::PropertyProxy::history [inherited]

Definition at line 63 of file PropertyProxy.py.

PropertyProxy::PropertyProxy::descr [inherited]

Definition at line 64 of file PropertyProxy.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:57:20 2011 for GaudiKernel by doxygen 1.4.7