spot  1.2.1a
openset.hh
1 // Copyright (C) 2013 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_CONCUR_OPENSET_HH
20 # define SPOT_FASTTGBAALGOS_EC_CONCUR_OPENSET_HH
21 
22 #include "fasttgba/fasttgba.hh"
23 #include <iosfwd>
24 #include <atomic>
25 
26 // For comparison def!
27 #include "uf.hh"
28 
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include "fasttgbaalgos/ec/concur/open_set.h"
35 
36 #ifdef __cplusplus
37 } // extern "C"
38 #endif
39 
40 
43 namespace spot
44 {
45  class openset
46  {
47  public :
48 
50  openset(int thread_number) : thread_number_(thread_number), size_(0)
51  {
52  effective_os = open_set_alloc(&DATATYPE_INT_PTRINT,
53  INIT_SCALE, thread_number);
54  }
55 
57  virtual ~openset()
58  {
59  open_set_free (effective_os, size_, thread_number_);
60  }
61 
62 
63  bool find_or_put(const fasttgba_state* key)
64  {
65  bool b = open_set_find_or_put(effective_os, (map_key_t) key);
66  if (b)
67  {
68  ++size_;
69  }
70  return b;
71  }
72 
75  const fasttgba_state* get_one(int tn)
76  {
77  return (const fasttgba_state*)open_set_get_one(effective_os, tn);
78  }
79 
81  int size()
82  {
83  return size_;
84  }
85 
86  private:
87  open_set_t* effective_os;
88  int thread_number_;
89  std::atomic<int> size_;
90  };
91 }
92 #endif // SPOT_FASTTGBAALGOS_EC_CONCUR_OPEN_HH
this class acts like a wrapper to the C code of the open_set.
Definition: public.hh:32
openset(int thread_number)
Constructor.
Definition: openset.hh:50
int size()
the current size of the open_set
Definition: openset.hh:81
This class act as an interface for all classes.
Definition: fasttgba_state.hh:30
const fasttgba_state * get_one(int tn)
Get the next state to deal with Return a new state or 0.
Definition: openset.hh:75
Definition: openset.hh:45
virtual ~openset()
Basic destructor.
Definition: openset.hh:57

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Jun 5 2015 11:31:18 for spot by doxygen 1.8.9.1