Commit 78727ff6 authored by Jerome Galtier's avatar Jerome Galtier
Browse files

Move transducer projection "makers" from vcsn::CONTEXT to traits.

	* include/vaucanson/algorithms/image.hxx (image_dispatch2): Update
	  to use output_projection_helpers trait.
	* include/vaucanson/contexts/fmp_transducer_maker.thh,
	* include/vaucanson/contexts/fmp_transducer_maker.thxx,
	* include/vaucanson/contexts/transducer_maker.thh,
	* include/vaucanson/contexts/transducer_maker.thxx: Move projections
	  declarations and implementations from here to ...
	* include/vaucanson/automata/concept/transducer.hh,
	* include/vaucanson/automata/concept/transducer.hxx: Here.
parent 195dcacb
2008-10-06 Jerome Galtier <jerome.galtier@lrde.epita.fr>
Move transducer projection "makers" from vcsn::CONTEXT to traits.
* include/vaucanson/algorithms/image.hxx (image_dispatch2): Update
to use output_projection_helpers trait.
* include/vaucanson/contexts/fmp_transducer_maker.thh,
* include/vaucanson/contexts/fmp_transducer_maker.thxx,
* include/vaucanson/contexts/transducer_maker.thh,
* include/vaucanson/contexts/transducer_maker.thxx: Move projections
declarations and implementations from here to ...
* include/vaucanson/automata/concept/transducer.hh,
* include/vaucanson/automata/concept/transducer.hxx: Here.
2008-10-06 Jerome Galtier <jerome.galtier@lrde.epita.fr>
 
