spot
0.8.3
|
00001 // Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement 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 #ifndef SPOT_SABAALGOS_SABAREACHITER_HH 00022 # define SPOT_SABAALGOS_SABAREACHITER_HH 00023 00024 #include "misc/hash.hh" 00025 #include "saba/saba.hh" 00026 #include <stack> 00027 #include <deque> 00028 00029 namespace spot 00030 { 00033 class saba_reachable_iterator 00034 { 00035 public: 00036 saba_reachable_iterator(const saba* a); 00037 virtual ~saba_reachable_iterator(); 00038 00044 void run(); 00045 00053 virtual void add_state(const saba_state* s) = 0; 00055 virtual const saba_state* next_state() = 0; 00057 00060 virtual bool want_state(const saba_state* s) const; 00061 00063 virtual void start(); 00065 virtual void end(); 00066 00071 virtual void process_state(const saba_state* s, int n); 00072 00082 virtual void 00083 process_state_conjunction(const saba_state* in_s, int in, 00084 const saba_state_conjunction* sc, 00085 int sc_id, 00086 const saba_succ_iterator* si); 00102 virtual void 00103 process_link(const saba_state* in_s, int in, 00104 const saba_state* out_s, int out, 00105 const saba_state_conjunction* sc, 00106 int sc_id, 00107 const saba_succ_iterator* si); 00108 00109 protected: 00110 const saba* automata_; 00111 00112 typedef Sgi::hash_map<const saba_state*, int, 00113 saba_state_ptr_hash, saba_state_ptr_equal> seen_map; 00114 seen_map seen; 00115 }; 00116 00120 class saba_reachable_iterator_depth_first : public saba_reachable_iterator 00121 { 00122 public: 00123 saba_reachable_iterator_depth_first(const saba* a); 00124 00125 virtual void add_state(const saba_state* s); 00126 virtual const saba_state* next_state(); 00127 00128 protected: 00129 std::stack<const saba_state*> todo; 00130 }; 00131 00135 class saba_reachable_iterator_breadth_first : public saba_reachable_iterator 00136 { 00137 public: 00138 saba_reachable_iterator_breadth_first(const saba* a); 00139 00140 virtual void add_state(const saba_state* s); 00141 virtual const saba_state* next_state(); 00142 00143 protected: 00144 std::deque<const saba_state*> todo; 00145 }; 00146 00147 00148 } 00149 00150 00151 #endif // SPOT_SABAALGOS_SABAREACHITER_HH