spot  1.99.4
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ta.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2010, 2012, 2013, 2014, 2015 Laboratoire de Recherche et
3 // Developpement 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 <set>
23 
24 #include <cassert>
25 #include "misc/bddlt.hh"
26 #include "twa/twa.hh"
27 
28 namespace spot
29 {
30 
31  // Forward declarations. See below.
32  class ta_succ_iterator;
33 
41 
44 
74 
75  class SPOT_API ta
76  {
77  protected:
78  acc_cond acc_;
79  bdd_dict_ptr dict_;
80 
81  public:
82  ta(const bdd_dict_ptr& d)
83  : dict_(d)
84  {
85  }
86 
87  virtual
88  ~ta()
89  {
90  }
91 
92  typedef std::set<state*, state_ptr_less_than> states_set_t;
93 
95  virtual const states_set_t
96  get_initial_states_set() const = 0;
97 
105  virtual spot::state*
107  {
108  return nullptr;
109  }
110 
117  virtual ta_succ_iterator*
118  succ_iter(const spot::state* state) const = 0;
119 
127  virtual ta_succ_iterator*
128  succ_iter(const spot::state* state, bdd changeset) const = 0;
129 
137  bdd_dict_ptr
138  get_dict() const
139  {
140  return dict_;
141  }
142 
147  virtual std::string
148  format_state(const spot::state* s) const = 0;
149 
151  virtual bool
152  is_accepting_state(const spot::state* s) const = 0;
153 
156  virtual bool
157  is_livelock_accepting_state(const spot::state* s) const = 0;
158 
160  virtual bool
161  is_initial_state(const spot::state* s) const = 0;
162 
165  virtual bdd
166  get_state_condition(const spot::state* s) const = 0;
167 
169  virtual void
170  free_state(const spot::state* s) const = 0;
171 
172 
173  const acc_cond& acc() const
174  {
175  return acc_;
176  }
177 
178  acc_cond& acc()
179  {
180  return acc_;
181  }
182 
183  };
184 
185  typedef std::shared_ptr<ta> ta_ptr;
186  typedef std::shared_ptr<const ta> const_ta_ptr;
187 
197  {
198  public:
199  virtual
201  {
202  }
203 
204  virtual bool first() = 0;
205  virtual bool next() = 0;
206  virtual bool done() const = 0;
207 
208  virtual state*
209  current_state() const = 0;
210 
214  virtual bdd
215  current_condition() const = 0;
216 
218  current_acceptance_conditions() const = 0;
219 
220  };
221 
222 #ifndef SWIG
223  // A stack of Strongly-Connected Components
225  {
226  public:
228  {
229  public:
230  connected_component(int index = -1);
231 
233  int index;
234 
235  bool is_accepting;
236 
240 
241  std::list<state*> rem;
242  };
243 
245  void
246  push(int index);
247 
250  top();
251 
253  const connected_component&
254  top() const;
255 
257  void
258  pop();
259 
261  size_t
262  size() const;
263 
265  std::list<state*>&
266  rem();
267 
269  bool
270  empty() const;
271 
272  typedef std::list<connected_component> stack_type;
273  stack_type s;
274  };
275 #endif // !SWIG
276 
279 
282 
285 
288 
289 
292 
295 
298 }
Definition: graph.hh:31
virtual bdd current_condition() const =0
Get the changeset on the transition leading to current successor.
connected_component & top()
Access the top SCC.
void pop()
Pop the top SCC.
Definition: ta.hh:224
std::list< state * > & rem()
The rem member of the top SCC.
Abstract class for states.
Definition: twa.hh:42
virtual bool done() const =0
Check whether the iteration is finished.
acc_cond::mark_t current_acceptance_conditions() const =0
Get the acceptance conditions on the transition leading to this successor.
Iterate over the successors of a state.
Definition: twa.hh:331
Definition: acc.hh:31
bool empty() const
Is the stack empty?
acc_cond::mark_t condition
Definition: ta.hh:239
virtual spot::state * get_artificial_initial_state() const
Get the artificial initial state set of the automaton. Return 0 if this artificial state is not imple...
Definition: ta.hh:106
size_t size() const
How many SCC are in stack.
A Testing Automaton.
Definition: ta.hh:75
bdd_dict_ptr get_dict() const
Get the dictionary associated to the automaton.
Definition: ta.hh:138
int index
Index of the SCC.
Definition: ta.hh:233
void push(int index)
Stack a new SCC with index index.
Iterate over the successors of a state.
Definition: ta.hh:196
virtual bool first()=0
Position the iterator on the first successor (if any).
virtual bool next()=0
Jump to the next successor (if any).
virtual state * current_state() const =0
Get the state of the current successor.
Definition: acc.hh:34

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Thu Oct 1 2015 05:49:14 for spot by doxygen 1.8.8