Fix compilation issue.
......
......@@ -181,8 +181,8 @@ namespace vcsn
do_rw_image(src, dst, m);
}
// Dispatch and build returned object for RW transducers. A map between states
// of the resulting automaton and the tranducer is filled.
// Dispatch and build returned object for RW transducers. A map between
// states of the resulting automaton and the tranducer is filled.
template <typename S, typename T, typename ST>
static
typename output_projection_helper<S, T>::ret
......@@ -190,7 +190,8 @@ namespace vcsn
const TransducerBase<ST>&,
std::map<typename T::hstate_t, typename T::hstate_t>& m)
{
typename output_projection_helper<S, T>::ret dst = make_output_projection_automaton(src);
typename output_projection_helper<S, T>::ret dst =
output_projection_helper<S, T>::make_output_projection_automaton(src);
image_dispatch(src, src.structure(),
src.structure().series().monoid(), dst, m);
......@@ -204,7 +205,8 @@ namespace vcsn
image_dispatch2(const Element<S,T>& src,
const TransducerBase<ST>&)
{
typename output_projection_helper<S, T>::ret dst = make_output_projection_automaton(src);
typename output_projection_helper<S, T>::ret dst =
output_projection_helper<S, T>::make_output_projection_automaton(src);
image_dispatch(src, src.structure(),
src.structure().series().monoid(), dst);
......
......@@ -78,6 +78,8 @@ namespace vcsn {
{
typedef Transducer<S> structure_t;
typedef Element<structure_t, T> automaton_t;
typedef typename structure_t::series_set_t::semiring_t
typeof_auto_series_set_t;
......@@ -91,6 +93,8 @@ namespace vcsn {
typedef typename input_projection_traits<T>::ret auto_impl_t;
typedef Element<Automata<auto_series_set_t>, auto_impl_t> ret;
static ret make_input_projection_automaton(const automaton_t& t);
};
template <class S, class T>
......@@ -98,6 +102,8 @@ namespace vcsn {
{
typedef Automata<S> structure_t;
typedef Element<structure_t, T> automaton_t;
typedef typename structure_t::series_set_t typeof_auto_series_set_t;
typedef typename structure_t::series_set_t::semiring_t auto_semiring_t;
......@@ -112,6 +118,8 @@ namespace vcsn {
typedef typename fmp_input_projection_traits<T>::ret auto_impl_t;
typedef Element<Automata<auto_series_set_t>, auto_impl_t> ret;
static ret make_input_projection_automaton(const automaton_t& t);
};
/*-------------------------.
......@@ -128,6 +136,8 @@ namespace vcsn {
{
typedef Transducer<S> structure_t;
typedef Element<structure_t, T> automaton_t;
typedef typename structure_t::series_set_t::semiring_t
typeof_auto_series_set_t;
......@@ -142,6 +152,8 @@ namespace vcsn {
typedef typename output_projection_traits<T>::ret auto_impl_t;
typedef Element<Automata<auto_series_set_t>, auto_impl_t> ret;
static ret make_output_projection_automaton(const automaton_t& t);
};
// FMP Transducers
......@@ -153,6 +165,8 @@ namespace vcsn {
{
typedef Automata<S> structure_t;
typedef Element<structure_t, T> automaton_t;
typedef typename structure_t::series_set_t typeof_auto_series_set_t;
typedef typename structure_t::series_set_t::monoid_t::second_monoid_t
......@@ -166,6 +180,8 @@ namespace vcsn {
typedef typename fmp_output_projection_traits<T>::ret auto_impl_t;
typedef Element<Automata<auto_series_set_t>, auto_impl_t> ret;
static ret make_output_projection_automaton(const automaton_t& t);
};
/*----------------.
......
......@@ -2,7 +2,7 @@
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 The Vaucanson Group.
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 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
......@@ -41,6 +41,80 @@ namespace vcsn {
return & lhs.series() == & rhs.series();
}
//
// Projections for RW transducers
//
template <typename S, typename T>
inline typename input_projection_helper<Transducer<S>, T>::ret
input_projection_helper<Transducer<S>, T>::
make_input_projection_automaton(const Element<Transducer<S>, T>& t)
{
// Type helpers.
typedef typename ret::set_t set_t;
typedef typename set_t::series_set_t series_set_t;
set_t
auto_set(series_set_t(t.structure().series().
semiring().semiring(), t.structure().
series().monoid()));
return ret(auto_set);
}
template <typename S, typename T>
inline typename output_projection_helper<Transducer<S>, T>::ret
output_projection_helper<Transducer<S>, T>::
make_output_projection_automaton(const Element<Transducer<S>, T>& t)
{
// Type helpers.
typedef typename ret::set_t set_t;
typedef typename set_t::series_set_t series_set_t;
set_t
auto_set(series_set_t(t.structure().series().semiring()));
return ret(auto_set);
}
//
// Projections for FMP transducers
//
template <typename S, typename T>
inline typename input_projection_helper<Automata<S>, T>::ret
input_projection_helper<Automata<S>, T>::
make_input_projection_automaton(const Element<Automata<S>, T>& t)
{
// Type helpers.
typedef typename ret::set_t set_t;
typedef typename set_t::series_set_t series_set_t;
set_t
auto_set(series_set_t(t.structure().series().
semiring(), t.structure().series().
monoid().first_monoid()));
return ret(auto_set);
}
template <typename S, typename T>
inline typename output_projection_helper<Automata<S>, T>::ret
output_projection_helper<Automata<S>, T>::
make_output_projection_automaton(const Element<Automata<S>, T>& t)
{
// Type helpers.
typedef typename ret::set_t set_t;
typedef typename set_t::series_set_t series_set_t;
set_t
auto_set(series_set_t(t.structure().series().
semiring(), t.structure().series().
monoid().second_monoid()));
return ret(auto_set);
}
template <class S, class T>
typename identity_transducer_helper<S, T>::ret
partial_identity(const Element<S, T>& a)
......
......@@ -38,14 +38,6 @@ namespace vcsn
const SecondInputIterator second_begin,
const SecondInputIterator second_end);
template <typename S, typename T>
input_projection_automaton_t
make_input_projection_automaton(const Element<S, T>& t);
template <typename S, typename T>
output_projection_automaton_t
make_output_projection_automaton(const Element<S, T>& t);
template <class T1, class T2>
monoid_elt_t make_couple(const T1& first_alphabet,
const T2& second_alphabet,
......
......@@ -73,32 +73,6 @@ namespace vcsn
second_alphabet.begin(), second_alphabet.end());
}
template <typename S, typename T>
input_projection_automaton_t
make_input_projection_automaton(const Element<S, T>& transducer)
{
typedef input_projection_automaton_t::set_t set_t;
typedef set_t::series_set_t series_set_t;
set_t
auto_set(series_set_t(transducer.structure().series().
semiring(), transducer.structure().series().
monoid().first_monoid()));
return input_projection_automaton_t(auto_set);
}
template <typename S, typename T>
output_projection_automaton_t
make_output_projection_automaton(const Element<S, T>& transducer)
{
typedef output_projection_automaton_t::set_t set_t;
typedef set_t::series_set_t series_set_t;
set_t
auto_set(series_set_t(transducer.structure().series().
semiring(), transducer.structure().series().
monoid().second_monoid()));
return output_projection_automaton_t(auto_set);
}
template <class FirstIterator, class SecondIterator>
monoid_elt_t make_couple(const FirstIterator first_begin,
const FirstIterator first_end,
......
......@@ -42,14 +42,6 @@ namespace vcsn
InputIterator output_alphabet_begin,
InputIterator output_alphabet_end);
template <typename S, typename T>
input_projection_automaton_t
make_input_projection_automaton(const Element<S, T>& t);
template <typename S, typename T>
output_projection_automaton_t
make_output_projection_automaton(const Element<S, T>& t);
template <typename TransStruct,
typename TransImpl,
typename ArgStruct,
......
......@@ -79,30 +79,6 @@ namespace vcsn
output_alphabet.end());
}
template <typename S, typename T>
input_projection_automaton_t
make_input_projection_automaton(const Element<S, T>& transducer)
{
typedef input_projection_automaton_t::set_t set_t;
typedef set_t::series_set_t series_set_t;
set_t
auto_set(series_set_t(transducer.structure().series().
semiring().semiring(), transducer.structure().
series().monoid()));
return input_projection_automaton_t(auto_set);
}
template <typename S, typename T>
output_projection_automaton_t
make_output_projection_automaton(const Element<S, T>& transducer)
{
typedef output_projection_automaton_t::set_t set_t;
typedef set_t::series_set_t series_set_t;
set_t
auto_set(series_set_t(transducer.structure().series().semiring()));
return output_projection_automaton_t(auto_set);
}
template <typename TransStruct,
typename TransImpl,
typename MonoidStruct,
......
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