spot
0.8.1
|
00001 // Copyright (C) 2011 Laboratoire de Recherche et Developpement de 00002 // l'Epita (LRDE). 00003 // Copyright (C) 2004, 2005 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_TGBAALGOS_EMPTINESS_HH 00025 # define SPOT_TGBAALGOS_EMPTINESS_HH 00026 00027 #include <map> 00028 #include <list> 00029 #include <iosfwd> 00030 #include <bdd.h> 00031 #include "misc/optionmap.hh" 00032 #include "tgba/state.hh" 00033 #include "emptiness_stats.hh" 00034 00035 namespace spot 00036 { 00037 class tgba; 00038 struct tgba_run; 00039 00072 00078 class emptiness_check_result 00079 { 00080 public: 00081 emptiness_check_result(const tgba* a, option_map o = option_map()) 00082 : a_(a), o_(o) 00083 { 00084 } 00085 00086 virtual 00087 ~emptiness_check_result() 00088 { 00089 } 00090 00103 virtual tgba_run* accepting_run(); 00104 00106 const tgba* 00107 automaton() const 00108 { 00109 return a_; 00110 } 00111 00113 const option_map& 00114 options() const 00115 { 00116 return o_; 00117 } 00118 00120 const char* parse_options(char* options); 00121 00123 virtual const unsigned_statistics* statistics() const; 00124 00125 protected: 00127 virtual void options_updated(const option_map& old); 00128 00129 const tgba* a_; 00130 option_map o_; 00131 }; 00132 00134 class emptiness_check 00135 { 00136 public: 00137 emptiness_check(const tgba* a, option_map o = option_map()) 00138 : a_(a), o_(o) 00139 { 00140 } 00141 virtual ~emptiness_check(); 00142 00144 const tgba* 00145 automaton() const 00146 { 00147 return a_; 00148 } 00149 00151 const option_map& 00152 options() const 00153 { 00154 return o_; 00155 } 00156 00158 const char* parse_options(char* options); 00159 00161 virtual bool safe() const; 00162 00177 virtual emptiness_check_result* check() = 0; 00178 00180 virtual const unsigned_statistics* statistics() const; 00181 00183 virtual std::ostream& print_stats(std::ostream& os) const; 00184 00186 virtual void options_updated(const option_map& old); 00187 00188 protected: 00189 const tgba* a_; 00190 option_map o_; 00191 }; 00192 00193 00194 // Dynamically create emptiness checks. Given their name and options. 00195 class emptiness_check_instantiator 00196 { 00197 public: 00207 static emptiness_check_instantiator* construct(const char* name, 00208 const char** err); 00209 00211 emptiness_check* instantiate(const tgba* a) const; 00212 00215 const option_map& 00216 options() const 00217 { 00218 return o_; 00219 } 00220 00221 option_map& 00222 options() 00223 { 00224 return o_; 00225 } 00227 00230 unsigned int min_acceptance_conditions() const; 00231 00236 unsigned int max_acceptance_conditions() const; 00237 private: 00238 emptiness_check_instantiator(option_map o, void* i); 00239 option_map o_; 00240 void *info_; 00241 }; 00242 00243 00245 00248 00249 00253 00255 struct tgba_run 00256 { 00257 struct step { 00258 const state* s; 00259 bdd label; 00260 bdd acc; 00261 }; 00262 00263 typedef std::list<step> steps; 00264 00265 steps prefix; 00266 steps cycle; 00267 00268 ~tgba_run(); 00269 tgba_run() 00270 { 00271 }; 00272 tgba_run(const tgba_run& run); 00273 tgba_run& operator=(const tgba_run& run); 00274 }; 00275 00290 std::ostream& print_tgba_run(std::ostream& os, 00291 const tgba* a, 00292 const tgba_run* run); 00293 00298 tgba* tgba_run_to_tgba(const tgba* a, const tgba_run* run); 00299 00301 00304 } 00305 00306 #endif // SPOT_TGBAALGOS_EMPTINESS_HH