spot  0.9.2
emptiness_stats.hh
Go to the documentation of this file.
1 // Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
2 // département Systèmes Répartis Coopératifs (SRC), Université Pierre
3 // et Marie Curie.
4 //
5 // This file is part of Spot, a model checking library.
6 //
7 // Spot is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // Spot is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with Spot; see the file COPYING. If not, write to the Free
19 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 // 02111-1307, USA.
21 
22 #ifndef SPOT_TGBAALGOS_EMPTINESS_STATS_HH
23 # define SPOT_TGBAALGOS_EMPTINESS_STATS_HH
24 
25 #include <cassert>
26 #include <map>
27 #include "misc/ltstr.hh"
28 
29 namespace spot
30 {
31 
34 
36  {
37  virtual
39  {
40  }
41 
42  unsigned
43  get(const char* str) const
44  {
45  stats_map::const_iterator i = stats.find(str);
46  assert(i != stats.end());
47  return (this->*i->second)();
48  }
49 
50  typedef unsigned (unsigned_statistics::*unsigned_fun)() const;
51  typedef std::map<const char*, unsigned_fun, char_ptr_less_than> stats_map;
53  };
54 
61  {
62  public:
64  : set(false)
65  {
66  }
67 
69  : set(false)
70  {
71  seteq(o);
72  }
73 
74  bool
76  {
77  if (!set)
78  {
79  unsigned_statistics::stats_map::const_iterator i;
80  for (i = o.stats.begin(); i != o.stats.end(); ++i)
81  stats[i->first] = (o.*i->second)();
82  set = true;
83  return true;
84  }
85  if (*this == o)
86  return true;
87  return false;
88  }
89 
90  typedef std::map<const char*, unsigned, char_ptr_less_than> stats_map;
92 
93 
94  bool
96  {
97  stats_map::const_iterator i;
98  for (i = stats.begin(); i != stats.end(); ++i)
99  {
100  stats_map::const_iterator i2 = o.stats.find(i->first);
101  if (i2 == o.stats.end())
102  return false;
103  if (i->second != i2->second)
104  return false;
105  }
106  return true;
107  }
108 
109  bool
111  {
112  return !(*this == o);
113  }
114 
115  bool set;
116  };
117 
124  {
125  public :
127  : states_(0), transitions_(0), depth_(0), max_depth_(0)
128  {
129  stats["states"] =
131  stats["transitions"] =
134  stats["max. depth"] =
137  }
138 
139  void
140  set_states(unsigned n)
141  {
142  states_ = n;
143  }
144 
145  void
147  {
148  ++states_;
149  }
150 
151  void
153  {
154  ++transitions_;
155  }
156 
157  void
158  inc_depth(unsigned n = 1)
159  {
160  depth_ += n;
161  if (depth_ > max_depth_)
162  max_depth_ = depth_;
163  }
164 
165  void
166  dec_depth(unsigned n = 1)
167  {
168  assert(depth_ >= n);
169  depth_ -= n;
170  }
171 
172  unsigned
173  states() const
174  {
175  return states_;
176  }
177 
178  unsigned
179  transitions() const
180  {
181  return transitions_;
182  }
183 
184  unsigned
185  max_depth() const
186  {
187  return max_depth_;
188  }
189 
190  unsigned
191  depth() const
192  {
193  return depth_;
194  }
195 
196  private :
197  unsigned states_;
198  unsigned transitions_;
199  unsigned depth_;
200  unsigned max_depth_;
201  };
202 
209  {
210  public:
213  {
214  stats["(non unique) states for prefix"] =
217  stats["(non unique) states for cycle"] =
220  }
221 
222  void
224  {
225  ++prefix_states_;
226  }
227 
228  unsigned
230  {
231  return prefix_states_;
232  }
233 
234  void
236  {
237  ++cycle_states_;
238  }
239 
240  unsigned
242  {
243  return cycle_states_;
244  }
245 
246  private:
247  unsigned prefix_states_;
248  unsigned cycle_states_;
249  };
250 
257  {
258  public:
260  {
261  stats["search space states"] =
264  }
265 
266  virtual
268  {
269  }
270 
272  virtual unsigned acss_states() const = 0;
273  };
274 
275 
277 }
278 
279 #endif // SPOT_TGBAALGOS_EMPTINESS_STATS_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Mon Jul 2 2012 17:35:47 for spot by doxygen 1.8.1.1