Vaucanson  1.4.1
bmig/iterator.hxx
1 // iterator.hxx: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2008 The Vaucanson Group.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // The complete GNU General Public Licence Notice can be found as the
13 // `COPYING' file in the root directory.
14 //
15 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
16 //
17 #ifndef VAUCANSON_AUTOMATA_IMPLEMENTATION_BMIG_ITERATOR_HXX
18 # define VAUCANSON_AUTOMATA_IMPLEMENTATION_BMIG_ITERATOR_HXX
19 
20 # include <vaucanson/automata/implementation/bmig_graph_impl.hh>
21 # include <vaucanson/automata/implementation/bmig/iterator.hh>
22 
23 namespace vcsn
24 {
25  namespace bmig
26  {
27 
28  // Syntactic sugar
29 # define BMIG_ITERATOR_TPARAM template <typename Graph, typename I>
30 # define BMIG_ITERATOR DeltaConstIterator<Graph, I>
31 
32  BMIG_ITERATOR_TPARAM
33  BMIG_ITERATOR::DeltaConstIterator(const graph_type& g,
34  typename graph_type::hstate_t s)
35  : graph_(g)
36  {
37  range_type tmp = graph_.deltai(s, iterator_type());
38  i_ = tmp.first;
39  end_ = tmp.second;
40  }
41 
42  BMIG_ITERATOR_TPARAM
43  BMIG_ITERATOR::~DeltaConstIterator()
44  { }
45 
46  BMIG_ITERATOR_TPARAM
47  void
48  BMIG_ITERATOR::next()
49  {
50  ++i_;
51  }
52 
53  BMIG_ITERATOR_TPARAM
54  bool
55  BMIG_ITERATOR::done() const
56  {
57  return i_ == end_;
58  }
59 
60  BMIG_ITERATOR_TPARAM
61  typename BMIG_ITERATOR::graph_type::htransition_t
63  {
64  return graph_.get_htransition(i_);
65  }
66 
67 # undef BMIG_ITERATOR_TPARAM
68 # undef BMIG_ITERATOR
69 
70  } // End of namespace bmig
71 
72 } // End of namespace vcsn
73 
74 #endif // ! VAUCANSON_AUTOMATA_IMPLEMENTATION_BMIG_ITERATOR_HXX