Package PyFoam :: Package Execution :: Module AnalyzedCommon
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.Execution.AnalyzedCommon

 1  #  ICE Revision: $Id: AnalyzedCommon.py 7581 2007-06-27 15:29:14Z bgschaid $  
 2  """Common stuff for classes that use analyzers""" 
 3   
 4  from os import path,mkdir 
 5   
6 -class AnalyzedCommon(object):
7 """This class collects information and methods that are needed for 8 handling analyzers""" 9
10 - def __init__(self,filename,analyzer):
11 """@param filename: name of the file that is being analyzed 12 @param analyzer: the analyzer itself""" 13 14 self.analyzer=analyzer 15 16 if 'dir' in dir(self): 17 self.logDir=path.join(self.dir,filename+".analyzed") 18 else: 19 self.logDir=filename+".analyzed" 20 21 if not path.exists(self.logDir): 22 mkdir(self.logDir) 23 24 self.reset()
25
26 - def tearDown(self):
27 self.analyzer.tearDown()
28
29 - def listAnalyzers(self):
30 """@returns: A list with the names of the analyzers""" 31 return self.analyzer.listAnalyzers()
32
33 - def getAnalyzer(self,name):
34 """@param name: name of the LineAnalyzer to get""" 35 return self.analyzer.getAnalyzer(name)
36
37 - def addAnalyzer(self,name,analyzer):
38 """@param name: name of the LineAnalyzer to add 39 @param analyzer: the analyzer to add""" 40 return self.analyzer.addAnalyzer(name,analyzer)
41
42 - def lineHandle(self,line):
43 """Not to be called: calls the analyzer for the current line""" 44 self.analyzer.analyzeLine(line)
45
46 - def reset(self):
47 """reset the analyzer""" 48 self.analyzer.setDirectory(self.logDir)
49
50 - def getDirname(self):
51 """Get the name of the directory where the data is written to""" 52 return self.logDir
53
54 - def getTime(self):
55 """Get the execution time""" 56 return self.analyzer.getTime()
57