spot
0.8.1
|
00001 // Copyright (C) 2011 Laboratoire de Recherche et Developpement 00002 // de l'Epita (LRDE) 00003 // 00004 // This file is part of Spot, a model checking library. 00005 // 00006 // Spot is free software; you can redistribute it and/or modify it 00007 // under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // Spot is distributed in the hope that it will be useful, but WITHOUT 00012 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00013 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00014 // License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with Spot; see the file COPYING. If not, write to the Free 00018 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00019 // 02111-1307, USA. 00020 00021 00022 #ifndef SPOT_KRIPKE_KRIPKEEXPLICIT_HH 00023 # define SPOT_KRIPKE_KRIPKEEXPLICIT_HH 00024 00025 # include <iosfwd> 00026 # include "kripke.hh" 00027 # include "ltlast/formula.hh" 00028 # include "kripkeprint.hh" 00029 00030 namespace spot 00031 { 00032 // Define in kripkeprint.hh 00033 class KripkeVisitor; 00034 00036 class state_kripke : public state 00037 { 00038 friend class kripke_explicit; 00039 friend class kripke_explicit_succ_iterator; 00040 private: 00041 state_kripke(); 00042 00051 virtual int compare (const state* other) const; 00052 00054 virtual size_t hash() const; 00055 00057 virtual state_kripke* clone() const; 00058 00061 void add_conditions(bdd f); 00062 00065 void add_succ(state_kripke* succ); 00066 00067 virtual bdd 00068 as_bdd() const 00069 { 00070 return bdd_; 00071 } 00072 00075 virtual void 00076 destroy() const 00077 { 00078 } 00079 00080 virtual 00081 ~state_kripke () 00082 { 00083 } 00084 00086 // Management for succ_iterator 00087 00088 const std::list<state_kripke*>& get_succ() const; 00089 00090 bdd bdd_; 00091 std::list<state_kripke*> succ_; 00092 }; 00093 00094 00097 class kripke_explicit_succ_iterator : public kripke_succ_iterator 00098 { 00099 public: 00100 kripke_explicit_succ_iterator(const state_kripke*, bdd); 00101 00102 ~kripke_explicit_succ_iterator(); 00103 00104 virtual void first(); 00105 virtual void next(); 00106 virtual bool done() const; 00107 00108 virtual state_kripke* current_state() const; 00109 00110 private: 00111 const state_kripke* s_; 00112 std::list<state_kripke*>::const_iterator it_; 00113 }; 00114 00115 00118 class kripke_explicit : public kripke 00119 { 00120 public: 00121 kripke_explicit(bdd_dict*); 00122 kripke_explicit(bdd_dict*, state_kripke*); 00123 ~kripke_explicit(); 00124 00125 bdd_dict* get_dict() const; 00126 state_kripke* get_init_state() const; 00127 00130 kripke_explicit_succ_iterator* 00131 succ_iter(const spot::state* local_state, 00132 const spot::state* global_state = 0, 00133 const tgba* global_automaton = 0) const; 00134 00136 bdd state_condition(const state* s) const; 00138 bdd state_condition(const std::string) const; 00139 00141 std::string format_state(const state*) const; 00142 00143 00147 void add_state(std::string); 00148 00150 void add_transition(std::string source, 00151 std::string dest); 00152 00157 void add_conditions(bdd add, 00158 std::string on_me); 00159 00164 void add_condition(const ltl::formula* f, 00165 std::string on_me); 00166 00168 const std::map<const state_kripke*, std::string>& 00169 sn_get() const; 00170 00171 private: 00173 void add_state(std::string, state_kripke*); 00174 00175 void add_conditions(bdd add, 00176 state_kripke* on_me); 00177 00178 void add_transition(std::string source, 00179 const state_kripke* dest); 00180 00181 void add_transition(state_kripke* source, 00182 const state_kripke* dest); 00183 00184 bdd_dict* dict_; 00185 state_kripke* init_; 00186 std::map<const std::string, state_kripke*> ns_nodes_; 00187 std::map<const state_kripke*, std::string> sn_nodes_; 00188 }; 00189 } 00190 #endif /* !SPOT_KRIPKEEXPLICIT_HH_ */