spot  0.9.2
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 2 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 Spot; see the file COPYING. If not, write to the Free
21 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 // 02111-1307, USA.
23 
24 #ifndef SPOT_TGBA_STATE_HH
25 # define SPOT_TGBA_STATE_HH
26 
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 
34 namespace spot
35 {
36 
39  class state
40  {
41  public:
52  virtual int compare(const state* other) const = 0;
53 
73  virtual size_t hash() const = 0;
74 
76  virtual state* clone() const = 0;
77 
87  virtual void destroy() const
88  {
89  delete this;
90  }
91 
92  protected:
97  virtual ~state()
98  {
99  }
100  };
101 
115  public std::binary_function<const state*, const state*, bool>
116  {
117  bool
118  operator()(const state* left, const state* right) const
119  {
120  assert(left);
121  return left->compare(right) < 0;
122  }
123  };
124 
139  public std::binary_function<const state*, const state*, bool>
140  {
141  bool
142  operator()(const state* left, const state* right) const
143  {
144  assert(left);
145  return 0 == left->compare(right);
146  }
147  };
148 
164  public std::unary_function<const state*, size_t>
165  {
166  size_t
167  operator()(const state* that) const
168  {
169  assert(that);
170  return that->hash();
171  }
172  };
173 
174  // Functions related to shared_ptr.
176 
177  typedef boost::shared_ptr<const state> shared_state;
178 
179  inline void shared_state_deleter(state* s) { s->destroy(); }
180 
195  public std::binary_function<shared_state,
196  shared_state, bool>
197  {
198  bool
200  shared_state right) const
201  {
202  assert(left);
203  return left->compare(right.get()) < 0;
204  }
205  };
206 
223  public std::binary_function<shared_state,
224  shared_state, bool>
225  {
226  bool
228  shared_state right) const
229  {
230  assert(left);
231  return 0 == left->compare(right.get());
232  }
233  };
234 
252  public std::unary_function<shared_state, size_t>
253  {
254  size_t
256  {
257  assert(that);
258  return that->hash();
259  }
260  };
261 
262 }
263 
264 #endif // SPOT_TGBA_STATE_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