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