Public Member Functions | |
def | __init__ |
def | __repr__ |
def | __str__ |
def | __getitem__ |
def | __delitem__ |
def | __iadd__ |
def | append |
def | isPublic |
def | toStringProperty |
def | __getstate__ |
def | __setstate__ |
Public Attributes | |
typesAndNames | |
Static Public Attributes | |
handleType = PrivateToolHandle | |
Static Private Attributes | |
tuple | __slots__ = () |
Definition at line 217 of file GaudiHandles.py.
def GaudiHandles::PrivateToolHandleArray::__init__ | ( | self, | ||
toolTypesAndNames = None | ||||
) |
Reimplemented from GaudiHandles::GaudiHandleArray.
Definition at line 221 of file GaudiHandles.py.
00221 : 00222 GaudiHandleArray.__init__( self, toolTypesAndNames ) 00223
def GaudiHandles::GaudiHandleArray::__repr__ | ( | self | ) | [inherited] |
Return class name with list of type/name strings as argument
Definition at line 114 of file GaudiHandles.py.
00115 : 00116 """Return class name with list of type/name strings as argument""" 00117 rep = self.__class__.__name__ + '([' 00118 for h in self: 00119 rep += repr(h.toStringProperty()) + ',' 00120 # remove last comma 00121 if rep[-1] == ',': rep = rep[:-1] 00122 return rep + '])'
def GaudiHandles::GaudiHandleArray::__str__ | ( | self | ) | [inherited] |
Print entries, one per line
Definition at line 123 of file GaudiHandles.py.
00124 : 00125 """Print entries, one per line""" 00126 shortName = self.__class__.__name__ 00127 #return "%s:%s" % (shortName, linesep + linesep.join([str(s) for s in self])) 00128 return self.toStringProperty()
def GaudiHandles::GaudiHandleArray::__getitem__ | ( | self, | ||
index | ||||
) | [inherited] |
Definition at line 129 of file GaudiHandles.py.
00130 : 00131 if type(index) == str: 00132 # seach by instance name 00133 for h in self: 00134 if h.getName() == index: 00135 return h 00136 raise IndexError( "%s does not have a %s with instance name %s" % \ 00137 (self.__class__.__name__, self.handleType.componentType, index) ) 00138 else: 00139 return list.__getitem__(self,index)
def GaudiHandles::GaudiHandleArray::__delitem__ | ( | self, | ||
key | ||||
) | [inherited] |
def GaudiHandles::GaudiHandleArray::__iadd__ | ( | self, | ||
array | ||||
) | [inherited] |
Definition at line 143 of file GaudiHandles.py.
00144 : 00145 arrayType = type(array) 00146 if arrayType == list or arrayType == type(self): 00147 for v in array: 00148 self.append( v ) 00149 else: 00150 raise TypeError( "Can not add a %s to a %s" % (arrayType.__name__, self.__class__.__name__) ) 00151 00152 return self
def GaudiHandles::GaudiHandleArray::append | ( | self, | ||
value | ||||
) | [inherited] |
Only allow appending compatible types. It accepts a string, a handle or a configurable.
Definition at line 153 of file GaudiHandles.py.
00154 : 00155 """Only allow appending compatible types. It accepts a string, a handle or a configurable.""" 00156 if type(value) == str: 00157 # convert string to handle 00158 value = self.__class__.handleType(value) 00159 elif type(value) == self.__class__.handleType: 00160 pass # leave handle as-is 00161 elif isinstance( value, GaudiHandle ): 00162 # do not allow different type of handles 00163 raise TypeError( "Can not add a %s to a %s" % (value.__class__.__name__, self.__class__.__name__) ) 00164 elif value.getGaudiType() != self.__class__.handleType.componentType: 00165 # assume it is a configurable: allow only correct types 00166 raise TypeError( "Can not append %s (%s) to a %s" % \ 00167 (value.__class__.__name__, value.getGaudiType(), self.__class__.__name__) ) 00168 elif hasattr(value,'isPublic'): 00169 # check public vs private if applicable for this configurable 00170 pop = value.isPublic() and 'Public' or 'Private' 00171 if value.isPublic() != self.__class__.handleType.isPublic: 00172 raise TypeError( "Can not append %s (%s %s) to a %s" % \ 00173 (value.__class__.__name__, pop, value.getGaudiType(), self.__class__.__name__) ) 00174 00175 # check that an instance name appears only once in the list 00176 try: 00177 oldValue = self.__getitem__( value.getName() ) 00178 except IndexError: 00179 # not yet there, so add it 00180 list.append( self, value ) 00181 else: 00182 print "%s WARNING %r with instance name %r already in list. Not adding %r" % \ 00183 (self.__class__.__name__, oldValue, oldValue.getName(), value) 00184
def GaudiHandles::GaudiHandleArray::isPublic | ( | self | ) | [inherited] |
def GaudiHandles::GaudiHandleArray::toStringProperty | ( | self | ) | [inherited] |
Definition at line 191 of file GaudiHandles.py.
00192 : 00193 rep = '[' 00194 # add entries 00195 for v in self: 00196 rep += repr( v.toStringProperty() ) + ',' 00197 # remove last comma 00198 if rep[-1] == ',': rep = rep[:-1] 00199 return rep + ']' 00200 # pickle support
def GaudiHandles::GaudiHandleArray::__getstate__ | ( | self | ) | [inherited] |
def GaudiHandles::GaudiHandleArray::__setstate__ | ( | self, | ||
dict | ||||
) | [inherited] |
Definition at line 204 of file GaudiHandles.py.
00205 : 00206 self.typesAndNames = dict[ 'typesAndNames' ] 00207
tuple GaudiHandles::PrivateToolHandleArray::__slots__ = () [static, private] |
GaudiHandles::GaudiHandleArray::typesAndNames [inherited] |
Definition at line 205 of file GaudiHandles.py.