spot 2.3.4

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List

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, 2016 Laboratoire de
3 // Recherche 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 <spot/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 };
86 typedef std::vector<bdd_info> bdd_info_map;
87 // Map BDD variables to their meaning.
88 bdd_info_map bdd_map;
89
101 int register_proposition(formula f, const void* for_me);
102
103 template <typename T>
104 int register_proposition(formula f, std::shared_ptr<T> for_me)
105 {
106 return register_proposition(f, for_me.get());
107 }
109
116 int has_registered_proposition(formula f, const void* me);
117
118 template <typename T>
119 int has_registered_proposition(formula f, std::shared_ptr<T> for_me)
120 {
121 return has_registered_proposition(f, for_me.get());
122 }
124
125 // \brief return the BDD variable associated to a registered
126 // proposition.
127 //
128 // Throws std::out_of_range if the \a is not a known proposition.
129 int varnum(formula f)
130 {
131 return var_map.at(f);
132 }
133
145 int register_acceptance_variable(formula f, const void* for_me);
146
147 template <typename T>
148 int register_acceptance_variable(formula f, std::shared_ptr<T> for_me)
149 {
150 return register_acceptance_variable(f, for_me.get());
151 }
153
162 int register_anonymous_variables(int n, const void* for_me);
163
164 template <typename T>
165 int register_anonymous_variables(int n, std::shared_ptr<T> for_me)
166 {
167 return register_anonymous_variables(n, for_me.get());
168 }
170
178 void register_all_variables_of(const void* from_other, const void* for_me);
179
180 template <typename T>
181 void register_all_variables_of(const void* from_other,
182 std::shared_ptr<T> for_me)
183 {
184 register_all_variables_of(from_other, for_me.get());
185 }
186
187 template <typename T>
188 void register_all_variables_of(std::shared_ptr<T> from_other,
189 const void* for_me)
190 {
191 register_all_variables_of(from_other.get(), for_me);
192 }
193
194 template <typename T, typename U>
195 void register_all_variables_of(std::shared_ptr<T> from_other,
196 std::shared_ptr<U> for_me)
197 {
198 register_all_variables_of(from_other.get(), for_me.get());
199 }
201
210 void register_all_propositions_of(const void* from_other,
211 const void* for_me);
212
213 template <typename T>
214 void register_all_propositions_of(const void* from_other,
215 std::shared_ptr<T> for_me)
216 {
217 register_all_propositions_of(from_other, for_me.get());
218 }
219
220 template <typename T>
221 void register_all_propositions_of(std::shared_ptr<T> from_other,
222 const void* for_me)
223 {
224 register_all_propositions_of(from_other.get(), for_me);
225 }
226
227 template <typename T, typename U>
228 void register_all_propositions_of(std::shared_ptr<T> from_other,
229 std::shared_ptr<U> for_me)
230 {
231 register_all_propositions_of(from_other.get(), for_me.get());
232 }
234
238 void unregister_all_my_variables(const void* me);
239
242 void unregister_variable(int var, const void* me);
243
244 template <typename T>
245 void unregister_variable(int var, std::shared_ptr<T> me)
246 {
247 unregister_variable(var, me.get());
248 }
250
253 std::ostream& dump(std::ostream& os) const;
254
266 void assert_emptiness() const;
267
268 private:
269 // Disallow copy.
270 bdd_dict(const bdd_dict& other) = delete;
271 bdd_dict& operator=(const bdd_dict& other) = delete;
272 };
273
274 typedef std::shared_ptr<bdd_dict> bdd_dict_ptr;
275
276 inline bdd_dict_ptr make_bdd_dict()
277 {
278 return std::make_shared<bdd_dict>();
279 }
280 }
spot::bdd_dict::ref_set
std::set< const void * > ref_set
BDD-variable reference counts.
Definition: bdddict.hh:77
spot
Definition: graph.hh:33
spot::bdd_dict::vf_map
std::map< int, formula > vf_map
BDD-variable-to-formula maps.
Definition: bdddict.hh:71
spot::bdd_dict::acc_map
fv_map acc_map
Maps acceptance conditions to BDD variables.
Definition: bdddict.hh:74
spot::bdd_dict::fv_map
std::map< formula, int > fv_map
Formula-to-BDD-variable maps.
Definition: bdddict.hh:69
spot::bdd_dict::register_all_variables_of
void register_all_variables_of(std::shared_ptr< T > from_other, const void *for_me)
Duplicate the variable usage of another object.
Definition: bdddict.hh:188
formula.hh
LTL/PSL formula interface.
spot::formula
Main class for temporal logic formula.
Definition: formula.hh:669
spot::bdd_dict::register_all_propositions_of
void register_all_propositions_of(std::shared_ptr< T > from_other, const void *for_me)
Register the same propositions as another object.
Definition: bdddict.hh:221
spot::bdd_dict::register_all_propositions_of
void register_all_propositions_of(const void *from_other, std::shared_ptr< T > for_me)
Register the same propositions as another object.
Definition: bdddict.hh:214
spot::bdd_dict::bdd_info
Definition: bdddict.hh:80
spot::bdd_dict
Map BDD variables to formulae.
Definition: bdddict.hh:55
spot::bdd_dict::unregister_variable
void unregister_variable(int var, std::shared_ptr< T > me)
Release a variable used by me.
Definition: bdddict.hh:245
spot::bdd_dict::register_all_variables_of
void register_all_variables_of(std::shared_ptr< T > from_other, std::shared_ptr< U > for_me)
Duplicate the variable usage of another object.
Definition: bdddict.hh:195
spot::bdd_dict::register_proposition
int register_proposition(formula f, std::shared_ptr< T > for_me)
Register an atomic proposition.
Definition: bdddict.hh:104
spot::bdd_dict::register_anonymous_variables
int register_anonymous_variables(int n, std::shared_ptr< T > for_me)
Register anonymous BDD variables.
Definition: bdddict.hh:165
spot::bdd_dict::register_acceptance_variable
int register_acceptance_variable(formula f, std::shared_ptr< T > for_me)
Register an acceptance variable.
Definition: bdddict.hh:148
spot::bdd_dict::register_all_propositions_of
void register_all_propositions_of(std::shared_ptr< T > from_other, std::shared_ptr< U > for_me)
Register the same propositions as another object.
Definition: bdddict.hh:228
spot::bdd_dict::var_map
fv_map var_map
Maps atomic propositions to BDD variables.
Definition: bdddict.hh:73
spot::bdd_dict::has_registered_proposition
int has_registered_proposition(formula f, std::shared_ptr< T > for_me)
whether a proposition has already been registered
Definition: bdddict.hh:119
spot::bdd_dict::register_all_variables_of
void register_all_variables_of(const void *from_other, std::shared_ptr< T > for_me)
Duplicate the variable usage of another object.
Definition: bdddict.hh:181

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.