spot  1.1.3
state.hh
Go to the documentation of this file.
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 <cstddef>
27 #include <bdd.h>
28 #include <cassert>
29 #include <functional>
30 #include <boost/shared_ptr.hpp>
31 #include "misc/casts.hh"
32 
33 namespace spot
34 {
35 
38  class state
39  {
40  public:
51  virtual int compare(const state* other) const = 0;
52 
72  virtual size_t hash() const = 0;
73 
75  virtual state* clone() const = 0;
76 
86  virtual void destroy() const
87  {
88  delete this;
89  }
90 
91  protected:
96  virtual ~state()
97  {
98  }
99  };
100 
114  public std::binary_function<const state*, const state*, bool>
115  {
116  bool
117  operator()(const state* left, const state* right) const
118  {
119  assert(left);
120  return left->compare(right) < 0;
121  }
122  };
123 
138  public std::binary_function<const state*, const state*, bool>
139  {
140  bool
141  operator()(const state* left, const state* right) const
142  {
143  assert(left);
144  return 0 == left->compare(right);
145  }
146  };
147 
163  public std::unary_function<const state*, size_t>
164  {
165  size_t
166  operator()(const state* that) const
167  {
168  assert(that);
169  return that->hash();
170  }
171  };
172 
173  // Functions related to shared_ptr.
175 
176  typedef boost::shared_ptr<const state> shared_state;
177 
178  inline void shared_state_deleter(state* s) { s->destroy(); }
179 
194  public std::binary_function<shared_state,
195  shared_state, bool>
196  {
197  bool
199  shared_state right) const
200  {
201  assert(left);
202  return left->compare(right.get()) < 0;
203  }
204  };
205 
222  public std::binary_function<shared_state,
223  shared_state, bool>
224  {
225  bool
227  shared_state right) const
228  {
229  assert(left);
230  return 0 == left->compare(right.get());
231  }
232  };
233 
251  public std::unary_function<shared_state, size_t>
252  {
253  size_t
255  {
256  assert(that);
257  return that->hash();
258  }
259  };
260 
261 }
262 
263 #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 Tue Jul 9 2013 14:04:33 for spot by doxygen 1.8.4