Vaucanson  1.4.1
listg/iterator.hh
1 // iterator.hh: 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_LISTG_ITERATOR_HH
18 # define VAUCANSON_AUTOMATA_IMPLEMENTATION_LISTG_ITERATOR_HH
19 
20 # include <set>
21 
22 namespace vcsn
23 {
24  namespace listg
25  {
26  class backward_iterator { };
27  class forward_iterator { };
28 
36  template <typename Graph, typename Direction>
38  {
39  public:
41  typedef Graph graph_type;
43  typedef std::set<typename graph_type::htransition_t> container_type;
45  typedef typename container_type::iterator iterator_type;
47  typedef Direction direction;
49 
55  DeltaConstIterator(const graph_type& g, typename graph_type::hstate_t s);
57 
61  void next();
66  bool done() const;
67 
71  typename graph_type::htransition_t operator*() const;
72 
73  private:
74  const graph_type& graph_;
75  typename graph_type::hstate_t s_;
76  iterator_type i_;
77  iterator_type end_;
78 
79  /*
80  ** Internal use
81  ** Initialize the i_ and end_ based on whether we want to iterate
82  ** over the successors or the predecessors.
83  */
84  void initialize(const backward_iterator&);
85  void initialize(const forward_iterator&);
86 
87  }; // End of class DeltaConstIterator
88 
89  } // End of namespace listg
90 
91 } // End of namespace vcsn
92 
93 # if !defined VCSN_USE_INTERFACE_ONLY
94 # include <vaucanson/automata/implementation/listg/iterator.hxx>
95 # endif // ! VCSN_USE_INTERFACE_ONLY
96 
97 #endif // ! VAUCANSON_AUTOMATA_IMPLEMENTATION_LISTG_ITERATOR_HH