spot  1.0
powerset.hh
Go to the documentation of this file.
1 // Copyright (C) 2011 Laboratoire de Recherche et Développement de
2 // l'Epita.
3 // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
4 // département Systèmes Répartis Coopératifs (SRC), Université Pierre
5 // 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_TGBAALGOS_POWERSET_HH
23 # define SPOT_TGBAALGOS_POWERSET_HH
24 
25 # include <list>
26 # include <map>
27 # include "tgba/tgbaexplicit.hh"
28 
29 namespace spot
30 {
31 
32  struct power_map
33  {
34  typedef std::set<const state*, state_ptr_less_than> power_state;
35  typedef std::map<int, power_state> power_map_data;
36  typedef Sgi::hash_set<const state*, state_ptr_hash,
38 
40  {
41  // Release all states.
42  state_set::const_iterator i = states.begin();
43  while (i != states.end())
44  {
45  // Advance the iterator before deleting the key.
46  const state* s = *i;
47  ++i;
48  s->destroy();
49  }
50  }
51 
52  const power_state&
53  states_of(int s) const
54  {
55  return map_.find(s)->second;
56  }
57 
58  const state*
59  canonicalize(const state* s)
60  {
61  state_set::const_iterator i = states.find(s);
62  if (i != states.end())
63  {
64  s->destroy();
65  s = *i;
66  }
67  else
68  {
69  states.insert(s);
70  }
71  return s;
72  }
73 
76  };
77 
78 
88 
92 }
93 
94 #endif // SPOT_TGBAALGOS_POWERSET_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