spot  2.11.6
reachiter.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016 Laboratoire de
3 // Recherche 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 <spot/misc/hash.hh>
23 #include <spot/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 
92  };
93 
98  : public ta_reachable_iterator
99  {
100  public:
101  ta_reachable_iterator_depth_first(const const_ta_ptr& a);
102 
103  virtual void add_state(const state* s) override;
104  virtual const state* next_state() override;
105 
106  protected:
107  std::stack<const state*> todo;
108  };
109 
114  : public ta_reachable_iterator
115  {
116  public:
117  ta_reachable_iterator_breadth_first(const const_ta_ptr& a);
118 
119  virtual void add_state(const state* s) override;
120  virtual const state* next_state() override;
121 
122  protected:
123  std::deque<const state*> todo;
124  };
125 }
Abstract class for states.
Definition: twa.hh:51
An implementation of spot::ta_reachable_iterator that browses states breadth first.
Definition: reachiter.hh:115
virtual const state * next_state() override
Called by run() to obtain the next state to process.
virtual void add_state(const state *s) override
Called by run() to obtain the next state to process.
std::deque< const state * > todo
A queue of states yet to explore.
Definition: reachiter.hh:123
An implementation of spot::ta_reachable_iterator that browses states depth first.
Definition: reachiter.hh:99
virtual void add_state(const state *s) override
Called by run() to obtain the next state to process.
std::stack< const state * > todo
A stack of states yet to explore.
Definition: reachiter.hh:107
virtual const state * next_state() override
Called by run() to obtain the next state to process.
Iterate over all reachable states of a spot::ta.
Definition: reachiter.hh:32
void run()
Iterate over all reachable states of a spot::ta.
virtual void add_state(const state *s)=0
Called by run() to obtain the next state to process.
virtual bool want_state(const state *s) const
const_ta_ptr t_automata_
The spot::ta to explore.
Definition: reachiter.hh:89
state_map< int > seen
States already seen.
Definition: reachiter.hh:91
virtual void process_state(const state *s, int n)
virtual const state * next_state()=0
Called by run() to obtain the next state to process.
virtual void process_link(int in, int out, const ta_succ_iterator *si)
virtual void start()
Called by run() before starting its iteration.
virtual void end()
Called by run() once all states have been explored.
Iterate over the successors of a state.
Definition: ta.hh:198
Definition: automata.hh:27
std::unordered_map< const state *, val, state_ptr_hash, state_ptr_equal > state_map
Unordered map of abstract states.
Definition: twa.hh:197

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.1