spot  1.99.4a
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  int register_anonymous_variables(int n, const void* for_me);
155 
156  template <typename T>
157  int register_anonymous_variables(int n, std::shared_ptr<T> for_me)
158  {
159  return register_anonymous_variables(n, for_me.get());
160  }
162 
170  void register_all_variables_of(const void* from_other, const void* for_me);
171 
172  template <typename T>
173  void register_all_variables_of(const void* from_other,
174  std::shared_ptr<T> for_me)
175  {
176  register_all_variables_of(from_other, for_me.get());
177  }
178 
179  template <typename T>
180  void register_all_variables_of(std::shared_ptr<T> from_other,
181  const void* for_me)
182  {
183  register_all_variables_of(from_other.get(), for_me);
184  }
185 
186  template <typename T, typename U>
187  void register_all_variables_of(std::shared_ptr<T> from_other,
188  std::shared_ptr<U> for_me)
189  {
190  register_all_variables_of(from_other.get(), for_me.get());
191  }
193 
202  void register_all_propositions_of(const void* from_other,
203  const void* for_me);
204 
205  template <typename T>
206  void register_all_propositions_of(const void* from_other,
207  std::shared_ptr<T> for_me)
208  {
209  register_all_propositions_of(from_other, for_me.get());
210  }
211 
212  template <typename T>
213  void register_all_propositions_of(std::shared_ptr<T> from_other,
214  const void* for_me)
215  {
216  register_all_propositions_of(from_other.get(), for_me);
217  }
218 
219  template <typename T, typename U>
220  void register_all_propositions_of(std::shared_ptr<T> from_other,
221  std::shared_ptr<U> for_me)
222  {
223  register_all_propositions_of(from_other.get(), for_me.get());
224  }
226 
230  void unregister_all_my_variables(const void* me);
231 
234  void unregister_variable(int var, const void* me);
235 
236  template <typename T>
237  void unregister_variable(int var, std::shared_ptr<T> me)
238  {
239  unregister_variable(var, me.get());
240  }
242 
245  std::ostream& dump(std::ostream& os) const;
246 
258  void assert_emptiness() const;
259 
260  private:
261  // Disallow copy.
262  bdd_dict(const bdd_dict& other) = delete;
263  bdd_dict& operator=(const bdd_dict& other) = delete;
264  };
265 
266  typedef std::shared_ptr<bdd_dict> bdd_dict_ptr;
267 
268  inline bdd_dict_ptr make_bdd_dict()
269  {
270  return std::make_shared<bdd_dict>();
271  }
272 }
std::set< const void * > ref_set
BDD-variable reference counts.
Definition: bdddict.hh:77
Definition: graph.hh:32
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:578
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 Sun Oct 11 2015 10:50:08 for spot by doxygen 1.8.9.1