CMS 3D CMS Logo

parseConfig::_IncrementFromVariableSetter Class Reference

Inheritance diagram for parseConfig::_IncrementFromVariableSetter:

parseConfig::_ReplaceSetter

List of all members.

Public Member Functions

def __init__
def dumpPython
def setProcess
def setValue

Public Attributes

 multiplesAllowed
 oldValue
 value
 valuePath


Detailed Description

replace command which gets its value from another parameter

Definition at line 1190 of file parseConfig.py.


Member Function Documentation

def parseConfig::_IncrementFromVariableSetter::__init__ (   self,
  value 
)

Reimplemented from parseConfig::_ReplaceSetter.

Definition at line 1192 of file parseConfig.py.

01192                             :
01193         self.valuePath = value
01194         super(type(self),self).__init__('.'.join(value))
01195         self.multiplesAllowed = True
01196         self.oldValue = None
    def setProcess(self,process):

def parseConfig::_IncrementFromVariableSetter::dumpPython (   self,
  options 
)

Reimplemented from parseConfig::_ReplaceSetter.

Definition at line 1218 of file parseConfig.py.

01218                                  :
01219         v = str(self.value)
01220         if options.isCfg:
01221             v = 'process.'+v
01222         # assume variables ending in s are plural
01223         if v[0] == '[':
01224            return ".extend("+v+")"
01225         elif v.endswith('s'):
01226            return ".extend("+v+")"
01227         else:
01228            return ".append("+v+")"
01229 
01230         
01231 
class _MakeSetter(object):

def parseConfig::_IncrementFromVariableSetter::setProcess (   self,
  process 
)

Definition at line 1197 of file parseConfig.py.

01197                                 :
01198         if self.oldValue is None:
01199             self.oldValue = self.value
01200             attr=None
01201             path = self.valuePath
01202             attr = process
01203             while path:
01204                 attr = getattr(attr,path[0])
01205                 path = path[1:]
01206             self.value = attr
    def setValue(self,obj,attr):

def parseConfig::_IncrementFromVariableSetter::setValue (   self,
  obj,
  attr 
)

Reimplemented from parseConfig::_ReplaceSetter.

Definition at line 1207 of file parseConfig.py.

01207                                :
01208         theAt = getattr(obj,attr)
01209         #determine if the types are compatible
01210         try:
01211             if type(theAt) is type(self.value):
01212                 theAt.extend(self.value)
01213             #see if theAt is a container and self.value can be added to it 
01214             else:
01215                 theAt.append(self.value.value())
01216         except Exception, e:
01217             raise RuntimeError("replacing with "+self.oldValue+" failed because\n"+str(e))
    def dumpPython(self, options):


Member Data Documentation

parseConfig::_IncrementFromVariableSetter::multiplesAllowed

Reimplemented from parseConfig::_ReplaceSetter.

Definition at line 1195 of file parseConfig.py.

parseConfig::_IncrementFromVariableSetter::oldValue

Definition at line 1196 of file parseConfig.py.

parseConfig::_IncrementFromVariableSetter::value

Reimplemented from parseConfig::_ReplaceSetter.

Definition at line 1206 of file parseConfig.py.

parseConfig::_IncrementFromVariableSetter::valuePath

Definition at line 1193 of file parseConfig.py.


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:49:27 2009 for CMSSW by  doxygen 1.5.4