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

Add RDeltaIterator.

* include/vaucanson/automata/implementation/iterators/rdelta_transition_iterator.hh,
* include/vaucanson/automata/implementation/iterators/rdelta_transition_iterator.hxx:
New.  Interface and implementation.
parent 738fd94d
2009-09-16 d-halluin <d-halluin@lrde.epita.fr>
Add RDeltaIterator.
* include/vaucanson/automata/implementation/iterators/rdelta_transition_iterator.hh,
* include/vaucanson/automata/implementation/iterators/rdelta_transition_iterator.hxx:
New. Interface and implementation.
2009-09-16 d-halluin <d-halluin@lrde.epita.fr>
 
Small fixes in IteratorBase and DeltaTransitionIterator.
......
// rdelta_transition_iterator.hh: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2009 The Vaucanson Group.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// The complete GNU General Public Licence Notice can be found as the
// `COPYING' file in the root directory.
//
// The Vaucanson Group consists of people listed in the `AUTHORS' file.
//
#ifndef VCSN_AUTOMATA_IMPLEMENTATION_ITERATORS_RDELTA_TRANSITION_ITERATOR_HH
# define VCSN_AUTOMATA_IMPLEMENTATION_ITERATORS_RDELTA_TRANSITION_ITERATOR_HH
# include <vaucanson/automata/implementation/iterators/transition_iterator_base.hh>
namespace vcsn
{
template <typename T>
struct RDeltaTransitionIterator;
/**
* Iterator traits.
*/
template <typename T>
struct iterator_traits_<RDeltaTransitionIterator<T> >
: iterator_traits_<TransitionIteratorBase<RDeltaTransitionIterator<T> > >
{
typedef T graph_t;
typedef typename graph_t::htransition_t value_type;
};
/**
* Class for iterators on the successors of a given state.
*/
template <typename T>
struct RDeltaTransitionIterator
: TransitionIteratorBase<RDeltaTransitionIterator<T> >
{
/// Self type definition.
typedef RDeltaTransitionIterator<T> self_t;
typedef typename TransitionIteratorBase<self_t>::graph_t graph_t;
// Typedefs
typedef typename graph_t::htransition_t htransition_t;
typedef typename graph_t::hstate_t hstate_t;
typedef typename graph_t::label_t label_t;
typedef typename graph_t::semiring_elt_value_t semiring_elt_value_t;
RDeltaTransitionIterator(graph_t graph,
hstate_t state);
~RDeltaTransitionIterator();
void op_next();
bool op_done() const;
htransition_t op_operator_star() const;
hstate_t op_src() const;
hstate_t op_dst() const;
semiring_elt_value_t op_weight() const;
label_t op_label() const;
private:
hstate_t state_;
typename graph_t::rdelta_iterator i_;
};
} // ! vcsn
# if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
# include <vaucanson/automata/implementation/iterators/rdelta_transition_iterator.hxx>
# endif
#endif // ! VCSN_AUTOMATA_IMPLEMENTATION_ITERATORS_DELTA_RTRANSITION_ITERATOR_HH
// rdelta_transition_iterator.hxx: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2009 The Vaucanson Group.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// The complete GNU General Public Licence Notice can be found as the
// `COPYING' file in the root directory.
//
// The Vaucanson Group consists of people listed in the `AUTHORS' file.
//
#ifndef VCSN_AUTOMATA_IMPLEMENTATION_ITERATORS_RDELTA_TRANSITION_ITERATOR_HXX
# define VCSN_AUTOMATA_IMPLEMENTATION_ITERATORS_RDELTA_TRANSITION_ITERATOR_HXX
# include <vaucanson/automata/implementation/iterators/rdelta_transition_iterator.hh>
namespace vcsn
{
template <typename T>
RDeltaTransitionIterator<T>::RDeltaTransitionIterator
(graph_t graph,
hstate_t state)
: TransitionIteratorBase<self_t>(graph),
state_(state),
i_(graph, state)
{
}
template <typename T>
RDeltaTransitionIterator<T>::~RDeltaTransitionIterator()
{}
template <typename T>
typename RDeltaTransitionIterator<T>::hstate_t
RDeltaTransitionIterator<T>::op_src() const
{
// this-> seems to be necessary here.
return this->graph_.src_of(*i_);
}
template <typename T>
typename RDeltaTransitionIterator<T>::hstate_t
RDeltaTransitionIterator<T>::op_dst() const
{
return this->graph_.dst_of(*i_);
}
template <typename T>
typename RDeltaTransitionIterator<T>::semiring_elt_value_t
RDeltaTransitionIterator<T>::op_weight() const
{
// FIXME: Extract weight from graph::label_t.
return semiring_elt_value_t();
}
template <typename T>
typename RDeltaTransitionIterator<T>::label_t
RDeltaTransitionIterator<T>::op_label() const
{
// Note: Should not include the weight.
return this->graph_.label_of(*i_);
}
template <typename T>
void
RDeltaTransitionIterator<T>::op_next()
{
return i_.next();
}
template <typename T>
bool
RDeltaTransitionIterator<T>::op_done() const
{
return i_.done();
}
template <typename T>
typename RDeltaTransitionIterator<T>::htransition_t
RDeltaTransitionIterator<T>::op_operator_star() const
{
return *i_;
}
} // ! vcsn
#endif // ! VCSN_AUTOMATA_IMPLEMENTATION_ITERATORS_RDELTA_TRANSITION_ITERATOR_HXX
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