CMS 3D CMS Logo

Classes | Functions | Variables
ClassesDefXmlUtils Namespace Reference

Classes

class  XmlParser
 

Functions

def checkClass (name, version, versionsToChecksums)
 
def initCheckClass ()
 
def initROOT (library)
 

Variables

 errorMustAddChecksum
 
 errorMustUpdateClassVersion
 
 errorRootDoesNotMatchClassDef
 
 noError
 

Function Documentation

◆ checkClass()

def ClassesDefXmlUtils.checkClass (   name,
  version,
  versionsToChecksums 
)

Definition at line 116 of file ClassesDefXmlUtils.py.

116 def checkClass(name,version,versionsToChecksums):
117  import ROOT
118  c = ROOT.TClass.GetClass(name)
119  if not c:
120  raise RuntimeError("failed to load dictionary for class '"+name+"'")
121  temp = "checkTheClass.f(" + '"' + name + '"' + ");"
122  retval = ROOT.gROOT.ProcessLine(temp)
123  if retval == 0 :
124  raise RuntimeError("TClass::GetCheckSum: Failed to load dictionary for base class. See previous Error message")
125  classChecksum = c.GetCheckSum()
126  classVersion = c.GetClassVersion()
127 
128  #does this version match what is in the file?
129  if version != classVersion:
130  return (errorRootDoesNotMatchClassDef,classVersion,classChecksum)
131 
132  #is the version already in our list?
133  found = False
134 
135  for v,cs in versionsToChecksums:
136  if v == version:
137  found = True
138  if classChecksum != cs:
139  return (errorMustUpdateClassVersion,classVersion,classChecksum)
140  break
141  if not found and classVersion != 0:
142  return (errorMustAddChecksum,classVersion,classChecksum)
143  return (noError,classVersion,classChecksum)
144 
def checkClass(name, version, versionsToChecksums)

◆ initCheckClass()

def ClassesDefXmlUtils.initCheckClass ( )
Must be called before checkClass()

Definition at line 103 of file ClassesDefXmlUtils.py.

103 def initCheckClass():
104  """Must be called before checkClass()"""
105  import ROOT
106  ROOT.gROOT.ProcessLine("class checkclass {public: int f(char const* name) {TClass* cl = TClass::GetClass(name); bool b = false; cl->GetCheckSum(b); return (int)b;} };")
107  ROOT.gROOT.ProcessLine("checkclass checkTheClass;")
108 
109 
110 #The following are error codes returned from checkClass

◆ initROOT()

def ClassesDefXmlUtils.initROOT (   library)

Definition at line 91 of file ClassesDefXmlUtils.py.

91 def initROOT(library):
92  #Need to not have ROOT load .rootlogon.(C|py) since it can cause interference.
93  import ROOT
94  ROOT.PyConfig.DisableRootLogon = True
95 
96  #Keep ROOT from trying to use X11
97  ROOT.gROOT.SetBatch(True)
98  ROOT.gROOT.ProcessLine(".autodict")
99  if library is not None:
100  if ROOT.gSystem.Load(library) < 0 :
101  raise RuntimeError("failed to load library '"+library+"'")
102 

Variable Documentation

◆ errorMustAddChecksum

ClassesDefXmlUtils.errorMustAddChecksum

Definition at line 114 of file ClassesDefXmlUtils.py.

◆ errorMustUpdateClassVersion

ClassesDefXmlUtils.errorMustUpdateClassVersion

Definition at line 113 of file ClassesDefXmlUtils.py.

◆ errorRootDoesNotMatchClassDef

ClassesDefXmlUtils.errorRootDoesNotMatchClassDef

Definition at line 112 of file ClassesDefXmlUtils.py.

◆ noError