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 
00037     template <typename Graph, typename Handler, typename Direction>
00038     class DeltaConstIterator
00039     {
00040       public:
00042         typedef Graph                                           graph_type;
00044         typedef Handler                                         data_type;
00046         typedef std::set<typename graph_type::htransition_t>    container_type;
00048         typedef typename container_type::iterator               iterator_type;
00050         typedef Direction                                       direction;
00051         typedef DeltaConstIterator<Graph, Handler, Direction>   self_t;
00052 
00058         DeltaConstIterator(const graph_type& g, typename graph_type::hstate_t s);
00059         ~DeltaConstIterator();
00060 
00064         void            next();
00069         bool            done() const;
00070 
00074         data_type       operator*() const;
00075 
00076       private:
00077         const graph_type&               graph_;
00078         typename graph_type::hstate_t   s_;
00079         iterator_type                   i_;
00080         iterator_type                   end_;
00081 
00082         /*
00083         ** Internal use
00084         ** Initialize the i_ and end_ based on whether we want to iterate
00085         ** over the successors or the predecessors.
00086         */
00087         void            initialize(const backward_iterator&);
00088         void            initialize(const forward_iterator&);
00089 
00090     }; // End of class DeltaConstIterator
00091 
00092   } // End of namespace listg
00093 
00094 } // End of namespace vcsn
00095 
00096 # if !defined VCSN_USE_INTERFACE_ONLY
00097 #  include <vaucanson/automata/implementation/listg/iterator.hxx>
00098 # endif // ! VCSN_USE_INTERFACE_ONLY
00099 
00100 #endif // ! VAUCANSON_AUTOMATA_IMPLEMENTATION_LISTG_ITERATOR_HH

Generated on Thu Oct 9 20:22:35 2008 for Vaucanson by  doxygen 1.5.1