Commit b14c66ad authored by Florent D'Halluin's avatar Florent D'Halluin
Browse files

Fix TransitionIteratorBase and DeltaTransitionIterator.

Note: The iterator system compiles and DeltaTransitionIterator
can be instanciated.

* include/vaucanson/automata/implementation/iterators/transition_iterator_base.hh,
* include/vaucanson/automata/implementation/iterators/transition_iterator_base.hxx:
Have weight() return a semiring_elt_value_t instead of semiring_elt_t.
Specialize iterator_traits_.
Add typename where missing.
* include/vaucanson/automata/implementation/iterators/delta_transition_iterator.hh,
* include/vaucanson/automata/implementation/iterators/delta_transition_iterator.hxx:
Fix iterator_traits_ to reflect changes in other files.
Add typename where missing.
parent ab9a570b
2009-09-16 d-halluin <d-halluin@lrde.epita.fr>
Fix TransitionIteratorBase and DeltaTransitionIterator.
Note: The iterator system compiles and DeltaTransitionIterator
can be instanciated.
* include/vaucanson/automata/implementation/iterators/transition_iterator_base.hh,
* include/vaucanson/automata/implementation/iterators/transition_iterator_base.hxx:
Have weight() return a semiring_elt_value_t instead of semiring_elt_t.
Specialize iterator_traits_.
Add typename where missing.
* include/vaucanson/automata/implementation/iterators/delta_transition_iterator.hh,
* include/vaucanson/automata/implementation/iterators/delta_transition_iterator.hxx:
Fix iterator_traits_ to reflect changes in other files.
Add typename where missing.
2009-09-15 d-halluin <d-halluin@lrde.epita.fr>
 
Add TransitionIteratorBase and DeltaTransitionIterator.
......
......@@ -30,6 +30,7 @@ namespace vcsn
*/
template <typename T>
struct iterator_traits_<DeltaTransitionIterator<T> >
: iterator_traits_<TransitionIteratorBase<DeltaTransitionIterator<T> > >
{
typedef T graph_t;
typedef typename graph_t::htransition_t value_type;
......@@ -49,22 +50,22 @@ namespace vcsn
typedef typename TransitionIteratorBase<self_t>::graph_t graph_t;
DeltaTransitionIterator(graph_t graph,
graph_t::hstate_t state);
typename graph_t::hstate_t state);
~DeltaTransitionIterator();
void op_next();
bool op_done();
graph_t::htransition_t op_operator_star() const;
typename graph_t::htransition_t op_operator_star() const;
graph_t::hstate_t op_src() const;
graph_t::hstate_t op_dst() const;
graph_t::semiring_elt_t op_weight() const;
graph_t::label_t op_label() const;
typename graph_t::hstate_t op_src() const;
typename graph_t::hstate_t op_dst() const;
typename graph_t::semiring_elt_value_t op_weight() const;
typename graph_t::label_t op_label() const;
private:
hstate_t state_;
graph_t::delta_iterator i_;
typename graph_t::hstate_t state_;
typename graph_t::delta_iterator i_;
};
} // ! vcsn
......
......@@ -23,8 +23,9 @@ namespace vcsn
{
template <typename T>
DeltaTransitionIterator<T>::DeltaTransitionIterator(graph_t graph,
graph_t::hstate_t state)
DeltaTransitionIterator<T>::DeltaTransitionIterator
(graph_t graph,
typename graph_t::hstate_t state)
: TransitionIteratorBase<self_t>(graph),
state_(state),
i_(graph, state)
......@@ -36,32 +37,33 @@ namespace vcsn
{}
template <typename T>
DeltaTransitionIterator<T>::graph_t::hstate_t
typename DeltaTransitionIterator<T>::graph_t::hstate_t
DeltaTransitionIterator<T>::op_src() const
{
return graph_.src_of(*i_);
// this-> seems to be necessary here.
return this->graph_.src_of(*i_);
}
template <typename T>
DeltaTransitionIterator<>::graph_t::hstate_t
typename DeltaTransitionIterator<T>::graph_t::hstate_t
DeltaTransitionIterator<T>::op_dst() const
{
return graph_.dst_of(*i_);
return this->graph_.dst_of(*i_);
}
template <typename T>
DeltaTransitionIterator<T>::graph_t::semiring_elt_t
typename DeltaTransitionIterator<T>::graph_t::semiring_elt_value_t
DeltaTransitionIterator<T>::op_weight() const
{
// FIXME: Extract weight from graph::label_t.
}
template <typename T>
DeltaTransitionIterator<T>::graph_t::label_t
typename DeltaTransitionIterator<T>::graph_t::label_t
DeltaTransitionIterator<T>::op_label() const
{
// Note: Should not include the weight.
return graph_.label_of(*i_);
return this->graph_.label_of(*i_);
}
template <typename T>
......@@ -79,7 +81,7 @@ namespace vcsn
}
template <typename T>
DeltaTransitionIterator<T>::graph_t::htransition_t
typename DeltaTransitionIterator<T>::graph_t::htransition_t
DeltaTransitionIterator<T>::op_operator_star() const
{
return *i_;
......
......@@ -22,6 +22,18 @@
namespace vcsn
{
template <typename S>
struct TransitionIteratorBase;
/**
* Iterator traits.
*/
template <typename S>
struct iterator_traits_<TransitionIteratorBase<S> >
: iterator_traits_<IteratorBase<S> >
{
};
/**
* Base class for automaton iterators on transitions.
*/
......@@ -32,15 +44,15 @@ namespace vcsn
/// Self type definition.
typedef TransitionIteratorBase<S> self_t;
typedef typename IteratorBase<self_t>::graph_t graph_t;
typedef typename IteratorBase<S>::graph_t graph_t;
TransitionIteratorBase(graph_t graph);
~TransitionIteratorBase();
graph_t::hstate_t src() const;
graph_t::hstate_t dst() const;
graph_t::semiring_elt_t weight() const;
graph_t::label_t label() const;
typename graph_t::hstate_t src() const;
typename graph_t::hstate_t dst() const;
typename graph_t::semiring_elt_value_t weight() const;
typename graph_t::label_t label() const;
};
} // ! vcsn
......
......@@ -46,7 +46,7 @@ namespace vcsn
}
template <typename S>
typename TransitionIteratorBase<S>::graph_t::semiring_elt_t
typename TransitionIteratorBase<S>::graph_t::semiring_elt_value_t
TransitionIteratorBase<S>::weight() const
{
return static_cast<const S*>(this)->op_weight();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment