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

In This Package:

GaudiHandles::PrivateToolHandleArray Class Reference

Inheritance diagram for GaudiHandles::PrivateToolHandleArray:
[legend]
Collaboration diagram for GaudiHandles::PrivateToolHandleArray:
[legend]
List of all members.

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__ = ()

Detailed Description

Definition at line 217 of file GaudiHandles.py.


Member Function Documentation

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]

Definition at line 140 of file GaudiHandles.py.

00141                                 :
00142         super( GaudiHandleArray, self ).__delitem__( self.index(self[key]) )

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]

Definition at line 185 of file GaudiHandles.py.

00186                       :
00187         return self.__class__.handleType.isPublic
00188 
    #

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]

Definition at line 201 of file GaudiHandles.py.

00202                            :
00203         return { 'typesAndNames' : self.typesAndNames }

def GaudiHandles::GaudiHandleArray::__setstate__ (   self,
  dict 
) [inherited]

Definition at line 204 of file GaudiHandles.py.

00205                                    :
00206         self.typesAndNames = dict[ 'typesAndNames' ]
00207 


Member Data Documentation

tuple GaudiHandles::PrivateToolHandleArray::__slots__ = () [static, private]

Reimplemented from GaudiHandles::GaudiHandleArray.

Definition at line 218 of file GaudiHandles.py.

GaudiHandles::PrivateToolHandleArray::handleType = PrivateToolHandle [static]

Reimplemented from GaudiHandles::GaudiHandleArray.

Definition at line 219 of file GaudiHandles.py.

GaudiHandles::GaudiHandleArray::typesAndNames [inherited]

Definition at line 205 of file GaudiHandles.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:17 2011 for GaudiKernel by doxygen 1.4.7