Merge lp:~verifydtapn-contributers/verifydtapn/CleanupUnusedCode into lp:verifydtapn
- CleanupUnusedCode
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~verifydtapn-contributers/verifydtapn/CleanupUnusedCode |
Merge into: | lp:verifydtapn |
Diff against target: |
9150 lines (+2390/-2469) 90 files modified
lib/rapidxml-1.13/rapidxml_print.hpp (+189/-171) src/Core/ArgsParser.cpp (+93/-93) src/Core/ArgsParser.hpp (+22/-22) src/Core/QueryParser/AST.cpp (+14/-14) src/Core/QueryParser/AST.hpp (+20/-20) src/Core/QueryParser/Generated/location.hh (+10/-8) src/Core/QueryParser/Generated/parser.cpp (+185/-155) src/Core/QueryParser/Generated/parser.hpp (+16/-11) src/Core/QueryParser/Generated/position.hh (+10/-9) src/Core/QueryParser/Generated/stack.hh (+15/-7) src/Core/QueryParser/NormalizationVisitor.cpp (+45/-45) src/Core/QueryParser/NormalizationVisitor.hpp (+9/-9) src/Core/QueryParser/TAPNQueryParser.cpp (+2/-2) src/Core/QueryParser/TAPNQueryParser.hpp (+5/-4) src/Core/QueryParser/Visitor.hpp (+7/-7) src/Core/QueryParser/grammar.yy (+5/-5) src/Core/TAPN/InhibitorArc.cpp (+2/-2) src/Core/TAPN/InhibitorArc.hpp (+5/-5) src/Core/TAPN/OutputArc.cpp (+4/-4) src/Core/TAPN/OutputArc.hpp (+5/-5) src/Core/TAPN/Pairing.cpp (+0/-74) src/Core/TAPN/Pairing.hpp (+0/-44) src/Core/TAPN/TimeInterval.cpp (+2/-2) src/Core/TAPN/TimeInterval.hpp (+8/-8) src/Core/TAPN/TimeInvariant.cpp (+2/-2) src/Core/TAPN/TimeInvariant.hpp (+6/-6) src/Core/TAPN/TimedArcPetriNet.cpp (+73/-84) src/Core/TAPN/TimedArcPetriNet.hpp (+26/-31) src/Core/TAPN/TimedInputArc.cpp (+2/-2) src/Core/TAPN/TimedInputArc.hpp (+6/-6) src/Core/TAPN/TimedPlace.cpp (+4/-4) src/Core/TAPN/TimedPlace.hpp (+28/-28) src/Core/TAPN/TimedTransition.cpp (+6/-6) src/Core/TAPN/TimedTransition.hpp (+20/-20) src/Core/TAPN/TransportArc.cpp (+2/-2) src/Core/TAPN/TransportArc.hpp (+7/-7) src/Core/TAPNParser/TAPNXmlParser.cpp (+47/-47) src/Core/TAPNParser/TAPNXmlParser.hpp (+20/-20) src/Core/TAPNParser/util.cpp (+1/-1) src/Core/TAPNParser/util.hpp (+2/-2) src/Core/VerificationOptions.cpp (+56/-57) src/Core/VerificationOptions.hpp (+102/-58) src/DiscreteVerification/DataStructures/EncodingStructure.h (+106/-110) src/DiscreteVerification/DataStructures/NonStrictMarking.hpp (+1/-1) src/DiscreteVerification/DataStructures/NonStrictMarkingBase.cpp (+38/-67) src/DiscreteVerification/DataStructures/NonStrictMarkingBase.hpp (+70/-50) src/DiscreteVerification/DataStructures/PData.h (+0/-430) src/DiscreteVerification/DataStructures/PTrie.h (+416/-0) src/DiscreteVerification/DataStructures/PWList.cpp (+25/-26) src/DiscreteVerification/DataStructures/PWList.hpp (+24/-26) src/DiscreteVerification/DataStructures/TimeDart.hpp (+1/-1) src/DiscreteVerification/DataStructures/TimeDartLivenessPWList.cpp (+38/-38) src/DiscreteVerification/DataStructures/TimeDartLivenessPWList.hpp (+21/-22) src/DiscreteVerification/DataStructures/TimeDartPWList.cpp (+21/-21) src/DiscreteVerification/DataStructures/TimeDartPWList.hpp (+18/-18) src/DiscreteVerification/DataStructures/WaitingList.hpp (+52/-52) src/DiscreteVerification/DiscreteVerification.cpp (+29/-29) src/DiscreteVerification/DiscreteVerification.hpp (+5/-5) src/DiscreteVerification/PlaceVisitor.cpp (+27/-27) src/DiscreteVerification/PlaceVisitor.hpp (+7/-7) src/DiscreteVerification/QueryVisitor.hpp (+31/-31) src/DiscreteVerification/SearchStrategies/LivenessWeightQueryVisitor.cpp (+26/-26) src/DiscreteVerification/SearchStrategies/LivenessWeightQueryVisitor.hpp (+8/-8) src/DiscreteVerification/SearchStrategies/NonStrictBFS.hpp (+1/-1) src/DiscreteVerification/SearchStrategies/NonStrictDFS.hpp (+1/-1) src/DiscreteVerification/SearchStrategies/NonStrictDFSHeuristic.hpp (+1/-1) src/DiscreteVerification/SearchStrategies/NonStrictDFSRandom.hpp (+1/-1) src/DiscreteVerification/SearchStrategies/NonStrictHeuristic.hpp (+1/-1) src/DiscreteVerification/SearchStrategies/NonStrictRandom.hpp (+1/-1) src/DiscreteVerification/SearchStrategies/SearchFactory.h (+20/-20) src/DiscreteVerification/SearchStrategies/SearchStrategy.hpp (+1/-1) src/DiscreteVerification/SearchStrategies/WeightQueryVisitor.cpp (+26/-26) src/DiscreteVerification/SearchStrategies/WeightQueryVisitor.hpp (+8/-8) src/DiscreteVerification/SuccessorGenerator.hpp (+46/-57) src/DiscreteVerification/TimeDartSuccessorGenerator.cpp (+24/-34) src/DiscreteVerification/TimeDartSuccessorGenerator.hpp (+2/-3) src/DiscreteVerification/Util/IntervalOps.cpp (+1/-1) src/DiscreteVerification/Util/IntervalOps.hpp (+1/-1) src/DiscreteVerification/VerificationTypes/LivenessSearch.cpp (+24/-24) src/DiscreteVerification/VerificationTypes/LivenessSearch.hpp (+5/-5) src/DiscreteVerification/VerificationTypes/ReachabilitySearch.cpp (+25/-25) src/DiscreteVerification/VerificationTypes/ReachabilitySearch.hpp (+7/-7) src/DiscreteVerification/VerificationTypes/TimeDartLiveness.cpp (+19/-19) src/DiscreteVerification/VerificationTypes/TimeDartLiveness.hpp (+4/-4) src/DiscreteVerification/VerificationTypes/TimeDartReachabilitySearch.cpp (+16/-16) src/DiscreteVerification/VerificationTypes/TimeDartReachabilitySearch.hpp (+5/-5) src/DiscreteVerification/VerificationTypes/TimeDartVerification.cpp (+44/-44) src/DiscreteVerification/VerificationTypes/TimeDartVerification.hpp (+5/-5) src/DiscreteVerification/VerificationTypes/Verification.hpp (+47/-47) src/main.cpp (+7/-7) |
To merge this branch: | bzr merge lp:~verifydtapn-contributers/verifydtapn/CleanupUnusedCode |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jiri Srba | Needs Fixing | ||
Jakob Taankvist | Pending | ||
Mathias Grund Sørensen | Pending | ||
Review via email: mp+163010@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-05-15.
Commit message
Description of the change
The changes are all renaming of methods, classes and variables, such that the code is consistent with respect to camelcase, getters and setters.
There are two other changes;
TokenList emptyTokenList;
in nonstrictmarking base has been made static.
Pairing has also been removed from the TAPN model as it was unused.
Furthermore, I propose that printHumanTrace is removed as it is unused and with high probability bugged.
Peter Gjøl Jensen (peter-gjoel) wrote : | # |
Jiri Srba (srba) wrote : | # |
Does not compile any more. A prefix of the long error list:
In file included from ./DiscreteVerif
./DiscreteVerif
In file included from ./DiscreteVerif
./DiscreteVerif
In file included from ./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
....
...
..
- 314. By Peter Gjøl Jensen
-
added missing file
- 315. By Peter Gjøl Jensen
-
corrected grammar
- 316. By Peter Gjøl Jensen
-
fixed errors in grammar
Peter Gjøl Jensen (peter-gjoel) wrote : | # |
Sorry, A file was missing after I renamed it. It should compile now
Jiri Srba (srba) wrote : | # |
Well, still more errors:
In file included from ./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
/Users/
In file included from ./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
/Users/
In file included from ./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
/Users/
In file included from ./DiscreteVerif
./DiscreteVerif
./DiscreteVerif
/Users/
In file included from ./DiscreteVerif
- 317. By Peter Gjøl Jensen
-
fixed need for --fpermssive on linux
- 318. By Peter Gjøl Jensen
-
made allocator for PTrie explicit
- 319. By Peter Gjøl Jensen
-
fixed warnings for g++ 4.7
- 320. By Peter Gjøl Jensen
-
corrected calculation of splitsize
- 321. By Peter Gjøl Jensen
-
diverged merge
- 322. By Jiri Srba
-
change version number to 2.0.1
- 323. By Peter Gjøl Jensen
-
fixed warning
Unmerged revisions
Preview Diff
1 | === modified file 'lib/rapidxml-1.13/rapidxml_print.hpp' |
2 | --- lib/rapidxml-1.13/rapidxml_print.hpp 2012-03-02 10:59:16 +0000 |
3 | +++ lib/rapidxml-1.13/rapidxml_print.hpp 2013-05-15 15:27:27 +0000 |
4 | @@ -10,89 +10,102 @@ |
5 | |
6 | // Only include streams if not disabled |
7 | #ifndef RAPIDXML_NO_STREAMS |
8 | - #include <ostream> |
9 | - #include <iterator> |
10 | +#include <ostream> |
11 | +#include <iterator> |
12 | #endif |
13 | |
14 | -namespace rapidxml |
15 | -{ |
16 | +namespace rapidxml { |
17 | |
18 | /////////////////////////////////////////////////////////////////////// |
19 | // Printing flags |
20 | |
21 | - const int print_no_indenting = 0x1; //!< Printer flag instructing the printer to suppress indenting of XML. See print() function. |
22 | + const int print_no_indenting = 0x1; //!< Printer flag instructing the printer to suppress indenting of XML. See print() function. |
23 | |
24 | /////////////////////////////////////////////////////////////////////// |
25 | // Internal |
26 | |
27 | //! \cond internal |
28 | - namespace internal |
29 | - { |
30 | - |
31 | + namespace internal { |
32 | + |
33 | /////////////////////////////////////////////////////////////////////////// |
34 | // Internal character operations |
35 | - |
36 | + |
37 | // Copy characters from given range to given output iterator |
38 | + |
39 | template<class OutIt, class Ch> |
40 | - inline OutIt copy_chars(const Ch *begin, const Ch *end, OutIt out) |
41 | - { |
42 | + inline OutIt copy_chars(const Ch *begin, const Ch *end, OutIt out) { |
43 | while (begin != end) |
44 | *out++ = *begin++; |
45 | return out; |
46 | } |
47 | - |
48 | + |
49 | // Copy characters from given range to given output iterator and expand |
50 | // characters into references (< > ' " &) |
51 | + |
52 | template<class OutIt, class Ch> |
53 | - inline OutIt copy_and_expand_chars(const Ch *begin, const Ch *end, Ch noexpand, OutIt out) |
54 | - { |
55 | - while (begin != end) |
56 | - { |
57 | - if (*begin == noexpand) |
58 | - { |
59 | - *out++ = *begin; // No expansion, copy character |
60 | - } |
61 | - else |
62 | - { |
63 | - switch (*begin) |
64 | - { |
65 | - case Ch('<'): |
66 | - *out++ = Ch('&'); *out++ = Ch('l'); *out++ = Ch('t'); *out++ = Ch(';'); |
67 | - break; |
68 | - case Ch('>'): |
69 | - *out++ = Ch('&'); *out++ = Ch('g'); *out++ = Ch('t'); *out++ = Ch(';'); |
70 | - break; |
71 | - case Ch('\''): |
72 | - *out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('p'); *out++ = Ch('o'); *out++ = Ch('s'); *out++ = Ch(';'); |
73 | - break; |
74 | - case Ch('"'): |
75 | - *out++ = Ch('&'); *out++ = Ch('q'); *out++ = Ch('u'); *out++ = Ch('o'); *out++ = Ch('t'); *out++ = Ch(';'); |
76 | - break; |
77 | - case Ch('&'): |
78 | - *out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('m'); *out++ = Ch('p'); *out++ = Ch(';'); |
79 | - break; |
80 | - default: |
81 | - *out++ = *begin; // No expansion, copy character |
82 | + inline OutIt copy_and_expand_chars(const Ch *begin, const Ch *end, Ch noexpand, OutIt out) { |
83 | + while (begin != end) { |
84 | + if (*begin == noexpand) { |
85 | + *out++ = *begin; // No expansion, copy character |
86 | + } else { |
87 | + switch (*begin) { |
88 | + case Ch('<'): |
89 | + *out++ = Ch('&'); |
90 | + *out++ = Ch('l'); |
91 | + *out++ = Ch('t'); |
92 | + *out++ = Ch(';'); |
93 | + break; |
94 | + case Ch('>'): |
95 | + *out++ = Ch('&'); |
96 | + *out++ = Ch('g'); |
97 | + *out++ = Ch('t'); |
98 | + *out++ = Ch(';'); |
99 | + break; |
100 | + case Ch('\''): |
101 | + *out++ = Ch('&'); |
102 | + *out++ = Ch('a'); |
103 | + *out++ = Ch('p'); |
104 | + *out++ = Ch('o'); |
105 | + *out++ = Ch('s'); |
106 | + *out++ = Ch(';'); |
107 | + break; |
108 | + case Ch('"'): |
109 | + *out++ = Ch('&'); |
110 | + *out++ = Ch('q'); |
111 | + *out++ = Ch('u'); |
112 | + *out++ = Ch('o'); |
113 | + *out++ = Ch('t'); |
114 | + *out++ = Ch(';'); |
115 | + break; |
116 | + case Ch('&'): |
117 | + *out++ = Ch('&'); |
118 | + *out++ = Ch('a'); |
119 | + *out++ = Ch('m'); |
120 | + *out++ = Ch('p'); |
121 | + *out++ = Ch(';'); |
122 | + break; |
123 | + default: |
124 | + *out++ = *begin; // No expansion, copy character |
125 | } |
126 | } |
127 | - ++begin; // Step to next character |
128 | + ++begin; // Step to next character |
129 | } |
130 | return out; |
131 | } |
132 | |
133 | // Fill given output iterator with repetitions of the same character |
134 | + |
135 | template<class OutIt, class Ch> |
136 | - inline OutIt fill_chars(OutIt out, int n, Ch ch) |
137 | - { |
138 | + inline OutIt fill_chars(OutIt out, int n, Ch ch) { |
139 | for (int i = 0; i < n; ++i) |
140 | *out++ = ch; |
141 | return out; |
142 | } |
143 | |
144 | // Find character |
145 | + |
146 | template<class Ch, Ch ch> |
147 | - inline bool find_char(const Ch *begin, const Ch *end) |
148 | - { |
149 | + inline bool find_char(const Ch *begin, const Ch *end) { |
150 | while (begin != end) |
151 | if (*begin++ == ch) |
152 | return true; |
153 | @@ -101,99 +114,36 @@ |
154 | |
155 | /////////////////////////////////////////////////////////////////////////// |
156 | // Internal printing operations |
157 | - |
158 | + |
159 | // Print node |
160 | template<class OutIt, class Ch> |
161 | - inline OutIt print_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) |
162 | - { |
163 | - // Print proper node type |
164 | - switch (node->type()) |
165 | - { |
166 | - |
167 | - // Document |
168 | - case node_document: |
169 | - out = print_children(out, node, flags, indent); |
170 | - break; |
171 | - |
172 | - // Element |
173 | - case node_element: |
174 | - out = print_element_node(out, node, flags, indent); |
175 | - break; |
176 | - |
177 | - // Data |
178 | - case node_data: |
179 | - out = print_data_node(out, node, flags, indent); |
180 | - break; |
181 | - |
182 | - // CDATA |
183 | - case node_cdata: |
184 | - out = print_cdata_node(out, node, flags, indent); |
185 | - break; |
186 | - |
187 | - // Declaration |
188 | - case node_declaration: |
189 | - out = print_declaration_node(out, node, flags, indent); |
190 | - break; |
191 | - |
192 | - // Comment |
193 | - case node_comment: |
194 | - out = print_comment_node(out, node, flags, indent); |
195 | - break; |
196 | - |
197 | - // Doctype |
198 | - case node_doctype: |
199 | - out = print_doctype_node(out, node, flags, indent); |
200 | - break; |
201 | - |
202 | - // Pi |
203 | - case node_pi: |
204 | - out = print_pi_node(out, node, flags, indent); |
205 | - break; |
206 | - |
207 | - // Unknown |
208 | - default: |
209 | - assert(0); |
210 | - break; |
211 | - } |
212 | - |
213 | - // If indenting not disabled, add line break after node |
214 | - if (!(flags & print_no_indenting)) |
215 | - *out = Ch('\n'), ++out; |
216 | - |
217 | - // Return modified iterator |
218 | - return out; |
219 | - } |
220 | - |
221 | + inline OutIt print_node(OutIt out, const xml_node<Ch> *node, int flags, int indent); |
222 | + |
223 | // Print children of the node |
224 | + |
225 | template<class OutIt, class Ch> |
226 | - inline OutIt print_children(OutIt out, const xml_node<Ch> *node, int flags, int indent) |
227 | - { |
228 | + inline OutIt print_children(OutIt out, const xml_node<Ch> *node, int flags, int indent) { |
229 | for (xml_node<Ch> *child = node->first_node(); child; child = child->next_sibling()) |
230 | out = print_node(out, child, flags, indent); |
231 | return out; |
232 | } |
233 | |
234 | // Print attributes of the node |
235 | + |
236 | template<class OutIt, class Ch> |
237 | - inline OutIt print_attributes(OutIt out, const xml_node<Ch> *node, int flags) |
238 | - { |
239 | - for (xml_attribute<Ch> *attribute = node->first_attribute(); attribute; attribute = attribute->next_attribute()) |
240 | - { |
241 | - if (attribute->name() && attribute->value()) |
242 | - { |
243 | + inline OutIt print_attributes(OutIt out, const xml_node<Ch> *node, int flags) { |
244 | + for (xml_attribute<Ch> *attribute = node->first_attribute(); attribute; attribute = attribute->next_attribute()) { |
245 | + if (attribute->name() && attribute->value()) { |
246 | // Print attribute name |
247 | *out = Ch(' '), ++out; |
248 | out = copy_chars(attribute->name(), attribute->name() + attribute->name_size(), out); |
249 | *out = Ch('='), ++out; |
250 | // Print attribute value using appropriate quote type |
251 | - if (find_char<Ch, Ch('"')>(attribute->value(), attribute->value() + attribute->value_size())) |
252 | - { |
253 | + if (find_char < Ch, Ch('"')>(attribute->value(), attribute->value() + attribute->value_size())) { |
254 | *out = Ch('\''), ++out; |
255 | out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('"'), out); |
256 | *out = Ch('\''), ++out; |
257 | - } |
258 | - else |
259 | - { |
260 | + } else { |
261 | *out = Ch('"'), ++out; |
262 | out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('\''), out); |
263 | *out = Ch('"'), ++out; |
264 | @@ -204,9 +154,9 @@ |
265 | } |
266 | |
267 | // Print data node |
268 | + |
269 | template<class OutIt, class Ch> |
270 | - inline OutIt print_data_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) |
271 | - { |
272 | + inline OutIt print_data_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) { |
273 | assert(node->type() == node_data); |
274 | if (!(flags & print_no_indenting)) |
275 | out = fill_chars(out, indent, Ch('\t')); |
276 | @@ -215,32 +165,44 @@ |
277 | } |
278 | |
279 | // Print data node |
280 | + |
281 | template<class OutIt, class Ch> |
282 | - inline OutIt print_cdata_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) |
283 | - { |
284 | + inline OutIt print_cdata_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) { |
285 | assert(node->type() == node_cdata); |
286 | if (!(flags & print_no_indenting)) |
287 | out = fill_chars(out, indent, Ch('\t')); |
288 | - *out = Ch('<'); ++out; |
289 | - *out = Ch('!'); ++out; |
290 | - *out = Ch('['); ++out; |
291 | - *out = Ch('C'); ++out; |
292 | - *out = Ch('D'); ++out; |
293 | - *out = Ch('A'); ++out; |
294 | - *out = Ch('T'); ++out; |
295 | - *out = Ch('A'); ++out; |
296 | - *out = Ch('['); ++out; |
297 | + *out = Ch('<'); |
298 | + ++out; |
299 | + *out = Ch('!'); |
300 | + ++out; |
301 | + *out = Ch('['); |
302 | + ++out; |
303 | + *out = Ch('C'); |
304 | + ++out; |
305 | + *out = Ch('D'); |
306 | + ++out; |
307 | + *out = Ch('A'); |
308 | + ++out; |
309 | + *out = Ch('T'); |
310 | + ++out; |
311 | + *out = Ch('A'); |
312 | + ++out; |
313 | + *out = Ch('['); |
314 | + ++out; |
315 | out = copy_chars(node->value(), node->value() + node->value_size(), out); |
316 | - *out = Ch(']'); ++out; |
317 | - *out = Ch(']'); ++out; |
318 | - *out = Ch('>'); ++out; |
319 | + *out = Ch(']'); |
320 | + ++out; |
321 | + *out = Ch(']'); |
322 | + ++out; |
323 | + *out = Ch('>'); |
324 | + ++out; |
325 | return out; |
326 | } |
327 | |
328 | // Print element node |
329 | + |
330 | template<class OutIt, class Ch> |
331 | - inline OutIt print_element_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) |
332 | - { |
333 | + inline OutIt print_element_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) { |
334 | assert(node->type() == node_element); |
335 | |
336 | // Print element name and attributes, if any |
337 | @@ -249,33 +211,25 @@ |
338 | *out = Ch('<'), ++out; |
339 | out = copy_chars(node->name(), node->name() + node->name_size(), out); |
340 | out = print_attributes(out, node, flags); |
341 | - |
342 | + |
343 | // If node is childless |
344 | - if (node->value_size() == 0 && !node->first_node()) |
345 | - { |
346 | + if (node->value_size() == 0 && !node->first_node()) { |
347 | // Print childless node tag ending |
348 | *out = Ch('/'), ++out; |
349 | *out = Ch('>'), ++out; |
350 | - } |
351 | - else |
352 | - { |
353 | + } else { |
354 | // Print normal node tag ending |
355 | *out = Ch('>'), ++out; |
356 | |
357 | // Test if node contains a single data node only (and no other nodes) |
358 | xml_node<Ch> *child = node->first_node(); |
359 | - if (!child) |
360 | - { |
361 | + if (!child) { |
362 | // If node has no children, only print its value without indenting |
363 | out = copy_and_expand_chars(node->value(), node->value() + node->value_size(), Ch(0), out); |
364 | - } |
365 | - else if (child->next_sibling() == 0 && child->type() == node_data) |
366 | - { |
367 | + } else if (child->next_sibling() == 0 && child->type() == node_data) { |
368 | // If node has a sole data child, only print its value without indenting |
369 | out = copy_and_expand_chars(child->value(), child->value() + child->value_size(), Ch(0), out); |
370 | - } |
371 | - else |
372 | - { |
373 | + } else { |
374 | // Print all children with full indenting |
375 | if (!(flags & print_no_indenting)) |
376 | *out = Ch('\n'), ++out; |
377 | @@ -294,9 +248,9 @@ |
378 | } |
379 | |
380 | // Print declaration node |
381 | + |
382 | template<class OutIt, class Ch> |
383 | - inline OutIt print_declaration_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) |
384 | - { |
385 | + inline OutIt print_declaration_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) { |
386 | // Print declaration start |
387 | if (!(flags & print_no_indenting)) |
388 | out = fill_chars(out, indent, Ch('\t')); |
389 | @@ -308,18 +262,18 @@ |
390 | |
391 | // Print attributes |
392 | out = print_attributes(out, node, flags); |
393 | - |
394 | + |
395 | // Print declaration end |
396 | *out = Ch('?'), ++out; |
397 | *out = Ch('>'), ++out; |
398 | - |
399 | + |
400 | return out; |
401 | } |
402 | |
403 | // Print comment node |
404 | + |
405 | template<class OutIt, class Ch> |
406 | - inline OutIt print_comment_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) |
407 | - { |
408 | + inline OutIt print_comment_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) { |
409 | assert(node->type() == node_comment); |
410 | if (!(flags & print_no_indenting)) |
411 | out = fill_chars(out, indent, Ch('\t')); |
412 | @@ -335,9 +289,9 @@ |
413 | } |
414 | |
415 | // Print doctype node |
416 | + |
417 | template<class OutIt, class Ch> |
418 | - inline OutIt print_doctype_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) |
419 | - { |
420 | + inline OutIt print_doctype_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) { |
421 | assert(node->type() == node_doctype); |
422 | if (!(flags & print_no_indenting)) |
423 | out = fill_chars(out, indent, Ch('\t')); |
424 | @@ -357,9 +311,9 @@ |
425 | } |
426 | |
427 | // Print pi node |
428 | + |
429 | template<class OutIt, class Ch> |
430 | - inline OutIt print_pi_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) |
431 | - { |
432 | + inline OutIt print_pi_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) { |
433 | assert(node->type() == node_pi); |
434 | if (!(flags & print_no_indenting)) |
435 | out = fill_chars(out, indent, Ch('\t')); |
436 | @@ -373,6 +327,68 @@ |
437 | return out; |
438 | } |
439 | |
440 | + // Print node |
441 | + |
442 | + template<class OutIt, class Ch> |
443 | + inline OutIt print_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) { |
444 | + // Print proper node type |
445 | + switch (node->type()) { |
446 | + |
447 | + // Document |
448 | + case node_document: |
449 | + out = print_children(out, node, flags, indent); |
450 | + break; |
451 | + |
452 | + // Element |
453 | + case node_element: |
454 | + out = print_element_node(out, node, flags, indent); |
455 | + break; |
456 | + |
457 | + // Data |
458 | + case node_data: |
459 | + out = print_data_node(out, node, flags, indent); |
460 | + break; |
461 | + |
462 | + // CDATA |
463 | + case node_cdata: |
464 | + out = print_cdata_node(out, node, flags, indent); |
465 | + break; |
466 | + |
467 | + // Declaration |
468 | + case node_declaration: |
469 | + out = print_declaration_node(out, node, flags, indent); |
470 | + break; |
471 | + |
472 | + // Comment |
473 | + case node_comment: |
474 | + out = print_comment_node(out, node, flags, indent); |
475 | + break; |
476 | + |
477 | + // Doctype |
478 | + case node_doctype: |
479 | + out = print_doctype_node(out, node, flags, indent); |
480 | + break; |
481 | + |
482 | + // Pi |
483 | + case node_pi: |
484 | + out = print_pi_node(out, node, flags, indent); |
485 | + break; |
486 | + |
487 | + // Unknown |
488 | + default: |
489 | + assert(0); |
490 | + break; |
491 | + } |
492 | + |
493 | + // If indenting not disabled, add line break after node |
494 | + if (!(flags & print_no_indenting)) |
495 | + *out = Ch('\n'), ++out; |
496 | + |
497 | + // Return modified iterator |
498 | + return out; |
499 | + } |
500 | + |
501 | + |
502 | } |
503 | //! \endcond |
504 | |
505 | @@ -384,9 +400,9 @@ |
506 | //! \param node Node to be printed. Pass xml_document to print entire document. |
507 | //! \param flags Flags controlling how XML is printed. |
508 | //! \return Output iterator pointing to position immediately after last character of printed text. |
509 | - template<class OutIt, class Ch> |
510 | - inline OutIt print(OutIt out, const xml_node<Ch> &node, int flags = 0) |
511 | - { |
512 | + |
513 | + template<class OutIt, class Ch> |
514 | + inline OutIt print(OutIt out, const xml_node<Ch> &node, int flags = 0) { |
515 | return internal::print_node(out, &node, flags, 0); |
516 | } |
517 | |
518 | @@ -397,9 +413,9 @@ |
519 | //! \param node Node to be printed. Pass xml_document to print entire document. |
520 | //! \param flags Flags controlling how XML is printed. |
521 | //! \return Output stream. |
522 | - template<class Ch> |
523 | - inline std::basic_ostream<Ch> &print(std::basic_ostream<Ch> &out, const xml_node<Ch> &node, int flags = 0) |
524 | - { |
525 | + |
526 | + template<class Ch> |
527 | + inline std::basic_ostream<Ch> &print(std::basic_ostream<Ch> &out, const xml_node<Ch> &node, int flags = 0) { |
528 | print(std::ostream_iterator<Ch>(out), node, flags); |
529 | return out; |
530 | } |
531 | @@ -408,12 +424,14 @@ |
532 | //! \param out Output stream to print to. |
533 | //! \param node Node to be printed. |
534 | //! \return Output stream. |
535 | - template<class Ch> |
536 | - inline std::basic_ostream<Ch> &operator <<(std::basic_ostream<Ch> &out, const xml_node<Ch> &node) |
537 | - { |
538 | + |
539 | + template<class Ch> |
540 | + inline std::basic_ostream<Ch> &operator <<(std::basic_ostream<Ch> &out, const xml_node<Ch> &node) { |
541 | return print(out, node); |
542 | } |
543 | |
544 | + |
545 | + |
546 | #endif |
547 | |
548 | } |
549 | |
550 | === modified file 'src/Core/ArgsParser.cpp' |
551 | --- src/Core/ArgsParser.cpp 2013-02-24 22:48:05 +0000 |
552 | +++ src/Core/ArgsParser.cpp 2013-05-15 15:27:27 +0000 |
553 | @@ -19,7 +19,7 @@ |
554 | static const std::string KEEP_DEAD = "keep-dead-tokens"; |
555 | |
556 | std::ostream& operator<<(std::ostream& out, const Switch& flag) { |
557 | - flag.Print(out); |
558 | + flag.print(out); |
559 | return out; |
560 | } |
561 | |
562 | @@ -43,36 +43,36 @@ |
563 | } |
564 | } |
565 | |
566 | -void Switch::Print(std::ostream& out) const { |
567 | +void Switch::print(std::ostream& out) const { |
568 | std::stringstream s; |
569 | - s << "-" << ShortName(); |
570 | - s << " [ --" << LongName() << " ]"; |
571 | + s << "-" << getShortName(); |
572 | + s << " [ --" << getLongName() << " ]"; |
573 | out << std::setw(WIDTH) << std::left << s.str(); |
574 | - PrintIndentedDescription(out, Description()); |
575 | + PrintIndentedDescription(out, getDescription()); |
576 | } |
577 | ; |
578 | |
579 | -void SwitchWithArg::Print(std::ostream& out) const { |
580 | +void SwitchWithArg::print(std::ostream& out) const { |
581 | std::stringstream s; |
582 | - s << "-" << ShortName(); |
583 | - s << " [ --" << LongName() << " ] "; |
584 | + s << "-" << getShortName(); |
585 | + s << " [ --" << getLongName() << " ] "; |
586 | s << " arg (=" << default_value << ")"; |
587 | out << std::setw(WIDTH) << std::left << s.str(); |
588 | - PrintIndentedDescription(out, Description()); |
589 | + PrintIndentedDescription(out, getDescription()); |
590 | } |
591 | ; |
592 | |
593 | -void SwitchWithStringArg::Print(std::ostream& out) const { |
594 | +void SwitchWithStringArg::print(std::ostream& out) const { |
595 | std::stringstream s; |
596 | - s << "-" << ShortName(); |
597 | - s << " [ --" << LongName() << " ] "; |
598 | + s << "-" << getShortName(); |
599 | + s << " [ --" << getLongName() << " ] "; |
600 | s << " a1,a2,.. (=" << default_value << ")"; |
601 | out << std::setw(WIDTH) << std::left << s.str(); |
602 | - PrintIndentedDescription(out, Description()); |
603 | + PrintIndentedDescription(out, getDescription()); |
604 | } |
605 | ; |
606 | |
607 | -bool Switch::Handles(const std::string& flag) const { |
608 | +bool Switch::handles(const std::string& flag) const { |
609 | std::stringstream stream; |
610 | stream << "-" << name << " "; |
611 | if (flag.find(stream.str()) != std::string::npos) |
612 | @@ -83,50 +83,50 @@ |
613 | } |
614 | ; |
615 | |
616 | -option Switch::Parse(const std::string& flag) { |
617 | - assert(Handles(flag)); |
618 | - handled_option = true; |
619 | - return option(LongName(), "1"); |
620 | -} |
621 | -; |
622 | - |
623 | -option SwitchWithArg::Parse(const std::string& flag) { |
624 | - assert(Handles(flag)); |
625 | - handled_option = true; |
626 | - std::string copy(flag); |
627 | - std::stringstream stream; |
628 | - stream << "-" << ShortName() << " "; |
629 | - if (flag.find(stream.str()) != std::string::npos) { |
630 | - boost::erase_all(copy, stream.str()); |
631 | - } else { |
632 | - std::stringstream long_name_stream; |
633 | - long_name_stream << "--" << LongName() << " "; |
634 | - boost::erase_all(copy, long_name_stream.str()); |
635 | - } |
636 | - boost::trim(copy); |
637 | - return option(LongName(), copy); |
638 | -} |
639 | -; |
640 | - |
641 | -option SwitchWithStringArg::Parse(const std::string& flag) { |
642 | - assert(Handles(flag)); |
643 | - handled_option = true; |
644 | - std::string copy(flag); |
645 | - std::stringstream stream; |
646 | - stream << "-" << ShortName() << " "; |
647 | - if (flag.find(stream.str()) != std::string::npos) { |
648 | - boost::erase_all(copy, stream.str()); |
649 | - } else { |
650 | - std::stringstream long_name_stream; |
651 | - long_name_stream << "--" << LongName() << " "; |
652 | - boost::erase_all(copy, long_name_stream.str()); |
653 | - } |
654 | - boost::trim(copy); |
655 | - return option(LongName(), copy); |
656 | -} |
657 | -; |
658 | - |
659 | -void ArgsParser::Initialize() { |
660 | +option Switch::parse(const std::string& flag) { |
661 | + assert(handles(flag)); |
662 | + handled_option = true; |
663 | + return option(getLongName(), "1"); |
664 | +} |
665 | +; |
666 | + |
667 | +option SwitchWithArg::parse(const std::string& flag) { |
668 | + assert(handles(flag)); |
669 | + handled_option = true; |
670 | + std::string copy(flag); |
671 | + std::stringstream stream; |
672 | + stream << "-" << getShortName() << " "; |
673 | + if (flag.find(stream.str()) != std::string::npos) { |
674 | + boost::erase_all(copy, stream.str()); |
675 | + } else { |
676 | + std::stringstream long_name_stream; |
677 | + long_name_stream << "--" << getLongName() << " "; |
678 | + boost::erase_all(copy, long_name_stream.str()); |
679 | + } |
680 | + boost::trim(copy); |
681 | + return option(getLongName(), copy); |
682 | +} |
683 | +; |
684 | + |
685 | +option SwitchWithStringArg::parse(const std::string& flag) { |
686 | + assert(handles(flag)); |
687 | + handled_option = true; |
688 | + std::string copy(flag); |
689 | + std::stringstream stream; |
690 | + stream << "-" << getShortName() << " "; |
691 | + if (flag.find(stream.str()) != std::string::npos) { |
692 | + boost::erase_all(copy, stream.str()); |
693 | + } else { |
694 | + std::stringstream long_name_stream; |
695 | + long_name_stream << "--" << getLongName() << " "; |
696 | + boost::erase_all(copy, long_name_stream.str()); |
697 | + } |
698 | + boost::trim(copy); |
699 | + return option(getLongName(), copy); |
700 | +} |
701 | +; |
702 | + |
703 | +void ArgsParser::initialize() { |
704 | // NOTE: The Help() function only splits and indents descriptions based on newlines. |
705 | // Each line in the description is assumed to fit within the remaining width |
706 | // of the console, so keep descriptions short, or implement manual word-wrapping :). |
707 | @@ -164,7 +164,7 @@ |
708 | "Output trace in xml format for TAPAAL.")); |
709 | }; |
710 | |
711 | -void ArgsParser::Help() const { |
712 | +void ArgsParser::printHelp() const { |
713 | std::cout |
714 | << "Usage: verifydtapn -k <number> [optional arguments] model-file query-file" |
715 | << std::endl; |
716 | @@ -180,20 +180,20 @@ |
717 | } |
718 | ; |
719 | |
720 | -void ArgsParser::Version() const { |
721 | +void ArgsParser::printVersion() const { |
722 | std::cout << "VerifyDTAPN " << version << std::endl; |
723 | std::cout << "Licensed under BSD." << std::endl; |
724 | } |
725 | |
726 | -VerificationOptions ArgsParser::Parse(int argc, char* argv[]) const { |
727 | +VerificationOptions ArgsParser::parse(int argc, char* argv[]) const { |
728 | if (argc == 1 || std::string(argv[1]) == "-h" |
729 | || std::string(argv[1]) == "--help") { |
730 | - Help(); |
731 | + printHelp(); |
732 | exit(0); |
733 | } |
734 | |
735 | if (std::string(argv[1]) == "-v" || std::string(argv[1]) == "--version") { |
736 | - Version(); |
737 | + printVersion(); |
738 | exit(0); |
739 | } |
740 | |
741 | @@ -244,8 +244,8 @@ |
742 | bool handled = false; |
743 | for (parser_vec::const_iterator it = parsers.begin(); |
744 | it != parsers.end(); it++) { |
745 | - if ((*it)->Handles(*flag)) { |
746 | - options.insert((*it)->Parse(*flag)); |
747 | + if ((*it)->handles(*flag)) { |
748 | + options.insert((*it)->parse(*flag)); |
749 | handled = true; |
750 | } |
751 | } |
752 | @@ -260,48 +260,48 @@ |
753 | // Put in default values for non-specified options |
754 | for (parser_vec::const_iterator it = parsers.begin(); it != parsers.end(); |
755 | it++) { |
756 | - if (!(*it)->HandledOption()) { |
757 | - options.insert((*it)->DefaultOption()); |
758 | + if (!(*it)->handledOption()) { |
759 | + options.insert((*it)->getDefaultOption()); |
760 | } |
761 | } |
762 | |
763 | - return CreateVerificationOptions(options, model_file, query_file); |
764 | + return createVerificationOptions(options, model_file, query_file); |
765 | } |
766 | |
767 | -SearchType intToSearchTypeEnum(int i) { |
768 | +VerificationOptions::SearchType intToSearchTypeEnum(int i) { |
769 | switch (i) { |
770 | case 0: |
771 | - return BREADTHFIRST; |
772 | + return VerificationOptions::BREADTHFIRST; |
773 | case 1: |
774 | - return DEPTHFIRST; |
775 | + return VerificationOptions::DEPTHFIRST; |
776 | case 2: |
777 | - return RANDOM; |
778 | + return VerificationOptions::RANDOM; |
779 | case 3: |
780 | - return COVERMOST; |
781 | + return VerificationOptions::COVERMOST; |
782 | default: |
783 | std::cout << "Unknown search strategy specified." << std::endl; |
784 | exit(1); |
785 | } |
786 | } |
787 | |
788 | -VerificationType intToVerificationTypeEnum(int i) { |
789 | +VerificationOptions::VerificationType intToVerificationTypeEnum(int i) { |
790 | switch (i) { |
791 | case 0: |
792 | - return DISCRETE; |
793 | + return VerificationOptions::DISCRETE; |
794 | case 1: |
795 | - return TIMEDART; |
796 | + return VerificationOptions::TIMEDART; |
797 | default: |
798 | std::cout << "Unknown verification method specified." << std::endl; |
799 | exit(1); |
800 | } |
801 | } |
802 | |
803 | -MemoryOptimization intToMemoryOptimizationEnum(int i) { |
804 | +VerificationOptions::MemoryOptimization intToMemoryOptimizationEnum(int i) { |
805 | switch (i) { |
806 | case 0: |
807 | - return NO_MEMORY_OPTIMIZATION; |
808 | + return VerificationOptions::NO_MEMORY_OPTIMIZATION; |
809 | case 1: |
810 | - return PTRIE; |
811 | + return VerificationOptions::PTRIE; |
812 | default: |
813 | std::cout << "Unknown memory optimization specified." << std::endl; |
814 | exit(1); |
815 | @@ -309,19 +309,19 @@ |
816 | } |
817 | |
818 | |
819 | -Trace intToEnum(int i) { |
820 | +VerificationOptions::Trace intToEnum(int i) { |
821 | switch (i) { |
822 | case 0: |
823 | - return NONE; |
824 | + return VerificationOptions::NO_TRACE; |
825 | case 1: |
826 | - return SOME; |
827 | + return VerificationOptions::SOME_TRACE; |
828 | default: |
829 | std::cout << "Unknown trace option specified." << std::endl; |
830 | exit(1); |
831 | } |
832 | } |
833 | |
834 | -unsigned int ArgsParser::TryParseInt(const option& option) const { |
835 | +unsigned int ArgsParser::tryParseInt(const option& option) const { |
836 | unsigned int result = 0; |
837 | try { |
838 | result = boost::lexical_cast<unsigned int>(option.second); |
839 | @@ -333,32 +333,32 @@ |
840 | return result; |
841 | } |
842 | |
843 | -std::vector<std::string> ArgsParser::ParseIncPlaces( |
844 | +std::vector<std::string> ArgsParser::parseIncPlaces( |
845 | const std::string& string) const { |
846 | std::vector<std::string> vec; |
847 | boost::split(vec, string, boost::is_any_of(",")); |
848 | return vec; |
849 | } |
850 | |
851 | -VerificationOptions ArgsParser::CreateVerificationOptions(const option_map& map, |
852 | +VerificationOptions ArgsParser::createVerificationOptions(const option_map& map, |
853 | const std::string& modelFile, const std::string& queryFile) const { |
854 | assert(map.find(KBOUND_OPTION) != map.end()); |
855 | - unsigned int kbound = TryParseInt(*map.find(KBOUND_OPTION)); |
856 | + unsigned int kbound = tryParseInt(*map.find(KBOUND_OPTION)); |
857 | |
858 | assert(map.find(SEARCH_OPTION) != map.end()); |
859 | - SearchType search = intToSearchTypeEnum( |
860 | - TryParseInt(*map.find(SEARCH_OPTION))); |
861 | + VerificationOptions::SearchType search = intToSearchTypeEnum( |
862 | + tryParseInt(*map.find(SEARCH_OPTION))); |
863 | |
864 | assert(map.find(VERIFICATION_OPTION) != map.end()); |
865 | - VerificationType verification = intToVerificationTypeEnum( |
866 | - TryParseInt(*map.find(VERIFICATION_OPTION))); |
867 | + VerificationOptions::VerificationType verification = intToVerificationTypeEnum( |
868 | + tryParseInt(*map.find(VERIFICATION_OPTION))); |
869 | |
870 | assert(map.find(MEMORY_OPTIMIZATION_OPTION) != map.end()); |
871 | - MemoryOptimization memoptimization = intToMemoryOptimizationEnum( |
872 | - TryParseInt(*map.find(MEMORY_OPTIMIZATION_OPTION))); |
873 | + VerificationOptions::MemoryOptimization memoptimization = intToMemoryOptimizationEnum( |
874 | + tryParseInt(*map.find(MEMORY_OPTIMIZATION_OPTION))); |
875 | |
876 | assert(map.find(TRACE_OPTION) != map.end()); |
877 | - Trace trace = intToEnum(TryParseInt(*map.find(TRACE_OPTION))); |
878 | + VerificationOptions::Trace trace = intToEnum(tryParseInt(*map.find(TRACE_OPTION))); |
879 | |
880 | assert(map.find(MAX_CONSTANT_OPTION) != map.end()); |
881 | bool max_constant = boost::lexical_cast<bool>( |
882 | |
883 | === modified file 'src/Core/ArgsParser.hpp' |
884 | --- src/Core/ArgsParser.hpp 2013-03-25 14:03:05 +0000 |
885 | +++ src/Core/ArgsParser.hpp 2013-05-15 15:27:27 +0000 |
886 | @@ -35,14 +35,14 @@ |
887 | Switch(const std::string& name, const std::string& long_name, const std::string& description) : name(name), long_name(long_name), description(description), handled_option(false) { }; |
888 | virtual ~Switch() { }; |
889 | public: |
890 | - inline const std::string& ShortName() const { return name; }; |
891 | - inline const std::string& LongName() const { return long_name; }; |
892 | - inline const std::string& Description() const { return description; }; |
893 | - virtual bool Handles(const std::string& flag) const; |
894 | - virtual option Parse(const std::string& flag); |
895 | - virtual void Print(std::ostream& out) const; |
896 | - inline bool HandledOption() const { return handled_option; }; |
897 | - virtual option DefaultOption() const { return option(long_name, "0"); }; |
898 | + inline const std::string& getShortName() const { return name; }; |
899 | + inline const std::string& getLongName() const { return long_name; }; |
900 | + inline const std::string& getDescription() const { return description; }; |
901 | + virtual bool handles(const std::string& flag) const; |
902 | + virtual option parse(const std::string& flag); |
903 | + virtual void print(std::ostream& out) const; |
904 | + inline bool handledOption() const { return handled_option; }; |
905 | + virtual option getDefaultOption() const { return option(long_name, "0"); }; |
906 | private: |
907 | std::string name; |
908 | std::string long_name; |
909 | @@ -58,9 +58,9 @@ |
910 | public: |
911 | SwitchWithStringArg(const std::string& name, const std::string& long_name, const std::string& description, const std::string& default_value) : Switch(name, long_name, description), default_value(default_value) { }; |
912 | virtual ~SwitchWithStringArg() { }; |
913 | - virtual option Parse(const std::string& flag); |
914 | - virtual void Print(std::ostream& out) const; |
915 | - virtual option DefaultOption() const { return option(LongName(), default_value); }; |
916 | + virtual option parse(const std::string& flag); |
917 | + virtual void print(std::ostream& out) const; |
918 | + virtual option getDefaultOption() const { return option(getLongName(), default_value); }; |
919 | private: |
920 | std::string default_value; |
921 | }; |
922 | @@ -70,9 +70,9 @@ |
923 | public: |
924 | SwitchWithArg(const std::string& name, const std::string& long_name, const std::string& description, unsigned int default_value) : Switch(name, long_name, description), default_value(default_value) { }; |
925 | virtual ~SwitchWithArg() { }; |
926 | - virtual option Parse(const std::string& flag); |
927 | - virtual void Print(std::ostream& out) const; |
928 | - virtual option DefaultOption() const { return option(LongName(), boost::lexical_cast<std::string>(default_value)); }; |
929 | + virtual option parse(const std::string& flag); |
930 | + virtual void print(std::ostream& out) const; |
931 | + virtual option getDefaultOption() const { return option(getLongName(), boost::lexical_cast<std::string>(default_value)); }; |
932 | private: |
933 | unsigned int default_value; |
934 | }; |
935 | @@ -80,17 +80,17 @@ |
936 | class ArgsParser { |
937 | typedef std::vector< boost::shared_ptr<Switch> > parser_vec; |
938 | public: |
939 | - ArgsParser() : parsers(), version(2,0,0) { Initialize(); }; |
940 | + ArgsParser() : parsers(), version(2,0,1) { initialize(); }; |
941 | virtual ~ArgsParser() {}; |
942 | |
943 | - VerificationOptions Parse(int argc, char* argv[]) const; |
944 | + VerificationOptions parse(int argc, char* argv[]) const; |
945 | private: |
946 | - VerificationOptions CreateVerificationOptions(const option_map& map,const std::string& modelFile, const std::string& queryFile) const; |
947 | - unsigned int TryParseInt(const option& option) const; |
948 | - std::vector<std::string> ParseIncPlaces(const std::string& string) const; |
949 | - void Initialize(); |
950 | - void Help() const; |
951 | - void Version() const; |
952 | + VerificationOptions createVerificationOptions(const option_map& map,const std::string& modelFile, const std::string& queryFile) const; |
953 | + unsigned int tryParseInt(const option& option) const; |
954 | + std::vector<std::string> parseIncPlaces(const std::string& string) const; |
955 | + void initialize(); |
956 | + void printHelp() const; |
957 | + void printVersion() const; |
958 | private: // data |
959 | parser_vec parsers; |
960 | VerifyTAPN::Version version; |
961 | |
962 | === modified file 'src/Core/QueryParser/AST.cpp' |
963 | --- src/Core/QueryParser/AST.cpp 2012-03-02 10:59:16 +0000 |
964 | +++ src/Core/QueryParser/AST.cpp 2013-05-15 15:27:27 +0000 |
965 | @@ -8,14 +8,14 @@ |
966 | return new NotExpression(*this); |
967 | } |
968 | |
969 | - void NotExpression::Accept(Visitor& visitor, boost::any& context) const |
970 | + void NotExpression::accept(Visitor& visitor, boost::any& context) const |
971 | { |
972 | - visitor.Visit(*this, context); |
973 | + visitor.visit(*this, context); |
974 | } |
975 | |
976 | - void BoolExpression::Accept(Visitor& visitor, boost::any& context) const |
977 | + void BoolExpression::accept(Visitor& visitor, boost::any& context) const |
978 | { |
979 | - visitor.Visit(*this, context); |
980 | + visitor.visit(*this, context); |
981 | } |
982 | |
983 | BoolExpression* BoolExpression::clone() const |
984 | @@ -23,9 +23,9 @@ |
985 | return new BoolExpression(*this); |
986 | } |
987 | |
988 | - void AtomicProposition::Accept(Visitor& visitor, boost::any& context) const |
989 | + void AtomicProposition::accept(Visitor& visitor, boost::any& context) const |
990 | { |
991 | - visitor.Visit(*this, context); |
992 | + visitor.visit(*this, context); |
993 | } |
994 | |
995 | AtomicProposition* AtomicProposition::clone() const |
996 | @@ -38,9 +38,9 @@ |
997 | return new AndExpression(*this); |
998 | } |
999 | |
1000 | - void AndExpression::Accept(Visitor& visitor, boost::any& context) const |
1001 | + void AndExpression::accept(Visitor& visitor, boost::any& context) const |
1002 | { |
1003 | - visitor.Visit(*this, context); |
1004 | + visitor.visit(*this, context); |
1005 | } |
1006 | |
1007 | OrExpression* OrExpression::clone() const |
1008 | @@ -48,9 +48,9 @@ |
1009 | return new OrExpression(*this); |
1010 | } |
1011 | |
1012 | - void OrExpression::Accept(Visitor& visitor, boost::any& context) const |
1013 | + void OrExpression::accept(Visitor& visitor, boost::any& context) const |
1014 | { |
1015 | - visitor.Visit(*this, context); |
1016 | + visitor.visit(*this, context); |
1017 | } |
1018 | |
1019 | ParExpression* ParExpression::clone() const |
1020 | @@ -58,9 +58,9 @@ |
1021 | return new ParExpression(*this); |
1022 | } |
1023 | |
1024 | - void ParExpression::Accept(Visitor& visitor, boost::any& context) const |
1025 | + void ParExpression::accept(Visitor& visitor, boost::any& context) const |
1026 | { |
1027 | - visitor.Visit(*this, context); |
1028 | + visitor.visit(*this, context); |
1029 | } |
1030 | |
1031 | Query* Query::clone() const |
1032 | @@ -68,9 +68,9 @@ |
1033 | return new Query(*this); |
1034 | } |
1035 | |
1036 | - void Query::Accept(Visitor& visitor, boost::any& context) const |
1037 | + void Query::accept(Visitor& visitor, boost::any& context) const |
1038 | { |
1039 | - visitor.Visit(*this, context); |
1040 | + visitor.visit(*this, context); |
1041 | } |
1042 | } |
1043 | } |
1044 | |
1045 | === modified file 'src/Core/QueryParser/AST.hpp' |
1046 | --- src/Core/QueryParser/AST.hpp 2012-04-19 12:40:05 +0000 |
1047 | +++ src/Core/QueryParser/AST.hpp 2013-05-15 15:27:27 +0000 |
1048 | @@ -12,7 +12,7 @@ |
1049 | class Visitable |
1050 | { |
1051 | public: |
1052 | - virtual void Accept(Visitor& visitor, boost::any& context) const = 0; |
1053 | + virtual void accept(Visitor& visitor, boost::any& context) const = 0; |
1054 | }; |
1055 | |
1056 | class Expression : public Visitable |
1057 | @@ -43,9 +43,9 @@ |
1058 | }; |
1059 | |
1060 | virtual NotExpression* clone() const; |
1061 | - virtual void Accept(Visitor& visitor, boost::any& context) const; |
1062 | + virtual void accept(Visitor& visitor, boost::any& context) const; |
1063 | |
1064 | - const Expression& Child() const { return *expr; } |
1065 | + const Expression& getChild() const { return *expr; } |
1066 | private: |
1067 | Expression* expr; |
1068 | }; |
1069 | @@ -57,9 +57,9 @@ |
1070 | virtual ~BoolExpression() { }; |
1071 | |
1072 | virtual BoolExpression* clone() const; |
1073 | - virtual void Accept(Visitor& visitor, boost::any& context) const; |
1074 | + virtual void accept(Visitor& visitor, boost::any& context) const; |
1075 | |
1076 | - bool GetValue() const { return value; }; |
1077 | + bool getValue() const { return value; }; |
1078 | private: |
1079 | bool value; |
1080 | }; |
1081 | @@ -82,11 +82,11 @@ |
1082 | virtual ~AtomicProposition() { }; |
1083 | |
1084 | virtual AtomicProposition* clone() const; |
1085 | - virtual void Accept(Visitor& visitor, boost::any& context) const; |
1086 | + virtual void accept(Visitor& visitor, boost::any& context) const; |
1087 | |
1088 | - const int Place() const { return place; } |
1089 | - const std::string& Operator() const { return op; } |
1090 | - int N() const { return n; } |
1091 | + const int getPlace() const { return place; } |
1092 | + const std::string& getOperator() const { return op; } |
1093 | + int getNumberOfTokens() const { return n; } |
1094 | private: |
1095 | int place; |
1096 | std::string op; |
1097 | @@ -116,10 +116,10 @@ |
1098 | } |
1099 | |
1100 | virtual AndExpression* clone() const; |
1101 | - void Accept(Visitor& visitor, boost::any& context) const; |
1102 | + void accept(Visitor& visitor, boost::any& context) const; |
1103 | |
1104 | - const Expression& Left() const { return *left; } |
1105 | - const Expression& Right() const { return *right; } |
1106 | + const Expression& getLeft() const { return *left; } |
1107 | + const Expression& getRight() const { return *right; } |
1108 | private: |
1109 | Expression* left; |
1110 | Expression* right; |
1111 | @@ -151,10 +151,10 @@ |
1112 | |
1113 | |
1114 | virtual OrExpression* clone() const; |
1115 | - virtual void Accept(Visitor& visitor, boost::any& context) const; |
1116 | + virtual void accept(Visitor& visitor, boost::any& context) const; |
1117 | |
1118 | - const Expression& Left() const { return *left; } |
1119 | - const Expression& Right() const { return *right; } |
1120 | + const Expression& getLeft() const { return *left; } |
1121 | + const Expression& getRight() const { return *right; } |
1122 | private: |
1123 | Expression* left; |
1124 | Expression* right; |
1125 | @@ -180,9 +180,9 @@ |
1126 | }; |
1127 | |
1128 | virtual ParExpression* clone() const; |
1129 | - virtual void Accept(Visitor& visitor, boost::any& context) const; |
1130 | + virtual void accept(Visitor& visitor, boost::any& context) const; |
1131 | |
1132 | - const Expression& Child() const { return *expr; } |
1133 | + const Expression& getChild() const { return *expr; } |
1134 | private: |
1135 | Expression* expr; |
1136 | }; |
1137 | @@ -206,10 +206,10 @@ |
1138 | virtual ~Query() { if( expr ) delete expr; } |
1139 | |
1140 | virtual Query* clone() const; |
1141 | - virtual void Accept(Visitor& visitor, boost::any& context) const; |
1142 | + virtual void accept(Visitor& visitor, boost::any& context) const; |
1143 | |
1144 | - Quantifier GetQuantifier() const { return quantifier; } |
1145 | - const Expression& Child() const { return *expr; } |
1146 | + Quantifier getQuantifier() const { return quantifier; } |
1147 | + const Expression& getChild() const { return *expr; } |
1148 | private: |
1149 | Quantifier quantifier; |
1150 | Expression* expr; |
1151 | |
1152 | === modified file 'src/Core/QueryParser/Generated/location.hh' |
1153 | --- src/Core/QueryParser/Generated/location.hh 2013-04-14 11:02:23 +0000 |
1154 | +++ src/Core/QueryParser/Generated/location.hh 2013-05-15 15:27:27 +0000 |
1155 | @@ -1,8 +1,8 @@ |
1156 | -/* A Bison parser, made by GNU Bison 2.6.5. */ |
1157 | +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ |
1158 | |
1159 | /* Locations for Bison parsers in C++ |
1160 | |
1161 | - Copyright (C) 2002-2007, 2009-2012 Free Software Foundation, Inc. |
1162 | + Copyright (C) 2002-2007, 2009-2013 Free Software Foundation, Inc. |
1163 | |
1164 | This program is free software: you can redistribute it and/or modify |
1165 | it under the terms of the GNU General Public License as published by |
1166 | @@ -40,10 +40,10 @@ |
1167 | |
1168 | # include "position.hh" |
1169 | |
1170 | -/* Line 164 of location.cc */ |
1171 | +/* Line 166 of location.cc */ |
1172 | #line 5 "Core/QueryParser/grammar.yy" |
1173 | namespace VerifyTAPN { |
1174 | -/* Line 164 of location.cc */ |
1175 | +/* Line 166 of location.cc */ |
1176 | #line 48 "Core/QueryParser/Generated/location.hh" |
1177 | |
1178 | /// Abstract a location. |
1179 | @@ -157,7 +157,9 @@ |
1180 | ** |
1181 | ** Avoid duplicate information. |
1182 | */ |
1183 | - inline std::ostream& operator<< (std::ostream& ostr, const location& loc) |
1184 | + template <typename YYChar> |
1185 | + inline std::basic_ostream<YYChar>& |
1186 | + operator<< (std::basic_ostream<YYChar>& ostr, const location& loc) |
1187 | { |
1188 | position last = loc.end - 1; |
1189 | ostr << loc.begin; |
1190 | @@ -172,10 +174,10 @@ |
1191 | return ostr; |
1192 | } |
1193 | |
1194 | -/* Line 292 of location.cc */ |
1195 | +/* Line 296 of location.cc */ |
1196 | #line 5 "Core/QueryParser/grammar.yy" |
1197 | } // VerifyTAPN |
1198 | -/* Line 292 of location.cc */ |
1199 | -#line 180 "Core/QueryParser/Generated/location.hh" |
1200 | +/* Line 296 of location.cc */ |
1201 | +#line 182 "Core/QueryParser/Generated/location.hh" |
1202 | |
1203 | #endif /* !YY_YY_CORE_QUERYPARSER_GENERATED_LOCATION_HH_INCLUDED */ |
1204 | |
1205 | === modified file 'src/Core/QueryParser/Generated/parser.cpp' |
1206 | --- src/Core/QueryParser/Generated/parser.cpp 2013-04-14 11:02:23 +0000 |
1207 | +++ src/Core/QueryParser/Generated/parser.cpp 2013-05-15 15:27:27 +0000 |
1208 | @@ -1,8 +1,8 @@ |
1209 | -/* A Bison parser, made by GNU Bison 2.6.5. */ |
1210 | +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ |
1211 | |
1212 | /* Skeleton implementation for Bison LALR(1) parsers in C++ |
1213 | |
1214 | - Copyright (C) 2002-2012 Free Software Foundation, Inc. |
1215 | + Copyright (C) 2002-2013 Free Software Foundation, Inc. |
1216 | |
1217 | This program is free software: you can redistribute it and/or modify |
1218 | it under the terms of the GNU General Public License as published by |
1219 | @@ -33,7 +33,7 @@ |
1220 | |
1221 | /* First part of user declarations. */ |
1222 | |
1223 | -/* Line 278 of lalr1.cc */ |
1224 | +/* Line 283 of lalr1.cc */ |
1225 | #line 38 "Core/QueryParser/Generated/parser.cpp" |
1226 | |
1227 | |
1228 | @@ -41,16 +41,16 @@ |
1229 | |
1230 | /* User implementation prologue. */ |
1231 | |
1232 | -/* Line 284 of lalr1.cc */ |
1233 | +/* Line 289 of lalr1.cc */ |
1234 | #line 46 "Core/QueryParser/Generated/parser.cpp" |
1235 | /* Unqualified %code blocks. */ |
1236 | -/* Line 285 of lalr1.cc */ |
1237 | +/* Line 290 of lalr1.cc */ |
1238 | #line 37 "Core/QueryParser/grammar.yy" |
1239 | |
1240 | #include "../TAPNQueryParser.hpp" |
1241 | |
1242 | |
1243 | -/* Line 285 of lalr1.cc */ |
1244 | +/* Line 290 of lalr1.cc */ |
1245 | #line 55 "Core/QueryParser/Generated/parser.cpp" |
1246 | |
1247 | |
1248 | @@ -129,9 +129,9 @@ |
1249 | #else /* !YYDEBUG */ |
1250 | |
1251 | # define YYCDEBUG if (false) std::cerr |
1252 | -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
1253 | -# define YY_REDUCE_PRINT(Rule) |
1254 | -# define YY_STACK_PRINT() |
1255 | +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) YYUSE(Type) |
1256 | +# define YY_REDUCE_PRINT(Rule) static_cast<void>(0) |
1257 | +# define YY_STACK_PRINT() static_cast<void>(0) |
1258 | |
1259 | #endif /* !YYDEBUG */ |
1260 | |
1261 | @@ -143,10 +143,10 @@ |
1262 | #define YYERROR goto yyerrorlab |
1263 | #define YYRECOVERING() (!!yyerrstatus_) |
1264 | |
1265 | -/* Line 352 of lalr1.cc */ |
1266 | +/* Line 357 of lalr1.cc */ |
1267 | #line 5 "Core/QueryParser/grammar.yy" |
1268 | namespace VerifyTAPN { |
1269 | -/* Line 352 of lalr1.cc */ |
1270 | +/* Line 357 of lalr1.cc */ |
1271 | #line 151 "Core/QueryParser/Generated/parser.cpp" |
1272 | |
1273 | /* Return YYSTR after stripping away unnecessary quotes and |
1274 | @@ -216,11 +216,7 @@ |
1275 | std::ostream& yyo = debug_stream (); |
1276 | std::ostream& yyoutput = yyo; |
1277 | YYUSE (yyoutput); |
1278 | - switch (yytype) |
1279 | - { |
1280 | - default: |
1281 | - break; |
1282 | - } |
1283 | + YYUSE (yytype); |
1284 | } |
1285 | |
1286 | |
1287 | @@ -244,119 +240,120 @@ |
1288 | YYUSE (yymsg); |
1289 | YYUSE (yyvaluep); |
1290 | |
1291 | - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
1292 | + if (yymsg) |
1293 | + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
1294 | |
1295 | switch (yytype) |
1296 | - { |
1297 | - case 3: /* IDENTIFIER */ |
1298 | -/* Line 453 of lalr1.cc */ |
1299 | + { |
1300 | + case 3: /* IDENTIFIER */ |
1301 | +/* Line 452 of lalr1.cc */ |
1302 | #line 52 "Core/QueryParser/grammar.yy" |
1303 | - { delete ((*yyvaluep).string); }; |
1304 | -/* Line 453 of lalr1.cc */ |
1305 | -#line 257 "Core/QueryParser/Generated/parser.cpp" |
1306 | - break; |
1307 | + { delete ((*yyvaluep).string); }; |
1308 | +/* Line 452 of lalr1.cc */ |
1309 | +#line 254 "Core/QueryParser/Generated/parser.cpp" |
1310 | + break; |
1311 | case 4: /* LESS */ |
1312 | -/* Line 453 of lalr1.cc */ |
1313 | +/* Line 452 of lalr1.cc */ |
1314 | #line 52 "Core/QueryParser/grammar.yy" |
1315 | - { delete ((*yyvaluep).string); }; |
1316 | -/* Line 453 of lalr1.cc */ |
1317 | -#line 264 "Core/QueryParser/Generated/parser.cpp" |
1318 | - break; |
1319 | + { delete ((*yyvaluep).string); }; |
1320 | +/* Line 452 of lalr1.cc */ |
1321 | +#line 261 "Core/QueryParser/Generated/parser.cpp" |
1322 | + break; |
1323 | case 5: /* LESSEQUAL */ |
1324 | -/* Line 453 of lalr1.cc */ |
1325 | +/* Line 452 of lalr1.cc */ |
1326 | #line 52 "Core/QueryParser/grammar.yy" |
1327 | - { delete ((*yyvaluep).string); }; |
1328 | -/* Line 453 of lalr1.cc */ |
1329 | -#line 271 "Core/QueryParser/Generated/parser.cpp" |
1330 | - break; |
1331 | + { delete ((*yyvaluep).string); }; |
1332 | +/* Line 452 of lalr1.cc */ |
1333 | +#line 268 "Core/QueryParser/Generated/parser.cpp" |
1334 | + break; |
1335 | case 6: /* EQUAL */ |
1336 | -/* Line 453 of lalr1.cc */ |
1337 | +/* Line 452 of lalr1.cc */ |
1338 | #line 52 "Core/QueryParser/grammar.yy" |
1339 | - { delete ((*yyvaluep).string); }; |
1340 | -/* Line 453 of lalr1.cc */ |
1341 | -#line 278 "Core/QueryParser/Generated/parser.cpp" |
1342 | - break; |
1343 | + { delete ((*yyvaluep).string); }; |
1344 | +/* Line 452 of lalr1.cc */ |
1345 | +#line 275 "Core/QueryParser/Generated/parser.cpp" |
1346 | + break; |
1347 | case 7: /* GREATEREQUAL */ |
1348 | -/* Line 453 of lalr1.cc */ |
1349 | +/* Line 452 of lalr1.cc */ |
1350 | #line 52 "Core/QueryParser/grammar.yy" |
1351 | - { delete ((*yyvaluep).string); }; |
1352 | -/* Line 453 of lalr1.cc */ |
1353 | -#line 285 "Core/QueryParser/Generated/parser.cpp" |
1354 | - break; |
1355 | + { delete ((*yyvaluep).string); }; |
1356 | +/* Line 452 of lalr1.cc */ |
1357 | +#line 282 "Core/QueryParser/Generated/parser.cpp" |
1358 | + break; |
1359 | case 8: /* GREATER */ |
1360 | -/* Line 453 of lalr1.cc */ |
1361 | +/* Line 452 of lalr1.cc */ |
1362 | #line 52 "Core/QueryParser/grammar.yy" |
1363 | - { delete ((*yyvaluep).string); }; |
1364 | -/* Line 453 of lalr1.cc */ |
1365 | -#line 292 "Core/QueryParser/Generated/parser.cpp" |
1366 | - break; |
1367 | + { delete ((*yyvaluep).string); }; |
1368 | +/* Line 452 of lalr1.cc */ |
1369 | +#line 289 "Core/QueryParser/Generated/parser.cpp" |
1370 | + break; |
1371 | case 22: /* query */ |
1372 | -/* Line 453 of lalr1.cc */ |
1373 | +/* Line 452 of lalr1.cc */ |
1374 | #line 54 "Core/QueryParser/grammar.yy" |
1375 | - { delete ((*yyvaluep).query); }; |
1376 | -/* Line 453 of lalr1.cc */ |
1377 | -#line 299 "Core/QueryParser/Generated/parser.cpp" |
1378 | - break; |
1379 | + { delete ((*yyvaluep).query); }; |
1380 | +/* Line 452 of lalr1.cc */ |
1381 | +#line 296 "Core/QueryParser/Generated/parser.cpp" |
1382 | + break; |
1383 | case 23: /* expression */ |
1384 | -/* Line 453 of lalr1.cc */ |
1385 | +/* Line 452 of lalr1.cc */ |
1386 | #line 53 "Core/QueryParser/grammar.yy" |
1387 | - { delete ((*yyvaluep).expr); }; |
1388 | -/* Line 453 of lalr1.cc */ |
1389 | -#line 306 "Core/QueryParser/Generated/parser.cpp" |
1390 | - break; |
1391 | + { delete ((*yyvaluep).expr); }; |
1392 | +/* Line 452 of lalr1.cc */ |
1393 | +#line 303 "Core/QueryParser/Generated/parser.cpp" |
1394 | + break; |
1395 | case 24: /* parExpression */ |
1396 | -/* Line 453 of lalr1.cc */ |
1397 | +/* Line 452 of lalr1.cc */ |
1398 | #line 53 "Core/QueryParser/grammar.yy" |
1399 | - { delete ((*yyvaluep).expr); }; |
1400 | -/* Line 453 of lalr1.cc */ |
1401 | -#line 313 "Core/QueryParser/Generated/parser.cpp" |
1402 | - break; |
1403 | + { delete ((*yyvaluep).expr); }; |
1404 | +/* Line 452 of lalr1.cc */ |
1405 | +#line 310 "Core/QueryParser/Generated/parser.cpp" |
1406 | + break; |
1407 | case 25: /* notExpression */ |
1408 | -/* Line 453 of lalr1.cc */ |
1409 | +/* Line 452 of lalr1.cc */ |
1410 | #line 53 "Core/QueryParser/grammar.yy" |
1411 | - { delete ((*yyvaluep).expr); }; |
1412 | -/* Line 453 of lalr1.cc */ |
1413 | -#line 320 "Core/QueryParser/Generated/parser.cpp" |
1414 | - break; |
1415 | + { delete ((*yyvaluep).expr); }; |
1416 | +/* Line 452 of lalr1.cc */ |
1417 | +#line 317 "Core/QueryParser/Generated/parser.cpp" |
1418 | + break; |
1419 | case 26: /* orExpression */ |
1420 | -/* Line 453 of lalr1.cc */ |
1421 | +/* Line 452 of lalr1.cc */ |
1422 | #line 53 "Core/QueryParser/grammar.yy" |
1423 | - { delete ((*yyvaluep).expr); }; |
1424 | -/* Line 453 of lalr1.cc */ |
1425 | -#line 327 "Core/QueryParser/Generated/parser.cpp" |
1426 | - break; |
1427 | + { delete ((*yyvaluep).expr); }; |
1428 | +/* Line 452 of lalr1.cc */ |
1429 | +#line 324 "Core/QueryParser/Generated/parser.cpp" |
1430 | + break; |
1431 | case 27: /* andExpression */ |
1432 | -/* Line 453 of lalr1.cc */ |
1433 | +/* Line 452 of lalr1.cc */ |
1434 | #line 53 "Core/QueryParser/grammar.yy" |
1435 | - { delete ((*yyvaluep).expr); }; |
1436 | -/* Line 453 of lalr1.cc */ |
1437 | -#line 334 "Core/QueryParser/Generated/parser.cpp" |
1438 | - break; |
1439 | + { delete ((*yyvaluep).expr); }; |
1440 | +/* Line 452 of lalr1.cc */ |
1441 | +#line 331 "Core/QueryParser/Generated/parser.cpp" |
1442 | + break; |
1443 | case 28: /* boolExpression */ |
1444 | -/* Line 453 of lalr1.cc */ |
1445 | +/* Line 452 of lalr1.cc */ |
1446 | #line 53 "Core/QueryParser/grammar.yy" |
1447 | - { delete ((*yyvaluep).expr); }; |
1448 | -/* Line 453 of lalr1.cc */ |
1449 | -#line 341 "Core/QueryParser/Generated/parser.cpp" |
1450 | - break; |
1451 | + { delete ((*yyvaluep).expr); }; |
1452 | +/* Line 452 of lalr1.cc */ |
1453 | +#line 338 "Core/QueryParser/Generated/parser.cpp" |
1454 | + break; |
1455 | case 29: /* atomicProposition */ |
1456 | -/* Line 453 of lalr1.cc */ |
1457 | +/* Line 452 of lalr1.cc */ |
1458 | #line 53 "Core/QueryParser/grammar.yy" |
1459 | - { delete ((*yyvaluep).expr); }; |
1460 | -/* Line 453 of lalr1.cc */ |
1461 | -#line 348 "Core/QueryParser/Generated/parser.cpp" |
1462 | - break; |
1463 | + { delete ((*yyvaluep).expr); }; |
1464 | +/* Line 452 of lalr1.cc */ |
1465 | +#line 345 "Core/QueryParser/Generated/parser.cpp" |
1466 | + break; |
1467 | case 30: /* compareOp */ |
1468 | -/* Line 453 of lalr1.cc */ |
1469 | +/* Line 452 of lalr1.cc */ |
1470 | #line 52 "Core/QueryParser/grammar.yy" |
1471 | - { delete ((*yyvaluep).string); }; |
1472 | -/* Line 453 of lalr1.cc */ |
1473 | -#line 355 "Core/QueryParser/Generated/parser.cpp" |
1474 | - break; |
1475 | + { delete ((*yyvaluep).string); }; |
1476 | +/* Line 452 of lalr1.cc */ |
1477 | +#line 352 "Core/QueryParser/Generated/parser.cpp" |
1478 | + break; |
1479 | |
1480 | - default: |
1481 | - break; |
1482 | - } |
1483 | + default: |
1484 | + break; |
1485 | + } |
1486 | } |
1487 | |
1488 | void |
1489 | @@ -437,6 +434,10 @@ |
1490 | |
1491 | int yyresult; |
1492 | |
1493 | + // FIXME: This shoud be completely indented. It is not yet to |
1494 | + // avoid gratuitous conflicts when merging into the master branch. |
1495 | + try |
1496 | + { |
1497 | YYCDEBUG << "Starting parse" << std::endl; |
1498 | |
1499 | |
1500 | @@ -448,15 +449,15 @@ |
1501 | yylloc.begin.filename = yylloc.end.filename = &driver.file; |
1502 | } |
1503 | /* Line 539 of lalr1.cc */ |
1504 | -#line 452 "Core/QueryParser/Generated/parser.cpp" |
1505 | +#line 453 "Core/QueryParser/Generated/parser.cpp" |
1506 | |
1507 | /* Initialize the stacks. The initial state will be pushed in |
1508 | yynewstate, since the latter expects the semantical and the |
1509 | location values to have been already stored, initialize these |
1510 | stacks with a primary value. */ |
1511 | - yystate_stack_ = state_stack_type (0); |
1512 | - yysemantic_stack_ = semantic_stack_type (0); |
1513 | - yylocation_stack_ = location_stack_type (0); |
1514 | + yystate_stack_.clear (); |
1515 | + yysemantic_stack_.clear (); |
1516 | + yylocation_stack_.clear (); |
1517 | yysemantic_stack_.push (yylval); |
1518 | yylocation_stack_.push (yylloc); |
1519 | |
1520 | @@ -482,8 +483,8 @@ |
1521 | /* Read a lookahead token. */ |
1522 | if (yychar == yyempty_) |
1523 | { |
1524 | - YYCDEBUG << "Reading a token: "; |
1525 | - yychar = yylex (&yylval, &yylloc, driver); |
1526 | + YYCDEBUG << "Reading a token: "; |
1527 | + yychar = yylex (&yylval, &yylloc, driver); |
1528 | } |
1529 | |
1530 | /* Convert token to internal form. */ |
1531 | @@ -556,125 +557,129 @@ |
1532 | else |
1533 | yyval = yysemantic_stack_[0]; |
1534 | |
1535 | + // Compute the default @$. |
1536 | { |
1537 | slice<location_type, location_stack_type> slice (yylocation_stack_, yylen); |
1538 | YYLLOC_DEFAULT (yyloc, slice, yylen); |
1539 | } |
1540 | + |
1541 | + // Perform the reduction. |
1542 | YY_REDUCE_PRINT (yyn); |
1543 | switch (yyn) |
1544 | { |
1545 | - case 2: |
1546 | -/* Line 661 of lalr1.cc */ |
1547 | + case 2: |
1548 | +/* Line 664 of lalr1.cc */ |
1549 | #line 58 "Core/QueryParser/grammar.yy" |
1550 | - { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EF, (yysemantic_stack_[(2) - (2)].expr)); driver.SetAST((yyval.query)); } |
1551 | + { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EF, (yysemantic_stack_[(2) - (2)].expr)); driver.setAST((yyval.query)); } |
1552 | break; |
1553 | |
1554 | case 3: |
1555 | -/* Line 661 of lalr1.cc */ |
1556 | +/* Line 664 of lalr1.cc */ |
1557 | #line 59 "Core/QueryParser/grammar.yy" |
1558 | - { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AG, (yysemantic_stack_[(2) - (2)].expr)); driver.SetAST((yyval.query)); } |
1559 | + { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AG, (yysemantic_stack_[(2) - (2)].expr)); driver.setAST((yyval.query)); } |
1560 | break; |
1561 | |
1562 | case 4: |
1563 | -/* Line 661 of lalr1.cc */ |
1564 | +/* Line 664 of lalr1.cc */ |
1565 | #line 60 "Core/QueryParser/grammar.yy" |
1566 | - { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EG, (yysemantic_stack_[(2) - (2)].expr)); driver.SetAST((yyval.query)); } |
1567 | + { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EG, (yysemantic_stack_[(2) - (2)].expr)); driver.setAST((yyval.query)); } |
1568 | break; |
1569 | |
1570 | case 5: |
1571 | -/* Line 661 of lalr1.cc */ |
1572 | +/* Line 664 of lalr1.cc */ |
1573 | #line 61 "Core/QueryParser/grammar.yy" |
1574 | - { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AF, (yysemantic_stack_[(2) - (2)].expr)); driver.SetAST((yyval.query)); } |
1575 | + { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AF, (yysemantic_stack_[(2) - (2)].expr)); driver.setAST((yyval.query)); } |
1576 | break; |
1577 | |
1578 | case 6: |
1579 | -/* Line 661 of lalr1.cc */ |
1580 | +/* Line 664 of lalr1.cc */ |
1581 | #line 64 "Core/QueryParser/grammar.yy" |
1582 | { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); } |
1583 | break; |
1584 | |
1585 | case 7: |
1586 | -/* Line 661 of lalr1.cc */ |
1587 | +/* Line 664 of lalr1.cc */ |
1588 | #line 65 "Core/QueryParser/grammar.yy" |
1589 | { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); } |
1590 | break; |
1591 | |
1592 | case 8: |
1593 | -/* Line 661 of lalr1.cc */ |
1594 | +/* Line 664 of lalr1.cc */ |
1595 | #line 66 "Core/QueryParser/grammar.yy" |
1596 | { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); } |
1597 | break; |
1598 | |
1599 | case 9: |
1600 | -/* Line 661 of lalr1.cc */ |
1601 | +/* Line 664 of lalr1.cc */ |
1602 | #line 67 "Core/QueryParser/grammar.yy" |
1603 | { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); } |
1604 | break; |
1605 | |
1606 | case 10: |
1607 | -/* Line 661 of lalr1.cc */ |
1608 | +/* Line 664 of lalr1.cc */ |
1609 | #line 68 "Core/QueryParser/grammar.yy" |
1610 | { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); } |
1611 | break; |
1612 | |
1613 | case 11: |
1614 | -/* Line 661 of lalr1.cc */ |
1615 | +/* Line 664 of lalr1.cc */ |
1616 | #line 69 "Core/QueryParser/grammar.yy" |
1617 | { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); } |
1618 | break; |
1619 | |
1620 | case 12: |
1621 | -/* Line 661 of lalr1.cc */ |
1622 | +/* Line 664 of lalr1.cc */ |
1623 | #line 75 "Core/QueryParser/grammar.yy" |
1624 | { (yyval.expr) = new VerifyTAPN::AST::ParExpression((yysemantic_stack_[(3) - (2)].expr)); } |
1625 | break; |
1626 | |
1627 | case 13: |
1628 | -/* Line 661 of lalr1.cc */ |
1629 | +/* Line 664 of lalr1.cc */ |
1630 | #line 76 "Core/QueryParser/grammar.yy" |
1631 | { (yyval.expr) = new VerifyTAPN::AST::NotExpression((yysemantic_stack_[(2) - (2)].expr)); } |
1632 | break; |
1633 | |
1634 | case 14: |
1635 | -/* Line 661 of lalr1.cc */ |
1636 | +/* Line 664 of lalr1.cc */ |
1637 | #line 77 "Core/QueryParser/grammar.yy" |
1638 | { (yyval.expr) = new VerifyTAPN::AST::OrExpression((yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); } |
1639 | break; |
1640 | |
1641 | case 15: |
1642 | -/* Line 661 of lalr1.cc */ |
1643 | +/* Line 664 of lalr1.cc */ |
1644 | #line 78 "Core/QueryParser/grammar.yy" |
1645 | { (yyval.expr) = new VerifyTAPN::AST::AndExpression((yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); } |
1646 | break; |
1647 | |
1648 | case 16: |
1649 | -/* Line 661 of lalr1.cc */ |
1650 | +/* Line 664 of lalr1.cc */ |
1651 | #line 79 "Core/QueryParser/grammar.yy" |
1652 | { (yyval.expr) = new VerifyTAPN::AST::BoolExpression(true); } |
1653 | break; |
1654 | |
1655 | case 17: |
1656 | -/* Line 661 of lalr1.cc */ |
1657 | +/* Line 664 of lalr1.cc */ |
1658 | #line 80 "Core/QueryParser/grammar.yy" |
1659 | { (yyval.expr) = new VerifyTAPN::AST::BoolExpression(false); } |
1660 | break; |
1661 | |
1662 | case 18: |
1663 | -/* Line 661 of lalr1.cc */ |
1664 | +/* Line 664 of lalr1.cc */ |
1665 | #line 82 "Core/QueryParser/grammar.yy" |
1666 | { |
1667 | - int placeIndex = driver.tapn().GetPlaceIndex(*(yysemantic_stack_[(3) - (1)].string)); |
1668 | + int placeIndex = driver.getTAPN().getPlaceIndex(*(yysemantic_stack_[(3) - (1)].string)); |
1669 | if(placeIndex == -1) error((yylocation_stack_[(3) - (1)]), "unknown place"); |
1670 | (yyval.expr) = new VerifyTAPN::AST::AtomicProposition(placeIndex, (yysemantic_stack_[(3) - (2)].string), (yysemantic_stack_[(3) - (3)].number)); |
1671 | } |
1672 | break; |
1673 | |
1674 | |
1675 | -/* Line 661 of lalr1.cc */ |
1676 | -#line 675 "Core/QueryParser/Generated/parser.cpp" |
1677 | - default: |
1678 | - break; |
1679 | +/* Line 664 of lalr1.cc */ |
1680 | +#line 679 "Core/QueryParser/Generated/parser.cpp" |
1681 | + default: |
1682 | + break; |
1683 | } |
1684 | + |
1685 | /* User semantic actions sometimes alter yychar, and that requires |
1686 | that yytoken be updated with the new translation. We take the |
1687 | approach of translating immediately before every use of yytoken. |
1688 | @@ -725,20 +730,19 @@ |
1689 | yyerror_range[1] = yylloc; |
1690 | if (yyerrstatus_ == 3) |
1691 | { |
1692 | - /* If just tried and failed to reuse lookahead token after an |
1693 | - error, discard it. */ |
1694 | - |
1695 | - if (yychar <= yyeof_) |
1696 | - { |
1697 | - /* Return failure if at end of input. */ |
1698 | - if (yychar == yyeof_) |
1699 | - YYABORT; |
1700 | - } |
1701 | - else |
1702 | - { |
1703 | - yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc); |
1704 | - yychar = yyempty_; |
1705 | - } |
1706 | + /* If just tried and failed to reuse lookahead token after an |
1707 | + error, discard it. */ |
1708 | + if (yychar <= yyeof_) |
1709 | + { |
1710 | + /* Return failure if at end of input. */ |
1711 | + if (yychar == yyeof_) |
1712 | + YYABORT; |
1713 | + } |
1714 | + else |
1715 | + { |
1716 | + yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc); |
1717 | + yychar = yyempty_; |
1718 | + } |
1719 | } |
1720 | |
1721 | /* Else will try to reuse lookahead token after shifting the error |
1722 | @@ -787,7 +791,7 @@ |
1723 | |
1724 | /* Pop the current state because it cannot handle the error token. */ |
1725 | if (yystate_stack_.height () == 1) |
1726 | - YYABORT; |
1727 | + YYABORT; |
1728 | |
1729 | yyerror_range[1] = yylocation_stack_[0]; |
1730 | yydestruct_ ("Error: popping", |
1731 | @@ -835,16 +839,42 @@ |
1732 | /* Do not reclaim the symbols of the rule which action triggered |
1733 | this YYABORT or YYACCEPT. */ |
1734 | yypop_ (yylen); |
1735 | - while (yystate_stack_.height () != 1) |
1736 | + while (1 < yystate_stack_.height ()) |
1737 | { |
1738 | - yydestruct_ ("Cleanup: popping", |
1739 | - yystos_[yystate_stack_[0]], |
1740 | - &yysemantic_stack_[0], |
1741 | - &yylocation_stack_[0]); |
1742 | - yypop_ (); |
1743 | + yydestruct_ ("Cleanup: popping", |
1744 | + yystos_[yystate_stack_[0]], |
1745 | + &yysemantic_stack_[0], |
1746 | + &yylocation_stack_[0]); |
1747 | + yypop_ (); |
1748 | } |
1749 | |
1750 | return yyresult; |
1751 | + } |
1752 | + catch (...) |
1753 | + { |
1754 | + YYCDEBUG << "Exception caught: cleaning lookahead and stack" |
1755 | + << std::endl; |
1756 | + // Do not try to display the values of the reclaimed symbols, |
1757 | + // as their printer might throw an exception. |
1758 | + if (yychar != yyempty_) |
1759 | + { |
1760 | + /* Make sure we have latest lookahead translation. See |
1761 | + comments at user semantic actions for why this is |
1762 | + necessary. */ |
1763 | + yytoken = yytranslate_ (yychar); |
1764 | + yydestruct_ (YY_NULL, yytoken, &yylval, &yylloc); |
1765 | + } |
1766 | + |
1767 | + while (1 < yystate_stack_.height ()) |
1768 | + { |
1769 | + yydestruct_ (YY_NULL, |
1770 | + yystos_[yystate_stack_[0]], |
1771 | + &yysemantic_stack_[0], |
1772 | + &yylocation_stack_[0]); |
1773 | + yypop_ (); |
1774 | + } |
1775 | + throw; |
1776 | + } |
1777 | } |
1778 | |
1779 | // Generate an error message. |
1780 | @@ -1173,12 +1203,12 @@ |
1781 | const unsigned int Parser::yyuser_token_number_max_ = 275; |
1782 | const Parser::token_number_type Parser::yyundef_token_ = 2; |
1783 | |
1784 | -/* Line 1106 of lalr1.cc */ |
1785 | +/* Line 1135 of lalr1.cc */ |
1786 | #line 5 "Core/QueryParser/grammar.yy" |
1787 | } // VerifyTAPN |
1788 | -/* Line 1106 of lalr1.cc */ |
1789 | -#line 1181 "Core/QueryParser/Generated/parser.cpp" |
1790 | -/* Line 1107 of lalr1.cc */ |
1791 | +/* Line 1135 of lalr1.cc */ |
1792 | +#line 1211 "Core/QueryParser/Generated/parser.cpp" |
1793 | +/* Line 1136 of lalr1.cc */ |
1794 | #line 89 "Core/QueryParser/grammar.yy" |
1795 | |
1796 | |
1797 | |
1798 | === modified file 'src/Core/QueryParser/Generated/parser.hpp' |
1799 | --- src/Core/QueryParser/Generated/parser.hpp 2013-04-14 11:02:23 +0000 |
1800 | +++ src/Core/QueryParser/Generated/parser.hpp 2013-05-15 15:27:27 +0000 |
1801 | @@ -1,8 +1,8 @@ |
1802 | -/* A Bison parser, made by GNU Bison 2.6.5. */ |
1803 | +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ |
1804 | |
1805 | /* Skeleton interface for Bison LALR(1) parsers in C++ |
1806 | |
1807 | - Copyright (C) 2002-2012 Free Software Foundation, Inc. |
1808 | + Copyright (C) 2002-2013 Free Software Foundation, Inc. |
1809 | |
1810 | This program is free software: you can redistribute it and/or modify |
1811 | it under the terms of the GNU General Public License as published by |
1812 | @@ -41,7 +41,7 @@ |
1813 | # define YY_YY_CORE_QUERYPARSER_GENERATED_PARSER_HPP_INCLUDED |
1814 | |
1815 | /* "%code requires" blocks. */ |
1816 | -/* Line 36 of lalr1.cc */ |
1817 | +/* Line 33 of lalr1.cc */ |
1818 | #line 7 "Core/QueryParser/grammar.yy" |
1819 | |
1820 | # include <string> |
1821 | @@ -51,7 +51,7 @@ |
1822 | } |
1823 | |
1824 | |
1825 | -/* Line 36 of lalr1.cc */ |
1826 | +/* Line 33 of lalr1.cc */ |
1827 | #line 56 "Core/QueryParser/Generated/parser.hpp" |
1828 | |
1829 | |
1830 | @@ -65,10 +65,10 @@ |
1831 | # define YYDEBUG 0 |
1832 | #endif |
1833 | |
1834 | -/* Line 36 of lalr1.cc */ |
1835 | +/* Line 33 of lalr1.cc */ |
1836 | #line 5 "Core/QueryParser/grammar.yy" |
1837 | namespace VerifyTAPN { |
1838 | -/* Line 36 of lalr1.cc */ |
1839 | +/* Line 33 of lalr1.cc */ |
1840 | #line 73 "Core/QueryParser/Generated/parser.hpp" |
1841 | |
1842 | /// A Bison parser. |
1843 | @@ -79,7 +79,7 @@ |
1844 | #ifndef YYSTYPE |
1845 | union semantic_type |
1846 | { |
1847 | -/* Line 36 of lalr1.cc */ |
1848 | +/* Line 33 of lalr1.cc */ |
1849 | #line 30 "Core/QueryParser/grammar.yy" |
1850 | |
1851 | int number; |
1852 | @@ -88,7 +88,7 @@ |
1853 | VerifyTAPN::AST::Query* query; |
1854 | |
1855 | |
1856 | -/* Line 36 of lalr1.cc */ |
1857 | +/* Line 33 of lalr1.cc */ |
1858 | #line 93 "Core/QueryParser/Generated/parser.hpp" |
1859 | }; |
1860 | #else |
1861 | @@ -149,6 +149,10 @@ |
1862 | #endif |
1863 | |
1864 | private: |
1865 | + /// This class is not copyable. |
1866 | + Parser (const Parser&); |
1867 | + Parser& operator= (const Parser&); |
1868 | + |
1869 | /// Report a syntax error. |
1870 | /// \param loc where the syntax error is found. |
1871 | /// \param msg a description of the syntax error. |
1872 | @@ -266,6 +270,7 @@ |
1873 | |
1874 | /// \brief Reclaim the memory associated to a symbol. |
1875 | /// \param yymsg Why this token is reclaimed. |
1876 | + /// If null, do not display the symbol, just free it. |
1877 | /// \param yytype The symbol type. |
1878 | /// \param yyvaluep Its semantic value. |
1879 | /// \param yylocationp Its location. |
1880 | @@ -293,11 +298,11 @@ |
1881 | /* User arguments. */ |
1882 | VerifyTAPN::TAPNQueryParser& driver; |
1883 | }; |
1884 | -/* Line 36 of lalr1.cc */ |
1885 | +/* Line 33 of lalr1.cc */ |
1886 | #line 5 "Core/QueryParser/grammar.yy" |
1887 | } // VerifyTAPN |
1888 | -/* Line 36 of lalr1.cc */ |
1889 | -#line 301 "Core/QueryParser/Generated/parser.hpp" |
1890 | +/* Line 33 of lalr1.cc */ |
1891 | +#line 306 "Core/QueryParser/Generated/parser.hpp" |
1892 | |
1893 | |
1894 | |
1895 | |
1896 | === modified file 'src/Core/QueryParser/Generated/position.hh' |
1897 | --- src/Core/QueryParser/Generated/position.hh 2013-04-14 11:02:23 +0000 |
1898 | +++ src/Core/QueryParser/Generated/position.hh 2013-05-15 15:27:27 +0000 |
1899 | @@ -1,8 +1,8 @@ |
1900 | -/* A Bison parser, made by GNU Bison 2.6.5. */ |
1901 | +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ |
1902 | |
1903 | /* Positions for Bison parsers in C++ |
1904 | |
1905 | - Copyright (C) 2002-2007, 2009-2012 Free Software Foundation, Inc. |
1906 | + Copyright (C) 2002-2007, 2009-2013 Free Software Foundation, Inc. |
1907 | |
1908 | This program is free software: you can redistribute it and/or modify |
1909 | it under the terms of the GNU General Public License as published by |
1910 | @@ -50,10 +50,10 @@ |
1911 | # endif |
1912 | # endif |
1913 | |
1914 | -/* Line 38 of location.cc */ |
1915 | +/* Line 36 of location.cc */ |
1916 | #line 5 "Core/QueryParser/grammar.yy" |
1917 | namespace VerifyTAPN { |
1918 | -/* Line 38 of location.cc */ |
1919 | +/* Line 36 of location.cc */ |
1920 | #line 58 "Core/QueryParser/Generated/position.hh" |
1921 | /// Abstract a position. |
1922 | class position |
1923 | @@ -157,17 +157,18 @@ |
1924 | ** \param ostr the destination output stream |
1925 | ** \param pos a reference to the position to redirect |
1926 | */ |
1927 | - inline std::ostream& |
1928 | - operator<< (std::ostream& ostr, const position& pos) |
1929 | + template <typename YYChar> |
1930 | + inline std::basic_ostream<YYChar>& |
1931 | + operator<< (std::basic_ostream<YYChar>& ostr, const position& pos) |
1932 | { |
1933 | if (pos.filename) |
1934 | ostr << *pos.filename << ':'; |
1935 | return ostr << pos.line << '.' << pos.column; |
1936 | } |
1937 | |
1938 | -/* Line 149 of location.cc */ |
1939 | +/* Line 148 of location.cc */ |
1940 | #line 5 "Core/QueryParser/grammar.yy" |
1941 | } // VerifyTAPN |
1942 | -/* Line 149 of location.cc */ |
1943 | -#line 173 "Core/QueryParser/Generated/position.hh" |
1944 | +/* Line 148 of location.cc */ |
1945 | +#line 174 "Core/QueryParser/Generated/position.hh" |
1946 | #endif /* !YY_YY_CORE_QUERYPARSER_GENERATED_POSITION_HH_INCLUDED */ |
1947 | |
1948 | === modified file 'src/Core/QueryParser/Generated/stack.hh' |
1949 | --- src/Core/QueryParser/Generated/stack.hh 2013-04-14 11:02:23 +0000 |
1950 | +++ src/Core/QueryParser/Generated/stack.hh 2013-05-15 15:27:27 +0000 |
1951 | @@ -1,8 +1,8 @@ |
1952 | -/* A Bison parser, made by GNU Bison 2.6.5. */ |
1953 | +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ |
1954 | |
1955 | /* Stack handling for Bison parsers in C++ |
1956 | |
1957 | - Copyright (C) 2002-2012 Free Software Foundation, Inc. |
1958 | + Copyright (C) 2002-2013 Free Software Foundation, Inc. |
1959 | |
1960 | This program is free software: you can redistribute it and/or modify |
1961 | it under the terms of the GNU General Public License as published by |
1962 | @@ -40,10 +40,10 @@ |
1963 | |
1964 | # include <deque> |
1965 | |
1966 | -/* Line 37 of stack.hh */ |
1967 | +/* Line 34 of stack.hh */ |
1968 | #line 5 "Core/QueryParser/grammar.yy" |
1969 | namespace VerifyTAPN { |
1970 | -/* Line 37 of stack.hh */ |
1971 | +/* Line 34 of stack.hh */ |
1972 | #line 48 "Core/QueryParser/Generated/stack.hh" |
1973 | template <class T, class S = std::deque<T> > |
1974 | class stack |
1975 | @@ -90,6 +90,12 @@ |
1976 | seq_.pop_front (); |
1977 | } |
1978 | |
1979 | + void |
1980 | + clear () |
1981 | + { |
1982 | + seq_.clear (); |
1983 | + } |
1984 | + |
1985 | inline |
1986 | unsigned int |
1987 | height () const |
1988 | @@ -101,6 +107,8 @@ |
1989 | inline const_iterator end () const { return seq_.rend (); } |
1990 | |
1991 | private: |
1992 | + stack (const stack&); |
1993 | + stack& operator= (const stack&); |
1994 | S seq_; |
1995 | }; |
1996 | |
1997 | @@ -126,10 +134,10 @@ |
1998 | const S& stack_; |
1999 | unsigned int range_; |
2000 | }; |
2001 | -/* Line 119 of stack.hh */ |
2002 | +/* Line 124 of stack.hh */ |
2003 | #line 5 "Core/QueryParser/grammar.yy" |
2004 | } // VerifyTAPN |
2005 | -/* Line 119 of stack.hh */ |
2006 | -#line 134 "Core/QueryParser/Generated/stack.hh" |
2007 | +/* Line 124 of stack.hh */ |
2008 | +#line 142 "Core/QueryParser/Generated/stack.hh" |
2009 | |
2010 | #endif /* !YY_YY_CORE_QUERYPARSER_GENERATED_STACK_HH_INCLUDED */ |
2011 | |
2012 | === modified file 'src/Core/QueryParser/NormalizationVisitor.cpp' |
2013 | --- src/Core/QueryParser/NormalizationVisitor.cpp 2012-03-02 10:59:16 +0000 |
2014 | +++ src/Core/QueryParser/NormalizationVisitor.cpp 2013-05-15 15:27:27 +0000 |
2015 | @@ -13,83 +13,83 @@ |
2016 | Tuple(bool negate, Expression* expr) : negate(negate), returnExpr(expr) {}; |
2017 | }; |
2018 | |
2019 | - void NormalizationVisitor::Visit(const NotExpression& expr, boost::any& context) |
2020 | + void NormalizationVisitor::visit(const NotExpression& expr, boost::any& context) |
2021 | { |
2022 | Tuple& tuple = boost::any_cast<Tuple&>(context); |
2023 | boost::any any = Tuple(!tuple.negate, NULL); |
2024 | - expr.Child().Accept(*this, any); |
2025 | + expr.getChild().accept(*this, any); |
2026 | tuple.returnExpr = boost::any_cast<Tuple&>(any).returnExpr; |
2027 | } |
2028 | |
2029 | - void NormalizationVisitor::Visit(const ParExpression& expr, boost::any& context) |
2030 | + void NormalizationVisitor::visit(const ParExpression& expr, boost::any& context) |
2031 | { |
2032 | Tuple& tuple = boost::any_cast<Tuple&>(context); |
2033 | boost::any any = Tuple(tuple.negate, NULL); |
2034 | - expr.Child().Accept(*this, any); |
2035 | + expr.getChild().accept(*this, any); |
2036 | tuple.returnExpr = new ParExpression(boost::any_cast<Tuple&>(any).returnExpr); |
2037 | } |
2038 | |
2039 | - void NormalizationVisitor::Visit(const OrExpression& expr, boost::any& context) |
2040 | - { |
2041 | - Tuple& tuple = boost::any_cast<Tuple&>(context); |
2042 | - boost::any left = Tuple(tuple.negate, NULL), right = Tuple(tuple.negate, NULL); |
2043 | - if(tuple.negate){ |
2044 | - expr.Left().Accept(*this, left); |
2045 | - expr.Right().Accept(*this, right); |
2046 | - tuple.returnExpr = new AndExpression(boost::any_cast<Tuple&>(left).returnExpr, boost::any_cast<Tuple&>(right).returnExpr); |
2047 | - }else{ |
2048 | - expr.Left().Accept(*this, left); |
2049 | - expr.Right().Accept(*this, right); |
2050 | - tuple.returnExpr = new OrExpression(boost::any_cast<Tuple&>(left).returnExpr, boost::any_cast<Tuple&>(right).returnExpr); |
2051 | - } |
2052 | - } |
2053 | - |
2054 | - void NormalizationVisitor::Visit(const AndExpression& expr, boost::any& context) |
2055 | - { |
2056 | - Tuple& tuple = boost::any_cast<Tuple&>(context); |
2057 | - boost::any left = Tuple(tuple.negate, NULL), right = Tuple(tuple.negate, NULL); |
2058 | - if(tuple.negate){ |
2059 | - expr.Left().Accept(*this, left); |
2060 | - expr.Right().Accept(*this, right); |
2061 | - tuple.returnExpr = new OrExpression(boost::any_cast<Tuple&>(left).returnExpr, boost::any_cast<Tuple&>(right).returnExpr); |
2062 | - }else{ |
2063 | - expr.Left().Accept(*this, left); |
2064 | - expr.Right().Accept(*this, right); |
2065 | - tuple.returnExpr = new AndExpression(boost::any_cast<Tuple&>(left).returnExpr, boost::any_cast<Tuple&>(right).returnExpr); |
2066 | - } |
2067 | - } |
2068 | - |
2069 | - void NormalizationVisitor::Visit(const AtomicProposition& expr, boost::any& context) |
2070 | + void NormalizationVisitor::visit(const OrExpression& expr, boost::any& context) |
2071 | + { |
2072 | + Tuple& tuple = boost::any_cast<Tuple&>(context); |
2073 | + boost::any left = Tuple(tuple.negate, NULL), right = Tuple(tuple.negate, NULL); |
2074 | + if(tuple.negate){ |
2075 | + expr.getLeft().accept(*this, left); |
2076 | + expr.getRight().accept(*this, right); |
2077 | + tuple.returnExpr = new AndExpression(boost::any_cast<Tuple&>(left).returnExpr, boost::any_cast<Tuple&>(right).returnExpr); |
2078 | + }else{ |
2079 | + expr.getLeft().accept(*this, left); |
2080 | + expr.getRight().accept(*this, right); |
2081 | + tuple.returnExpr = new OrExpression(boost::any_cast<Tuple&>(left).returnExpr, boost::any_cast<Tuple&>(right).returnExpr); |
2082 | + } |
2083 | + } |
2084 | + |
2085 | + void NormalizationVisitor::visit(const AndExpression& expr, boost::any& context) |
2086 | + { |
2087 | + Tuple& tuple = boost::any_cast<Tuple&>(context); |
2088 | + boost::any left = Tuple(tuple.negate, NULL), right = Tuple(tuple.negate, NULL); |
2089 | + if(tuple.negate){ |
2090 | + expr.getLeft().accept(*this, left); |
2091 | + expr.getRight().accept(*this, right); |
2092 | + tuple.returnExpr = new OrExpression(boost::any_cast<Tuple&>(left).returnExpr, boost::any_cast<Tuple&>(right).returnExpr); |
2093 | + }else{ |
2094 | + expr.getLeft().accept(*this, left); |
2095 | + expr.getRight().accept(*this, right); |
2096 | + tuple.returnExpr = new AndExpression(boost::any_cast<Tuple&>(left).returnExpr, boost::any_cast<Tuple&>(right).returnExpr); |
2097 | + } |
2098 | + } |
2099 | + |
2100 | + void NormalizationVisitor::visit(const AtomicProposition& expr, boost::any& context) |
2101 | { |
2102 | Tuple& tuple = boost::any_cast<Tuple&>(context); |
2103 | std::string op; |
2104 | if(tuple.negate){ |
2105 | - op = NegateOperator(expr.Operator()); |
2106 | + op = negateOperator(expr.getOperator()); |
2107 | }else{ |
2108 | - op = expr.Operator(); |
2109 | + op = expr.getOperator(); |
2110 | } |
2111 | - tuple.returnExpr = new AtomicProposition(expr.Place(), &op, expr.N()); |
2112 | + tuple.returnExpr = new AtomicProposition(expr.getPlace(), &op, expr.getNumberOfTokens()); |
2113 | } |
2114 | |
2115 | - void NormalizationVisitor::Visit(const BoolExpression& expr, boost::any& context) |
2116 | + void NormalizationVisitor::visit(const BoolExpression& expr, boost::any& context) |
2117 | { |
2118 | Tuple& tuple = boost::any_cast<Tuple&>(context); |
2119 | if(tuple.negate){ |
2120 | - tuple.returnExpr = new BoolExpression(!expr.GetValue()); |
2121 | + tuple.returnExpr = new BoolExpression(!expr.getValue()); |
2122 | }else{ |
2123 | - tuple.returnExpr = new BoolExpression(expr.GetValue()); |
2124 | + tuple.returnExpr = new BoolExpression(expr.getValue()); |
2125 | } |
2126 | } |
2127 | |
2128 | - void NormalizationVisitor::Visit(const Query& query, boost::any& context) |
2129 | + void NormalizationVisitor::visit(const Query& query, boost::any& context) |
2130 | { |
2131 | boost::any any = Tuple(false, NULL); |
2132 | - query.Child().Accept(*this, any); |
2133 | + query.getChild().accept(*this, any); |
2134 | |
2135 | - normalizedQuery = new AST::Query(query.GetQuantifier(), boost::any_cast<Tuple&>(any).returnExpr); |
2136 | + normalizedQuery = new AST::Query(query.getQuantifier(), boost::any_cast<Tuple&>(any).returnExpr); |
2137 | } |
2138 | |
2139 | - std::string NormalizationVisitor::NegateOperator(const std::string& op) const{ |
2140 | + std::string NormalizationVisitor::negateOperator(const std::string& op) const{ |
2141 | if(op == "=" || op == "=="){ |
2142 | return "!="; |
2143 | }else if(op == ">"){ |
2144 | |
2145 | === modified file 'src/Core/QueryParser/NormalizationVisitor.hpp' |
2146 | --- src/Core/QueryParser/NormalizationVisitor.hpp 2012-03-02 10:59:16 +0000 |
2147 | +++ src/Core/QueryParser/NormalizationVisitor.hpp 2013-05-15 15:27:27 +0000 |
2148 | @@ -20,17 +20,17 @@ |
2149 | public: |
2150 | NormalizationVisitor() : normalizedQuery() { }; |
2151 | virtual ~NormalizationVisitor() {}; |
2152 | - virtual void Visit(const NotExpression& expr, boost::any& context); |
2153 | - virtual void Visit(const ParExpression& expr, boost::any& context); |
2154 | - virtual void Visit(const OrExpression& expr, boost::any& context); |
2155 | - virtual void Visit(const AndExpression& expr, boost::any& context); |
2156 | - virtual void Visit(const AtomicProposition& expr, boost::any& context); |
2157 | - virtual void Visit(const BoolExpression& expr, boost::any& context); |
2158 | - virtual void Visit(const Query& query, boost::any& context); |
2159 | + virtual void visit(const NotExpression& expr, boost::any& context); |
2160 | + virtual void visit(const ParExpression& expr, boost::any& context); |
2161 | + virtual void visit(const OrExpression& expr, boost::any& context); |
2162 | + virtual void visit(const AndExpression& expr, boost::any& context); |
2163 | + virtual void visit(const AtomicProposition& expr, boost::any& context); |
2164 | + virtual void visit(const BoolExpression& expr, boost::any& context); |
2165 | + virtual void visit(const Query& query, boost::any& context); |
2166 | |
2167 | - AST::Query* Normalize(const AST::Query& query) { boost::any any; query.Accept(*this, any); return normalizedQuery; }; |
2168 | + AST::Query* normalize(const AST::Query& query) { boost::any any; query.accept(*this, any); return normalizedQuery; }; |
2169 | private: |
2170 | - std::string NegateOperator(const std::string& op) const; |
2171 | + std::string negateOperator(const std::string& op) const; |
2172 | private: |
2173 | AST::Query* normalizedQuery; |
2174 | }; |
2175 | |
2176 | === modified file 'src/Core/QueryParser/TAPNQueryParser.cpp' |
2177 | --- src/Core/QueryParser/TAPNQueryParser.cpp 2012-03-02 10:59:16 +0000 |
2178 | +++ src/Core/QueryParser/TAPNQueryParser.cpp 2013-05-15 15:27:27 +0000 |
2179 | @@ -14,11 +14,11 @@ |
2180 | return result; |
2181 | } |
2182 | |
2183 | - void TAPNQueryParser::SetAST(AST::Query* query){ |
2184 | + void TAPNQueryParser::setAST(AST::Query* query){ |
2185 | ast = query->clone(); |
2186 | } |
2187 | |
2188 | - AST::Query* TAPNQueryParser::GetAST(){ |
2189 | + AST::Query* TAPNQueryParser::getAST(){ |
2190 | return ast; |
2191 | } |
2192 | |
2193 | |
2194 | === modified file 'src/Core/QueryParser/TAPNQueryParser.hpp' |
2195 | --- src/Core/QueryParser/TAPNQueryParser.hpp 2012-03-02 10:59:16 +0000 |
2196 | +++ src/Core/QueryParser/TAPNQueryParser.hpp 2013-05-15 15:27:27 +0000 |
2197 | @@ -31,17 +31,18 @@ |
2198 | |
2199 | public: |
2200 | int parse(const std::string& file); |
2201 | - void SetAST(VerifyTAPN::AST::Query* ast); |
2202 | - AST::Query* GetAST(); |
2203 | + void setAST(VerifyTAPN::AST::Query* ast); |
2204 | + AST::Query* getAST(); |
2205 | |
2206 | - const VerifyTAPN::TAPN::TimedArcPetriNet& tapn() { return net; }; |
2207 | + const VerifyTAPN::TAPN::TimedArcPetriNet& getTAPN() { return net; }; |
2208 | |
2209 | public: // error handling |
2210 | void error(const location& l, const std::string& m); |
2211 | void error(const std::string& m); |
2212 | |
2213 | - public: |
2214 | + // must be public for the generated lexer and parser to work! |
2215 | std::string file; |
2216 | + private: |
2217 | VerifyTAPN::AST::Query* ast; |
2218 | const VerifyTAPN::TAPN::TimedArcPetriNet& net; |
2219 | }; |
2220 | |
2221 | === modified file 'src/Core/QueryParser/Visitor.hpp' |
2222 | --- src/Core/QueryParser/Visitor.hpp 2012-03-02 10:59:16 +0000 |
2223 | +++ src/Core/QueryParser/Visitor.hpp 2013-05-15 15:27:27 +0000 |
2224 | @@ -19,13 +19,13 @@ |
2225 | { |
2226 | public: |
2227 | virtual ~Visitor() { }; |
2228 | - virtual void Visit(const NotExpression& expr, boost::any& context) = 0; |
2229 | - virtual void Visit(const ParExpression& expr, boost::any& context) = 0; |
2230 | - virtual void Visit(const OrExpression& expr, boost::any& context) = 0; |
2231 | - virtual void Visit(const AndExpression& expr, boost::any& context) = 0; |
2232 | - virtual void Visit(const AtomicProposition& expr, boost::any& context) = 0; |
2233 | - virtual void Visit(const BoolExpression& expr, boost::any& context) = 0; |
2234 | - virtual void Visit(const Query& query, boost::any& context) = 0; |
2235 | + virtual void visit(const NotExpression& expr, boost::any& context) = 0; |
2236 | + virtual void visit(const ParExpression& expr, boost::any& context) = 0; |
2237 | + virtual void visit(const OrExpression& expr, boost::any& context) = 0; |
2238 | + virtual void visit(const AndExpression& expr, boost::any& context) = 0; |
2239 | + virtual void visit(const AtomicProposition& expr, boost::any& context) = 0; |
2240 | + virtual void visit(const BoolExpression& expr, boost::any& context) = 0; |
2241 | + virtual void visit(const Query& query, boost::any& context) = 0; |
2242 | }; |
2243 | } |
2244 | } |
2245 | |
2246 | === modified file 'src/Core/QueryParser/grammar.yy' |
2247 | --- src/Core/QueryParser/grammar.yy 2012-04-19 12:40:05 +0000 |
2248 | +++ src/Core/QueryParser/grammar.yy 2013-05-15 15:27:27 +0000 |
2249 | @@ -55,10 +55,10 @@ |
2250 | |
2251 | %% |
2252 | %start query; |
2253 | -query : EF expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EF, $2); driver.SetAST($$); } |
2254 | - | AG expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AG, $2); driver.SetAST($$); } |
2255 | - | EG expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EG, $2); driver.SetAST($$); } |
2256 | - | AF expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AF, $2); driver.SetAST($$); } |
2257 | +query : EF expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EF, $2); driver.setAST($$); } |
2258 | + | AG expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AG, $2); driver.setAST($$); } |
2259 | + | EG expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EG, $2); driver.setAST($$); } |
2260 | + | AF expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AF, $2); driver.setAST($$); } |
2261 | ; |
2262 | |
2263 | expression : parExpression { $$ = $1; } |
2264 | @@ -80,7 +80,7 @@ |
2265 | | BOOL_FALSE { $$ = new VerifyTAPN::AST::BoolExpression(false); }; |
2266 | atomicProposition : IDENTIFIER compareOp NUMBER |
2267 | { |
2268 | - int placeIndex = driver.tapn().GetPlaceIndex(*$1); |
2269 | + int placeIndex = driver.getTAPN().getPlaceIndex(*$1); |
2270 | if(placeIndex == -1) error(@1, "unknown place"); |
2271 | $$ = new VerifyTAPN::AST::AtomicProposition(placeIndex, $2, $3); |
2272 | }; |
2273 | |
2274 | === modified file 'src/Core/TAPN/InhibitorArc.cpp' |
2275 | --- src/Core/TAPN/InhibitorArc.cpp 2012-04-16 10:37:52 +0000 |
2276 | +++ src/Core/TAPN/InhibitorArc.cpp 2013-05-15 15:27:27 +0000 |
2277 | @@ -4,9 +4,9 @@ |
2278 | |
2279 | namespace VerifyTAPN { |
2280 | namespace TAPN { |
2281 | - void InhibitorArc::Print(std::ostream& out) const |
2282 | + void InhibitorArc::print(std::ostream& out) const |
2283 | { |
2284 | - out << "From " << place->GetName() << " to " << transition->GetName() << " weight: " << weight; |
2285 | + out << "From " << place->getName() << " to " << transition->getName() << " weight: " << weight; |
2286 | } |
2287 | } |
2288 | } |
2289 | |
2290 | === modified file 'src/Core/TAPN/InhibitorArc.hpp' |
2291 | --- src/Core/TAPN/InhibitorArc.hpp 2012-04-16 10:22:56 +0000 |
2292 | +++ src/Core/TAPN/InhibitorArc.hpp 2013-05-15 15:27:27 +0000 |
2293 | @@ -19,12 +19,12 @@ |
2294 | virtual ~InhibitorArc() { /* empty */ } |
2295 | |
2296 | public: // modifiers |
2297 | - inline TimedPlace& InputPlace() { return *place; } |
2298 | - inline TimedTransition& OutputTransition() { return *transition; } |
2299 | + inline TimedPlace& getInputPlace() { return *place; } |
2300 | + inline TimedTransition& getOutputTransition() { return *transition; } |
2301 | |
2302 | public: // Inspectors |
2303 | - void Print(std::ostream& out) const; |
2304 | - inline const int GetWeight() const { return weight; } |
2305 | + void print(std::ostream& out) const; |
2306 | + inline const int getWeight() const { return weight; } |
2307 | private: |
2308 | const boost::shared_ptr<TimedPlace> place; |
2309 | const boost::shared_ptr<TimedTransition> transition; |
2310 | @@ -33,7 +33,7 @@ |
2311 | |
2312 | inline std::ostream& operator<<(std::ostream& out, const InhibitorArc& arc) |
2313 | { |
2314 | - arc.Print(out); |
2315 | + arc.print(out); |
2316 | return out; |
2317 | } |
2318 | } |
2319 | |
2320 | === modified file 'src/Core/TAPN/OutputArc.cpp' |
2321 | --- src/Core/TAPN/OutputArc.cpp 2012-04-16 10:37:52 +0000 |
2322 | +++ src/Core/TAPN/OutputArc.cpp 2013-05-15 15:27:27 +0000 |
2323 | @@ -4,17 +4,17 @@ |
2324 | |
2325 | namespace VerifyTAPN { |
2326 | namespace TAPN { |
2327 | - void OutputArc::Print(std::ostream& out) const |
2328 | + void OutputArc::print(std::ostream& out) const |
2329 | { |
2330 | - out << "From " << transition->GetName() << " to " << place->GetName() << " weight: " << weight; |
2331 | + out << "From " << transition->getName() << " to " << place->getName() << " weight: " << weight; |
2332 | } |
2333 | |
2334 | - TimedPlace& OutputArc::OutputPlace() |
2335 | + TimedPlace& OutputArc::getOutputPlace() |
2336 | { |
2337 | return *place; |
2338 | } |
2339 | |
2340 | - TimedTransition& OutputArc::InputTransition() |
2341 | + TimedTransition& OutputArc::getInputTransition() |
2342 | { |
2343 | return *transition; |
2344 | } |
2345 | |
2346 | === modified file 'src/Core/TAPN/OutputArc.hpp' |
2347 | --- src/Core/TAPN/OutputArc.hpp 2012-04-16 10:22:56 +0000 |
2348 | +++ src/Core/TAPN/OutputArc.hpp 2013-05-15 15:27:27 +0000 |
2349 | @@ -20,12 +20,12 @@ |
2350 | virtual ~OutputArc() { /* empty */ } |
2351 | |
2352 | public: // modifiers |
2353 | - TimedPlace& OutputPlace(); |
2354 | - TimedTransition& InputTransition(); |
2355 | + TimedPlace& getOutputPlace(); |
2356 | + TimedTransition& getInputTransition(); |
2357 | |
2358 | public: // inspectors |
2359 | - void Print(std::ostream& out) const; |
2360 | - inline const int GetWeight() const { return weight; } |
2361 | + void print(std::ostream& out) const; |
2362 | + inline const int getWeight() const { return weight; } |
2363 | private: |
2364 | const boost::shared_ptr<TimedTransition> transition; |
2365 | const boost::shared_ptr<TimedPlace> place; |
2366 | @@ -34,7 +34,7 @@ |
2367 | |
2368 | inline std::ostream& operator<<(std::ostream& out, const OutputArc& arc) |
2369 | { |
2370 | - arc.Print(out); |
2371 | + arc.print(out); |
2372 | return out; |
2373 | } |
2374 | } |
2375 | |
2376 | === removed file 'src/Core/TAPN/Pairing.cpp' |
2377 | --- src/Core/TAPN/Pairing.cpp 2012-03-02 10:59:16 +0000 |
2378 | +++ src/Core/TAPN/Pairing.cpp 1970-01-01 00:00:00 +0000 |
2379 | @@ -1,74 +0,0 @@ |
2380 | -#include "Pairing.hpp" |
2381 | -#include "../TAPN/TimedTransition.hpp" |
2382 | -#include "../TAPN/TimedArcPetriNet.hpp" |
2383 | - |
2384 | -namespace VerifyTAPN { |
2385 | - |
2386 | -using namespace TAPN; |
2387 | - |
2388 | - void Pairing::GeneratePairingFor(const TimedArcPetriNet& tapn, const TAPN::TimedTransition& t) { |
2389 | - TimedInputArc::WeakPtrVector preset = t.GetPreset(); |
2390 | - OutputArc::WeakPtrVector postset = t.GetPostset(); |
2391 | - |
2392 | - unsigned int sizeOfPairing = preset.size() >= postset.size() ? preset.size() : postset.size(); |
2393 | - |
2394 | - int inputPlace; |
2395 | - int outputPlace; |
2396 | - |
2397 | - for(unsigned int i = 0; i < sizeOfPairing; i++) |
2398 | - { |
2399 | - if(i < preset.size() && i < postset.size()) |
2400 | - { |
2401 | - boost::shared_ptr<TimedInputArc> tiaPtr = preset[i].lock(); |
2402 | - boost::shared_ptr<OutputArc> oaPtr = postset[i].lock(); |
2403 | - |
2404 | - inputPlace = tapn.GetPlaceIndex(tiaPtr->InputPlace()); |
2405 | - outputPlace = tapn.GetPlaceIndex(oaPtr->OutputPlace()); |
2406 | - |
2407 | - Add(inputPlace, outputPlace); |
2408 | - } |
2409 | - else if(i < preset.size() && i >= postset.size()){ |
2410 | - boost::shared_ptr<TimedInputArc> tiaPtr = preset[i].lock(); |
2411 | - |
2412 | - inputPlace = tapn.GetPlaceIndex(tiaPtr->InputPlace()); |
2413 | - Add(inputPlace, TimedPlace::BottomIndex()); |
2414 | - } |
2415 | - else if(i >= preset.size() && i < postset.size()) |
2416 | - { |
2417 | - boost::shared_ptr<OutputArc> oaPtr = postset[i].lock(); |
2418 | - |
2419 | - outputPlace = tapn.GetPlaceIndex(oaPtr->OutputPlace()); |
2420 | - |
2421 | - Add(TimedPlace::BottomIndex(),outputPlace); |
2422 | - } |
2423 | - } |
2424 | - } |
2425 | - |
2426 | - const std::list<int>& Pairing::GetOutputPlacesFor(int inputPlace) const |
2427 | - { |
2428 | - return pairing[inputPlace]; |
2429 | - } |
2430 | - |
2431 | - void Pairing::Add(int inputPlace, int outputPlace) |
2432 | - { |
2433 | - std::list<int>& outPlaces = pairing[inputPlace]; |
2434 | - |
2435 | - outPlaces.push_back(outputPlace); |
2436 | - } |
2437 | - |
2438 | - void Pairing::Print(std::ostream& out) const |
2439 | - { |
2440 | - out << "( INPUT PLACE, OUTPUT PLACE )\n"; |
2441 | - out << "-------------------------------\n"; |
2442 | - for(HashMap::const_iterator iter = pairing.begin(); iter != pairing.end(); ++iter) |
2443 | - { |
2444 | - std::list<int> outPlaces = (*iter).second; |
2445 | - for(std::list<int>::const_iterator pIter = outPlaces.begin(); pIter != outPlaces.end(); ++pIter) |
2446 | - { |
2447 | - out << "(" << (*iter).first << ", " << (*pIter) << ")" << "\n"; |
2448 | - } |
2449 | - } |
2450 | - |
2451 | - out << "\n"; |
2452 | - } |
2453 | -} |
2454 | |
2455 | === removed file 'src/Core/TAPN/Pairing.hpp' |
2456 | --- src/Core/TAPN/Pairing.hpp 2012-03-02 10:59:16 +0000 |
2457 | +++ src/Core/TAPN/Pairing.hpp 1970-01-01 00:00:00 +0000 |
2458 | @@ -1,44 +0,0 @@ |
2459 | -#ifndef PAIRING_HPP_ |
2460 | -#define PAIRING_HPP_ |
2461 | -#include "google/sparse_hash_map" |
2462 | -#include "../TAPN/TimedPlace.hpp" |
2463 | -#include "boost/functional/hash.hpp" |
2464 | -#include <string> |
2465 | -#include <list> |
2466 | - |
2467 | -namespace VerifyTAPN { |
2468 | - namespace TAPN { |
2469 | - class TimedTransition; |
2470 | - class TimedArcPetriNet; |
2471 | - } |
2472 | - |
2473 | - class Pairing { |
2474 | - public: |
2475 | - typedef google::sparse_hash_map<int, std::list<int>, boost::hash<int> > HashMap; |
2476 | - public: // construction |
2477 | - Pairing(const TAPN::TimedArcPetriNet& tapn, const TAPN::TimedTransition& t) : pairing() { GeneratePairingFor(tapn, t); }; |
2478 | - Pairing() : pairing() { }; |
2479 | - |
2480 | - public: // inspectors |
2481 | - const std::list<int>& GetOutputPlacesFor(int inputPlace) const; |
2482 | - inline bool IsPairingEmpty() const { return pairing.empty(); } |
2483 | - void Print(std::ostream& out) const; |
2484 | - |
2485 | - private: // initializers |
2486 | - void GeneratePairingFor(const TAPN::TimedArcPetriNet& tapn, const TAPN::TimedTransition& t); |
2487 | - void Add(int inputPlace, int outputPlace); |
2488 | - |
2489 | - private: // data |
2490 | - mutable HashMap pairing; |
2491 | - |
2492 | - }; |
2493 | - |
2494 | - inline std::ostream& operator<<(std::ostream& out, const Pairing& pairing) |
2495 | - { |
2496 | - pairing.Print(out); |
2497 | - return out; |
2498 | - } |
2499 | - |
2500 | -} |
2501 | - |
2502 | -#endif /* PAIRING_HPP_ */ |
2503 | |
2504 | === modified file 'src/Core/TAPN/TimeInterval.cpp' |
2505 | --- src/Core/TAPN/TimeInterval.cpp 2012-03-02 10:59:16 +0000 |
2506 | +++ src/Core/TAPN/TimeInterval.cpp 2013-05-15 15:27:27 +0000 |
2507 | @@ -6,7 +6,7 @@ |
2508 | namespace VerifyTAPN { |
2509 | namespace TAPN { |
2510 | using namespace boost::algorithm; |
2511 | - TimeInterval TimeInterval::CreateFor(const std::string& interval) |
2512 | + TimeInterval TimeInterval::createFor(const std::string& interval) |
2513 | { |
2514 | bool leftStrict = boost::algorithm::icontains(interval, "("); |
2515 | bool rightStrict = boost::algorithm::icontains(interval,")"); |
2516 | @@ -30,7 +30,7 @@ |
2517 | return TimeInterval(leftStrict, lowerBound, upperBound, rightStrict); |
2518 | } |
2519 | |
2520 | - void TimeInterval::Print(std::ostream& out) const |
2521 | + void TimeInterval::print(std::ostream& out) const |
2522 | { |
2523 | std::string leftParenthesis = leftStrict ? "(" : "["; |
2524 | std::string rightParenthesis = rightStrict ? ")" : "]"; |
2525 | |
2526 | === modified file 'src/Core/TAPN/TimeInterval.hpp' |
2527 | --- src/Core/TAPN/TimeInterval.hpp 2012-06-19 09:03:00 +0000 |
2528 | +++ src/Core/TAPN/TimeInterval.hpp 2013-05-15 15:27:27 +0000 |
2529 | @@ -25,16 +25,16 @@ |
2530 | virtual ~TimeInterval() { /* empty */ } |
2531 | |
2532 | public: // inspectors |
2533 | - void Print(std::ostream& out) const; |
2534 | - inline const int GetLowerBound() const { return lowerBound; } |
2535 | - inline const int GetUpperBound() const { return upperBound; } |
2536 | - inline const bool IsLowerBoundStrict() const { return leftStrict; } |
2537 | - inline const bool IsUpperBoundStrict() const { return rightStrict; } |
2538 | + void print(std::ostream& out) const; |
2539 | + inline const int getLowerBound() const { return lowerBound; } |
2540 | + inline const int getUpperBound() const { return upperBound; } |
2541 | + inline const bool isLowerBoundStrict() const { return leftStrict; } |
2542 | + inline const bool isUpperBoundStrict() const { return rightStrict; } |
2543 | |
2544 | - inline const bool IsZeroInfinity() const { return !leftStrict && lowerBound == 0 && upperBound == std::numeric_limits<int>().max() && rightStrict; } |
2545 | + inline const bool isZeroInfinity() const { return !leftStrict && lowerBound == 0 && upperBound == std::numeric_limits<int>().max() && rightStrict; } |
2546 | |
2547 | public: // statics |
2548 | - static TimeInterval CreateFor(const std::string& interval); |
2549 | + static TimeInterval createFor(const std::string& interval); |
2550 | |
2551 | |
2552 | private: // data |
2553 | @@ -46,7 +46,7 @@ |
2554 | |
2555 | inline std::ostream& operator<<(std::ostream& out, const TimeInterval& interval) |
2556 | { |
2557 | - interval.Print(out); |
2558 | + interval.print(out); |
2559 | return out; |
2560 | } |
2561 | } |
2562 | |
2563 | === modified file 'src/Core/TAPN/TimeInvariant.cpp' |
2564 | --- src/Core/TAPN/TimeInvariant.cpp 2012-03-02 10:59:16 +0000 |
2565 | +++ src/Core/TAPN/TimeInvariant.cpp 2013-05-15 15:27:27 +0000 |
2566 | @@ -6,7 +6,7 @@ |
2567 | namespace TAPN { |
2568 | const TimeInvariant TimeInvariant::LS_INF; |
2569 | |
2570 | - TimeInvariant TimeInvariant::CreateFor(const std::string& invariant) |
2571 | + TimeInvariant TimeInvariant::createFor(const std::string& invariant) |
2572 | { |
2573 | bool strict = !boost::algorithm::icontains(invariant, "<="); |
2574 | int bound = std::numeric_limits<int>().max(); |
2575 | @@ -23,7 +23,7 @@ |
2576 | return TimeInvariant(strict, bound); |
2577 | } |
2578 | |
2579 | - void TimeInvariant::Print(std::ostream& out) const |
2580 | + void TimeInvariant::print(std::ostream& out) const |
2581 | { |
2582 | std::string comparison = strictComparison ? "<" : "<="; |
2583 | std::string strBound = bound == std::numeric_limits<int>().max() ? "inf" : boost::lexical_cast<std::string>(bound); |
2584 | |
2585 | === modified file 'src/Core/TAPN/TimeInvariant.hpp' |
2586 | --- src/Core/TAPN/TimeInvariant.hpp 2012-03-02 10:59:16 +0000 |
2587 | +++ src/Core/TAPN/TimeInvariant.hpp 2013-05-15 15:27:27 +0000 |
2588 | @@ -25,12 +25,12 @@ |
2589 | |
2590 | virtual ~TimeInvariant() { /* Empty */ }; |
2591 | public: // inspectors |
2592 | - void Print(std::ostream& out) const; |
2593 | - inline const int GetBound() const { return bound; } |
2594 | - inline const bool IsBoundStrict() const { return strictComparison; } |
2595 | + void print(std::ostream& out) const; |
2596 | + inline const int getBound() const { return bound; } |
2597 | + inline const bool isBoundStrict() const { return strictComparison; } |
2598 | |
2599 | public: // statics |
2600 | - static TimeInvariant CreateFor(const std::string& invariant); |
2601 | + static TimeInvariant createFor(const std::string& invariant); |
2602 | |
2603 | private: // data |
2604 | bool strictComparison; |
2605 | @@ -39,7 +39,7 @@ |
2606 | |
2607 | inline bool operator==(const TimeInvariant& a, const TimeInvariant& b) |
2608 | { |
2609 | - return a.GetBound() == b.GetBound() && a.IsBoundStrict() == b.IsBoundStrict(); |
2610 | + return a.getBound() == b.getBound() && a.isBoundStrict() == b.isBoundStrict(); |
2611 | } |
2612 | |
2613 | inline bool operator!=(const TimeInvariant& a, const TimeInvariant& b) |
2614 | @@ -49,7 +49,7 @@ |
2615 | |
2616 | inline std::ostream& operator<<(std::ostream& out, const TimeInvariant& invariant) |
2617 | { |
2618 | - invariant.Print(out); |
2619 | + invariant.print(out); |
2620 | return out; |
2621 | } |
2622 | } |
2623 | |
2624 | === modified file 'src/Core/TAPN/TimedArcPetriNet.cpp' |
2625 | --- src/Core/TAPN/TimedArcPetriNet.cpp 2012-10-10 06:32:18 +0000 |
2626 | +++ src/Core/TAPN/TimedArcPetriNet.cpp 2013-05-15 15:27:27 +0000 |
2627 | @@ -5,58 +5,58 @@ |
2628 | |
2629 | namespace VerifyTAPN { |
2630 | namespace TAPN { |
2631 | - void TimedArcPetriNet::Initialize(bool useGlobalMaxConstant) |
2632 | + void TimedArcPetriNet::initialize(bool useGlobalMaxConstant) |
2633 | { |
2634 | for(unsigned int i = 0; i < places.size(); i++){ |
2635 | - places[i]->SetIndex(i); |
2636 | - UpdateMaxConstant(places[i]->GetInvariant()); |
2637 | + places[i]->setIndex(i); |
2638 | + updateMaxConstant(places[i]->getInvariant()); |
2639 | } |
2640 | |
2641 | for(unsigned int i = 0; i < transitions.size(); i++){ |
2642 | - transitions[i]->SetIndex(i); |
2643 | + transitions[i]->setIndex(i); |
2644 | } |
2645 | |
2646 | for(TimedInputArc::Vector::const_iterator iter = inputArcs.begin(); iter != inputArcs.end(); ++iter) |
2647 | { |
2648 | const boost::shared_ptr<TimedInputArc>& arc = *iter; |
2649 | - arc->OutputTransition().AddToPreset(arc); |
2650 | - arc->InputPlace().AddInputArc(arc); |
2651 | - UpdateMaxConstant(arc->Interval()); |
2652 | + arc->getOutputTransition().addToPreset(arc); |
2653 | + arc->getInputPlace().addInputArc(arc); |
2654 | + updateMaxConstant(arc->getInterval()); |
2655 | } |
2656 | |
2657 | for(TransportArc::Vector::const_iterator iter = transportArcs.begin(); iter != transportArcs.end(); ++iter) |
2658 | { |
2659 | const boost::shared_ptr<TransportArc>& arc = *iter; |
2660 | - arc->Transition().AddTransportArcGoingThrough(arc); |
2661 | - arc->Source().AddTransportArc(arc); |
2662 | - UpdateMaxConstant(arc->Interval()); |
2663 | + arc->getTransition().addTransportArcGoingThrough(arc); |
2664 | + arc->getSource().addTransportArc(arc); |
2665 | + updateMaxConstant(arc->getInterval()); |
2666 | } |
2667 | |
2668 | for(InhibitorArc::Vector::const_iterator iter = inhibitorArcs.begin(); iter != inhibitorArcs.end(); ++iter) { |
2669 | const boost::shared_ptr<InhibitorArc>& arc = *iter; |
2670 | - arc->OutputTransition().AddIncomingInhibitorArc(arc); |
2671 | - arc->InputPlace().AddInhibitorArc(arc); |
2672 | - arc->InputPlace().SetHasInhibitorArcs(true); |
2673 | + arc->getOutputTransition().addIncomingInhibitorArc(arc); |
2674 | + arc->getInputPlace().addInhibitorArc(arc); |
2675 | + arc->getInputPlace().setHasInhibitorArcs(true); |
2676 | } |
2677 | |
2678 | for(OutputArc::Vector::const_iterator iter = outputArcs.begin(); iter != outputArcs.end(); ++iter) |
2679 | { |
2680 | const boost::shared_ptr<OutputArc>& arc = *iter; |
2681 | - arc->InputTransition().AddToPostset(arc); |
2682 | - arc->OutputPlace().AddOutputArc(arc); |
2683 | + arc->getInputTransition().addToPostset(arc); |
2684 | + arc->getOutputPlace().addOutputArc(arc); |
2685 | } |
2686 | |
2687 | - GeneratePairings(); |
2688 | - FindMaxConstants(); |
2689 | + |
2690 | + findMaxConstants(); |
2691 | |
2692 | if(useGlobalMaxConstant){ |
2693 | for(TimedPlace::Vector::const_iterator place_iter = places.begin(); place_iter != places.end(); ++place_iter) |
2694 | { |
2695 | - (*place_iter)->SetMaxConstant(MaxConstant()==0? -1:MaxConstant()); |
2696 | + (*place_iter)->setMaxConstant(getMaxConstant()==0? -1:getMaxConstant()); |
2697 | } |
2698 | } |
2699 | |
2700 | - MarkUntimedPlaces(); |
2701 | + markUntimedPlaces(); |
2702 | } |
2703 | |
2704 | void TimedArcPetriNet::removeOrphantedTransitions(){ |
2705 | @@ -69,7 +69,7 @@ |
2706 | TimedTransition::Vector::iterator iter = transitions.begin(); |
2707 | while(iter != transitions.end()) |
2708 | { |
2709 | - if((*iter)->GetPresetSize() == 0 && (*iter)->GetPostsetSize() == 0){ |
2710 | + if((*iter)->getPresetSize() == 0 && (*iter)->getPostsetSize() == 0){ |
2711 | iter = transitions.erase(iter); |
2712 | if(!hasShownMessage){ |
2713 | std::cout << "Orphaned transitions have been removed." << std::endl << std::endl; |
2714 | @@ -82,98 +82,98 @@ |
2715 | } |
2716 | } |
2717 | |
2718 | - void TimedArcPetriNet::MarkUntimedPlaces() |
2719 | + void TimedArcPetriNet::markUntimedPlaces() |
2720 | { |
2721 | for(TimedPlace::Vector::const_iterator iter = places.begin(); iter != places.end(); ++iter) |
2722 | { |
2723 | - bool isUntimedPlace = (*iter)->GetInvariant() == TimeInvariant::LS_INF; |
2724 | + bool isUntimedPlace = (*iter)->getInvariant() == TimeInvariant::LS_INF; |
2725 | |
2726 | for(TransportArc::Vector::const_iterator arcIter = transportArcs.begin(); arcIter != transportArcs.end(); ++arcIter) |
2727 | { |
2728 | - isUntimedPlace = isUntimedPlace && (*arcIter)->Source() != **iter; |
2729 | + isUntimedPlace = isUntimedPlace && (*arcIter)->getSource() != **iter; |
2730 | } |
2731 | |
2732 | if(isUntimedPlace) |
2733 | { |
2734 | for(TimedInputArc::Vector::const_iterator arcIter = inputArcs.begin(); arcIter != inputArcs.end(); ++arcIter) |
2735 | { |
2736 | - if((*arcIter)->InputPlace() == **iter) |
2737 | + if((*arcIter)->getInputPlace() == **iter) |
2738 | { |
2739 | - isUntimedPlace = isUntimedPlace && (*arcIter)->Interval().IsZeroInfinity(); |
2740 | + isUntimedPlace = isUntimedPlace && (*arcIter)->getInterval().isZeroInfinity(); |
2741 | } |
2742 | } |
2743 | } |
2744 | |
2745 | - if(isUntimedPlace) (*iter)->MarkPlaceAsUntimed(); |
2746 | + if(isUntimedPlace) (*iter)->markPlaceAsUntimed(); |
2747 | } |
2748 | } |
2749 | |
2750 | - void TimedArcPetriNet::FindMaxConstants() |
2751 | + void TimedArcPetriNet::findMaxConstants() |
2752 | { |
2753 | for(TimedPlace::Vector::const_iterator iter = places.begin(); iter != places.end(); ++iter) |
2754 | { |
2755 | int maxConstant = -1; |
2756 | - if((*iter)->GetInvariant() != TimeInvariant::LS_INF){ |
2757 | - maxConstant = (*iter)->GetInvariant().GetBound(); |
2758 | - (*iter)->SetMaxConstant(maxConstant); |
2759 | - (*iter)->SetType(Inv); |
2760 | + if((*iter)->getInvariant() != TimeInvariant::LS_INF){ |
2761 | + maxConstant = (*iter)->getInvariant().getBound(); |
2762 | + (*iter)->setMaxConstant(maxConstant); |
2763 | + (*iter)->setType(Inv); |
2764 | } |
2765 | else { |
2766 | - (*iter)->SetType(Dead); |
2767 | + (*iter)->setType(Dead); |
2768 | for(TimedInputArc::Vector::const_iterator arcIter = inputArcs.begin(); arcIter != inputArcs.end(); ++arcIter) |
2769 | { |
2770 | - if((*arcIter)->InputPlace() == **iter) |
2771 | + if((*arcIter)->getInputPlace() == **iter) |
2772 | { |
2773 | boost::shared_ptr<TimedInputArc> ia = *arcIter; |
2774 | - const TAPN::TimeInterval& interval = ia->Interval(); |
2775 | + const TAPN::TimeInterval& interval = ia->getInterval(); |
2776 | |
2777 | - const int lowerBound = interval.GetLowerBound(); |
2778 | - const int upperBound = interval.GetUpperBound(); |
2779 | + const int lowerBound = interval.getLowerBound(); |
2780 | + const int upperBound = interval.getUpperBound(); |
2781 | |
2782 | if(upperBound != std::numeric_limits<int>().max() || lowerBound != 0){ |
2783 | if(upperBound == std::numeric_limits<int>().max()){ |
2784 | maxConstant = (maxConstant < lowerBound ? lowerBound : maxConstant); |
2785 | - (*iter)->SetType(Std); |
2786 | + (*iter)->setType(Std); |
2787 | } else { |
2788 | maxConstant = (maxConstant < upperBound ? upperBound : maxConstant); |
2789 | } |
2790 | } else { |
2791 | - (*iter)->SetType(Std); |
2792 | + (*iter)->setType(Std); |
2793 | } |
2794 | } |
2795 | } |
2796 | for(TransportArc::Vector::const_iterator transport_iter = transportArcs.begin(); transport_iter != transportArcs.end(); transport_iter++) |
2797 | { |
2798 | - if((*transport_iter)->Source() == **iter) |
2799 | + if((*transport_iter)->getSource() == **iter) |
2800 | { |
2801 | int maxArc = -1; |
2802 | boost::shared_ptr<TransportArc> ta = *transport_iter; |
2803 | - const TAPN::TimeInterval& interval = ta->Interval(); |
2804 | - const int lowerBound = interval.GetLowerBound(); |
2805 | - const int upperBound = interval.GetUpperBound(); |
2806 | + const TAPN::TimeInterval& interval = ta->getInterval(); |
2807 | + const int lowerBound = interval.getLowerBound(); |
2808 | + const int upperBound = interval.getUpperBound(); |
2809 | |
2810 | if(upperBound != std::numeric_limits<int>().max() || lowerBound != 0){ |
2811 | if(upperBound == std::numeric_limits<int>().max()){ |
2812 | maxArc = lowerBound; |
2813 | - (*iter)->SetType(Std); |
2814 | + (*iter)->setType(Std); |
2815 | } else { |
2816 | maxArc = upperBound; |
2817 | } |
2818 | } else { |
2819 | - (*iter)->SetType(Std); |
2820 | + (*iter)->setType(Std); |
2821 | } |
2822 | - int destinationInvariant = ta->Destination().GetInvariant().GetBound(); |
2823 | + int destinationInvariant = ta->getDestination().getInvariant().getBound(); |
2824 | if(destinationInvariant != std::numeric_limits<int>().max()){ |
2825 | maxArc = maxArc < destinationInvariant ? maxArc : destinationInvariant; |
2826 | } |
2827 | maxConstant = maxConstant < maxArc ? maxArc : maxConstant; |
2828 | } |
2829 | } |
2830 | - (*iter)->SetMaxConstant(maxConstant); |
2831 | + (*iter)->setMaxConstant(maxConstant); |
2832 | |
2833 | for(InhibitorArc::Vector::const_iterator inhib_iter = inhibitorArcs.begin(); inhib_iter != inhibitorArcs.end(); inhib_iter++){ |
2834 | - if((*inhib_iter)->InputPlace().GetIndex() == (*iter)->GetIndex() && (*iter)->GetType() == Dead){ |
2835 | - (*iter)->SetType(Std); |
2836 | + if((*inhib_iter)->getInputPlace().getIndex() == (*iter)->getIndex() && (*iter)->getType() == Dead){ |
2837 | + (*iter)->setType(Std); |
2838 | } |
2839 | } |
2840 | } |
2841 | @@ -184,15 +184,15 @@ |
2842 | std::vector< TimedPlace* > causalitySet; |
2843 | calculateCausality(**place_iter, &causalitySet); |
2844 | for(std::vector< TimedPlace* >::const_iterator cau_iter = causalitySet.begin(); cau_iter != causalitySet.end(); cau_iter++){ |
2845 | - if((*cau_iter)->GetMaxConstant() > (*place_iter)->GetMaxConstant()){ |
2846 | - (*place_iter)->SetMaxConstant((*cau_iter)->GetMaxConstant()); |
2847 | + if((*cau_iter)->getMaxConstant() > (*place_iter)->getMaxConstant()){ |
2848 | + (*place_iter)->setMaxConstant((*cau_iter)->getMaxConstant()); |
2849 | } |
2850 | } |
2851 | } |
2852 | |
2853 | for(TimedTransition::Vector::iterator iter = transitions.begin(); iter != transitions.end(); iter++){ |
2854 | - for(OutputArc::WeakPtrVector::const_iterator place_iter = iter->get()->GetPostset().begin(); place_iter != iter->get()->GetPostset().end(); place_iter++){ |
2855 | - if(place_iter->lock()->OutputPlace().GetMaxConstant() > -1){ |
2856 | + for(OutputArc::WeakPtrVector::const_iterator place_iter = iter->get()->getPostset().begin(); place_iter != iter->get()->getPostset().end(); place_iter++){ |
2857 | + if(place_iter->lock()->getOutputPlace().getMaxConstant() > -1){ |
2858 | iter->get()->setUntimedPostset(false); |
2859 | break; |
2860 | } |
2861 | @@ -206,10 +206,10 @@ |
2862 | if(**iter == p) return; |
2863 | } |
2864 | result->push_back(&p); |
2865 | - for(TransportArc::Vector::const_iterator iter = this->GetTransportArcs().begin(); iter != this->GetTransportArcs().end(); iter++){ |
2866 | - if((*iter)->Source() == p){ |
2867 | - if((*iter)->Interval().GetUpperBound() == std::numeric_limits<int>().max()){ |
2868 | - calculateCausality((*iter)->Destination(), result); |
2869 | + for(TransportArc::Vector::const_iterator iter = this->getTransportArcs().begin(); iter != this->getTransportArcs().end(); iter++){ |
2870 | + if((*iter)->getSource() == p){ |
2871 | + if((*iter)->getInterval().getUpperBound() == std::numeric_limits<int>().max()){ |
2872 | + calculateCausality((*iter)->getDestination(), result); |
2873 | } |
2874 | } |
2875 | } |
2876 | @@ -219,27 +219,27 @@ |
2877 | std::vector< int > placeNumbers; |
2878 | boost::any context = placeNumbers; |
2879 | DiscreteVerification::PlaceVisitor visitor; |
2880 | - query->Accept(visitor, context); |
2881 | + query->accept(visitor, context); |
2882 | placeNumbers = boost::any_cast< std::vector< int > >(context); |
2883 | |
2884 | for(TimedPlace::Vector::const_iterator iter = places.begin(); iter != places.end(); ++iter){ |
2885 | - if(options.GetKeepDeadTokens() && (*iter)->GetType() == Dead){ |
2886 | - (*iter)->SetType(Std); |
2887 | + if(options.getKeepDeadTokens() && (*iter)->getType() == Dead){ |
2888 | + (*iter)->setType(Std); |
2889 | continue; |
2890 | } |
2891 | for(std::vector<int>::const_iterator id_iter = placeNumbers.begin(); id_iter != placeNumbers.end(); id_iter++){ |
2892 | - if((*id_iter) == (*iter)->GetIndex() && (*iter)->GetType() == Dead){ |
2893 | - (*iter)->SetType(Std); |
2894 | + if((*id_iter) == (*iter)->getIndex() && (*iter)->getType() == Dead){ |
2895 | + (*iter)->setType(Std); |
2896 | break; |
2897 | } |
2898 | } |
2899 | } |
2900 | } |
2901 | |
2902 | - void TimedArcPetriNet::UpdateMaxConstant(const TimeInterval& interval) |
2903 | + void TimedArcPetriNet::updateMaxConstant(const TimeInterval& interval) |
2904 | { |
2905 | - int lowerBound = interval.GetLowerBound(); |
2906 | - int upperBound = interval.GetUpperBound(); |
2907 | + int lowerBound = interval.getLowerBound(); |
2908 | + int upperBound = interval.getUpperBound(); |
2909 | if(lowerBound < std::numeric_limits<int>().max() && lowerBound > maxConstant) |
2910 | { |
2911 | maxConstant = lowerBound; |
2912 | @@ -250,21 +250,21 @@ |
2913 | } |
2914 | } |
2915 | |
2916 | - void TimedArcPetriNet::UpdateMaxConstant(const TimeInvariant& invariant) |
2917 | + void TimedArcPetriNet::updateMaxConstant(const TimeInvariant& invariant) |
2918 | { |
2919 | - int bound = invariant.GetBound(); |
2920 | + int bound = invariant.getBound(); |
2921 | if(bound < std::numeric_limits<int>().max() && bound > maxConstant) |
2922 | { |
2923 | maxConstant = bound; |
2924 | } |
2925 | } |
2926 | |
2927 | - int TimedArcPetriNet::GetPlaceIndex(const std::string& placeName) const |
2928 | + int TimedArcPetriNet::getPlaceIndex(const std::string& placeName) const |
2929 | { |
2930 | int idx = TimedPlace::BottomIndex(); |
2931 | for(unsigned int i = 0; i < places.size(); ++i) |
2932 | { |
2933 | - if(places[i]->GetName() == placeName) |
2934 | + if(places[i]->getName() == placeName) |
2935 | { |
2936 | idx = i; |
2937 | break; |
2938 | @@ -274,7 +274,7 @@ |
2939 | return idx; |
2940 | } |
2941 | |
2942 | - void TimedArcPetriNet::Print(std::ostream & out) const |
2943 | + void TimedArcPetriNet::print(std::ostream & out) const |
2944 | { |
2945 | out << "TAPN:" << std::endl << " Places: "; |
2946 | for(TimedPlace::Vector::const_iterator iter = places.begin();iter != places.end();iter++) |
2947 | @@ -326,22 +326,11 @@ |
2948 | out << std::endl; |
2949 | } |
2950 | |
2951 | - |
2952 | - void TimedArcPetriNet::GeneratePairings() |
2953 | - { |
2954 | - for(TimedTransition::Vector::const_iterator iter = transitions.begin(); iter != transitions.end(); ++iter) |
2955 | - { |
2956 | - const TimedTransition& t = *(*iter); |
2957 | - Pairing p(*this, t); |
2958 | - pairings.insert(std::pair<TimedTransition, Pairing>(t, p)); |
2959 | - } |
2960 | - } |
2961 | - |
2962 | - bool TimedArcPetriNet::IsNonStrict() const{ |
2963 | + bool TimedArcPetriNet::isNonStrict() const{ |
2964 | |
2965 | for(TimedInputArc::Vector::const_iterator iter = inputArcs.begin(); iter != inputArcs.end(); iter++){ |
2966 | TimedInputArc& ia = *(*iter); |
2967 | - if(ia.Interval().IsLowerBoundStrict() || (ia.Interval().IsUpperBoundStrict() && ia.Interval().GetUpperBound() != std::numeric_limits<int>().max())){ |
2968 | + if(ia.getInterval().isLowerBoundStrict() || (ia.getInterval().isUpperBoundStrict() && ia.getInterval().getUpperBound() != std::numeric_limits<int>().max())){ |
2969 | return false; |
2970 | } |
2971 | } |
2972 | @@ -349,14 +338,14 @@ |
2973 | |
2974 | for(TransportArc::Vector::const_iterator iter = transportArcs.begin(); iter != transportArcs.end(); iter++){ |
2975 | TransportArc& ta = *(*iter); |
2976 | - if(ta.Interval().IsLowerBoundStrict() || (ta.Interval().IsUpperBoundStrict() && ta.Interval().GetUpperBound() != std::numeric_limits<int>().max())){ |
2977 | + if(ta.getInterval().isLowerBoundStrict() || (ta.getInterval().isUpperBoundStrict() && ta.getInterval().getUpperBound() != std::numeric_limits<int>().max())){ |
2978 | return false; |
2979 | } |
2980 | } |
2981 | |
2982 | for(TimedPlace::Vector::const_iterator iter = places.begin(); iter != places.end(); iter++){ |
2983 | const TimedPlace& p = *(*iter); |
2984 | - if(p.GetInvariant().IsBoundStrict() && p.GetInvariant().GetBound() != std::numeric_limits<int>().max()){ |
2985 | + if(p.getInvariant().isBoundStrict() && p.getInvariant().getBound() != std::numeric_limits<int>().max()){ |
2986 | return false; |
2987 | } |
2988 | } |
2989 | |
2990 | === modified file 'src/Core/TAPN/TimedArcPetriNet.hpp' |
2991 | --- src/Core/TAPN/TimedArcPetriNet.hpp 2012-07-12 15:47:35 +0000 |
2992 | +++ src/Core/TAPN/TimedArcPetriNet.hpp 2013-05-15 15:27:27 +0000 |
2993 | @@ -11,7 +11,6 @@ |
2994 | #include "boost/make_shared.hpp" |
2995 | #include "google/sparse_hash_map" |
2996 | #include "boost/functional/hash.hpp" |
2997 | -#include "Pairing.hpp" |
2998 | #include "../QueryParser/AST.hpp" |
2999 | #include "../../DiscreteVerification/PlaceVisitor.hpp" |
3000 | #include "../VerificationOptions.hpp" |
3001 | @@ -22,8 +21,7 @@ |
3002 | |
3003 | class TimedArcPetriNet |
3004 | { |
3005 | - public: // typedefs |
3006 | - typedef google::sparse_hash_map<TimedTransition, VerifyTAPN::Pairing, boost::hash<TAPN::TimedTransition> > HashMap; |
3007 | + |
3008 | public:// construction |
3009 | TimedArcPetriNet(const TimedPlace::Vector& places, |
3010 | const TimedTransition::Vector& transitions, |
3011 | @@ -35,37 +33,35 @@ |
3012 | virtual ~TimedArcPetriNet() { /* empty */ } |
3013 | |
3014 | public: // inspectors |
3015 | - void Print(std::ostream& out) const; |
3016 | - inline int GetPlaceIndex(const TimedPlace& p) const { return p.GetIndex(); }; |
3017 | - int GetPlaceIndex(const std::string& placeName) const; |
3018 | - const TimedPlace& GetPlace(const int placeIndex) const { return *places[placeIndex]; } |
3019 | - const TimedTransition::Vector& GetTransitions() const { return transitions; } |
3020 | - const TimedInputArc::Vector& GetInputArcs() const { return inputArcs; } |
3021 | - const TransportArc::Vector& GetTransportArcs() const { return transportArcs; } |
3022 | - const InhibitorArc::Vector& GetInhibitorArcs() const { return inhibitorArcs; } |
3023 | - const TimedPlace::Vector& GetPlaces() const { return places; }; |
3024 | - const int GetNumberOfConsumingArcs() const { return inputArcs.size() + transportArcs.size(); } |
3025 | - const OutputArc::Vector& GetOutputArcs() const { return outputArcs; } |
3026 | - const int GetNumberOfOutputArcs() const { return outputArcs.size(); } |
3027 | - int NumberOfPlaces() const { return places.size(); }; |
3028 | - const Pairing& GetPairing(const TimedTransition& t) const { return pairings.find(t)->second; } |
3029 | - inline int MaxConstant() const { return maxConstant; }; |
3030 | - inline const bool IsPlaceUntimed(int index) const { return places[index]->IsUntimed(); } |
3031 | - bool IsNonStrict() const; |
3032 | + void print(std::ostream& out) const; |
3033 | + inline int getPlaceIndex(const TimedPlace& p) const { return p.getIndex(); }; |
3034 | + int getPlaceIndex(const std::string& placeName) const; |
3035 | + const TimedPlace& getPlace(const int placeIndex) const { return *places[placeIndex]; } |
3036 | + const TimedTransition::Vector& getTransitions() const { return transitions; } |
3037 | + const TimedInputArc::Vector& getInputArcs() const { return inputArcs; } |
3038 | + const TransportArc::Vector& getTransportArcs() const { return transportArcs; } |
3039 | + const InhibitorArc::Vector& getInhibitorArcs() const { return inhibitorArcs; } |
3040 | + const TimedPlace::Vector& getPlaces() const { return places; }; |
3041 | + const int getNumberOfConsumingArcs() const { return inputArcs.size() + transportArcs.size(); } |
3042 | + const OutputArc::Vector& getOutputArcs() const { return outputArcs; } |
3043 | + const int getNumberOfOutputArcs() const { return outputArcs.size(); } |
3044 | + int getNumberOfPlaces() const { return places.size(); }; |
3045 | + inline int getMaxConstant() const { return maxConstant; }; |
3046 | + inline const bool isPlaceAtIndexUntimed(int index) const { return places[index]->isUntimed(); } |
3047 | + bool isNonStrict() const; |
3048 | void calculateCausality(TimedPlace& p, std::vector< TimedPlace* >* result) const; |
3049 | void updatePlaceTypes(const AST::Query* query, VerificationOptions options); |
3050 | public: // modifiers |
3051 | - void Initialize(bool useGlobalMaxConstant); |
3052 | + void initialize(bool useGlobalMaxConstant); |
3053 | void removeOrphantedTransitions(); |
3054 | |
3055 | |
3056 | private: // modifiers |
3057 | - void MakeTAPNConservative(); |
3058 | - void GeneratePairings(); |
3059 | - void UpdateMaxConstant(const TimeInterval& interval); |
3060 | - void UpdateMaxConstant(const TimeInvariant& invariant); |
3061 | - void MarkUntimedPlaces(); |
3062 | - void FindMaxConstants(); |
3063 | + void makeTAPNConservative(); |
3064 | + void updateMaxConstant(const TimeInterval& interval); |
3065 | + void updateMaxConstant(const TimeInvariant& invariant); |
3066 | + void markUntimedPlaces(); |
3067 | + void findMaxConstants(); |
3068 | |
3069 | private: // data |
3070 | const TimedPlace::Vector places; |
3071 | @@ -74,20 +70,19 @@ |
3072 | const OutputArc::Vector outputArcs; |
3073 | const TransportArc::Vector transportArcs; |
3074 | const InhibitorArc::Vector inhibitorArcs; |
3075 | - mutable HashMap pairings; |
3076 | int maxConstant; |
3077 | }; |
3078 | |
3079 | inline std::ostream& operator<<(std::ostream& out, const VerifyTAPN::TAPN::TimedArcPetriNet& tapn) |
3080 | { |
3081 | - tapn.Print( out ); |
3082 | + tapn.print( out ); |
3083 | return out; |
3084 | } |
3085 | |
3086 | - inline std::size_t hash_value(const TimedTransition& transition) |
3087 | + inline std::size_t getHashValue(const TimedTransition& transition) |
3088 | { |
3089 | boost::hash<std::string> hasher; |
3090 | - return hasher(transition.GetName()); |
3091 | + return hasher(transition.getName()); |
3092 | } |
3093 | } |
3094 | } |
3095 | |
3096 | === modified file 'src/Core/TAPN/TimedInputArc.cpp' |
3097 | --- src/Core/TAPN/TimedInputArc.cpp 2012-04-16 10:37:52 +0000 |
3098 | +++ src/Core/TAPN/TimedInputArc.cpp 2013-05-15 15:27:27 +0000 |
3099 | @@ -4,9 +4,9 @@ |
3100 | |
3101 | namespace VerifyTAPN { |
3102 | namespace TAPN { |
3103 | - void TimedInputArc::Print(std::ostream& out) const |
3104 | + void TimedInputArc::print(std::ostream& out) const |
3105 | { |
3106 | - out << "From " << place->GetName() << " to " << transition->GetName() << " weight: " << weight; |
3107 | + out << "From " << place->getName() << " to " << transition->getName() << " weight: " << weight; |
3108 | out << " with interval " << interval; |
3109 | } |
3110 | } |
3111 | |
3112 | === modified file 'src/Core/TAPN/TimedInputArc.hpp' |
3113 | --- src/Core/TAPN/TimedInputArc.hpp 2012-04-16 10:22:56 +0000 |
3114 | +++ src/Core/TAPN/TimedInputArc.hpp 2013-05-15 15:27:27 +0000 |
3115 | @@ -21,13 +21,13 @@ |
3116 | virtual ~TimedInputArc() { /* empty */} |
3117 | |
3118 | public: // modifiers |
3119 | - inline TimedPlace& InputPlace() { return *place; } |
3120 | - inline TimedTransition& OutputTransition() { return *transition; } |
3121 | - inline const TimeInterval& Interval() { return interval; } |
3122 | + inline TimedPlace& getInputPlace() { return *place; } |
3123 | + inline TimedTransition& getOutputTransition() { return *transition; } |
3124 | + inline const TimeInterval& getInterval() { return interval; } |
3125 | |
3126 | public: // Inspectors |
3127 | - void Print(std::ostream& out) const; |
3128 | - inline const int GetWeight() const { return weight; } |
3129 | + void print(std::ostream& out) const; |
3130 | + inline const int getWeight() const { return weight; } |
3131 | private: |
3132 | const TimeInterval interval; |
3133 | const boost::shared_ptr<TimedPlace> place; |
3134 | @@ -37,7 +37,7 @@ |
3135 | |
3136 | inline std::ostream& operator<<(std::ostream& out, const TimedInputArc& arc) |
3137 | { |
3138 | - arc.Print(out); |
3139 | + arc.print(out); |
3140 | return out; |
3141 | } |
3142 | } |
3143 | |
3144 | === modified file 'src/Core/TAPN/TimedPlace.cpp' |
3145 | --- src/Core/TAPN/TimedPlace.cpp 2012-04-11 11:13:01 +0000 |
3146 | +++ src/Core/TAPN/TimedPlace.cpp 2013-05-15 15:27:27 +0000 |
3147 | @@ -5,19 +5,19 @@ |
3148 | |
3149 | const std::string TimedPlace::BOTTOM_NAME = "*BOTTOM*"; |
3150 | |
3151 | - const std::string& TimedPlace::GetName() const |
3152 | + const std::string& TimedPlace::getName() const |
3153 | { |
3154 | return name; |
3155 | } |
3156 | |
3157 | - const std::string& TimedPlace::GetId() const |
3158 | + const std::string& TimedPlace::getId() const |
3159 | { |
3160 | return id; |
3161 | } |
3162 | |
3163 | - void TimedPlace::Print(std::ostream& out) const |
3164 | + void TimedPlace::print(std::ostream& out) const |
3165 | { |
3166 | - out << "(" << name << " (index: " << index << "), " << timeInvariant << ", Max Constant: " << maxConstant << ", Infinity Place: " << (isUntimed ? "true" : "false") << ", Type: " << (type == Std ? "Std" : (type == Inv ? "Inv" : "Dead")) << ")"; |
3167 | + out << "(" << name << " (index: " << index << "), " << timeInvariant << ", Max Constant: " << maxConstant << ", Infinity Place: " << (untimed ? "true" : "false") << ", Type: " << (type == Std ? "Std" : (type == Inv ? "Inv" : "Dead")) << ")"; |
3168 | } |
3169 | } |
3170 | } |
3171 | |
3172 | === modified file 'src/Core/TAPN/TimedPlace.hpp' |
3173 | --- src/Core/TAPN/TimedPlace.hpp 2012-04-25 13:02:36 +0000 |
3174 | +++ src/Core/TAPN/TimedPlace.hpp 2013-05-15 15:27:27 +0000 |
3175 | @@ -36,33 +36,33 @@ |
3176 | |
3177 | public: // construction / destruction |
3178 | TimedPlace(const std::string& name, const std::string& id, const TimeInvariant timeInvariant) |
3179 | - : name(name), id(id), timeInvariant(timeInvariant), index(-2), isUntimed(false), maxConstant(0), hasInhibitorArcs(false), inputArcs(), transportArcs(), inhibitorArcs() { }; |
3180 | - TimedPlace() : name(BOTTOM_NAME), timeInvariant(), index(BottomIndex()), isUntimed(false), maxConstant(0), hasInhibitorArcs(false), inputArcs(), transportArcs(), inhibitorArcs(){ }; |
3181 | + : name(name), id(id), timeInvariant(timeInvariant), index(-2), untimed(false), maxConstant(0), containsInhibitorArcs(false), inputArcs(), transportArcs(), inhibitorArcs() { }; |
3182 | + TimedPlace() : name(BOTTOM_NAME), timeInvariant(), index(BottomIndex()), untimed(false), maxConstant(0), containsInhibitorArcs(false), inputArcs(), transportArcs(), inhibitorArcs(){ }; |
3183 | virtual ~TimedPlace() { /* empty */ }; |
3184 | |
3185 | public: // modifiers |
3186 | - inline void MarkPlaceAsUntimed() { isUntimed = true; } |
3187 | - inline void SetIndex(int i) { index = i; }; |
3188 | - inline void SetMaxConstant(int max) { maxConstant = max; } |
3189 | - inline void SetHasInhibitorArcs(bool inhibitorArcs) { hasInhibitorArcs = inhibitorArcs; } |
3190 | - inline void AddInputArc(boost::shared_ptr<TimedInputArc> inputArc) { inputArcs.push_back(inputArc); } |
3191 | - inline void AddTransportArc(boost::shared_ptr<TransportArc> transportArc) { transportArcs.push_back(transportArc); } |
3192 | - inline void AddInhibitorArc(boost::shared_ptr<InhibitorArc> inhibitorArc) { inhibitorArcs.push_back(inhibitorArc); } |
3193 | - inline void AddOutputArc(boost::shared_ptr<OutputArc> outputArc) { outputArcs.push_back(outputArc); } |
3194 | - inline void SetType(PlaceType type){ this->type = type; } |
3195 | + inline void markPlaceAsUntimed() { untimed = true; } |
3196 | + inline void setIndex(int i) { index = i; }; |
3197 | + inline void setMaxConstant(int max) { maxConstant = max; } |
3198 | + inline void setHasInhibitorArcs(bool inhibitorArcs) { containsInhibitorArcs = inhibitorArcs; } |
3199 | + inline void addInputArc(boost::shared_ptr<TimedInputArc> inputArc) { inputArcs.push_back(inputArc); } |
3200 | + inline void addTransportArc(boost::shared_ptr<TransportArc> transportArc) { transportArcs.push_back(transportArc); } |
3201 | + inline void addInhibitorArc(boost::shared_ptr<InhibitorArc> inhibitorArc) { inhibitorArcs.push_back(inhibitorArc); } |
3202 | + inline void addOutputArc(boost::shared_ptr<OutputArc> outputArc) { outputArcs.push_back(outputArc); } |
3203 | + inline void setType(PlaceType type){ this->type = type; } |
3204 | public: // inspection |
3205 | - inline const PlaceType GetType() const { return type; } |
3206 | - const std::string& GetName() const; |
3207 | - const std::string& GetId() const; |
3208 | - void Print(std::ostream& out) const; |
3209 | - inline int GetIndex() const { return index; }; |
3210 | - inline const bool IsUntimed() const { return isUntimed; } |
3211 | - inline const int GetMaxConstant() const { return maxConstant; } |
3212 | - inline const TAPN::TimeInvariant& GetInvariant() const { return timeInvariant; }; |
3213 | - inline bool HasInhibitorArcs() const { return hasInhibitorArcs; }; |
3214 | - inline const TransportArc::WeakPtrVector& GetTransportArcs() const { return transportArcs; } |
3215 | - inline const InhibitorArc::WeakPtrVector& GetInhibitorArcs() const { return inhibitorArcs; } |
3216 | - inline const TimedInputArc::WeakPtrVector& GetInputArcs() const { return inputArcs; } |
3217 | + inline const PlaceType getType() const { return type; } |
3218 | + const std::string& getName() const; |
3219 | + const std::string& getId() const; |
3220 | + void print(std::ostream& out) const; |
3221 | + inline int getIndex() const { return index; }; |
3222 | + inline const bool isUntimed() const { return untimed; } |
3223 | + inline const int getMaxConstant() const { return maxConstant; } |
3224 | + inline const TAPN::TimeInvariant& getInvariant() const { return timeInvariant; }; |
3225 | + inline bool hasInhibitorArcs() const { return containsInhibitorArcs; }; |
3226 | + inline const TransportArc::WeakPtrVector& getTransportArcs() const { return transportArcs; } |
3227 | + inline const InhibitorArc::WeakPtrVector& getInhibitorArcs() const { return inhibitorArcs; } |
3228 | + inline const TimedInputArc::WeakPtrVector& getInputArcs() const { return inputArcs; } |
3229 | |
3230 | private: // data |
3231 | PlaceType type; |
3232 | @@ -70,9 +70,9 @@ |
3233 | std::string id; |
3234 | TimeInvariant timeInvariant; |
3235 | int index; |
3236 | - bool isUntimed; |
3237 | + bool untimed; |
3238 | int maxConstant; |
3239 | - bool hasInhibitorArcs; |
3240 | + bool containsInhibitorArcs; |
3241 | TimedInputArc::WeakPtrVector inputArcs; |
3242 | TransportArc::WeakPtrVector transportArcs; |
3243 | InhibitorArc::WeakPtrVector inhibitorArcs; |
3244 | @@ -81,7 +81,7 @@ |
3245 | |
3246 | inline std::ostream& operator<<(std::ostream& out, const TimedPlace& place) |
3247 | { |
3248 | - place.Print(out); |
3249 | + place.print(out); |
3250 | return out; |
3251 | } |
3252 | |
3253 | @@ -89,12 +89,12 @@ |
3254 | // thus it is enough to use the name to determine equality. |
3255 | inline bool operator==(TimedPlace const& a, TimedPlace const& b) |
3256 | { |
3257 | - return a.GetName() == b.GetName(); |
3258 | + return a.getName() == b.getName(); |
3259 | } |
3260 | |
3261 | inline bool operator!=(TimedPlace const& a, TimedPlace const& b) |
3262 | { |
3263 | - return !(a.GetName() == b.GetName()); |
3264 | + return !(a.getName() == b.getName()); |
3265 | } |
3266 | } |
3267 | } |
3268 | |
3269 | === modified file 'src/Core/TAPN/TimedTransition.cpp' |
3270 | --- src/Core/TAPN/TimedTransition.cpp 2012-03-02 10:59:16 +0000 |
3271 | +++ src/Core/TAPN/TimedTransition.cpp 2013-05-15 15:27:27 +0000 |
3272 | @@ -2,12 +2,12 @@ |
3273 | |
3274 | namespace VerifyTAPN { |
3275 | namespace TAPN { |
3276 | - void TimedTransition::Print(std::ostream& out) const |
3277 | + void TimedTransition::print(std::ostream& out) const |
3278 | { |
3279 | - out << GetName() << "(" << index << ")"; |
3280 | + out << getName() << "(" << index << ")"; |
3281 | } |
3282 | |
3283 | - void TimedTransition::AddToPreset(const boost::shared_ptr<TimedInputArc>& arc) |
3284 | + void TimedTransition::addToPreset(const boost::shared_ptr<TimedInputArc>& arc) |
3285 | { |
3286 | if(arc) |
3287 | { |
3288 | @@ -15,7 +15,7 @@ |
3289 | } |
3290 | } |
3291 | |
3292 | - void TimedTransition::AddTransportArcGoingThrough(const boost::shared_ptr<TransportArc>& arc) |
3293 | + void TimedTransition::addTransportArcGoingThrough(const boost::shared_ptr<TransportArc>& arc) |
3294 | { |
3295 | if(arc) |
3296 | { |
3297 | @@ -23,7 +23,7 @@ |
3298 | } |
3299 | } |
3300 | |
3301 | - void TimedTransition::AddIncomingInhibitorArc(const boost::shared_ptr<InhibitorArc>& arc) |
3302 | + void TimedTransition::addIncomingInhibitorArc(const boost::shared_ptr<InhibitorArc>& arc) |
3303 | { |
3304 | if(arc) |
3305 | { |
3306 | @@ -31,7 +31,7 @@ |
3307 | } |
3308 | } |
3309 | |
3310 | - void TimedTransition::AddToPostset(const boost::shared_ptr<OutputArc>& arc) |
3311 | + void TimedTransition::addToPostset(const boost::shared_ptr<OutputArc>& arc) |
3312 | { |
3313 | if(arc) |
3314 | { |
3315 | |
3316 | === modified file 'src/Core/TAPN/TimedTransition.hpp' |
3317 | --- src/Core/TAPN/TimedTransition.hpp 2012-10-10 06:32:18 +0000 |
3318 | +++ src/Core/TAPN/TimedTransition.hpp 2013-05-15 15:27:27 +0000 |
3319 | @@ -26,27 +26,27 @@ |
3320 | virtual ~TimedTransition() { /* empty */ } |
3321 | |
3322 | public: // modifiers |
3323 | - void AddToPreset(const boost::shared_ptr<TimedInputArc>& arc); |
3324 | - void AddToPostset(const boost::shared_ptr<OutputArc>& arc); |
3325 | - void AddTransportArcGoingThrough(const boost::shared_ptr<TransportArc>& arc); |
3326 | - void AddIncomingInhibitorArc(const boost::shared_ptr<InhibitorArc>& arc); |
3327 | + void addToPreset(const boost::shared_ptr<TimedInputArc>& arc); |
3328 | + void addToPostset(const boost::shared_ptr<OutputArc>& arc); |
3329 | + void addTransportArcGoingThrough(const boost::shared_ptr<TransportArc>& arc); |
3330 | + void addIncomingInhibitorArc(const boost::shared_ptr<InhibitorArc>& arc); |
3331 | |
3332 | - inline void SetIndex(int i) { index = i; }; |
3333 | + inline void setIndex(int i) { index = i; }; |
3334 | public: // inspectors |
3335 | - inline const std::string& GetName() const { return name; }; |
3336 | - inline const std::string& GetId() const { return id; }; |
3337 | - void Print(std::ostream&) const; |
3338 | - inline const TimedInputArc::WeakPtrVector& GetPreset() const { return preset; } |
3339 | - inline const TransportArc::WeakPtrVector& GetTransportArcs() const { return transportArcs; } |
3340 | - inline const InhibitorArc::WeakPtrVector& GetInhibitorArcs() const { return inhibitorArcs; } |
3341 | - inline const unsigned int GetPresetSize() const { return NumberOfInputArcs() + NumberOfTransportArcs(); } |
3342 | - inline const OutputArc::WeakPtrVector& GetPostset() const { return postset; } |
3343 | - inline const unsigned int GetPostsetSize() const { return postset.size() + transportArcs.size(); } |
3344 | - inline unsigned int NumberOfInputArcs() const { return preset.size(); }; |
3345 | - inline unsigned int NumberOfTransportArcs() const { return transportArcs.size(); }; |
3346 | - // bool isEnabledBy(const TimedArcPetriNet& tapn, const VerifyTAPN::SymMarking& marking) const; |
3347 | + inline const std::string& getName() const { return name; }; |
3348 | + inline const std::string& getId() const { return id; }; |
3349 | + void print(std::ostream&) const; |
3350 | + inline const TimedInputArc::WeakPtrVector& getPreset() const { return preset; } |
3351 | + inline const TransportArc::WeakPtrVector& getTransportArcs() const { return transportArcs; } |
3352 | + inline const InhibitorArc::WeakPtrVector& getInhibitorArcs() const { return inhibitorArcs; } |
3353 | + inline const unsigned int getPresetSize() const { return getNumberOfInputArcs() + getNumberOfTransportArcs(); } |
3354 | + inline const OutputArc::WeakPtrVector& getPostset() const { return postset; } |
3355 | + inline const unsigned int getPostsetSize() const { return postset.size() + transportArcs.size(); } |
3356 | + inline unsigned int getNumberOfInputArcs() const { return preset.size(); }; |
3357 | + inline unsigned int getNumberOfTransportArcs() const { return transportArcs.size(); }; |
3358 | + |
3359 | inline const bool isConservative() const { return preset.size() == postset.size(); } |
3360 | - inline unsigned int GetIndex() const { return index; } |
3361 | + inline unsigned int getIndex() const { return index; } |
3362 | inline const bool hasUntimedPostset() const { return untimedPostset; } |
3363 | inline void setUntimedPostset(bool untimed){ untimedPostset = untimed; } |
3364 | |
3365 | @@ -63,7 +63,7 @@ |
3366 | |
3367 | inline std::ostream& operator<<(std::ostream& out, const TimedTransition& transition) |
3368 | { |
3369 | - transition.Print(out); |
3370 | + transition.print(out); |
3371 | return out; |
3372 | } |
3373 | |
3374 | @@ -71,7 +71,7 @@ |
3375 | // thus it is enough to use the name to determine equality. |
3376 | inline bool operator==(TimedTransition const& a, TimedTransition const& b) |
3377 | { |
3378 | - return a.GetName() == b.GetName(); |
3379 | + return a.getName() == b.getName(); |
3380 | } |
3381 | } |
3382 | } |
3383 | |
3384 | === modified file 'src/Core/TAPN/TransportArc.cpp' |
3385 | --- src/Core/TAPN/TransportArc.cpp 2012-04-16 10:37:52 +0000 |
3386 | +++ src/Core/TAPN/TransportArc.cpp 2013-05-15 15:27:27 +0000 |
3387 | @@ -6,9 +6,9 @@ |
3388 | { |
3389 | namespace TAPN |
3390 | { |
3391 | - void TransportArc::Print(std::ostream& out) const |
3392 | + void TransportArc::print(std::ostream& out) const |
3393 | { |
3394 | - out << "From " << source->GetName() << " to " << transition->GetName() << " to " << destination->GetName() << " weight: " << weight; |
3395 | + out << "From " << source->getName() << " to " << transition->getName() << " to " << destination->getName() << " weight: " << weight; |
3396 | out << " with interval " << interval; |
3397 | } |
3398 | } |
3399 | |
3400 | === modified file 'src/Core/TAPN/TransportArc.hpp' |
3401 | --- src/Core/TAPN/TransportArc.hpp 2012-04-16 10:22:56 +0000 |
3402 | +++ src/Core/TAPN/TransportArc.hpp 2013-05-15 15:27:27 +0000 |
3403 | @@ -28,14 +28,14 @@ |
3404 | |
3405 | virtual ~TransportArc() {}; |
3406 | public: |
3407 | - inline TimedPlace& Source() { return *source; } |
3408 | - inline TimedTransition& Transition() { return *transition; } |
3409 | - inline TimedPlace& Destination() { return *destination; } |
3410 | - inline const TimeInterval& Interval() { return interval; } |
3411 | + inline TimedPlace& getSource() { return *source; } |
3412 | + inline TimedTransition& getTransition() { return *transition; } |
3413 | + inline TimedPlace& getDestination() { return *destination; } |
3414 | + inline const TimeInterval& getInterval() { return interval; } |
3415 | |
3416 | public: // Inspectors |
3417 | - void Print(std::ostream& out) const; |
3418 | - inline const int GetWeight() const { return weight; } |
3419 | + void print(std::ostream& out) const; |
3420 | + inline const int getWeight() const { return weight; } |
3421 | private: |
3422 | const TAPN::TimeInterval interval; |
3423 | const boost::shared_ptr<TimedPlace> source; |
3424 | @@ -46,7 +46,7 @@ |
3425 | |
3426 | inline std::ostream& operator<<(std::ostream& out, const TransportArc& arc) |
3427 | { |
3428 | - arc.Print(out); |
3429 | + arc.print(out); |
3430 | return out; |
3431 | } |
3432 | } |
3433 | |
3434 | === modified file 'src/Core/TAPNParser/TAPNXmlParser.cpp' |
3435 | --- src/Core/TAPNParser/TAPNXmlParser.cpp 2012-07-02 06:52:57 +0000 |
3436 | +++ src/Core/TAPNParser/TAPNXmlParser.cpp 2013-05-15 15:27:27 +0000 |
3437 | @@ -9,9 +9,9 @@ |
3438 | namespace VerifyTAPN { |
3439 | using namespace rapidxml; |
3440 | |
3441 | -boost::shared_ptr<TimedArcPetriNet> TAPNXmlParser::Parse(const std::string & filename) const |
3442 | +boost::shared_ptr<TimedArcPetriNet> TAPNXmlParser::parse(const std::string & filename) const |
3443 | { |
3444 | - const std::string contents = VerifyTAPN::ReadFile(filename); |
3445 | + const std::string contents = VerifyTAPN::readFile(filename); |
3446 | std::vector<char> charArray(contents.begin(), contents.end()); |
3447 | charArray.push_back('\0'); |
3448 | |
3449 | @@ -24,12 +24,12 @@ |
3450 | xml_node<>* root = pnml->first_node("net"); |
3451 | if(root == 0) throw std::string("invalid file."); |
3452 | |
3453 | - return ParseTAPN(*root); |
3454 | + return parseTAPN(*root); |
3455 | } |
3456 | |
3457 | -std::vector<int> TAPNXmlParser::ParseMarking(const std::string & filename, const TimedArcPetriNet& tapn) const |
3458 | +std::vector<int> TAPNXmlParser::parseMarking(const std::string & filename, const TimedArcPetriNet& tapn) const |
3459 | { |
3460 | - const std::string contents = VerifyTAPN::ReadFile(filename); // not sure if this is a good idea, because it copies to string? Maybe the compiler is smart enough not to make a copy |
3461 | + const std::string contents = VerifyTAPN::readFile(filename); // not sure if this is a good idea, because it copies to string? Maybe the compiler is smart enough not to make a copy |
3462 | std::vector<char> charArray(contents.begin(), contents.end()); |
3463 | charArray.push_back('\0'); |
3464 | |
3465 | @@ -38,28 +38,28 @@ |
3466 | |
3467 | xml_node<>* pnml = xmldoc.first_node("pnml"); // we don't need error handling here, since we are parsing the same file as above |
3468 | xml_node<>* root = pnml->first_node("net"); |
3469 | - return ParseInitialMarking(*root, tapn); |
3470 | + return parseInitialMarking(*root, tapn); |
3471 | } |
3472 | |
3473 | -boost::shared_ptr<TimedArcPetriNet> TAPNXmlParser::ParseTAPN(const xml_node<>& root) const |
3474 | +boost::shared_ptr<TimedArcPetriNet> TAPNXmlParser::parseTAPN(const xml_node<>& root) const |
3475 | { |
3476 | - TimedPlace::Vector places = ParsePlaces(root); |
3477 | - TimedTransition::Vector transitions = ParseTransitions(root); |
3478 | + TimedPlace::Vector places = parsePlaces(root); |
3479 | + TimedTransition::Vector transitions = parseTransitions(root); |
3480 | |
3481 | - TAPNXmlParser::ArcCollections arcs = ParseArcs(root, places, transitions); |
3482 | + TAPNXmlParser::ArcCollections arcs = parseArcs(root, places, transitions); |
3483 | |
3484 | boost::shared_ptr<TimedArcPetriNet> tapn = boost::make_shared<TimedArcPetriNet>(places, transitions, arcs.inputArcs, arcs.outputArcs, arcs.transportArcs, arcs.inhibitorArcs); |
3485 | |
3486 | return tapn; |
3487 | } |
3488 | |
3489 | -TimedPlace::Vector TAPNXmlParser::ParsePlaces(const xml_node<>& root) const |
3490 | +TimedPlace::Vector TAPNXmlParser::parsePlaces(const xml_node<>& root) const |
3491 | { |
3492 | TimedPlace::Vector places; |
3493 | |
3494 | xml_node<>* placeNode = root.first_node("place"); |
3495 | while(placeNode != NULL){ |
3496 | - boost::shared_ptr<TimedPlace> place = ParsePlace(*placeNode); |
3497 | + boost::shared_ptr<TimedPlace> place = parsePlace(*placeNode); |
3498 | places.push_back(place); |
3499 | placeNode = placeNode->next_sibling("place"); |
3500 | } |
3501 | @@ -67,23 +67,23 @@ |
3502 | return places; |
3503 | } |
3504 | |
3505 | -boost::shared_ptr<TimedPlace> TAPNXmlParser::ParsePlace(const xml_node<>& placeNode) const |
3506 | +boost::shared_ptr<TimedPlace> TAPNXmlParser::parsePlace(const xml_node<>& placeNode) const |
3507 | { |
3508 | std::string id(placeNode.first_attribute("id")->value()); |
3509 | std::string name(placeNode.first_attribute("name")->value()); |
3510 | |
3511 | std::string invariantNode = placeNode.first_attribute("invariant")->value(); |
3512 | - TimeInvariant timeInvariant = TimeInvariant::CreateFor(invariantNode); |
3513 | + TimeInvariant timeInvariant = TimeInvariant::createFor(invariantNode); |
3514 | return boost::make_shared<TimedPlace>(name, id, timeInvariant); |
3515 | } |
3516 | |
3517 | -TimedTransition::Vector TAPNXmlParser::ParseTransitions(const xml_node<>& root) const |
3518 | +TimedTransition::Vector TAPNXmlParser::parseTransitions(const xml_node<>& root) const |
3519 | { |
3520 | TimedTransition::Vector transitions; |
3521 | |
3522 | xml_node<>* transitionNode = root.first_node("transition"); |
3523 | while(transitionNode != NULL){ |
3524 | - boost::shared_ptr<TimedTransition> transition = ParseTransition(*transitionNode); |
3525 | + boost::shared_ptr<TimedTransition> transition = parseTransition(*transitionNode); |
3526 | transitions.push_back(transition); |
3527 | transitionNode = transitionNode->next_sibling("transition"); |
3528 | } |
3529 | @@ -91,71 +91,71 @@ |
3530 | return transitions; |
3531 | } |
3532 | |
3533 | -boost::shared_ptr<TimedTransition> TAPNXmlParser::ParseTransition(const xml_node<>& transitionNode) const |
3534 | +boost::shared_ptr<TimedTransition> TAPNXmlParser::parseTransition(const xml_node<>& transitionNode) const |
3535 | { |
3536 | std::string id(transitionNode.first_attribute("id")->value()); |
3537 | std::string name(transitionNode.first_attribute("name")->value()); |
3538 | return boost::make_shared<TimedTransition>(name, id); |
3539 | } |
3540 | |
3541 | -TAPNXmlParser::ArcCollections TAPNXmlParser::ParseArcs(const xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3542 | +TAPNXmlParser::ArcCollections TAPNXmlParser::parseArcs(const xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3543 | { |
3544 | |
3545 | - TimedInputArc::Vector inputArcs = ParseInputArcs(root, places, transitions); |
3546 | - TransportArc::Vector transportArcs = ParseTransportArcs(root, places, transitions); |
3547 | - InhibitorArc::Vector inhibitorArcs = ParseInhibitorArcs(root,places,transitions); |
3548 | - OutputArc::Vector outputArcs = ParseOutputArcs(root, places, transitions); |
3549 | + TimedInputArc::Vector inputArcs = parseInputArcs(root, places, transitions); |
3550 | + TransportArc::Vector transportArcs = parseTransportArcs(root, places, transitions); |
3551 | + InhibitorArc::Vector inhibitorArcs = parseInhibitorArcs(root,places,transitions); |
3552 | + OutputArc::Vector outputArcs = parseOutputArcs(root, places, transitions); |
3553 | |
3554 | return ArcCollections(inputArcs, outputArcs, transportArcs, inhibitorArcs); |
3555 | } |
3556 | |
3557 | -TransportArc::Vector TAPNXmlParser::ParseTransportArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3558 | +TransportArc::Vector TAPNXmlParser::parseTransportArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3559 | { |
3560 | TransportArc::Vector transportArcs; |
3561 | xml_node<>* arcNode = root.first_node("transportArc"); |
3562 | while(arcNode != NULL){ |
3563 | - transportArcs.push_back(ParseTransportArc(*arcNode, places, transitions)); |
3564 | + transportArcs.push_back(parseTransportArc(*arcNode, places, transitions)); |
3565 | arcNode = arcNode->next_sibling("transportArc"); |
3566 | } |
3567 | return transportArcs; |
3568 | } |
3569 | |
3570 | -InhibitorArc::Vector TAPNXmlParser::ParseInhibitorArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3571 | +InhibitorArc::Vector TAPNXmlParser::parseInhibitorArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3572 | { |
3573 | InhibitorArc::Vector inhibitorArcs; |
3574 | xml_node<>* arcNode = root.first_node("inhibitorArc"); |
3575 | while(arcNode != NULL){ |
3576 | - inhibitorArcs.push_back(ParseInhibitorArc(*arcNode, places, transitions)); |
3577 | + inhibitorArcs.push_back(parseInhibitorArc(*arcNode, places, transitions)); |
3578 | arcNode = arcNode->next_sibling("inhibitorArc"); |
3579 | } |
3580 | return inhibitorArcs; |
3581 | } |
3582 | |
3583 | -TimedInputArc::Vector TAPNXmlParser::ParseInputArcs(const xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3584 | +TimedInputArc::Vector TAPNXmlParser::parseInputArcs(const xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3585 | { |
3586 | TimedInputArc::Vector inputArcs; |
3587 | xml_node<>* arcNode = root.first_node("inputArc"); |
3588 | while(arcNode != NULL){ |
3589 | - inputArcs.push_back(ParseInputArc(*arcNode, places, transitions)); |
3590 | + inputArcs.push_back(parseInputArc(*arcNode, places, transitions)); |
3591 | arcNode = arcNode->next_sibling("inputArc"); |
3592 | } |
3593 | |
3594 | return inputArcs; |
3595 | } |
3596 | |
3597 | -OutputArc::Vector TAPNXmlParser::ParseOutputArcs(const xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3598 | +OutputArc::Vector TAPNXmlParser::parseOutputArcs(const xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3599 | { |
3600 | OutputArc::Vector outputArcs; |
3601 | xml_node<>* arcNode = root.first_node("outputArc"); |
3602 | while(arcNode != NULL){ |
3603 | - outputArcs.push_back(ParseOutputArc(*arcNode, places, transitions)); |
3604 | + outputArcs.push_back(parseOutputArc(*arcNode, places, transitions)); |
3605 | arcNode = arcNode->next_sibling("outputArc"); |
3606 | } |
3607 | |
3608 | return outputArcs; |
3609 | } |
3610 | |
3611 | -boost::shared_ptr<TimedInputArc> TAPNXmlParser::ParseInputArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3612 | +boost::shared_ptr<TimedInputArc> TAPNXmlParser::parseInputArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3613 | { |
3614 | std::string source = arcNode.first_attribute("source")->value(); |
3615 | std::string target = arcNode.first_attribute("target")->value(); |
3616 | @@ -166,13 +166,13 @@ |
3617 | weight = atoi(attribute->value()); |
3618 | } |
3619 | |
3620 | - TimedPlace::Vector::const_iterator place = find_if(places.begin(), places.end(), boost::bind(boost::mem_fn(&TimedPlace::GetId), _1) == source); |
3621 | - TimedTransition::Vector::const_iterator transition = find_if(transitions.begin(), transitions.end(), boost::bind(boost::mem_fn(&TimedTransition::GetId), _1) == target); |
3622 | + TimedPlace::Vector::const_iterator place = find_if(places.begin(), places.end(), boost::bind(boost::mem_fn(&TimedPlace::getId), _1) == source); |
3623 | + TimedTransition::Vector::const_iterator transition = find_if(transitions.begin(), transitions.end(), boost::bind(boost::mem_fn(&TimedTransition::getId), _1) == target); |
3624 | |
3625 | - return boost::make_shared<TimedInputArc>(*place, *transition, weight, TimeInterval::CreateFor(interval)); |
3626 | + return boost::make_shared<TimedInputArc>(*place, *transition, weight, TimeInterval::createFor(interval)); |
3627 | } |
3628 | |
3629 | -boost::shared_ptr<TransportArc> TAPNXmlParser::ParseTransportArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3630 | +boost::shared_ptr<TransportArc> TAPNXmlParser::parseTransportArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3631 | { |
3632 | std::string sourceName = arcNode.first_attribute("source")->value(); |
3633 | std::string transitionName = arcNode.first_attribute("transition")->value(); |
3634 | @@ -184,13 +184,13 @@ |
3635 | weight = atoi(attribute->value()); |
3636 | } |
3637 | |
3638 | - TimedPlace::Vector::const_iterator source = find_if(places.begin(), places.end(), boost::bind(boost::mem_fn(&TimedPlace::GetId), _1) == sourceName); |
3639 | - TimedTransition::Vector::const_iterator transition = find_if(transitions.begin(), transitions.end(), boost::bind(boost::mem_fn(&TimedTransition::GetId), _1) == transitionName); |
3640 | - TimedPlace::Vector::const_iterator target = find_if(places.begin(), places.end(), boost::bind(boost::mem_fn(&TimedPlace::GetId), _1) == targetName); |
3641 | - return boost::make_shared<TransportArc>(*source, *transition, *target, TimeInterval::CreateFor(interval), weight); |
3642 | + TimedPlace::Vector::const_iterator source = find_if(places.begin(), places.end(), boost::bind(boost::mem_fn(&TimedPlace::getId), _1) == sourceName); |
3643 | + TimedTransition::Vector::const_iterator transition = find_if(transitions.begin(), transitions.end(), boost::bind(boost::mem_fn(&TimedTransition::getId), _1) == transitionName); |
3644 | + TimedPlace::Vector::const_iterator target = find_if(places.begin(), places.end(), boost::bind(boost::mem_fn(&TimedPlace::getId), _1) == targetName); |
3645 | + return boost::make_shared<TransportArc>(*source, *transition, *target, TimeInterval::createFor(interval), weight); |
3646 | } |
3647 | |
3648 | -boost::shared_ptr<InhibitorArc> TAPNXmlParser::ParseInhibitorArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3649 | +boost::shared_ptr<InhibitorArc> TAPNXmlParser::parseInhibitorArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3650 | { |
3651 | std::string source = arcNode.first_attribute("source")->value(); |
3652 | std::string target = arcNode.first_attribute("target")->value(); |
3653 | @@ -200,13 +200,13 @@ |
3654 | weight = atoi(attribute->value()); |
3655 | } |
3656 | |
3657 | - TimedPlace::Vector::const_iterator place = find_if(places.begin(), places.end(), boost::bind(boost::mem_fn(&TimedPlace::GetId), _1) == source); |
3658 | - TimedTransition::Vector::const_iterator transition = find_if(transitions.begin(), transitions.end(), boost::bind(boost::mem_fn(&TimedTransition::GetId), _1) == target); |
3659 | + TimedPlace::Vector::const_iterator place = find_if(places.begin(), places.end(), boost::bind(boost::mem_fn(&TimedPlace::getId), _1) == source); |
3660 | + TimedTransition::Vector::const_iterator transition = find_if(transitions.begin(), transitions.end(), boost::bind(boost::mem_fn(&TimedTransition::getId), _1) == target); |
3661 | |
3662 | return boost::make_shared<InhibitorArc>(*place, *transition, weight); |
3663 | } |
3664 | |
3665 | -boost::shared_ptr<OutputArc> TAPNXmlParser::ParseOutputArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3666 | +boost::shared_ptr<OutputArc> TAPNXmlParser::parseOutputArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const |
3667 | { |
3668 | std::string source = arcNode.first_attribute("source")->value(); |
3669 | std::string target = arcNode.first_attribute("target")->value(); |
3670 | @@ -216,14 +216,14 @@ |
3671 | weight = atoi(attribute->value()); |
3672 | } |
3673 | |
3674 | - TimedTransition::Vector::const_iterator transition = find_if(transitions.begin(), transitions.end(), boost::bind(boost::mem_fn(&TimedTransition::GetId), _1) == source); |
3675 | - TimedPlace::Vector::const_iterator place = find_if(places.begin(), places.end(), boost::bind(boost::mem_fn(&TimedPlace::GetId), _1) == target); |
3676 | + TimedTransition::Vector::const_iterator transition = find_if(transitions.begin(), transitions.end(), boost::bind(boost::mem_fn(&TimedTransition::getId), _1) == source); |
3677 | + TimedPlace::Vector::const_iterator place = find_if(places.begin(), places.end(), boost::bind(boost::mem_fn(&TimedPlace::getId), _1) == target); |
3678 | |
3679 | return boost::make_shared<OutputArc>(*transition, *place, weight); |
3680 | |
3681 | } |
3682 | |
3683 | -std::vector<int> TAPNXmlParser::ParseInitialMarking(const rapidxml::xml_node<>& root, const TimedArcPetriNet& tapn) const |
3684 | +std::vector<int> TAPNXmlParser::parseInitialMarking(const rapidxml::xml_node<>& root, const TimedArcPetriNet& tapn) const |
3685 | { |
3686 | std::vector<int> markedPlaces; |
3687 | xml_node<>* placeNode = root.first_node("place"); |
3688 | @@ -241,7 +241,7 @@ |
3689 | if(nTokens > 0) |
3690 | { |
3691 | for(int i = 0; i < nTokens; i++) { |
3692 | - markedPlaces.push_back(tapn.GetPlaceIndex(placeName)); |
3693 | + markedPlaces.push_back(tapn.getPlaceIndex(placeName)); |
3694 | } |
3695 | } |
3696 | |
3697 | |
3698 | === modified file 'src/Core/TAPNParser/TAPNXmlParser.hpp' |
3699 | --- src/Core/TAPNParser/TAPNXmlParser.hpp 2012-03-02 10:59:16 +0000 |
3700 | +++ src/Core/TAPNParser/TAPNXmlParser.hpp 2013-05-15 15:27:27 +0000 |
3701 | @@ -27,27 +27,27 @@ |
3702 | virtual ~TAPNXmlParser() { /* empty */ }; |
3703 | |
3704 | public: |
3705 | - boost::shared_ptr<TimedArcPetriNet> Parse(const std::string & filename) const; |
3706 | - std::vector<int> ParseMarking(const std::string & filename, const TimedArcPetriNet& tapn) const; |
3707 | + boost::shared_ptr<TimedArcPetriNet> parse(const std::string & filename) const; |
3708 | + std::vector<int> parseMarking(const std::string & filename, const TimedArcPetriNet& tapn) const; |
3709 | private: |
3710 | - boost::shared_ptr<TimedArcPetriNet> ParseTAPN(const rapidxml::xml_node<> & root) const; |
3711 | - |
3712 | - TimedPlace::Vector ParsePlaces(const rapidxml::xml_node<>& root) const; |
3713 | - boost::shared_ptr<TimedPlace> ParsePlace(const rapidxml::xml_node<>& placeNode) const; |
3714 | - |
3715 | - TimedTransition::Vector ParseTransitions(const rapidxml::xml_node<>& root) const; |
3716 | - boost::shared_ptr<TimedTransition> ParseTransition(const rapidxml::xml_node<>& transitionNode) const; |
3717 | - |
3718 | - ArcCollections ParseArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3719 | - TransportArc::Vector ParseTransportArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3720 | - InhibitorArc::Vector ParseInhibitorArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3721 | - TimedInputArc::Vector ParseInputArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3722 | - OutputArc::Vector ParseOutputArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3723 | - boost::shared_ptr<TimedInputArc> ParseInputArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3724 | - boost::shared_ptr<InhibitorArc> ParseInhibitorArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3725 | - boost::shared_ptr<TransportArc> ParseTransportArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3726 | - boost::shared_ptr<OutputArc> ParseOutputArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3727 | - std::vector<int> ParseInitialMarking(const rapidxml::xml_node<>& root, const TimedArcPetriNet& tapn) const; |
3728 | + boost::shared_ptr<TimedArcPetriNet> parseTAPN(const rapidxml::xml_node<> & root) const; |
3729 | + |
3730 | + TimedPlace::Vector parsePlaces(const rapidxml::xml_node<>& root) const; |
3731 | + boost::shared_ptr<TimedPlace> parsePlace(const rapidxml::xml_node<>& placeNode) const; |
3732 | + |
3733 | + TimedTransition::Vector parseTransitions(const rapidxml::xml_node<>& root) const; |
3734 | + boost::shared_ptr<TimedTransition> parseTransition(const rapidxml::xml_node<>& transitionNode) const; |
3735 | + |
3736 | + ArcCollections parseArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3737 | + TransportArc::Vector parseTransportArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3738 | + InhibitorArc::Vector parseInhibitorArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3739 | + TimedInputArc::Vector parseInputArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3740 | + OutputArc::Vector parseOutputArcs(const rapidxml::xml_node<>& root, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3741 | + boost::shared_ptr<TimedInputArc> parseInputArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3742 | + boost::shared_ptr<InhibitorArc> parseInhibitorArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3743 | + boost::shared_ptr<TransportArc> parseTransportArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3744 | + boost::shared_ptr<OutputArc> parseOutputArc(const rapidxml::xml_node<>& arcNode, const TimedPlace::Vector& places, const TimedTransition::Vector& transitions) const; |
3745 | + std::vector<int> parseInitialMarking(const rapidxml::xml_node<>& root, const TimedArcPetriNet& tapn) const; |
3746 | }; |
3747 | } |
3748 | |
3749 | |
3750 | === modified file 'src/Core/TAPNParser/util.cpp' |
3751 | --- src/Core/TAPNParser/util.cpp 2012-03-02 10:59:16 +0000 |
3752 | +++ src/Core/TAPNParser/util.cpp 2013-05-15 15:27:27 +0000 |
3753 | @@ -3,7 +3,7 @@ |
3754 | |
3755 | namespace VerifyTAPN |
3756 | { |
3757 | - const std::string ReadFile(const std::string& filename) |
3758 | + const std::string readFile(const std::string& filename) |
3759 | { |
3760 | std::ifstream file (filename.c_str()); |
3761 | if(!file){ |
3762 | |
3763 | === modified file 'src/Core/TAPNParser/util.hpp' |
3764 | --- src/Core/TAPNParser/util.hpp 2012-03-02 10:59:16 +0000 |
3765 | +++ src/Core/TAPNParser/util.hpp 2013-05-15 15:27:27 +0000 |
3766 | @@ -6,10 +6,10 @@ |
3767 | |
3768 | namespace VerifyTAPN |
3769 | { |
3770 | - const std::string ReadFile(const std::string& filename); |
3771 | + const std::string readFile(const std::string& filename); |
3772 | |
3773 | template<class T> |
3774 | - const std::string ToString(T t) |
3775 | + const std::string toString(T t) |
3776 | { |
3777 | std::stringstream s; |
3778 | s << t; |
3779 | |
3780 | === modified file 'src/Core/VerificationOptions.cpp' |
3781 | --- src/Core/VerificationOptions.cpp 2013-02-16 19:21:05 +0000 |
3782 | +++ src/Core/VerificationOptions.cpp 2013-05-15 15:27:27 +0000 |
3783 | @@ -2,61 +2,60 @@ |
3784 | #include <iostream> |
3785 | |
3786 | namespace VerifyTAPN { |
3787 | - std::string enumToString(Trace trace){ |
3788 | - switch(trace) |
3789 | - { |
3790 | - case SOME: |
3791 | - return "some"; |
3792 | - default: |
3793 | - return "no"; |
3794 | - } |
3795 | - } |
3796 | - |
3797 | - std::string SearchTypeEnumToString(SearchType s){ |
3798 | - switch(s){ |
3799 | - case COVERMOST: |
3800 | - return "Heuristic Search"; |
3801 | - case RANDOM: |
3802 | - return "Random Search"; |
3803 | - case DEPTHFIRST: |
3804 | - return "Depth-First Search"; |
3805 | - default: |
3806 | - return "Breadth-First Search"; |
3807 | - } |
3808 | - } |
3809 | - |
3810 | - std::string VerificationTypeEnumToString(VerificationType s){ |
3811 | - switch(s){ |
3812 | - case TIMEDART: |
3813 | - return "Time darts"; |
3814 | - default: |
3815 | - return "Default (discrete)"; |
3816 | - } |
3817 | - } |
3818 | - |
3819 | - std::string MemoryOptimizationEnumToString(MemoryOptimization m){ |
3820 | - switch(m){ |
3821 | - case NONE: |
3822 | - return "None"; |
3823 | - case PTRIE: |
3824 | - return "PTrie "; |
3825 | - default: |
3826 | - return "None"; |
3827 | - } |
3828 | - } |
3829 | - |
3830 | - std::ostream& operator<<(std::ostream& out, const VerificationOptions& options) |
3831 | - { |
3832 | - out << "Search type: " << SearchTypeEnumToString(options.GetSearchType()) << std::endl; |
3833 | - out << "Verification method: " << VerificationTypeEnumToString(options.GetVerificationType()) << std::endl; |
3834 | - out << "Memory optimization: " << MemoryOptimizationEnumToString(options.GetMemoryOptimization()) << std::endl; |
3835 | - out << "k-bound is: " << options.GetKBound() << std::endl; |
3836 | - out << "Generating " << enumToString(options.GetTrace()) << " trace"; |
3837 | - if(options.GetTrace() != NONE) out << " in " << (options.XmlTrace() ? "xml format" : "human readable format"); |
3838 | - out << std::endl; |
3839 | - out << "Using " << (options.GetGlobalMaxConstantsEnabled() ? "global maximum constant" : "local maximum constants") << " for extrapolation" << std::endl; |
3840 | - out << "Model file is: " << options.GetInputFile() << std::endl; |
3841 | - out << "Query file is: " << options.QueryFile() << std::endl; |
3842 | - return out; |
3843 | - } |
3844 | + |
3845 | + std::string enumToString(VerificationOptions::Trace trace) { |
3846 | + switch (trace) { |
3847 | + case VerificationOptions::SOME_TRACE: |
3848 | + return "some"; |
3849 | + default: |
3850 | + return "no"; |
3851 | + } |
3852 | + } |
3853 | + |
3854 | + std::string SearchTypeEnumToString(VerificationOptions::SearchType s) { |
3855 | + switch (s) { |
3856 | + case VerificationOptions::COVERMOST: |
3857 | + return "Heuristic Search"; |
3858 | + case VerificationOptions::RANDOM: |
3859 | + return "Random Search"; |
3860 | + case VerificationOptions::DEPTHFIRST: |
3861 | + return "Depth-First Search"; |
3862 | + default: |
3863 | + return "Breadth-First Search"; |
3864 | + } |
3865 | + } |
3866 | + |
3867 | + std::string VerificationTypeEnumToString(VerificationOptions::VerificationType s) { |
3868 | + switch (s) { |
3869 | + case VerificationOptions::TIMEDART: |
3870 | + return "Time darts"; |
3871 | + default: |
3872 | + return "Default (discrete)"; |
3873 | + } |
3874 | + } |
3875 | + |
3876 | + std::string MemoryOptimizationEnumToString(VerificationOptions::MemoryOptimization m) { |
3877 | + switch (m) { |
3878 | + case VerificationOptions::NO_TRACE: |
3879 | + return "None"; |
3880 | + case VerificationOptions::PTRIE: |
3881 | + return "PTrie "; |
3882 | + default: |
3883 | + return "None"; |
3884 | + } |
3885 | + } |
3886 | + |
3887 | + std::ostream& operator<<(std::ostream& out, const VerificationOptions& options) { |
3888 | + out << "Search type: " << SearchTypeEnumToString(options.getSearchType()) << std::endl; |
3889 | + out << "Verification method: " << VerificationTypeEnumToString(options.getVerificationType()) << std::endl; |
3890 | + out << "Memory optimization: " << MemoryOptimizationEnumToString(options.getMemoryOptimization()) << std::endl; |
3891 | + out << "k-bound is: " << options.getKBound() << std::endl; |
3892 | + out << "Generating " << enumToString(options.getTrace()) << " trace"; |
3893 | + if (options.getTrace() != VerificationOptions::NO_TRACE) out << " in " << (options.getXmlTrace() ? "xml format" : "human readable format"); |
3894 | + out << std::endl; |
3895 | + out << "Using " << (options.getGlobalMaxConstantsEnabled() ? "global maximum constant" : "local maximum constants") << " for extrapolation" << std::endl; |
3896 | + out << "Model file is: " << options.getInputFile() << std::endl; |
3897 | + out << "Query file is: " << options.getQueryFile() << std::endl; |
3898 | + return out; |
3899 | + } |
3900 | } |
3901 | |
3902 | === modified file 'src/Core/VerificationOptions.hpp' |
3903 | --- src/Core/VerificationOptions.hpp 2013-02-16 19:21:05 +0000 |
3904 | +++ src/Core/VerificationOptions.hpp 2013-05-15 15:27:27 +0000 |
3905 | @@ -6,64 +6,108 @@ |
3906 | #include <vector> |
3907 | |
3908 | namespace VerifyTAPN { |
3909 | - enum Trace { NONE, SOME }; |
3910 | - enum SearchType { BREADTHFIRST, DEPTHFIRST, RANDOM, COVERMOST }; |
3911 | - enum VerificationType { DISCRETE, TIMEDART }; |
3912 | - enum MemoryOptimization { NO_MEMORY_OPTIMIZATION, PTRIE }; |
3913 | - |
3914 | - class VerificationOptions { |
3915 | - public: |
3916 | - VerificationOptions(){} |
3917 | - VerificationOptions( |
3918 | - const std::string& inputFile, |
3919 | - const std::string& queryFile, |
3920 | - SearchType searchType, |
3921 | - VerificationType verificationType, |
3922 | - MemoryOptimization memOptimization, |
3923 | - unsigned int k_bound, |
3924 | - Trace trace, |
3925 | - bool xml_trace, |
3926 | - bool useGlobalMaxConstants, |
3927 | - bool keepDeadTokens |
3928 | - ) : inputFile(inputFile), |
3929 | - queryFile(queryFile), |
3930 | - searchType(searchType), |
3931 | - verificationType(verificationType), |
3932 | - memOptimization(memOptimization), |
3933 | - k_bound(k_bound), |
3934 | - trace(trace), |
3935 | - xml_trace(xml_trace), |
3936 | - useGlobalMaxConstants(useGlobalMaxConstants), |
3937 | - keepDeadTokens(keepDeadTokens) |
3938 | - { |
3939 | - |
3940 | - }; |
3941 | - |
3942 | - public: // inspectors |
3943 | - const std::string GetInputFile() const { return inputFile; } |
3944 | - const std::string QueryFile() const {return queryFile; } |
3945 | - inline const unsigned int GetKBound() const { return k_bound; } |
3946 | - inline const Trace GetTrace() const { return trace; }; |
3947 | - inline const bool XmlTrace() const { return xml_trace; }; |
3948 | - inline const bool GetGlobalMaxConstantsEnabled() const { return useGlobalMaxConstants; } |
3949 | - inline const SearchType GetSearchType() const { return searchType; } |
3950 | - inline const VerificationType GetVerificationType() const { return verificationType; } |
3951 | - inline const MemoryOptimization GetMemoryOptimization() const { return memOptimization; } |
3952 | - inline const bool GetKeepDeadTokens() const { return keepDeadTokens; }; |
3953 | - private: |
3954 | - std::string inputFile; |
3955 | - std::string queryFile; |
3956 | - SearchType searchType; |
3957 | - VerificationType verificationType; |
3958 | - MemoryOptimization memOptimization; |
3959 | - unsigned int k_bound; |
3960 | - Trace trace; |
3961 | - bool xml_trace; |
3962 | - bool useGlobalMaxConstants; |
3963 | - bool keepDeadTokens; |
3964 | - }; |
3965 | - |
3966 | - std::ostream& operator<<(std::ostream& out, const VerificationOptions& options); |
3967 | + |
3968 | + class VerificationOptions { |
3969 | + public: |
3970 | + |
3971 | + enum Trace { |
3972 | + NO_TRACE, SOME_TRACE |
3973 | + }; |
3974 | + |
3975 | + enum SearchType { |
3976 | + BREADTHFIRST, DEPTHFIRST, RANDOM, COVERMOST |
3977 | + }; |
3978 | + |
3979 | + enum VerificationType { |
3980 | + DISCRETE, TIMEDART |
3981 | + }; |
3982 | + |
3983 | + enum MemoryOptimization { |
3984 | + NO_MEMORY_OPTIMIZATION, PTRIE |
3985 | + }; |
3986 | + |
3987 | + VerificationOptions() { |
3988 | + } |
3989 | + |
3990 | + VerificationOptions( |
3991 | + const std::string& inputFile, |
3992 | + const std::string& queryFile, |
3993 | + SearchType searchType, |
3994 | + VerificationType verificationType, |
3995 | + MemoryOptimization memOptimization, |
3996 | + unsigned int k_bound, |
3997 | + Trace trace, |
3998 | + bool xml_trace, |
3999 | + bool useGlobalMaxConstants, |
4000 | + bool keepDeadTokens |
4001 | + ) : inputFile(inputFile), |
4002 | + queryFile(queryFile), |
4003 | + searchType(searchType), |
4004 | + verificationType(verificationType), |
4005 | + memOptimization(memOptimization), |
4006 | + k_bound(k_bound), |
4007 | + trace(trace), |
4008 | + xml_trace(xml_trace), |
4009 | + useGlobalMaxConstants(useGlobalMaxConstants), |
4010 | + keepDeadTokens(keepDeadTokens) { |
4011 | + |
4012 | + }; |
4013 | + |
4014 | + public: // inspectors |
4015 | + |
4016 | + const std::string getInputFile() const { |
4017 | + return inputFile; |
4018 | + } |
4019 | + |
4020 | + const std::string getQueryFile() const { |
4021 | + return queryFile; |
4022 | + } |
4023 | + |
4024 | + inline const unsigned int getKBound() const { |
4025 | + return k_bound; |
4026 | + } |
4027 | + |
4028 | + inline const Trace getTrace() const { |
4029 | + return trace; |
4030 | + }; |
4031 | + |
4032 | + inline const bool getXmlTrace() const { |
4033 | + return xml_trace; |
4034 | + }; |
4035 | + |
4036 | + inline const bool getGlobalMaxConstantsEnabled() const { |
4037 | + return useGlobalMaxConstants; |
4038 | + } |
4039 | + |
4040 | + inline const SearchType getSearchType() const { |
4041 | + return searchType; |
4042 | + } |
4043 | + |
4044 | + inline const VerificationType getVerificationType() const { |
4045 | + return verificationType; |
4046 | + } |
4047 | + |
4048 | + inline const MemoryOptimization getMemoryOptimization() const { |
4049 | + return memOptimization; |
4050 | + } |
4051 | + |
4052 | + inline const bool getKeepDeadTokens() const { |
4053 | + return keepDeadTokens; |
4054 | + }; |
4055 | + private: |
4056 | + std::string inputFile; |
4057 | + std::string queryFile; |
4058 | + SearchType searchType; |
4059 | + VerificationType verificationType; |
4060 | + MemoryOptimization memOptimization; |
4061 | + unsigned int k_bound; |
4062 | + Trace trace; |
4063 | + bool xml_trace; |
4064 | + bool useGlobalMaxConstants; |
4065 | + bool keepDeadTokens; |
4066 | + }; |
4067 | + |
4068 | + std::ostream& operator<<(std::ostream& out, const VerificationOptions& options); |
4069 | } |
4070 | |
4071 | #endif /* VERIFICATIONOPTIONS_HPP_ */ |
4072 | |
4073 | === modified file 'src/DiscreteVerification/DataStructures/EncodingStructure.h' |
4074 | --- src/DiscreteVerification/DataStructures/EncodingStructure.h 2012-12-09 14:16:04 +0000 |
4075 | +++ src/DiscreteVerification/DataStructures/EncodingStructure.h 2013-05-15 15:27:27 +0000 |
4076 | @@ -1,6 +1,6 @@ |
4077 | /* |
4078 | * File: Encoding.h |
4079 | - * Author: Peter Gjøl Jense |
4080 | + * Author: Peter Gjøl Jensen |
4081 | * |
4082 | * Created on 27. oktober 2012, 12:36 |
4083 | */ |
4084 | @@ -28,54 +28,73 @@ |
4085 | EncodingStructure(const EncodingStructure &other, uint size, uint offset, uint encsize); |
4086 | EncodingStructure(char* raw, uint size, uint offset, uint encsize); |
4087 | EncodingStructure(char* raw, uint size){ |
4088 | - shadow = raw; |
4089 | - rsize = size; |
4090 | + binaryBlob = raw; |
4091 | + numberOfBytes = size; |
4092 | }; |
4093 | virtual ~EncodingStructure(); |
4094 | |
4095 | - EncodingStructure Clone() { |
4096 | + EncodingStructure clone() { |
4097 | EncodingStructure s; |
4098 | - s.rsize = rsize; |
4099 | - s.shadow = new char[rsize + sizeof (T)]; |
4100 | - memcpy(s.shadow, shadow, rsize + sizeof (T)); |
4101 | + s.numberOfBytes = numberOfBytes; |
4102 | + s.binaryBlob = new char[numberOfBytes + sizeof (T)]; |
4103 | + memcpy(s.binaryBlob, binaryBlob, numberOfBytes + sizeof (T)); |
4104 | return s; |
4105 | } |
4106 | |
4107 | - void Copy(const EncodingStructure &other, unsigned int offset) { |
4108 | - memcpy(&(shadow[offset / 8]), other.shadow, other.rsize); |
4109 | + inline void copy(const EncodingStructure &other, unsigned int offset) { |
4110 | + memcpy(&(binaryBlob[offset / 8]), other.binaryBlob, other.numberOfBytes); |
4111 | } |
4112 | |
4113 | - void Copy(const char* raw, unsigned int size){ |
4114 | - shadow = new char[size + sizeof(T)]; |
4115 | - memcpy(shadow, raw, size); |
4116 | - } |
4117 | - |
4118 | - bool At(const uint place) const; |
4119 | - void Set(const uint place, const bool value) const; |
4120 | - |
4121 | - void Zero() const { |
4122 | - memset(shadow, 0x0, rsize); |
4123 | - } |
4124 | - |
4125 | - unsigned short int Size() const { |
4126 | - return rsize; |
4127 | - } |
4128 | - |
4129 | - void Release() const { |
4130 | - delete[] shadow; |
4131 | - } |
4132 | - |
4133 | - char* GetRaw() const { |
4134 | - return shadow; |
4135 | - } |
4136 | - |
4137 | - void PrintEncoding() const { |
4138 | - for (unsigned short int i = 0; i < rsize * 8; i++) |
4139 | - cout << this->At(i); |
4140 | + inline void copy(const char* raw, unsigned int size){ |
4141 | + binaryBlob = new char[size + sizeof(T)]; |
4142 | + memcpy(binaryBlob, raw, size); |
4143 | + } |
4144 | + |
4145 | + inline bool at(const uint place) const { |
4146 | + uint offset = place % 8; |
4147 | + bool res2; |
4148 | + if (place / 8 < numberOfBytes) |
4149 | + res2 = (binaryBlob[place / 8] & masks[offset]) != 0; |
4150 | + else |
4151 | + res2 = false; |
4152 | + |
4153 | + return res2; |
4154 | + } |
4155 | + |
4156 | + inline void set(const uint place, const bool value) const { |
4157 | + uint offset = place % 8; |
4158 | + uint theplace = place / 8; |
4159 | + if (value) { |
4160 | + binaryBlob[theplace] |= masks[offset]; |
4161 | + } else { |
4162 | + binaryBlob[theplace] &= ~masks[offset]; |
4163 | + } |
4164 | + |
4165 | + } |
4166 | + |
4167 | + inline void zero() const { |
4168 | + memset(binaryBlob, 0x0, numberOfBytes); |
4169 | + } |
4170 | + |
4171 | + inline unsigned short int Size() const { |
4172 | + return numberOfBytes; |
4173 | + } |
4174 | + |
4175 | + inline void release() const { |
4176 | + delete[] binaryBlob; |
4177 | + } |
4178 | + |
4179 | + inline char* getRaw() const { |
4180 | + return binaryBlob; |
4181 | + } |
4182 | + |
4183 | + void printEncoding() const { |
4184 | + for (unsigned short int i = 0; i < numberOfBytes * 8; i++) |
4185 | + cout << this->at(i); |
4186 | cout << endl; |
4187 | } |
4188 | |
4189 | - inline static uint Overhead(uint size) { |
4190 | + inline static uint overhead(uint size) { |
4191 | size = size % 8; |
4192 | if (size == 0) |
4193 | return 0; |
4194 | @@ -83,47 +102,47 @@ |
4195 | return 8 - size; |
4196 | } |
4197 | |
4198 | - inline void SetMetaData(T data) const { |
4199 | - memcpy(&(shadow[rsize]), &data, sizeof (T)); |
4200 | + inline void setMetaData(T data) const { |
4201 | + memcpy(&(binaryBlob[numberOfBytes]), &data, sizeof (T)); |
4202 | } |
4203 | |
4204 | - inline T GetMetaData() const { |
4205 | + inline T getMetaData() const { |
4206 | T res; |
4207 | - memcpy(&res, &(shadow[rsize]), sizeof (T)); |
4208 | + memcpy(&res, &(binaryBlob[numberOfBytes]), sizeof (T)); |
4209 | return res; |
4210 | } |
4211 | |
4212 | - const char operator[](int i) { |
4213 | + inline const char operator[](int i) { |
4214 | |
4215 | - if (i >= rsize) { |
4216 | + if (i >= numberOfBytes) { |
4217 | return 0x0; |
4218 | } |
4219 | - return shadow[i]; |
4220 | + return binaryBlob[i]; |
4221 | } |
4222 | |
4223 | - friend bool operator==(const EncodingStructure &enc1, const EncodingStructure &enc2) { |
4224 | - if(enc1.rsize != enc2.rsize) |
4225 | + inline friend bool operator==(const EncodingStructure &enc1, const EncodingStructure &enc2) { |
4226 | + if(enc1.numberOfBytes != enc2.numberOfBytes) |
4227 | return false; |
4228 | - for(int i = 0; i < enc1.rsize; i++) |
4229 | - if(enc1.shadow[i] != enc2.shadow[i]) |
4230 | + for(int i = 0; i < enc1.numberOfBytes; i++) |
4231 | + if(enc1.binaryBlob[i] != enc2.binaryBlob[i]) |
4232 | return false; |
4233 | return true; |
4234 | } |
4235 | |
4236 | |
4237 | - friend bool operator<(const EncodingStructure &enc1, const EncodingStructure &enc2) { |
4238 | - int count = enc1.rsize > enc2.rsize ? enc1.rsize : enc2.rsize; |
4239 | + inline friend bool operator<(const EncodingStructure &enc1, const EncodingStructure &enc2) { |
4240 | + int count = enc1.numberOfBytes > enc2.numberOfBytes ? enc1.numberOfBytes : enc2.numberOfBytes; |
4241 | |
4242 | for (int i = 0; i < count; i++) { |
4243 | - if (enc1.rsize > i && enc2.rsize > i && enc1.shadow[i] != enc2.shadow[i]) { |
4244 | - return ((unsigned short int) enc1.shadow[i]) < ((unsigned short int) enc2.shadow[i]); |
4245 | + if (enc1.numberOfBytes > i && enc2.numberOfBytes > i && enc1.binaryBlob[i] != enc2.binaryBlob[i]) { |
4246 | + return ((unsigned short int) enc1.binaryBlob[i]) < ((unsigned short int) enc2.binaryBlob[i]); |
4247 | } |
4248 | |
4249 | } |
4250 | - if (enc1.rsize > enc2.rsize) { |
4251 | + if (enc1.numberOfBytes > enc2.numberOfBytes) { |
4252 | return false; |
4253 | |
4254 | - } else if (enc1.rsize < enc2.rsize) { |
4255 | + } else if (enc1.numberOfBytes < enc2.numberOfBytes) { |
4256 | return true; |
4257 | } |
4258 | |
4259 | @@ -131,44 +150,44 @@ |
4260 | } |
4261 | |
4262 | private: |
4263 | - char* shadow; |
4264 | - unsigned short rsize; |
4265 | + char* binaryBlob; |
4266 | + unsigned short numberOfBytes; |
4267 | const static char masks[8]; |
4268 | }; |
4269 | |
4270 | template<class T> |
4271 | const char EncodingStructure<T>::masks[8] = { |
4272 | - 0x01, |
4273 | - 0x02, |
4274 | - 0x04, |
4275 | - 0x08, |
4276 | - 0x10, |
4277 | - 0x20, |
4278 | - 0x40, |
4279 | - 0x80 |
4280 | + static_cast <char>(0x01), |
4281 | + static_cast <char>(0x02), |
4282 | + static_cast <char>(0x04), |
4283 | + static_cast <char>(0x08), |
4284 | + static_cast <char>(0x10), |
4285 | + static_cast <char>(0x20), |
4286 | + static_cast <char>(0x40), |
4287 | + static_cast <char>(0x80) |
4288 | }; |
4289 | |
4290 | template<class T> |
4291 | EncodingStructure<T>::EncodingStructure(uint size) { |
4292 | - rsize = (size + Overhead(size)) / 8; |
4293 | - shadow = new char[rsize + sizeof (T)]; |
4294 | - memset(shadow, 0x0, rsize + sizeof (T)); |
4295 | + numberOfBytes = (size + overhead(size)) / 8; |
4296 | + binaryBlob = new char[numberOfBytes + sizeof (T)]; |
4297 | + memset(binaryBlob, 0x0, numberOfBytes + sizeof (T)); |
4298 | } |
4299 | |
4300 | template<class T> |
4301 | EncodingStructure<T>::EncodingStructure(const EncodingStructure &other, uint offset) { |
4302 | offset = offset / 8; |
4303 | |
4304 | - rsize = other.rsize; |
4305 | - if (rsize > offset) |
4306 | - rsize -= offset; |
4307 | + numberOfBytes = other.numberOfBytes; |
4308 | + if (numberOfBytes > offset) |
4309 | + numberOfBytes -= offset; |
4310 | else { |
4311 | - rsize = 0; |
4312 | + numberOfBytes = 0; |
4313 | } |
4314 | |
4315 | - shadow = new char[rsize + sizeof (T)]; |
4316 | - memcpy(shadow, &(other.shadow[offset]), rsize); |
4317 | - SetMetaData(other.GetMetaData()); |
4318 | + binaryBlob = new char[numberOfBytes + sizeof (T)]; |
4319 | + memcpy(binaryBlob, &(other.binaryBlob[offset]), numberOfBytes); |
4320 | + setMetaData(other.getMetaData()); |
4321 | } |
4322 | |
4323 | template<class T> |
4324 | @@ -177,16 +196,16 @@ |
4325 | uint so = size + offset; |
4326 | offset = ((so - 1) / 8) - ((size - 1) / 8); |
4327 | |
4328 | - rsize = ((encsize + this->Overhead(encsize)) / 8); |
4329 | - if (rsize > offset) |
4330 | - rsize -= offset; |
4331 | + numberOfBytes = ((encsize + this->overhead(encsize)) / 8); |
4332 | + if (numberOfBytes > offset) |
4333 | + numberOfBytes -= offset; |
4334 | else { |
4335 | - rsize = 0; |
4336 | + numberOfBytes = 0; |
4337 | } |
4338 | |
4339 | - shadow = new char[rsize + sizeof (T)]; |
4340 | - memcpy(shadow, &(other.shadow[offset]), rsize); |
4341 | - SetMetaData(other.GetMetaData()); |
4342 | + binaryBlob = new char[numberOfBytes + sizeof (T)]; |
4343 | + memcpy(binaryBlob, &(other.binaryBlob[offset]), numberOfBytes); |
4344 | + setMetaData(other.getMetaData()); |
4345 | } |
4346 | |
4347 | template<class T> |
4348 | @@ -195,14 +214,14 @@ |
4349 | uint so = size + offset; |
4350 | offset = ((so - 1) / 8) - ((size - 1) / 8); |
4351 | |
4352 | - rsize = ((encsize + this->Overhead(encsize)) / 8); |
4353 | - if (rsize > offset) |
4354 | - rsize -= offset; |
4355 | + numberOfBytes = ((encsize + this->overhead(encsize)) / 8); |
4356 | + if (numberOfBytes > offset) |
4357 | + numberOfBytes -= offset; |
4358 | else { |
4359 | - rsize = 0; |
4360 | + numberOfBytes = 0; |
4361 | } |
4362 | |
4363 | - shadow = &(raw[offset]); |
4364 | + binaryBlob = &(raw[offset]); |
4365 | } |
4366 | |
4367 | template<class T> |
4368 | @@ -210,30 +229,7 @@ |
4369 | |
4370 | } |
4371 | |
4372 | - template<class T> |
4373 | - bool EncodingStructure<T>::At(const uint place) const { |
4374 | - // return data[place]; |
4375 | - uint offset = place % 8; |
4376 | - bool res2; |
4377 | - if (place / 8 < rsize) |
4378 | - res2 = (shadow[place / 8] & masks[offset]) != 0; |
4379 | - else |
4380 | - res2 = false; |
4381 | - |
4382 | - return res2; |
4383 | - } |
4384 | - |
4385 | - template<class T> |
4386 | - void EncodingStructure<T>::Set(const uint place, const bool value) const { |
4387 | - uint offset = place % 8; |
4388 | - uint theplace = place / 8; |
4389 | - if (value) { |
4390 | - shadow[theplace] |= masks[offset]; |
4391 | - } else { |
4392 | - shadow[theplace] &= ~masks[offset]; |
4393 | - } |
4394 | - |
4395 | - } |
4396 | + |
4397 | |
4398 | } |
4399 | } |
4400 | |
4401 | === modified file 'src/DiscreteVerification/DataStructures/NonStrictMarking.hpp' |
4402 | --- src/DiscreteVerification/DataStructures/NonStrictMarking.hpp 2013-02-26 10:02:19 +0000 |
4403 | +++ src/DiscreteVerification/DataStructures/NonStrictMarking.hpp 2013-05-15 15:27:27 +0000 |
4404 | @@ -33,7 +33,7 @@ |
4405 | |
4406 | // ugly forward declaration |
4407 | template<class MetaData> |
4408 | - class EncodingPointer; |
4409 | + struct EncodingPointer; |
4410 | |
4411 | struct MetaDataWithTraceAndEncoding : public MetaDataWithTrace { |
4412 | EncodingPointer<MetaData>* ep; |
4413 | |
4414 | === modified file 'src/DiscreteVerification/DataStructures/NonStrictMarkingBase.cpp' |
4415 | --- src/DiscreteVerification/DataStructures/NonStrictMarkingBase.cpp 2013-04-08 15:26:40 +0000 |
4416 | +++ src/DiscreteVerification/DataStructures/NonStrictMarkingBase.cpp 2013-05-15 15:27:27 +0000 |
4417 | @@ -12,9 +12,10 @@ |
4418 | namespace VerifyTAPN { |
4419 | namespace DiscreteVerification { |
4420 | |
4421 | +TokenList NonStrictMarkingBase::emptyTokenList = TokenList(); |
4422 | + |
4423 | NonStrictMarkingBase::NonStrictMarkingBase() : children(0), generatedBy(NULL){ |
4424 | - // TODO Auto-generated constructor stub |
4425 | - |
4426 | + // empty constructor |
4427 | } |
4428 | |
4429 | NonStrictMarkingBase::NonStrictMarkingBase(const TAPN::TimedArcPetriNet& tapn, const std::vector<int>& v) :children(0), generatedBy(NULL){ |
4430 | @@ -30,7 +31,7 @@ |
4431 | } |
4432 | }else{ |
4433 | |
4434 | - Place p(&tapn.GetPlace(*iter)); |
4435 | + Place p(&tapn.getPlace(*iter)); |
4436 | Token t(0,1); |
4437 | p.tokens.push_back(t); |
4438 | places.push_back(p); |
4439 | @@ -40,12 +41,8 @@ |
4440 | } |
4441 | |
4442 | NonStrictMarkingBase::NonStrictMarkingBase(const NonStrictMarkingBase& nsm) : children(0), generatedBy(NULL){ |
4443 | - //for(PlaceList::const_iterator it = nsm.places.begin(); it != nsm.places.end(); it++){ |
4444 | - // places.push_back(Place(*it)); |
4445 | - //} |
4446 | |
4447 | places = nsm.places; |
4448 | - |
4449 | parent = nsm.parent; |
4450 | generatedBy = nsm.generatedBy; |
4451 | } |
4452 | @@ -60,18 +57,10 @@ |
4453 | return count; |
4454 | } |
4455 | |
4456 | -//int NonStrictMarkingBase::NumberOfTokensInPlace(const Place& place) const{ |
4457 | -// int count = 0; |
4458 | -// for(TokenList::const_iterator it = place.tokens.begin(); it != place.tokens.end(); it++){ |
4459 | -// count = count + it->getCount(); |
4460 | -// } |
4461 | -// return count; |
4462 | -//} |
4463 | - |
4464 | -int NonStrictMarkingBase::NumberOfTokensInPlace(int placeId) const{ |
4465 | +int NonStrictMarkingBase::numberOfTokensInPlace(int placeId) const{ |
4466 | int count = 0; |
4467 | for(PlaceList::const_iterator iter = places.begin(); iter != places.end(); iter++){ |
4468 | - if(iter->place->GetIndex() == placeId){ |
4469 | + if(iter->place->getIndex() == placeId){ |
4470 | for(TokenList::const_iterator it = iter->tokens.begin(); it != iter->tokens.end(); it++){ |
4471 | count = count + it->getCount(); |
4472 | } |
4473 | @@ -80,19 +69,19 @@ |
4474 | return count; |
4475 | } |
4476 | |
4477 | -const TokenList& NonStrictMarkingBase::GetTokenList(int placeId) const{ |
4478 | +const TokenList& NonStrictMarkingBase::getTokenList(int placeId) const{ |
4479 | for(PlaceList::const_iterator iter = places.begin(); iter != places.end(); iter++){ |
4480 | - if(iter->place->GetIndex() == placeId) return iter->tokens; |
4481 | + if(iter->place->getIndex() == placeId) return iter->tokens; |
4482 | } |
4483 | return emptyTokenList; |
4484 | } |
4485 | |
4486 | -bool NonStrictMarkingBase::RemoveToken(int placeId, int age){ |
4487 | +bool NonStrictMarkingBase::removeToken(int placeId, int age){ |
4488 | for(PlaceList::iterator pit = places.begin(); pit != places.end(); pit++){ |
4489 | - if(pit->place->GetIndex() == placeId){ |
4490 | + if(pit->place->getIndex() == placeId){ |
4491 | for(TokenList::iterator tit = pit->tokens.begin(); tit != pit->tokens.end(); tit++){ |
4492 | if(tit->getAge() == age){ |
4493 | - return RemoveToken(*pit, *tit); |
4494 | + return removeToken(*pit, *tit); |
4495 | } |
4496 | } |
4497 | } |
4498 | @@ -100,11 +89,11 @@ |
4499 | return false; |
4500 | } |
4501 | |
4502 | -void NonStrictMarkingBase::RemoveRangeOfTokens(Place& place, TokenList::iterator begin, TokenList::iterator end){ |
4503 | +void NonStrictMarkingBase::removeRangeOfTokens(Place& place, TokenList::iterator begin, TokenList::iterator end){ |
4504 | place.tokens.erase(begin, end); |
4505 | } |
4506 | |
4507 | -bool NonStrictMarkingBase::RemoveToken(Place& place, Token& token){ |
4508 | +bool NonStrictMarkingBase::removeToken(Place& place, Token& token){ |
4509 | if(token.getCount() > 1){ |
4510 | token.remove(1); |
4511 | return true; |
4512 | @@ -114,7 +103,7 @@ |
4513 | place.tokens.erase(iter); |
4514 | if(place.tokens.empty()){ |
4515 | for(PlaceList::iterator it = places.begin(); it != places.end(); it++){ |
4516 | - if(it->place->GetIndex() == place.place->GetIndex()){ |
4517 | + if(it->place->getIndex() == place.place->getIndex()){ |
4518 | places.erase(it); |
4519 | return true; |
4520 | } |
4521 | @@ -127,29 +116,29 @@ |
4522 | return false; |
4523 | } |
4524 | |
4525 | -void NonStrictMarkingBase::AddTokenInPlace(TAPN::TimedPlace& place, int age){ |
4526 | +void NonStrictMarkingBase::addTokenInPlace(TAPN::TimedPlace& place, int age){ |
4527 | for(PlaceList::iterator pit = places.begin(); pit != places.end(); pit++){ |
4528 | - if(pit->place->GetIndex() == place.GetIndex()){ |
4529 | + if(pit->place->getIndex() == place.getIndex()){ |
4530 | for(TokenList::iterator tit = pit->tokens.begin(); tit != pit->tokens.end(); tit++){ |
4531 | if(tit->getAge() == age){ |
4532 | Token t(age, 1); |
4533 | - AddTokenInPlace(*pit, t); |
4534 | + addTokenInPlace(*pit, t); |
4535 | return; |
4536 | } |
4537 | } |
4538 | Token t(age,1); |
4539 | - AddTokenInPlace(*pit, t); |
4540 | + addTokenInPlace(*pit, t); |
4541 | return; |
4542 | } |
4543 | } |
4544 | Token t(age,1); |
4545 | Place p(&place); |
4546 | - AddTokenInPlace(p,t); |
4547 | + addTokenInPlace(p,t); |
4548 | |
4549 | // Insert place |
4550 | bool inserted = false; |
4551 | for(PlaceList::iterator it = places.begin(); it != places.end(); it++){ |
4552 | - if(it->place->GetIndex() > place.GetIndex()){ |
4553 | + if(it->place->getIndex() > place.getIndex()){ |
4554 | places.insert(it, p); |
4555 | inserted = true; |
4556 | break; |
4557 | @@ -160,21 +149,21 @@ |
4558 | } |
4559 | } |
4560 | |
4561 | -void NonStrictMarkingBase::AddTokenInPlace(const TAPN::TimedPlace& place, Token& token){ |
4562 | +void NonStrictMarkingBase::addTokenInPlace(const TAPN::TimedPlace& place, Token& token){ |
4563 | for(PlaceList::iterator pit = places.begin(); pit != places.end(); pit++){ |
4564 | - if(pit->place->GetIndex() == place.GetIndex()){ |
4565 | - AddTokenInPlace(*pit, token); |
4566 | + if(pit->place->getIndex() == place.getIndex()){ |
4567 | + addTokenInPlace(*pit, token); |
4568 | return; |
4569 | } |
4570 | } |
4571 | |
4572 | Place p(&place); |
4573 | - AddTokenInPlace(p,token); |
4574 | + addTokenInPlace(p,token); |
4575 | |
4576 | // Insert place |
4577 | bool inserted = false; |
4578 | for(PlaceList::iterator it = places.begin(); it != places.end(); it++){ |
4579 | - if(it->place->GetIndex() > place.GetIndex()){ |
4580 | + if(it->place->getIndex() > place.getIndex()){ |
4581 | places.insert(it, p); |
4582 | inserted = true; |
4583 | break; |
4584 | @@ -185,7 +174,7 @@ |
4585 | } |
4586 | } |
4587 | |
4588 | -void NonStrictMarkingBase::AddTokenInPlace(Place& place, Token& token){ |
4589 | +void NonStrictMarkingBase::addTokenInPlace(Place& place, Token& token){ |
4590 | if(token.getCount() == 0) return; |
4591 | for(TokenList::iterator iter = place.tokens.begin(); iter != place.tokens.end(); iter++){ |
4592 | if(iter->getAge() == token.getAge()){ |
4593 | @@ -207,24 +196,6 @@ |
4594 | } |
4595 | } |
4596 | |
4597 | -void NonStrictMarkingBase::incrementAge(){ |
4598 | - for(PlaceList::iterator iter = places.begin(); iter != places.end(); iter++){ |
4599 | - iter->incrementAge(); |
4600 | - } |
4601 | -} |
4602 | - |
4603 | -void NonStrictMarkingBase::incrementAge(int age){ |
4604 | - for(PlaceList::iterator iter = places.begin(); iter != places.end(); iter++){ |
4605 | - iter->incrementAge(age); |
4606 | - } |
4607 | -} |
4608 | - |
4609 | -void NonStrictMarkingBase::decrementAge(){ |
4610 | - for(PlaceList::iterator iter = places.begin(); iter != places.end(); iter++){ |
4611 | - iter->decrementAge(); |
4612 | - } |
4613 | -} |
4614 | - |
4615 | NonStrictMarkingBase::~NonStrictMarkingBase() { } |
4616 | |
4617 | bool NonStrictMarkingBase::equals(const NonStrictMarkingBase &m1) const{ |
4618 | @@ -232,7 +203,7 @@ |
4619 | |
4620 | PlaceList::const_iterator p_iter = m1.places.begin(); |
4621 | for(PlaceList::const_iterator iter = places.begin(); iter != places.end(); iter++, p_iter++){ |
4622 | - if(iter->place->GetIndex() != p_iter->place->GetIndex()) return false; |
4623 | + if(iter->place->getIndex() != p_iter->place->getIndex()) return false; |
4624 | if(iter->tokens.size() != p_iter->tokens.size()) return false; |
4625 | TokenList::const_iterator pt_iter = p_iter->tokens.begin(); |
4626 | for(TokenList::const_iterator t_iter = iter->tokens.begin(); t_iter != iter->tokens.end(); t_iter++, pt_iter++){ |
4627 | @@ -246,7 +217,7 @@ |
4628 | std::ostream& operator<<(std::ostream& out, NonStrictMarkingBase& x ) { |
4629 | out << "-"; |
4630 | for(PlaceList::iterator iter = x.places.begin(); iter != x.places.end(); iter++){ |
4631 | - out << "place " << iter->place->GetId() << " has tokens (age, count): "; |
4632 | + out << "place " << iter->place->getId() << " has tokens (age, count): "; |
4633 | for(TokenList::iterator it = iter->tokens.begin(); it != iter->tokens.end(); it++){ |
4634 | out << "(" << it->getAge() << ", " << it->getCount() << ") "; |
4635 | } |
4636 | @@ -266,23 +237,23 @@ |
4637 | //set age of too old tokens to max age |
4638 | int count = 0; |
4639 | for(TokenList::iterator token_iter = place_iter->tokens.begin(); token_iter != place_iter->tokens.end(); token_iter++) { |
4640 | - if(token_iter->getAge() > place_iter->place->GetMaxConstant()){ // this will also removed dead tokens |
4641 | + if(token_iter->getAge() > place_iter->place->getMaxConstant()){ // this will also removed dead tokens |
4642 | TokenList::iterator beginDelete = token_iter; |
4643 | - if(place_iter->place->GetType() == TAPN::Std){ |
4644 | + if(place_iter->place->getType() == TAPN::Std){ |
4645 | for(; token_iter != place_iter->tokens.end(); token_iter++){ |
4646 | count += token_iter->getCount(); |
4647 | } |
4648 | } |
4649 | - this->RemoveRangeOfTokens(*place_iter, beginDelete, place_iter->tokens.end()); |
4650 | + this->removeRangeOfTokens(*place_iter, beginDelete, place_iter->tokens.end()); |
4651 | break; |
4652 | } |
4653 | } |
4654 | if(count){ |
4655 | - Token t(place_iter->place->GetMaxConstant()+1,count); |
4656 | - this->AddTokenInPlace(*place_iter, t); |
4657 | + Token t(place_iter->place->getMaxConstant()+1,count); |
4658 | + this->addTokenInPlace(*place_iter, t); |
4659 | } |
4660 | } |
4661 | - this->CleanUp(); |
4662 | + this->cleanUp(); |
4663 | #ifdef DEBUG |
4664 | std::cout << "After cut: " << *this << std::endl; |
4665 | #endif |
4666 | @@ -290,8 +261,8 @@ |
4667 | |
4668 | int NonStrictMarkingBase::getYoungest(){ |
4669 | int youngest = INT_MAX; |
4670 | - for(PlaceList::const_iterator place_iter = GetPlaceList().begin(); place_iter != GetPlaceList().end(); place_iter++){ |
4671 | - if(youngest > place_iter->tokens.front().getAge() && place_iter->tokens.front().getAge() <= place_iter->place->GetMaxConstant()){ |
4672 | + for(PlaceList::const_iterator place_iter = getPlaceList().begin(); place_iter != getPlaceList().end(); place_iter++){ |
4673 | + if(youngest > place_iter->tokens.front().getAge() && place_iter->tokens.front().getAge() <= place_iter->place->getMaxConstant()){ |
4674 | youngest = place_iter->tokens.front().getAge(); |
4675 | } |
4676 | } |
4677 | @@ -310,11 +281,11 @@ |
4678 | |
4679 | for(PlaceList::iterator place_iter = places.begin(); place_iter != places.end(); place_iter++){ |
4680 | for(TokenList::iterator token_iter = place_iter->tokens.begin(); token_iter != place_iter->tokens.end(); token_iter++){ |
4681 | - if(token_iter->getAge() != place_iter->place->GetMaxConstant() + 1){ |
4682 | + if(token_iter->getAge() != place_iter->place->getMaxConstant() + 1){ |
4683 | token_iter->setAge(token_iter->getAge()-youngest); |
4684 | } |
4685 | #ifdef DEBUG |
4686 | - else if(token_iter->getAge() > place_iter->place->GetMaxConstant() + 1){ |
4687 | + else if(token_iter->getAge() > place_iter->place->getMaxConstant() + 1){ |
4688 | assert(false); |
4689 | } |
4690 | #endif |
4691 | |
4692 | === modified file 'src/DiscreteVerification/DataStructures/NonStrictMarkingBase.hpp' |
4693 | --- src/DiscreteVerification/DataStructures/NonStrictMarkingBase.hpp 2013-03-17 14:00:48 +0000 |
4694 | +++ src/DiscreteVerification/DataStructures/NonStrictMarkingBase.hpp 2013-05-15 15:27:27 +0000 |
4695 | @@ -32,14 +32,14 @@ |
4696 | Token(int age, int count) : age(age), count(count) { }; |
4697 | Token(const Token& t) : age(t.age), count(t.count) { }; |
4698 | |
4699 | - bool equals(const Token &t) const { return (this->age == t.age && this->count == t.count); }; |
4700 | + inline bool equals(const Token &t) const { return (this->age == t.age && this->count == t.count); }; |
4701 | |
4702 | - void add(int num){ count = count + num; }; |
4703 | - int getCount() const { return count; }; |
4704 | - int getAge() const { return age; }; |
4705 | - void setAge(int i) { age = i; }; |
4706 | - void setCount(int i) { count = i; }; |
4707 | - void remove(int num){ count = count - num; }; |
4708 | + inline void add(int num){ count = count + num; }; |
4709 | + inline int getCount() const { return count; }; |
4710 | + inline int getAge() const { return age; }; |
4711 | + inline void setAge(int i) { age = i; }; |
4712 | + inline void setCount(int i) { count = i; }; |
4713 | + inline void remove(int num){ count = count - num; }; |
4714 | |
4715 | // Ages all tokens by 1 |
4716 | inline void incrementAge(){ |
4717 | @@ -78,12 +78,12 @@ |
4718 | friend std::size_t hash_value(Place const& p) |
4719 | { |
4720 | std::size_t seed = boost::hash_range(p.tokens.begin(), p.tokens.end()); |
4721 | - boost::hash_combine(seed, p.place->GetIndex()); |
4722 | + boost::hash_combine(seed, p.place->getIndex()); |
4723 | |
4724 | return seed; |
4725 | } |
4726 | |
4727 | - int NumberOfTokens() const{ |
4728 | + inline int numberOfTokens() const{ |
4729 | int count = 0; |
4730 | for(TokenList::const_iterator iter = tokens.begin(); iter != tokens.end(); iter++){ |
4731 | count += iter->getCount(); |
4732 | @@ -91,7 +91,7 @@ |
4733 | return count; |
4734 | } |
4735 | |
4736 | - int MaxTokenAge() const{ |
4737 | + inline int maxTokenAge() const{ |
4738 | int max = -1; |
4739 | for(TokenList::const_iterator iter = tokens.begin(); iter != tokens.end(); iter++){ |
4740 | if(iter->getAge() > max) max = iter->getAge(); |
4741 | @@ -100,19 +100,19 @@ |
4742 | } |
4743 | |
4744 | // Ages all tokens by 1 |
4745 | - void incrementAge(){ |
4746 | + inline void incrementAge(){ |
4747 | for(TokenList::iterator iter = tokens.begin(); iter != tokens.end(); iter++){ |
4748 | iter->incrementAge(); |
4749 | } |
4750 | } |
4751 | |
4752 | - void incrementAge(int age){ |
4753 | + inline void incrementAge(int age){ |
4754 | for(TokenList::iterator iter = tokens.begin(); iter != tokens.end(); iter++){ |
4755 | iter->incrementAge(age); |
4756 | } |
4757 | } |
4758 | |
4759 | - void decrementAge(){ |
4760 | + inline void decrementAge(){ |
4761 | for(TokenList::iterator iter = tokens.begin(); iter != tokens.end(); iter++){ |
4762 | iter->decrementAge(); |
4763 | } |
4764 | @@ -133,38 +133,57 @@ |
4765 | |
4766 | virtual ~NonStrictMarkingBase(); |
4767 | |
4768 | - virtual size_t HashKey() const { return boost::hash_range(places.begin(), places.end()); }; |
4769 | - |
4770 | - virtual NonStrictMarkingBase& Clone() |
4771 | - { |
4772 | - NonStrictMarkingBase* clone = new NonStrictMarkingBase(*this); |
4773 | - return *clone; |
4774 | - }; |
4775 | - |
4776 | public: // inspectors |
4777 | - //int NumberOfTokensInPlace(const Place& palce) const; |
4778 | - int NumberOfTokensInPlace(int placeId) const; |
4779 | - const TokenList& GetTokenList(int placeId) const; |
4780 | - const PlaceList& GetPlaceList() const{ return places; } |
4781 | + int numberOfTokensInPlace(int placeId) const; |
4782 | + const TokenList& getTokenList(int placeId) const; |
4783 | + inline const PlaceList& getPlaceList() const{ return places; } |
4784 | unsigned int size(); |
4785 | - const NonStrictMarkingBase* GetParent() const { return parent; } |
4786 | - const TAPN::TimedTransition* GetGeneratedBy() const { return generatedBy; } |
4787 | - |
4788 | - |
4789 | + inline const NonStrictMarkingBase* getParent() const { return parent; } |
4790 | + inline const TAPN::TimedTransition* getGeneratedBy() const { return generatedBy; } |
4791 | + bool equals(const NonStrictMarkingBase &m1) const; |
4792 | + inline int getNumberOfChildren(){ |
4793 | + return children; |
4794 | + } |
4795 | + virtual size_t getHashKey() const { return boost::hash_range(places.begin(), places.end()); }; |
4796 | + |
4797 | public: // modifiers |
4798 | - void cut(); |
4799 | - bool RemoveToken(int placeId, int age); |
4800 | - bool RemoveToken(Place& place, Token& token); |
4801 | - void AddTokenInPlace(TAPN::TimedPlace& place, int age); |
4802 | - void AddTokenInPlace(Place& place, Token& token); |
4803 | - void AddTokenInPlace(const TAPN::TimedPlace& place, Token& token); |
4804 | - void incrementAge(); // increment |
4805 | - void incrementAge(int age); |
4806 | - void decrementAge(); // decrement |
4807 | - void RemoveRangeOfTokens(Place& place, TokenList::iterator begin, TokenList::iterator end); |
4808 | - void SetParent(NonStrictMarkingBase* parent) { this->parent = parent; } |
4809 | - void SetGeneratedBy(const TAPN::TimedTransition* generatedBy) { this->generatedBy = generatedBy; } |
4810 | - void CleanUp() { |
4811 | + |
4812 | + void cut(); |
4813 | + bool removeToken(int placeId, int age); |
4814 | + bool removeToken(Place& place, Token& token); |
4815 | + void addTokenInPlace(TAPN::TimedPlace& place, int age); |
4816 | + void addTokenInPlace(Place& place, Token& token); |
4817 | + void addTokenInPlace(const TAPN::TimedPlace& place, Token& token); |
4818 | + inline void incrementAge(){ |
4819 | + for(PlaceList::iterator iter = places.begin(); iter != places.end(); iter++){ |
4820 | + iter->incrementAge(); |
4821 | + } |
4822 | + } |
4823 | + |
4824 | + inline void incrementAge(int age){ |
4825 | + for(PlaceList::iterator iter = places.begin(); iter != places.end(); iter++){ |
4826 | + iter->incrementAge(age); |
4827 | + } |
4828 | + } |
4829 | + |
4830 | + inline void decrementAge(){ |
4831 | + for(PlaceList::iterator iter = places.begin(); iter != places.end(); iter++){ |
4832 | + iter->decrementAge(); |
4833 | + } |
4834 | + } |
4835 | + void removeRangeOfTokens(Place& place, TokenList::iterator begin, TokenList::iterator end); |
4836 | + inline void setParent(NonStrictMarkingBase* parent) { this->parent = parent; } |
4837 | + inline void setGeneratedBy(const TAPN::TimedTransition* generatedBy) { this->generatedBy = generatedBy; } |
4838 | + inline void setNumberOfChildren(int i){ |
4839 | + children = i; |
4840 | + } |
4841 | + inline void incrementNumberOfChildren(){ |
4842 | + ++children; |
4843 | + } |
4844 | + inline void decrementNumberOfChildren(){ |
4845 | + --children; |
4846 | + } |
4847 | + inline void cleanUp() { |
4848 | for(unsigned int i = 0; i < places.size(); i++){ |
4849 | if(places[i].tokens.empty()){ |
4850 | places.erase(places.begin()+i); |
4851 | @@ -174,18 +193,19 @@ |
4852 | } |
4853 | int getYoungest(); |
4854 | int makeBase(TAPN::TimedArcPetriNet* tapn); |
4855 | - |
4856 | - public: |
4857 | - bool equals(const NonStrictMarkingBase &m1) const; |
4858 | - |
4859 | - public: |
4860 | + virtual NonStrictMarkingBase& Clone() |
4861 | + { |
4862 | + NonStrictMarkingBase* clone = new NonStrictMarkingBase(*this); |
4863 | + return *clone; |
4864 | + }; |
4865 | + |
4866 | + private: |
4867 | int children; |
4868 | PlaceList places; |
4869 | - TokenList emptyTokenList; |
4870 | - |
4871 | - public: |
4872 | NonStrictMarkingBase* parent; |
4873 | const TAPN::TimedTransition* generatedBy; |
4874 | + |
4875 | + static TokenList emptyTokenList; |
4876 | }; |
4877 | |
4878 | std::ostream& operator<<(std::ostream& out, NonStrictMarkingBase& x); |
4879 | |
4880 | === removed file 'src/DiscreteVerification/DataStructures/PData.h' |
4881 | --- src/DiscreteVerification/DataStructures/PData.h 2013-04-08 13:45:17 +0000 |
4882 | +++ src/DiscreteVerification/DataStructures/PData.h 1970-01-01 00:00:00 +0000 |
4883 | @@ -1,430 +0,0 @@ |
4884 | -/* |
4885 | - * File: PData.h |
4886 | - * Author: Peter Gjøl Jensen |
4887 | - * |
4888 | - * Created on 5. november 2012, 10:22 |
4889 | - */ |
4890 | - |
4891 | - |
4892 | -#include "NonStrictMarking.hpp" |
4893 | -#include "EncodingStructure.h" |
4894 | -#include "TimeDart.hpp" |
4895 | - |
4896 | -#ifndef PDATA_H |
4897 | -#define PDATA_H |
4898 | -namespace VerifyTAPN { |
4899 | - namespace DiscreteVerification { |
4900 | - |
4901 | - // pointer containing enough data to reconstruct the stored data at any time! |
4902 | - template<typename T> |
4903 | - struct EncodingPointer { |
4904 | - // The part of the encoding not being represented by the path in the PTrie |
4905 | - EncodingStructure<T*> encoding; |
4906 | - // The coresponding node in the PTrie |
4907 | - unsigned int node; |
4908 | - |
4909 | - // empty constructor |
4910 | - EncodingPointer() { |
4911 | - }; |
4912 | - |
4913 | - // Construct a pointer with enough (persistent) data to recreate the marking. |
4914 | - // The encoding is cloned as it is not persistant in the PTrie |
4915 | - EncodingPointer(EncodingStructure<T*> &en, unsigned int n) : encoding(en.Clone()), node(n) { |
4916 | - } |
4917 | - }; |
4918 | - |
4919 | - template<typename T> |
4920 | - class PData { |
4921 | - public: |
4922 | - typedef unsigned int uint; |
4923 | - typedef EncodingStructure<T*> MarkingEncoding; |
4924 | - |
4925 | - struct Result { |
4926 | - bool isNew; |
4927 | - MarkingEncoding encoding; |
4928 | - uint pos; |
4929 | - |
4930 | - Result(bool ex, MarkingEncoding en, uint node) : isNew(ex), encoding(en), pos(node) { |
4931 | - }; |
4932 | - }; |
4933 | - |
4934 | - |
4935 | - PData(boost::shared_ptr<TAPN::TimedArcPetriNet>& tapn, int knumber, int nplaces, int mage) : |
4936 | - k(knumber), |
4937 | - maxAge(mage + 1), |
4938 | - numberOfPlaces(nplaces), |
4939 | - countSize(ceil(log2((knumber ? knumber : 1)) + 1)), |
4940 | - enumeratedOffset(ceil(log2((nplaces * (mage + 1))) + 1) + countSize), |
4941 | - numberOfVariables(enumeratedOffset * (knumber ? knumber : 1)), |
4942 | - cachesize(128), |
4943 | - tapn(tapn) { |
4944 | - overhead = MarkingEncoding::Overhead(this->numberOfVariables); |
4945 | - this->numberOfVariables += overhead; |
4946 | - stored = 0; |
4947 | - bddsize = cachesize; |
4948 | - this->BDDArr.push_back(new PNode[this->bddsize]); |
4949 | - memset(this->BDDArr[0], 0xffffffff, this->bddsize * sizeof (PNode)); |
4950 | - BDDArr[0][0].shadow = NULL; |
4951 | - BDDArr[0][0].highCount = BDDArr[0][0].lowCount = 0; |
4952 | - BDDArr[0][0].lowpos = BDDArr[0][0].highpos = 0; |
4953 | - BDDArr[0][0].parent = 0; |
4954 | - bddnext = 1; |
4955 | - encoding = MarkingEncoding(this->numberOfVariables); |
4956 | - listcount = 0; |
4957 | - maxCount = sizeof (PNode) * 4 + sizeof (std::list<PNode>) * 4; |
4958 | - |
4959 | - }; |
4960 | - virtual ~PData(); |
4961 | - |
4962 | - uint maxCount; |
4963 | - |
4964 | - struct PNode { |
4965 | - MarkingEncoding* shadow; |
4966 | - uint highpos; |
4967 | - |
4968 | - uint lowpos; |
4969 | - |
4970 | - short int highCount; |
4971 | - short int lowCount; |
4972 | - uint parent; |
4973 | - }; |
4974 | - |
4975 | - bool search(MarkingEncoding* arr, MarkingEncoding en, int size) { |
4976 | - for (int i = 0; i < size; i++) { |
4977 | - if (arr[i] == en) |
4978 | - return true; |
4979 | - } |
4980 | - return false; |
4981 | - } |
4982 | - /* bool equal(MarkingEncoding* arr, EncodingList* lst){ |
4983 | - EncodingList::const_iterator it = lst->begin(); |
4984 | - while(it != lst->end()){ |
4985 | - if(!search(arr, *it, lst->size())) |
4986 | - return false; |
4987 | - it++; |
4988 | - } |
4989 | - return true; |
4990 | - }*/ |
4991 | - |
4992 | - Result Add(NonStrictMarkingBase* marking); |
4993 | - |
4994 | - unsigned int size() { |
4995 | - return stored; |
4996 | - } |
4997 | - void PrintMemStats(); |
4998 | - void PrintEncoding(bool* encoding, int length); |
4999 | - |
5000 | - inline PNode* FetchNode(uint i) { |
Also, the following methods have been moved and made inline in NonStrictMarkin gBase:
incrementAge()
incrementAge(int age)
decrementAge()