spot  1.2.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
reachiter.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2008, 2009, 2011, 2013 Laboratoire de Recherche et
3 // Développement de l'Epita (LRDE).
4 // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6
5 // (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
6 // Pierre et Marie Curie.
7 //
8 // This file is part of Spot, a model checking library.
9 //
10 // Spot is free software; you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Spot is distributed in the hope that it will be useful, but WITHOUT
16 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 // License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23 #ifndef SPOT_TGBAALGOS_REACHITER_HH
24 # define SPOT_TGBAALGOS_REACHITER_HH
25 
26 #include "misc/hash.hh"
27 #include "tgba/tgba.hh"
28 #include <stack>
29 #include <deque>
30 
31 namespace spot
32 {
35  class SPOT_API tgba_reachable_iterator
36  {
37  public:
38  tgba_reachable_iterator(const tgba* a);
39  virtual ~tgba_reachable_iterator();
40 
46  virtual void run();
47 
55  virtual void add_state(const state* s) = 0;
57  virtual const state* next_state() = 0;
59 
62  virtual bool want_state(const state* s) const;
63 
65  virtual void start();
67  virtual void end();
68 
74  virtual void process_state(const state* s, int n, tgba_succ_iterator* si);
87  virtual void process_link(const state* in_s, int in,
88  const state* out_s, int out,
89  const tgba_succ_iterator* si);
90 
91  protected:
92  const tgba* aut_;
93 
94  typedef Sgi::hash_map<const state*, int,
96  seen_map seen;
97  };
98 
104  {
105  public:
107 
108  virtual void add_state(const state* s);
109  virtual const state* next_state();
110 
111  protected:
112  std::deque<const state*> todo;
113  };
114 
118  {
119  public:
122 
128  virtual void run();
129 
132  virtual bool want_state(const state* s) const;
133 
135  virtual void start();
137  virtual void end();
138 
144  virtual void process_state(const state* s, int n, tgba_succ_iterator* si);
157  virtual void process_link(const state* in_s, int in,
158  const state* out_s, int out,
159  const tgba_succ_iterator* si);
160 
161  protected:
162  const tgba* aut_;
163 
164  typedef Sgi::hash_map<const state*, int,
165  state_ptr_hash, state_ptr_equal> seen_map;
166  seen_map seen;
167  struct stack_item
168  {
169  const state* src;
170  int src_n;
171  tgba_succ_iterator* it;
172  };
173  std::deque<stack_item> todo;
174 
176  virtual void push(const state* s, int sn);
178  virtual void pop();
179  };
180 
188  {
189  public:
195  bool on_stack(int sn) const;
196  protected:
197  virtual void push(const state* s, int sn);
198  virtual void pop();
199 
200  Sgi::hash_set<int> stack_;
201  };
202 }
203 
204 
205 #endif // SPOT_TGBAALGOS_REACHITER_HH

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Sat Dec 6 2014 12:28:44 for spot by doxygen 1.8.4