spot  1.99.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
reachiter.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2010, 2011, 2012, 2013, 2014 Laboratoire de Recherche
3 // et Développement de l'Epita (LRDE).
4 //
5 // This file is part of Spot, a model checking library.
6 //
7 // Spot is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // Spot is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 
20 #pragma once
21 
22 #include "misc/hash.hh"
23 #include "ta/ta.hh"
24 #include <stack>
25 #include <deque>
26 
27 namespace spot
28 {
31  class SPOT_API ta_reachable_iterator
32  {
33  public:
34  ta_reachable_iterator(const const_ta_ptr& a);
35  virtual
37 
43  void
44  run();
45 
53  virtual void
54  add_state(const state* s) = 0;
56  virtual const state*
57  next_state() = 0;
59 
62  virtual bool
63  want_state(const state* s) const;
64 
66  virtual void
67  start();
69  virtual void
70  end();
71 
76  virtual void
77  process_state(const state* s, int n);
84  virtual void
85  process_link(int in, int out, const ta_succ_iterator* si);
86 
87  protected:
88 
89  const_ta_ptr t_automata_;
90 
91  typedef std::unordered_map<const state*, int,
93  seen_map seen;
94  };
95 
100  : public ta_reachable_iterator
101  {
102  public:
103  ta_reachable_iterator_depth_first(const const_ta_ptr& a);
104 
105  virtual void
106  add_state(const state* s);
107  virtual const state*
108  next_state();
109 
110  protected:
111  std::stack<const state*> todo;
112  };
113 
118  : public ta_reachable_iterator
119  {
120  public:
121  ta_reachable_iterator_breadth_first(const const_ta_ptr& a);
122 
123  virtual void
124  add_state(const state* s);
125  virtual const state*
126  next_state();
127 
128  protected:
129  std::deque<const state*> todo;
130  };
131 }
Definition: public.hh:31
std::stack< const state * > todo
A stack of states yet to explore.
Definition: reachiter.hh:111
An Equivalence Relation for state*.
Definition: twa.hh:138
Iterate over all reachable states of a spot::ta.
Definition: reachiter.hh:31
An implementation of spot::ta_reachable_iterator that browses states depth first. ...
Definition: reachiter.hh:99
Abstract class for states.
Definition: twa.hh:40
An implementation of spot::ta_reachable_iterator that browses states breadth first.
Definition: reachiter.hh:117
seen_map seen
States already seen.
Definition: reachiter.hh:93
Hash Function for state*.
Definition: twa.hh:162
std::deque< const state * > todo
A queue of states yet to explore.
Definition: reachiter.hh:129
Iterate over the successors of a state.
Definition: ta.hh:196
const_ta_ptr t_automata_
The spot::ta to explore.
Definition: reachiter.hh:89

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Wed Aug 26 2015 08:42:37 for spot by doxygen 1.8.8