spot  1.0
state.hh
Go to the documentation of this file.
1 // Copyright (C) 2009, 2011 Laboratoire de Recherche et Développement
2 // de l'Epita (LRDE).
3 // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6
4 // (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
5 // Pierre et Marie Curie.
6 //
7 // This file is part of Spot, a model checking library.
8 //
9 // Spot is free software; you can redistribute it and/or modify it
10 // under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 3 of the License, or
12 // (at your option) any later version.
13 //
14 // Spot is distributed in the hope that it will be useful, but WITHOUT
15 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 // License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 #ifndef SPOT_TGBA_STATE_HH
23 # define SPOT_TGBA_STATE_HH
24 
25 #include <cstddef>
26 #include <bdd.h>
27 #include <cassert>
28 #include <functional>
29 #include <boost/shared_ptr.hpp>
30 #include "misc/casts.hh"
31 
32 namespace spot
33 {
34 
37  class state
38  {
39  public:
50  virtual int compare(const state* other) const = 0;
51 
71  virtual size_t hash() const = 0;
72 
74  virtual state* clone() const = 0;
75 
85  virtual void destroy() const
86  {
87  delete this;
88  }
89 
90  protected:
95  virtual ~state()
96  {
97  }
98  };
99 
113  public std::binary_function<const state*, const state*, bool>
114  {
115  bool
116  operator()(const state* left, const state* right) const
117  {
118  assert(left);
119  return left->compare(right) < 0;
120  }
121  };
122 
137  public std::binary_function<const state*, const state*, bool>
138  {
139  bool
140  operator()(const state* left, const state* right) const
141  {
142  assert(left);
143  return 0 == left->compare(right);
144  }
145  };
146 
162  public std::unary_function<const state*, size_t>
163  {
164  size_t
165  operator()(const state* that) const
166  {
167  assert(that);
168  return that->hash();
169  }
170  };
171 
172  // Functions related to shared_ptr.
174 
175  typedef boost::shared_ptr<const state> shared_state;
176 
177  inline void shared_state_deleter(state* s) { s->destroy(); }
178 
193  public std::binary_function<shared_state,
194  shared_state, bool>
195  {
196  bool
198  shared_state right) const
199  {
200  assert(left);
201  return left->compare(right.get()) < 0;
202  }
203  };
204 
221  public std::binary_function<shared_state,
222  shared_state, bool>
223  {
224  bool
226  shared_state right) const
227  {
228  assert(left);
229  return 0 == left->compare(right.get());
230  }
231  };
232 
250  public std::unary_function<shared_state, size_t>
251  {
252  size_t
254  {
255  assert(that);
256  return that->hash();
257  }
258  };
259 
260 }
261 
262 #endif // SPOT_TGBA_STATE_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Sat Oct 27 2012 09:34:32 for spot by doxygen 1.8.1.2