Debian Codegraph @

seatac/filterObj.H

raw symbols SCIP
1 #cxx . . $ `<file>/seatac/filterObj.H`/ifndef FILTEROBJ_H
2 #define FILTEROBJ_Hcxx . . $ `seatac/filterObj.H:2:9`!
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include "sharedObj.H"cxx . . $ `<file>/seatac/sharedObj.H`/
7 #include "util++.H"cxx . . $ `<file>/libutil/util++.H`/
8
9 //
10 // Object that will filter and output hits. If no sharedObj is
11 // supplied, the default behavior is output all hits.
12 //
13
14 // The default filter here inserts lots of '#'s into the output string,
15 // then replaces those with the real match id on output. An alternative
16 // (and probably better idea) is to build a vector of structs of things
17 // to output.
18
19 class filterObjcxx . . $ filterObj# {
20 public:
21 filterObjcxx . . $ filterObj#filterObj(6f6da539ca2a87b6).(sharedObjcxx . . $ sharedObj# *so, char *soOpts);
22 ~cxx . . $ filterObj#`~filterObj`(ced63f7c635d850d).filterObjcxx . . $ filterObj#();
23
24 void addHitcxx . . $ filterObj#addHit(a209694d0a1a92e0).(char direction,
25 uint32cxx . . $ uint32# id1,
26 uint32cxx . . $ uint32# pos1,
27 uint32cxx . . $ uint32# len1,
28 uint32cxx . . $ uint32# id2,
29 uint32cxx . . $ uint32# pos2,
30 uint32cxx . . $ uint32# len2,
31 uint32cxx . . $ uint32# filled);
32 void filtercxx . . $ filterObj#filter(49f6e7a06ebc5aa8).(void);
33 uint64cxx . . $ uint64# outputcxx . . $ filterObj#output(9bd1d5b934681de1).(FILE *, uint64cxx . . $ uint64#);
34
35 private:
36 char *soOptscxx . . $ filterObj#soOpts.;
37 sharedObjcxx . . $ sharedObj# *socxx . . $ filterObj#so.;
38
39 void *handlecxx . . $ filterObj#handle.;
40
41 void * (*soconstructcxx . . $ filterObj#soconstruct.)(char *);
42 void (*sodestructcxx . . $ filterObj#sodestruct.)(void *);
43 void (*soaddHitcxx . . $ filterObj#soaddHit.)(void *, char, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#);
44 void (*sofiltercxx . . $ filterObj#sofilter.)(void *);
45 uint64cxx . . $ uint64# (*sooutputcxx . . $ filterObj#sooutput.)(void *, FILE *, uint64cxx . . $ uint64#);
46
47 uint32cxx . . $ uint32# theOutputPoscxx . . $ filterObj#theOutputPos.;
48 uint32cxx . . $ uint32# theOutputMaxcxx . . $ filterObj#theOutputMax.;
49 char *theOutputcxx . . $ filterObj#theOutput.;
50
51 char name1cxx . . $ filterObj#name1.[32];
52 char name2cxx . . $ filterObj#name2.[32];
53
54 friend class statObjcxx . . $ statObj#;
55 };
56
57
58
59 inline
60 filterObjcxx . . $ filterObj#::filterObjcxx . . $ filterObj#filterObj(6f6da539ca2a87b6).(sharedObjcxx . . $ sharedObj# *so_, char *op_) {
61 soOptscxx . . $ filterObj#soOpts. = 0L;
62 socxx . . $ filterObj#so. = so_;
63
64 handlecxx . . $ filterObj#handle. = 0L;
65
66 soconstructcxx . . $ filterObj#soconstruct. = 0L;
67 sodestructcxx . . $ filterObj#sodestruct. = 0L;
68 soaddHitcxx . . $ filterObj#soaddHit. = 0L;
69 sofiltercxx . . $ filterObj#sofilter. = 0L;
70 sooutputcxx . . $ filterObj#sooutput. = 0L;
71
72 theOutputPoscxx . . $ filterObj#theOutputPos. = 0;
73 theOutputMaxcxx . . $ filterObj#theOutputMax. = 0;
74 theOutputcxx . . $ filterObj#theOutput. = 0L;
75
76 strcpy(name1cxx . . $ filterObj#name1., "UNK");
77 strcpy(name2cxx . . $ filterObj#name2., "UNK");
78
79 if (op_) {
80 soOptscxx . . $ filterObj#soOpts. = new char [strlen(op_) + 1];
81 strcpy(soOptscxx . . $ filterObj#soOpts., op_);
82
83 splitToWordscxx . . $ splitToWords# Wcxx . . $ splitToWords#splitToWords(fda57c8427c60377).(soOptscxx . . $ filterObj#soOpts.);
84
85 for (uint32cxx . . $ uint32# arg = 0; arg < W.numWordscxx . . $ splitToWords#numWords(db52760e79bf9054).(); arg++) {
86 if (strcmp(W.getWordcxx . . $ splitToWords#getWord(f109d7e0a0ca42b3).(arg), "-1") == 0) {
87 strncpy(name1cxx . . $ filterObj#name1., W.getWordcxx . . $ splitToWords#getWord(f109d7e0a0ca42b3).(++arg), 31);
88 } else if (strcmp(W.getWordcxx . . $ splitToWords#getWord(f109d7e0a0ca42b3).(arg), "-2") == 0) {
89 strncpy(name2cxx . . $ filterObj#name2., W.getWordcxx . . $ splitToWords#getWord(f109d7e0a0ca42b3).(++arg), 31);
90 }
91 }
92 }
93
94 if (socxx . . $ filterObj#so.) {
95 soconstructcxx . . $ filterObj#soconstruct. = (void* (*)(char *))socxx . . $ filterObj#so.->getcxx . . $ sharedObj#get(42228c1987407501).("construct");
96 sodestructcxx . . $ filterObj#sodestruct. = (void (*)(void*))socxx . . $ filterObj#so.->getcxx . . $ sharedObj#get(42228c1987407501).("destruct");
97 soaddHitcxx . . $ filterObj#soaddHit. = (void (*)(void *, char, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#, uint32cxx . . $ uint32#))socxx . . $ filterObj#so.->getcxx . . $ sharedObj#get(42228c1987407501).("addHit");
98 sofiltercxx . . $ filterObj#sofilter. = (void (*)(void*))socxx . . $ filterObj#so.->getcxx . . $ sharedObj#get(42228c1987407501).("filter");
99 sooutputcxx . . $ filterObj#sooutput. = (uint64cxx . . $ uint64# (*)(void*,FILE*,uint64cxx . . $ uint64#))socxx . . $ filterObj#so.->getcxx . . $ sharedObj#get(42228c1987407501).("output");
100
101 if (!soconstructcxx . . $ filterObj#soconstruct.) fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "construct not found!\n");
102 if (!sodestructcxx . . $ filterObj#sodestruct.) fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "destruct not found!\n");
103 if (!soaddHitcxx . . $ filterObj#soaddHit.) fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "addHit not found!\n");
104 if (!sofiltercxx . . $ filterObj#sofilter.) fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "filter not found!\n");
105 if (!sooutputcxx . . $ filterObj#sooutput.) fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "output not found!\n");
106
107 handlecxx . . $ filterObj#handle. = (*soconstructcxx . . $ filterObj#soconstruct.)(soOptscxx . . $ filterObj#soOpts.);
108 }
109
110 if (!socxx . . $ filterObj#so.) {
111 theOutputPoscxx . . $ filterObj#theOutputPos. = 0;
112 theOutputMaxcxx . . $ filterObj#theOutputMax. = 1048576;
113 theOutputcxx . . $ filterObj#theOutput. = new char [theOutputMaxcxx . . $ filterObj#theOutputMax.];
114 theOutputcxx . . $ filterObj#theOutput.[0] = 0;
115 }
116 }
117
118 inline
119 filterObjcxx . . $ filterObj#::~cxx . . $ filterObj#`~filterObj`(ced63f7c635d850d).filterObjcxx . . $ filterObj#() {
120 if (sodestructcxx . . $ filterObj#sodestruct.)
121 (*sodestructcxx . . $ filterObj#sodestruct.)(handlecxx . . $ filterObj#handle.);
122 delete [] soOptscxx . . $ filterObj#soOpts.;
123 delete [] theOutputcxx . . $ filterObj#theOutput.;
124 }
125
126
127 inline
128 void
129 filterObjcxx . . $ filterObj#::addHitcxx . . $ filterObj#addHit(a209694d0a1a92e0).(char orientation,
130 uint32cxx . . $ uint32# id1,
131 uint32cxx . . $ uint32# pos1,
132 uint32cxx . . $ uint32# len1,
133 uint32cxx . . $ uint32# id2,
134 uint32cxx . . $ uint32# pos2,
135 uint32cxx . . $ uint32# len2,
136 uint32cxx . . $ uint32# filled) {
137
138 if (soaddHitcxx . . $ filterObj#soaddHit.) {
139 (*soaddHitcxx . . $ filterObj#soaddHit.)(handlecxx . . $ filterObj#handle., orientation, id1, pos1, len1, id2, pos2, len2, filled);
140 } else {
141 if (theOutputPoscxx . . $ filterObj#theOutputPos. + 128 >= theOutputMaxcxx . . $ filterObj#theOutputMax.) {
142 theOutputMaxcxx . . $ filterObj#theOutputMax. <<= 1;
143 char *o = 0L;
144 try {
145 o = new char [theOutputMaxcxx . . $ filterObj#theOutputMax.];
146 } catch (stdcxx . . $ std/::bad_alloccxx . . $ std/bad_alloc#)cxx . . $ std/bad_alloc#bad_alloc(f0898f11383ce75e). {
147 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "hitMatrix::filter()-- caught std::bad_alloc in %s at line %d\n", __FILE__, __LINE__);
148 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "hitMatrix::filter()-- tried to extend output string from "uint32FMTcxx . . $ `libutil/util.h:65:10`!" to "uint32FMTcxx . . $ `libutil/util.h:65:10`!" bytes.\n", theOutputPoscxx . . $ filterObj#theOutputPos., theOutputMaxcxx . . $ filterObj#theOutputMax.);
149 exitcxx . . $ exit(44ed87f96534fad7).(1);
150 }
151 memcpy(o, theOutputcxx . . $ filterObj#theOutput., theOutputPoscxx . . $ filterObj#theOutputPos.);
152 delete [] theOutputcxx . . $ filterObj#theOutput.;
153 theOutputcxx . . $ filterObj#theOutput. = o;
154 }
155
156 sprintf(theOutputcxx . . $ filterObj#theOutput. + theOutputPoscxx . . $ filterObj#theOutputPos.,
157 "M x ############ . %s:"uint32FMTcxx . . $ `libutil/util.h:65:10`!" "uint32FMTcxx . . $ `libutil/util.h:65:10`!" "uint32FMTcxx . . $ `libutil/util.h:65:10`!" 1 %s:"uint32FMTcxx . . $ `libutil/util.h:65:10`!" "uint32FMTcxx . . $ `libutil/util.h:65:10`!" "uint32FMTcxx . . $ `libutil/util.h:65:10`!" %s "uint32FMTcxx . . $ `libutil/util.h:65:10`!"\n",
158 name1cxx . . $ filterObj#name1., id1, pos1, len1, name2cxx . . $ filterObj#name2., id2, pos2, len2, (orientation == 'f') ? "1" : "-1", filled);
159
160 while (theOutputcxx . . $ filterObj#theOutput.[theOutputPoscxx . . $ filterObj#theOutputPos.])
161 theOutputPoscxx . . $ filterObj#theOutputPos.++;
162 }
163 }
164
165
166
167 inline
168 void
169 filterObjcxx . . $ filterObj#::filtercxx . . $ filterObj#filter(49f6e7a06ebc5aa8).(void) {
170
171 if (sofiltercxx . . $ filterObj#sofilter.) {
172 (*sofiltercxx . . $ filterObj#sofilter.)(handlecxx . . $ filterObj#handle.);
173 }
174 }
175
176 inline
177 uint64cxx . . $ uint64#
178 filterObjcxx . . $ filterObj#::outputcxx . . $ filterObj#output(9bd1d5b934681de1).(FILE *F, uint64cxx . . $ uint64# matchid) {
179 if (sooutputcxx . . $ filterObj#sooutput.) {
180 matchid = (*sooutputcxx . . $ filterObj#sooutput.)(handlecxx . . $ filterObj#handle., F, matchid);
181 } else {
182 char matchIDstring[32] = {0};
183
184 // Insert the match id's for all these matches. We have to
185 // do this here (not during searches) because we're threaded.
186 //
187 char *pos = theOutputcxx . . $ filterObj#theOutput.;
188 while (*pos) {
189
190 // Construct a string holding the text version of the match id.
191 //
192 matchid++;
193 sprintf(matchIDstring, uint64FMTcxx . . $ `libutil/util.h:55:10`!, matchid);
194
195 // At the start of an output record. Skip the row type and
196 // sub type, 'M x ', which should put us at the start of
197 // the match id.
198 //
199 pos += 4;
200
201 // Copy the number into the space, removing any extra #
202 // marks, warning if we run out of space.
203 //
204 char *matchIDiterator = matchIDstring;
205 while ((*pos == '#') && (*matchIDiterator != 0))
206 *pos++ = *matchIDiterator++;
207
208 while (*pos == '#')
209 *pos++ = ' ';
210
211 if (*matchIDiterator != 0)
212 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "WARNING: there isn't enough space in the match to insert the match id "uint64FMTcxx . . $ `libutil/util.h:55:10`!" '%s'!\n",
213 matchid, matchIDstring);
214
215 // Skip to the next record
216 //
217 while (*pos++ != '\n')
218 ;
219 }
220
221 fwrite(theOutputcxx . . $ filterObj#theOutput., sizeof(char), theOutputPoscxx . . $ filterObj#theOutputPos., F);
222 }
223
224 return(matchid);
225 }
226
227
228 #endif // FILTEROBJ_H