Vaucanson 1.4
iterator.hh
00001 // iterator.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2008 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VAUCANSON_AUTOMATA_IMPLEMENTATION_LISTG_ITERATOR_HH
00018 # define VAUCANSON_AUTOMATA_IMPLEMENTATION_LISTG_ITERATOR_HH
00019 
00020 # include <set>
00021 
00022 namespace vcsn
00023 {
00024   namespace listg
00025   {
00026     class backward_iterator { };
00027     class forward_iterator { };
00028 
00036     template <typename Graph, typename Direction>
00037     class DeltaConstIterator
00038     {
00039       public:
00041         typedef Graph                                           graph_type;
00043         typedef std::set<typename graph_type::htransition_t>    container_type;
00045         typedef typename container_type::iterator               iterator_type;
00047         typedef Direction                                       direction;
00048         typedef DeltaConstIterator<Graph, Direction>            self_t;
00049 
00055         DeltaConstIterator(const graph_type& g, typename graph_type::hstate_t s);
00056         ~DeltaConstIterator();
00057 
00061         void            next();
00066         bool            done() const;
00067 
00071         typename graph_type::htransition_t      operator*() const;
00072 
00073       private:
00074         const graph_type&               graph_;
00075         typename graph_type::hstate_t   s_;
00076         iterator_type                   i_;
00077         iterator_type                   end_;
00078 
00079         /*
00080         ** Internal use
00081         ** Initialize the i_ and end_ based on whether we want to iterate
00082         ** over the successors or the predecessors.
00083         */
00084         void            initialize(const backward_iterator&);
00085         void            initialize(const forward_iterator&);
00086 
00087     }; // End of class DeltaConstIterator
00088 
00089   } // End of namespace listg
00090 
00091 } // End of namespace vcsn
00092 
00093 # if !defined VCSN_USE_INTERFACE_ONLY
00094 #  include <vaucanson/automata/implementation/listg/iterator.hxx>
00095 # endif // ! VCSN_USE_INTERFACE_ONLY
00096 
00097 #endif // ! VAUCANSON_AUTOMATA_IMPLEMENTATION_LISTG_ITERATOR_HH