spot  1.2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
state.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2009, 2011, 2013 Laboratoire de Recherche et
3 // Développement de l'Epita (LRDE).
4 // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6
5 // (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
6 // Pierre et Marie Curie.
7 //
8 // This file is part of Spot, a model checking library.
9 //
10 // Spot is free software; you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Spot is distributed in the hope that it will be useful, but WITHOUT
16 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 // License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23 #ifndef SPOT_TGBA_STATE_HH
24 # define SPOT_TGBA_STATE_HH
25 
26 #include "misc/common.hh"
27 #include <cstddef>
28 #include <bdd.h>
29 #include <cassert>
30 #include <functional>
31 #include <boost/shared_ptr.hpp>
32 #include "misc/casts.hh"
33 #include "misc/hash.hh"
34 
35 namespace spot
36 {
37 
40  class SPOT_API state
41  {
42  public:
53  virtual int compare(const state* other) const = 0;
54 
74  virtual size_t hash() const = 0;
75 
77  virtual state* clone() const = 0;
78 
88  virtual void destroy() const
89  {
90  delete this;
91  }
92 
93  protected:
98  virtual ~state()
99  {
100  }
101  };
102 
116  public std::binary_function<const state*, const state*, bool>
117  {
118  bool
119  operator()(const state* left, const state* right) const
120  {
121  assert(left);
122  return left->compare(right) < 0;
123  }
124  };
125 
140  public std::binary_function<const state*, const state*, bool>
141  {
142  bool
143  operator()(const state* left, const state* right) const
144  {
145  assert(left);
146  return 0 == left->compare(right);
147  }
148  };
149 
165  public std::unary_function<const state*, size_t>
166  {
167  size_t
168  operator()(const state* that) const
169  {
170  assert(that);
171  return that->hash();
172  }
173  };
174 
175  typedef Sgi::hash_set<const state*,
177  spot::state_ptr_equal> state_set;
178 
179 
180  // Functions related to shared_ptr.
182 
183  typedef boost::shared_ptr<const state> shared_state;
184 
185  inline void shared_state_deleter(state* s) { s->destroy(); }
186 
201  public std::binary_function<shared_state,
202  shared_state, bool>
203  {
204  bool
205  operator()(shared_state left,
206  shared_state right) const
207  {
208  assert(left);
209  return left->compare(right.get()) < 0;
210  }
211  };
212 
229  public std::binary_function<shared_state,
230  shared_state, bool>
231  {
232  bool
233  operator()(shared_state left,
234  shared_state right) const
235  {
236  assert(left);
237  return 0 == left->compare(right.get());
238  }
239  };
240 
258  public std::unary_function<shared_state, size_t>
259  {
260  size_t
261  operator()(shared_state that) const
262  {
263  assert(that);
264  return that->hash();
265  }
266  };
267 
268  typedef Sgi::hash_set<shared_state,
270  state_shared_ptr_equal> shared_state_set;
271 
272 }
273 
274 #endif // SPOT_TGBA_STATE_HH

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Thu May 15 2014 11:04:11 for spot by doxygen 1.8.4