spot  0.9.2
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 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_TGBAALGOS_POWERSET_HH
25 # define SPOT_TGBAALGOS_POWERSET_HH
26 
27 # include <list>
28 # include <map>
29 # include "tgba/tgbaexplicit.hh"
30 
31 namespace spot
32 {
33 
34  struct power_map
35  {
36  typedef std::set<const state*, state_ptr_less_than> power_state;
37  typedef std::map<int, power_state> power_map_data;
38  typedef Sgi::hash_set<const state*, state_ptr_hash,
40 
42  {
43  // Release all states.
44  state_set::const_iterator i = states.begin();
45  while (i != states.end())
46  {
47  // Advance the iterator before deleting the key.
48  const state* s = *i;
49  ++i;
50  s->destroy();
51  }
52  }
53 
54  const power_state&
55  states_of(int s) const
56  {
57  return map_.find(s)->second;
58  }
59 
60  const state*
61  canonicalize(const state* s)
62  {
63  state_set::const_iterator i = states.find(s);
64  if (i != states.end())
65  {
66  s->destroy();
67  s = *i;
68  }
69  else
70  {
71  states.insert(s);
72  }
73  return s;
74  }
75 
78  };
79 
80 
90 
94 }
95 
96 #endif // SPOT_TGBAALGOS_POWERSET_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