reachiter.hh

Go to the documentation of this file.
00001 // Copyright (C) 2008, 2009 Laboratoire de Recherche et Développement
00002 // de l'Epita (LRDE).
00003 // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6
00004 // (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
00005 // Pierre 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_REACHITER_HH
00025 # define SPOT_TGBAALGOS_REACHITER_HH
00026 
00027 #include "misc/hash.hh"
00028 #include "tgba/tgba.hh"
00029 #include <stack>
00030 #include <deque>
00031 
00032 namespace spot
00033 {
00036   class tgba_reachable_iterator
00037   {
00038   public:
00039     tgba_reachable_iterator(const tgba* a);
00040     virtual ~tgba_reachable_iterator();
00041 
00047     void run();
00048 
00056     virtual void add_state(const state* s) = 0;
00058     virtual const state* next_state() = 0;
00060 
00063     virtual bool want_state(const state* s) const;
00064 
00066     virtual void start();
00068     virtual void end();
00069 
00075     virtual void process_state(const state* s, int n, tgba_succ_iterator* si);
00088     virtual void process_link(const state* in_s, int in,
00089                               const state* out_s, int out,
00090                               const tgba_succ_iterator* si);
00091 
00092   protected:
00093     const tgba* automata_;      
00094 
00095     typedef Sgi::hash_map<const state*, int,
00096                           state_ptr_hash, state_ptr_equal> seen_map;
00097     seen_map seen;              
00098   };
00099 
00103   class tgba_reachable_iterator_depth_first : public tgba_reachable_iterator
00104   {
00105   public:
00106     tgba_reachable_iterator_depth_first(const tgba* a);
00107 
00108     virtual void add_state(const state* s);
00109     virtual const state* next_state();
00110 
00111   protected:
00112     std::stack<const state*> todo; 
00113   };
00114 
00118   class tgba_reachable_iterator_breadth_first : public tgba_reachable_iterator
00119   {
00120   public:
00121     tgba_reachable_iterator_breadth_first(const tgba* a);
00122 
00123     virtual void add_state(const state* s);
00124     virtual const state* next_state();
00125 
00126   protected:
00127     std::deque<const state*> todo; 
00128   };
00129 
00130 
00131 }
00132 
00133 
00134 #endif // SPOT_TGBAALGOS_REACHITER_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Tue Feb 1 2011 12:00:52 for spot by doxygen 1.7.1