Vaucanson 1.4
iterator.hxx
00001 // iterator.hxx: 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_BMIG_ITERATOR_HXX
00018 # define VAUCANSON_AUTOMATA_IMPLEMENTATION_BMIG_ITERATOR_HXX
00019 
00020 # include <vaucanson/automata/implementation/bmig_graph_impl.hh>
00021 # include <vaucanson/automata/implementation/bmig/iterator.hh>
00022 
00023 namespace vcsn
00024 {
00025   namespace bmig
00026   {
00027 
00028     // Syntactic sugar
00029 # define BMIG_ITERATOR_TPARAM template <typename Graph, typename I>
00030 # define BMIG_ITERATOR DeltaConstIterator<Graph, I>
00031 
00032     BMIG_ITERATOR_TPARAM
00033     BMIG_ITERATOR::DeltaConstIterator(const graph_type& g,
00034                                       typename graph_type::hstate_t s)
00035       : graph_(g)
00036     {
00037       range_type        tmp = graph_.deltai(s, iterator_type());
00038       i_ = tmp.first;
00039       end_ = tmp.second;
00040     }
00041 
00042     BMIG_ITERATOR_TPARAM
00043     BMIG_ITERATOR::~DeltaConstIterator()
00044     { }
00045 
00046     BMIG_ITERATOR_TPARAM
00047     void
00048     BMIG_ITERATOR::next()
00049     {
00050       ++i_;
00051     }
00052 
00053     BMIG_ITERATOR_TPARAM
00054     bool
00055     BMIG_ITERATOR::done() const
00056     {
00057       return i_ == end_;
00058     }
00059 
00060     BMIG_ITERATOR_TPARAM
00061     typename BMIG_ITERATOR::graph_type::htransition_t
00062     BMIG_ITERATOR::operator*() const
00063     {
00064       return graph_.get_htransition(i_);
00065     }
00066 
00067 # undef BMIG_ITERATOR_TPARAM
00068 # undef BMIG_ITERATOR
00069 
00070   } // End of namespace bmig
00071 
00072 } // End of namespace vcsn
00073 
00074 #endif // ! VAUCANSON_AUTOMATA_IMPLEMENTATION_BMIG_ITERATOR_HXX