spot  1.99.4
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
bdddict.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2011, 2012, 2013, 2014, 2015 Laboratoire de Recherche
3 // et Développement de l'Epita (LRDE).
4 // Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de Paris
5 // 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
6 // Université 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 #pragma once
24 
25 #include <list>
26 #include <set>
27 #include <map>
28 #include <iosfwd>
29 #include <bddx.h>
30 #include <vector>
31 #include <memory>
32 #include "tl/formula.hh"
33 
34 namespace spot
35 {
37  class bdd_dict_priv;
38 
55  class SPOT_API bdd_dict
56  {
57  bdd_dict_priv* priv_;
58  public:
59 
60  bdd_dict();
61 
66  ~bdd_dict();
67 
69  typedef std::map<formula, int> fv_map;
71  typedef std::map<int, formula> vf_map;
72 
73  fv_map var_map;
74  fv_map acc_map;
75 
77  typedef std::set<const void*> ref_set;
78 
79  enum var_type { anon = 0, var, acc };
80  struct bdd_info {
81  bdd_info() : type(anon) {}
82  var_type type;
83  formula f; // Used unless t==anon.
84  ref_set refs;
85  int clone_counts;
86  };
87  typedef std::vector<bdd_info> bdd_info_map;
88  // Map BDD variables to their meaning.
89  bdd_info_map bdd_map;
90 
102  int register_proposition(formula f, const void* for_me);
103 
104  template <typename T>
105  int register_proposition(formula f, std::shared_ptr<T> for_me)
106  {
107  return register_proposition(f, for_me.get());
108  }
110 
117  int has_registered_proposition(formula f, const void* me);
118 
119  template <typename T>
120  int has_registered_proposition(formula f, std::shared_ptr<T> for_me)
121  {
122  return has_registered_proposition(f, for_me.get());
123  }
125 
137  int register_acceptance_variable(formula f, const void* for_me);
138 
139  template <typename T>
140  int register_acceptance_variable(formula f, std::shared_ptr<T> for_me)
141  {
142  return register_acceptance_variable(f, for_me.get());
143  }
145 
154  void register_acceptance_variables(bdd f, const void* for_me);
155 
156  template <typename T>
157  void register_acceptance_variables(bdd f, std::shared_ptr<T> for_me)
158  {
159  register_acceptance_variables(f, for_me.get());
160  }
162 
172  formula oneacc_to_formula(bdd oneacc) const;
173 
182  formula oneacc_to_formula(int var) const;
183 
192  int register_anonymous_variables(int n, const void* for_me);
193 
194  template <typename T>
195  int register_anonymous_variables(int n, std::shared_ptr<T> for_me)
196  {
197  return register_anonymous_variables(n, for_me.get());
198  }
200 
208  void register_all_variables_of(const void* from_other, const void* for_me);
209 
210  template <typename T>
211  void register_all_variables_of(const void* from_other,
212  std::shared_ptr<T> for_me)
213  {
214  register_all_variables_of(from_other, for_me.get());
215  }
216 
217  template <typename T>
218  void register_all_variables_of(std::shared_ptr<T> from_other,
219  const void* for_me)
220  {
221  register_all_variables_of(from_other.get(), for_me);
222  }
223 
224  template <typename T, typename U>
225  void register_all_variables_of(std::shared_ptr<T> from_other,
226  std::shared_ptr<U> for_me)
227  {
228  register_all_variables_of(from_other.get(), for_me.get());
229  }
231 
240  void register_all_propositions_of(const void* from_other,
241  const void* for_me);
242 
243  template <typename T>
244  void register_all_propositions_of(const void* from_other,
245  std::shared_ptr<T> for_me)
246  {
247  register_all_propositions_of(from_other, for_me.get());
248  }
249 
250  template <typename T>
251  void register_all_propositions_of(std::shared_ptr<T> from_other,
252  const void* for_me)
253  {
254  register_all_propositions_of(from_other.get(), for_me);
255  }
256 
257  template <typename T, typename U>
258  void register_all_propositions_of(std::shared_ptr<T> from_other,
259  std::shared_ptr<U> for_me)
260  {
261  register_all_propositions_of(from_other.get(), for_me.get());
262  }
264 
268  void unregister_all_my_variables(const void* me);
269 
273  void unregister_all_typed_variables(var_type type, const void* me);
274 
275  template <typename T>
276  void unregister_all_typed_variables(var_type type, std::shared_ptr<T> me)
277  {
278  unregister_all_typed_variables(type, me.get());
279  }
281 
284  void unregister_variable(int var, const void* me);
285 
286  template <typename T>
287  void unregister_variable(int var, std::shared_ptr<T> me)
288  {
289  unregister_variable(var, me.get());
290  }
292 
295  std::ostream& dump(std::ostream& os) const;
296 
308  void assert_emptiness() const;
309 
310  private:
311  // Disallow copy.
312  bdd_dict(const bdd_dict& other) SPOT_DELETED;
313  bdd_dict& operator=(const bdd_dict& other) SPOT_DELETED;
314  };
315 
316  typedef std::shared_ptr<bdd_dict> bdd_dict_ptr;
317 
318  inline bdd_dict_ptr make_bdd_dict()
319  {
320  return std::make_shared<bdd_dict>();
321  }
322 }
std::set< const void * > ref_set
BDD-variable reference counts.
Definition: bdddict.hh:77
Definition: graph.hh:31
std::map< int, formula > vf_map
BDD-variable-to-formula maps.
Definition: bdddict.hh:71
fv_map acc_map
Maps acceptance conditions to BDD variables.
Definition: bdddict.hh:74
std::map< formula, int > fv_map
Formula-to-BDD-variable maps.
Definition: bdddict.hh:69
LTL/PSL formula interface.
Main class for temporal logic formula.
Definition: formula.hh:574
Definition: bdddict.hh:80
Map BDD variables to formulae.
Definition: bdddict.hh:55
fv_map var_map
Maps atomic propositions to BDD variables.
Definition: bdddict.hh:73

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Thu Oct 1 2015 05:49:14 for spot by doxygen 1.8.8