Vaucanson 1.4
|
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_LISTG_ITERATOR_HXX 00018 # define VAUCANSON_AUTOMATA_IMPLEMENTATION_LISTG_ITERATOR_HXX 00019 00020 # include <vaucanson/automata/implementation/listg/iterator.hh> 00021 00022 namespace vcsn 00023 { 00024 namespace listg 00025 { 00026 00027 // Syntactic sugar 00028 # define LISTG_ITERATOR_TPARAM template <typename Graph, typename Direction> 00029 # define LISTG_ITERATOR DeltaConstIterator<Graph, Direction> 00030 00031 LISTG_ITERATOR_TPARAM 00032 LISTG_ITERATOR::DeltaConstIterator(const graph_type& g, typename graph_type::hstate_t s) 00033 : graph_(g), s_(s) 00034 { 00035 initialize(direction()); 00036 } 00037 00038 LISTG_ITERATOR_TPARAM 00039 LISTG_ITERATOR::~DeltaConstIterator() 00040 { } 00041 00042 LISTG_ITERATOR_TPARAM 00043 void 00044 LISTG_ITERATOR::next() 00045 { 00046 ++i_; 00047 } 00048 00049 LISTG_ITERATOR_TPARAM 00050 bool 00051 LISTG_ITERATOR::done() const 00052 { 00053 return i_ == end_; 00054 } 00055 00056 LISTG_ITERATOR_TPARAM 00057 void 00058 LISTG_ITERATOR::initialize(const backward_iterator&) 00059 { 00060 i_ = graph_.states_[s_].input_edges.begin(); 00061 end_ = graph_.states_[s_].input_edges.end(); 00062 } 00063 00064 LISTG_ITERATOR_TPARAM 00065 void 00066 LISTG_ITERATOR::initialize(const forward_iterator&) 00067 { 00068 i_ = graph_.states_[s_].output_edges.begin(); 00069 end_ = graph_.states_[s_].output_edges.end(); 00070 } 00071 00072 LISTG_ITERATOR_TPARAM 00073 typename LISTG_ITERATOR::graph_type::htransition_t 00074 LISTG_ITERATOR::operator*() const 00075 { 00076 return *i_; 00077 } 00078 00079 # undef LISTG_ITERATOR_TPARAM 00080 # undef LISTG_ITERATOR 00081 00082 } // End of namespace listg 00083 00084 } // End of namespace vcsn 00085 00086 00087 #endif // ! VAUCANSON_AUTOMATA_IMPLEMENTATION_LISTG_ITERATOR_HXX