00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
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     
00029 # define BMIG_ITERATOR_TPARAM template <typename Graph, typename Handler, typename I>
00030 # define BMIG_ITERATOR DeltaConstIterator<Graph, Handler, 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     
00061 
00062 
00063 
00064 
00065     template <typename IteratorType>
00066     typename IteratorType::data_type
00067     op_get_delta_iterator_value(const IteratorType&,
00068                                 const typename IteratorType::iterator_type& i);
00069 
00070 # define BMIG_DCI(Handler, Kind)                        \
00071     DeltaConstIterator<Graph,                           \
00072                        typename Graph::Handler,         \
00073                        typename Graph::Kind##_iterator>
00074     template <typename Graph>
00075     typename BMIG_DCI(hstate_t, src)::data_type
00076     op_get_delta_iterator_value(const BMIG_DCI(hstate_t, src)&,
00077                                 const Graph&,
00078                                 const typename BMIG_DCI(hstate_t, src)::iterator_type& i)
00079     {
00080       return typename BMIG_DCI(hstate_t, src)::data_type(i->to_);
00081     }
00082     template <typename Graph>
00083     typename BMIG_DCI(hstate_t, dst)::data_type
00084     op_get_delta_iterator_value(const BMIG_DCI(hstate_t, dst)&,
00085                                 const Graph&,
00086                                 const typename BMIG_DCI(hstate_t, dst)::iterator_type& i)
00087     {
00088       return typename BMIG_DCI(hstate_t, dst)::data_type(i->from_);
00089     }
00090 # undef BMIG_DCI
00091 # define BMIG_DCI(Handler, Kind)                        \
00092     DeltaConstIterator<Graph,                           \
00093                        typename Graph::Handler,         \
00094                        T>
00095     template <typename Graph, typename T>
00096     typename BMIG_DCI(htransition_t, T)::data_type
00097     op_get_delta_iterator_value(const BMIG_DCI(htransition_t, T)&,
00098                                 const Graph& g,
00099                                 const typename BMIG_DCI(htransition_t, T)::iterator_type& i)
00100     {
00101       return g.get_htransition(i);
00102     }
00103 # undef BMIG_DCI
00104 
00105 
00106     BMIG_ITERATOR_TPARAM
00107     typename BMIG_ITERATOR::data_type
00108     BMIG_ITERATOR::operator*() const
00109     {
00110       return op_get_delta_iterator_value(*this, graph_, i_);
00111     }
00112 
00113 # undef BMIG_ITERATOR_TPARAM
00114 # undef BMIG_ITERATOR
00115 
00116   } 
00117 
00118 } 
00119 
00120 #endif // ! VAUCANSON_AUTOMATA_IMPLEMENTATION_BMIG_ITERATOR_HXX