1
2 """Line analyzer with output and the capability to store lines"""
3
4 from LogLineAnalyzer import LogLineAnalyzer
5 from PyFoam.Basics.OutFileCollection import OutFileCollection
6 from PyFoam.Basics.TimeLineCollection import TimeLineCollection
7
9 """Base class for analyzers that write data to files and store time-lines
10
11 Combines the capabilities of TimeLineLineAnalyzer and FileLineAnalyzer"""
12
13 - def __init__(self,
14 doTimelines=False,
15 doFiles=False,
16 titles=[],
17 accumulation=None,
18 singleFile=False,
19 startTime=None,
20 endTime=None):
21 """
22 @param titles: The titles of the data elements
23 """
24 LogLineAnalyzer.__init__(self)
25
26 self.doTimelines=doTimelines
27 self.doFiles=doFiles
28 self.singleFile=singleFile
29
30 self.files=None
31 self.titles=titles
32
33 self.setTitles(titles)
34
35 accu="first"
36 if accumulation!=None:
37 accu=accumulation
38 if self.doTimelines:
39 self.lines=TimeLineCollection(accumulation=accu)
40 else:
41 self.lines=None
42
43 self.startTime=startTime
44 self.endTime=endTime
45
46 self.master=None
47
49 """Assign another line-analyzer that will do the actual data gathering"""
50 self.master=master
51 if self.lines and self.master.lines:
52 self.master.lines.addSlave(self.lines)
53
55 """
56 Sets the titles anew
57 @param titles: the new titles
58 """
59 if self.doFiles:
60 self.titles=titles
61 if self.files!=None:
62 self.files.setTitles(titles)
63
65 """Creates the OutFileCollection-object"""
66 if self.doFiles:
67 self.files=OutFileCollection(oDir,
68 titles=self.titles,
69 singleFile=self.singleFile)
70 else:
71 self.files=None
72
82
84 """@param name: Name of the timeline to return
85 @return: the timeline as two list: the times and the values"""
86 if self.doTimelines:
87 return self.lines.getTimes(),self.lines.getValues(name)
88 else:
89 return [],[]
90
109
111 """Method at the start of a successfull match"""
112 pass
113
115 """Method at the end of a successfull match"""
116 pass
117
119 """Method that adds matched data to timelines
120
121 @param match: data matched by a regular expression"""
122
123 pass
124
126 """Method that adds matched data to files
127
128 @param match: data matched by a regular expression"""
129
130 pass
131
138