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

In This Package:

catalog.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import reference
00004 
00005 class Catalog(reference.Referable):
00006     "A <catalog>"
00007     def __init__(self,name,logvols=[],refs=[],things=[]):
00008         reference.Referable.__init__(self,name)
00009         self.logvols=logvols
00010         self.refs=refs
00011         self.things=things
00012         self.full_path="/dd/"+name
00013         self.update()
00014         return
00015 
00016     def update(self):
00017         for ref in self.refs:
00018             ref.set_path(self.full_path)
00019         for lv in self.logvols:
00020             lv.set_path(self.full_path)
00021 
00022 
00023     def xml(self,fo,pre):
00024         "Output self as XML to file object fo, prefacing each line with pre"
00025         fo.write('%s<catalog name="%s">\n'%(pre,self.name))
00026         self.update()
00027         for ref in self.refs:
00028             ref.xml(fo,pre+'  ')
00029         for lv in self.logvols:
00030             lv.xml(fo,pre+'  ')
00031         for thing in self.things:
00032             thing.xml(fo,pre+'  ')
00033         fo.write('%s</catalog>\n'%pre)
00034         return
00035 
00036 
00037 if '__main__' == __name__:
00038     a = Catalog("CatalogA")
00039     b = Catalog("CatalogB")
00040     a.refs = [reference.Reference("#%s"%b.name,b)]
00041     import sys
00042     sys.stderr.write('a.full_path="%s" b.full_path="%s"\n'%(a.full_path,b.full_path))
00043     a.xml(sys.stdout,'')
00044     sys.stderr.write('a.full_path="%s" b.full_path="%s"\n'%(a.full_path,b.full_path))
00045     b.xml(sys.stdout,'')
00046     sys.stderr.write('a.full_path="%s" b.full_path="%s"\n'%(a.full_path,b.full_path))
00047 
00048     aa = Catalog("CatalogA")
00049     print aa.refs
00050     print aa.logvols
00051     print aa.things
00052     
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:14:01 2011 for XmlDetDesc by doxygen 1.4.7