spot
0.8.2
|
00001 // Copyright (C) 2011 Laboratoire de Recherche et Developpement de 00002 // l'Epita (LRDE). 00003 // Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de Paris 6 (LIP6), 00004 // département Systèmes Répartis Coopératifs (SRC), Université Pierre 00005 // et Marie Curie. 00006 // 00007 // This file is part of Spot, a model checking library. 00008 // 00009 // Spot is free software; you can redistribute it and/or modify it 00010 // under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation; either version 2 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // Spot is distributed in the hope that it will be useful, but WITHOUT 00015 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00016 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00017 // License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with Spot; see the file COPYING. If not, write to the Free 00021 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00022 // 02111-1307, USA. 00023 00024 #ifndef SPOT_TGBA_BDDDICT_HH 00025 # define SPOT_TGBA_BDDDICT_HH 00026 00027 #include <list> 00028 #include <set> 00029 #include <map> 00030 #include <iosfwd> 00031 #include <bdd.h> 00032 #include "ltlast/formula.hh" 00033 #include "misc/bddalloc.hh" 00034 00035 namespace spot 00036 { 00037 00047 class bdd_dict: public bdd_allocator 00048 { 00049 public: 00050 00051 bdd_dict(); 00052 ~bdd_dict(); 00053 00055 typedef std::map<const ltl::formula*, int> fv_map; 00057 typedef std::map<int, const ltl::formula*> vf_map; 00058 00059 fv_map now_map; 00060 vf_map now_formula_map; 00061 fv_map var_map; 00062 vf_map var_formula_map; 00063 fv_map acc_map; 00064 vf_map acc_formula_map; 00065 00067 typedef std::map<int, int> cc_map; 00068 cc_map clone_counts; 00069 00073 bddPair* next_to_now; 00077 bddPair* now_to_next; 00078 00089 int register_proposition(const ltl::formula* f, const void* for_me); 00090 00098 void register_propositions(bdd f, const void* for_me); 00099 00111 int register_state(const ltl::formula* f, const void* for_me); 00112 00123 int register_acceptance_variable(const ltl::formula* f, const void* for_me); 00124 00130 int register_clone_acc(int var, const void* for_me); 00131 00139 void register_acceptance_variables(bdd f, const void* for_me); 00140 00148 int register_anonymous_variables(int n, const void* for_me); 00149 00156 void register_all_variables_of(const void* from_other, const void* for_me); 00157 00161 void unregister_all_my_variables(const void* me); 00162 00164 void unregister_variable(int var, const void* me); 00165 00168 bool is_registered_proposition(const ltl::formula* f, const void* by_me); 00169 bool is_registered_state(const ltl::formula* f, const void* by_me); 00170 bool is_registered_acceptance_variable(const ltl::formula* f, 00171 const void* by_me); 00173 00176 std::ostream& dump(std::ostream& os) const; 00177 00182 void assert_emptiness() const; 00183 00184 protected: 00186 typedef std::set<const void*> ref_set; 00187 typedef std::map<int, ref_set> vr_map; 00188 vr_map var_refs; 00189 00190 void unregister_variable(vr_map::iterator& cur, const void* me); 00191 00192 // SWIG does not grok the following definition, no idea why. 00193 // It's not important for the Python interface anyway. 00194 #ifndef SWIG 00195 class anon_free_list : public spot::free_list 00196 { 00197 public: 00198 // WARNING: We need a default constructor so this can be used in 00199 // a hash; but we should ensure that no object in the hash is 00200 // constructed with d==0. 00201 anon_free_list(bdd_dict* d = 0); 00202 virtual int extend(int n); 00203 private: 00204 bdd_dict* dict_; 00205 }; 00206 #endif 00207 00209 typedef std::map<const void*, anon_free_list> free_anonymous_list_of_type; 00210 free_anonymous_list_of_type free_anonymous_list_of; 00211 00212 private: 00213 // Disallow copy. 00214 bdd_dict(const bdd_dict& other); 00215 bdd_dict& operator=(const bdd_dict& other); 00216 }; 00217 00218 00219 } 00220 00221 #endif // SPOT_TGBA_BDDDICT_HH