spot  1.2.1a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
deadstore.hh
1 // Copyright (C) 2012 Laboratoire de Recherche et Développement
2 // de l'Epita (LRDE).
3 //
4 // This file is part of Spot, a model checking library.
5 //
6 // Spot is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // Spot is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef SPOT_FASTTGBAALGOS_EC_DEADSTORE_HH
20 # define SPOT_FASTTGBAALGOS_EC_DEADSTORE_HH
21 
22 
23 #include "misc/hash.hh"
24 #include "fasttgba/fasttgba.hh"
25 #include "boost/tuple/tuple.hpp"
26 
27 
28 #include <cassert>
29 #include <iosfwd>
30 #include <functional>
31 #include <memory>
32 #include <unordered_set>
33 #include <vector>
34 
35 namespace spot
36 {
37 
41  class deadstore
42  {
43  public:
45  deadstore(): store()
46  { }
47 
48  virtual ~deadstore()
49  {
50  std::unordered_set
51  <const fasttgba_state*,
53  fasttgba_state_ptr_equal>::iterator it = store.begin();
54  while (it != store.end())
55  {
56  const fasttgba_state* ptr = *it;
57  ++it;
58  ptr->destroy();
59  }
60  }
61 
64  bool contains (const fasttgba_state* state)
65  {
66  return store.find (state) != store.end();
67  }
68 
70  void add (const fasttgba_state* state)
71  {
72  assert(!contains(state));
73  store.insert(state);
74  }
75 
77  int size ()
78  {
79  return store.size();
80  }
81 
82  private :
84  std::unordered_set<const fasttgba_state*,
85  fasttgba_state_ptr_hash,
87  };
88 }
89 #endif // SPOT_FASTTGBAALGOS_EC_DEASSTORE_HH
This class act as an interface for all classes.
Definition: fasttgba_state.hh:30
Abstract class for states.
Definition: state.hh:40
int size()
\ brief Return the size of the store.
Definition: deadstore.hh:77
void add(const fasttgba_state *state)
Add a new element in the store.
Definition: deadstore.hh:70
bool contains(const fasttgba_state *state)
check wheter an element is in the store
Definition: deadstore.hh:64
deadstore()
A simple constructor that instanciate a store.
Definition: deadstore.hh:45
Definition: fasttgba_state.hh:76
This class represent a dead store. For now it&#39;s just a set but it can be combined with bitstate hasin...
Definition: deadstore.hh:41
Definition: fasttgba_state.hh:88
virtual void destroy() const
Release a state.
Definition: fasttgba_state.hh:60

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Tue Jan 21 2014 16:52:01 for spot by doxygen 1.8.5