00001 // Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), 00002 // département Systèmes Répartis Coopératifs (SRC), Université Pierre 00003 // et Marie Curie. 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 #ifndef SPOT_TGBAALGOS_EMPTINESS_HH 00023 # define SPOT_TGBAALGOS_EMPTINESS_HH 00024 00025 #include <map> 00026 #include <list> 00027 #include <iosfwd> 00028 #include <bdd.h> 00029 #include "misc/optionmap.hh" 00030 #include "tgba/state.hh" 00031 #include "emptiness_stats.hh" 00032 00033 namespace spot 00034 { 00035 class tgba; 00036 struct tgba_run; 00037 00070 00076 class emptiness_check_result 00077 { 00078 public: 00079 emptiness_check_result(const tgba* a, option_map o = option_map()) 00080 : a_(a), o_(o) 00081 { 00082 } 00083 00084 virtual 00085 ~emptiness_check_result() 00086 { 00087 } 00088 00101 virtual tgba_run* accepting_run(); 00102 00104 const tgba* 00105 automaton() const 00106 { 00107 return a_; 00108 } 00109 00111 const option_map& 00112 options() const 00113 { 00114 return o_; 00115 } 00116 00118 const char* parse_options(char* options); 00119 00121 virtual const unsigned_statistics* statistics() const; 00122 00123 protected: 00125 virtual void options_updated(const option_map& old); 00126 00127 const tgba* a_; 00128 option_map o_; 00129 }; 00130 00132 class emptiness_check 00133 { 00134 public: 00135 emptiness_check(const tgba* a, option_map o = option_map()) 00136 : a_(a), o_(o) 00137 { 00138 } 00139 virtual ~emptiness_check(); 00140 00142 const tgba* 00143 automaton() const 00144 { 00145 return a_; 00146 } 00147 00149 const option_map& 00150 options() const 00151 { 00152 return o_; 00153 } 00154 00156 const char* parse_options(char* options); 00157 00159 virtual bool safe() const; 00160 00175 virtual emptiness_check_result* check() = 0; 00176 00178 virtual const unsigned_statistics* statistics() const; 00179 00181 virtual std::ostream& print_stats(std::ostream& os) const; 00182 00184 virtual void options_updated(const option_map& old); 00185 00186 protected: 00187 const tgba* a_; 00188 option_map o_; 00189 }; 00190 00191 00192 // Dynamically create emptiness checks. Given their name and options. 00193 class emptiness_check_instantiator 00194 { 00195 public: 00205 static emptiness_check_instantiator* construct(const char* name, 00206 const char** err); 00207 00209 emptiness_check* instantiate(const tgba* a) const; 00210 00213 const option_map& 00214 options() const 00215 { 00216 return o_; 00217 } 00218 00219 option_map& 00220 options() 00221 { 00222 return o_; 00223 } 00225 00228 unsigned int min_acceptance_conditions() const; 00229 00234 unsigned int max_acceptance_conditions() const; 00235 private: 00236 emptiness_check_instantiator(option_map o, void* i); 00237 option_map o_; 00238 void *info_; 00239 }; 00240 00241 00243 00246 00247 00251 00253 struct tgba_run 00254 { 00255 struct step { 00256 const state* s; 00257 bdd label; 00258 bdd acc; 00259 }; 00260 00261 typedef std::list<step> steps; 00262 00263 steps prefix; 00264 steps cycle; 00265 00266 ~tgba_run(); 00267 tgba_run() 00268 { 00269 }; 00270 tgba_run(const tgba_run& run); 00271 tgba_run& operator=(const tgba_run& run); 00272 }; 00273 00289 std::ostream& print_tgba_run(std::ostream& os, 00290 const tgba* a, 00291 const tgba_run* run); 00292 00297 tgba* tgba_run_to_tgba(const tgba* a, const tgba_run* run); 00298 00300 00303 } 00304 00305 #endif // SPOT_TGBAALGOS_EMPTINESS_HH