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