Commit c4adce42 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Move portions of code in VCSN_GRAPH_IMPL namespace

	This code depends on the graph structure thus it had to be part of the
	VCSN_GRAPH_IMPL namespace.
	Some declarations also needed to have the VCSN_GRAPH_IMPL namespace
	specified.

	* include/vaucanson/algebra/implementation/series/krat.hxx: .
	* include/vaucanson/automata/implementation/generalized.hh: .
	* include/vaucanson/automata/implementation/legacy_graph_impl.hh: .
	* include/vaucanson/automata/implementation/legacy_graph_impl.hxx: .
	* include/vaucanson/contexts/fmp_transducer_maker.thh: .
	* include/vaucanson/contexts/fmp_transducer_maker.thxx: .
	* include/vaucanson/contexts/generic_automaton_impl.thh: .
	* include/vaucanson/contexts/transducer_maker.thh: .
	* include/vaucanson/contexts/transducer_maker.thxx: .
parent ee477f5f
2007-10-12 Guillaume Lazzara <z@lrde.epita.fr>
Move portions of code in VCSN_GRAPH_IMPL namespace
This code depends on the graph structure thus it had to be part of the
VCSN_GRAPH_IMPL namespace.
Some declarations also needed to have the VCSN_GRAPH_IMPL namespace
specified.
* include/vaucanson/algebra/implementation/series/krat.hxx: .
* include/vaucanson/automata/implementation/generalized.hh: .
* include/vaucanson/automata/implementation/legacy_graph_impl.hh: .
* include/vaucanson/automata/implementation/legacy_graph_impl.hxx: .
* include/vaucanson/contexts/fmp_transducer_maker.thh: .
* include/vaucanson/contexts/fmp_transducer_maker.thxx: .
* include/vaucanson/contexts/generic_automaton_impl.thh: .
* include/vaucanson/contexts/transducer_maker.thh: .
* include/vaucanson/contexts/transducer_maker.thxx: .
2007-10-12 Guillaume Lazzara <z@lrde.epita.fr>
Introduce a third graph structure
......
......@@ -618,7 +618,7 @@ namespace vcsn {
typedef typename algebra::Series<W,M> series_set_t;
typedef typename algebra::polynom<Tm, Tw> series_set_elt_value_t;
typedef typename rat::exp<Tm, Tw> exp_t;
typedef Graph
typedef VCSN_GRAPH_IMPL::Graph
<
labels_are_series,
Tm,
......
......@@ -48,7 +48,7 @@ namespace vcsn {
typedef vcsn::Element
<vcsn::Automata<series_set_t>,
Graph<labels_are_series,
VCSN_GRAPH_IMPL::Graph<labels_are_series,
monoid_elt_value_t,
semiring_elt_value_t,
rat::exp<monoid_elt_value_t, semiring_elt_value_t>,
......
......@@ -23,44 +23,45 @@
namespace vcsn
{
VCSN_CONTEXT_NAMESPACE
namespace VCSN_GRAPH_IMPL
{
VCSN_CONTEXT_NAMESPACE
{
template <class T1, class T2>
automaton_t make_automaton(const T1& first_alphabet,
const T2& second_alphabet);
template <class FirstInputIterator, class SecondInputIterator>
automaton_t make_automaton(const FirstInputIterator first_begin,
const FirstInputIterator first_end,
const SecondInputIterator second_begin,
const SecondInputIterator second_end);
template <class T1, class T2>
automaton_t make_automaton(const T1& first_alphabet,
const T2& second_alphabet);
template <class T1, class T2>
monoid_elt_t make_couple(const T1& first_alphabet,
const T2& second_alphabet,
const std::string& first_exp = "",
const std::string& second_exp = "");
template <class FirstInputIterator, class SecondInputIterator>
automaton_t make_automaton(const FirstInputIterator first_begin,
const FirstInputIterator first_end,
const SecondInputIterator second_begin,
const SecondInputIterator second_end);
template <class FirstIterator, class SecondIterator>
monoid_elt_t make_couple(const FirstIterator first_begin,
const FirstIterator first_end,
const SecondIterator second_begin,
const SecondIterator second_end,
const std::string& first_exp,
const std::string& second_exp);
template <class T1, class T2>
monoid_elt_t make_couple(const T1& first_alphabet,
const T2& second_alphabet,
const std::string& first_exp = "",
const std::string& second_exp = "");
template <typename TransStruct,
typename TransImpl,
typename ArgStruct,
typename ArgImpl>
AUTOMATON_CONTEXT::rat_exp_t
evaluation(const Element<TransStruct, TransImpl>& t,
const Element<ArgStruct, ArgImpl>& input);
template <class FirstIterator, class SecondIterator>
monoid_elt_t make_couple(const FirstIterator first_begin,
const FirstIterator first_end,
const SecondIterator second_begin,
const SecondIterator second_end,
const std::string& first_exp,
const std::string& second_exp);
} // End of VCSN_CONTEXT_NAMESPACE.
template <typename TransStruct,
typename TransImpl,
typename ArgStruct,
typename ArgImpl>
AUTOMATON_CONTEXT::rat_exp_t
evaluation(const Element<TransStruct, TransImpl>& t,
const Element<ArgStruct, ArgImpl>& input);
} // End of VCSN_CONTEXT_NAMESPACE.
} // End of VCSN_GRAPH_IMPL
} // End of namespace vcsn.
# include <vaucanson/contexts/fmp_transducer_maker.thxx>
......
......@@ -29,121 +29,125 @@
namespace vcsn
{
VCSN_CONTEXT_NAMESPACE
namespace VCSN_GRAPH_IMPL
{
template <class FirstInputIterator, class SecondInputIterator>
automata_set_t make_automata_set(const FirstInputIterator first_begin,
const FirstInputIterator first_end,
const SecondInputIterator second_begin,
const SecondInputIterator second_end)
{
first_alphabet_t first_alpha;
for (FirstInputIterator e = first_begin; e != first_end; ++e)
first_alpha.insert(*e);
second_alphabet_t second_alpha;
for (SecondInputIterator e = second_begin; e != second_end; ++e)
second_alpha.insert(*e);
semiring_t semiring;
monoid_t freemonoidproduct (first_alpha, second_alpha);
series_set_t series (semiring, freemonoidproduct);
return automata_set_t (series);
}
template <class FirstInputIterator, class SecondInputIterator>
automaton_t make_automaton(const FirstInputIterator first_begin,
const FirstInputIterator first_end,
const SecondInputIterator second_begin,
const SecondInputIterator second_end)
{
return automaton_t (make_automata_set(first_begin, first_end,
second_begin, second_end));
}
template <class T1, class T2>
automaton_t make_automaton(const T1& first_alphabet,
const T2& second_alphabet)
VCSN_CONTEXT_NAMESPACE
{
return make_automaton(first_alphabet.begin(), first_alphabet.end(),
second_alphabet.begin(), second_alphabet.end());
}
template <class FirstIterator, class SecondIterator>
monoid_elt_t make_couple(const FirstIterator first_begin,
const FirstIterator first_end,
const SecondIterator second_begin,
const SecondIterator second_end,
const std::string& first_exp,
const std::string& second_exp)
{
first_alphabet_t first_alpha;
for (FirstIterator e = first_begin; e != first_end; ++e)
first_alpha.insert(*e);
second_alphabet_t second_alpha;
for (SecondIterator e = second_begin; e != second_end; ++e)
second_alpha.insert(*e);
monoid_t fmp (first_alpha, second_alpha);
monoid_elt_value_t fmp_elt_value (first_exp, second_exp);
return Element<monoid_t, monoid_elt_value_t> (fmp, fmp_elt_value);
}
template <class T1, class T2>
monoid_elt_t make_couple(const T1& first_alphabet,
const T2& second_alphabet,
const std::string& first_exp,
const std::string& second_exp)
{
return make_couple(first_alphabet.begin(), first_alphabet.end(),
second_alphabet.begin(), second_alphabet.end(),
first_exp, second_exp);
}
template <typename TransStruct,
typename TransImpl,
typename SeriesStruct,
typename SeriesImpl,
typename S,
typename T>
AUTOMATON_CONTEXT::rat_exp_t
do_evaluation(const vcsn::AutomataBase<TransStruct>&,
const TransImpl&,
const SeriesStruct&,
const vcsn::rat::exp<S, T>& input,
const Element<TransStruct, TransImpl>& t,
const Element<SeriesStruct, SeriesImpl>&)
{
AUTOMATON_CONTEXT::automaton_t w = AUTOMATON_CONTEXT::make_automaton(t.structure().series()
.monoid().first_monoid().alphabet());
AUTOMATON_CONTEXT::automaton_t result = AUTOMATON_CONTEXT::make_automaton(t.structure().series()
.monoid().second_monoid().alphabet());
standard_of(w, input);
evaluation_fmp(t, quotient(w), result);
return aut_to_exp(generalized(quotient(realtime(trim(result)))),
DMChooser());
}
template <typename TransStruct,
typename TransImpl,
typename ArgStruct,
typename ArgImpl>
AUTOMATON_CONTEXT::rat_exp_t
evaluation(const Element<TransStruct, TransImpl>& t,
const Element<ArgStruct, ArgImpl>& input)
{
return do_evaluation(t.structure(), t.value(),
input.structure(), input.value(),
t, input);
}
} // End of VCSN_CONTEXT_NAMESPACE.
template <class FirstInputIterator, class SecondInputIterator>
automata_set_t make_automata_set(const FirstInputIterator first_begin,
const FirstInputIterator first_end,
const SecondInputIterator second_begin,
const SecondInputIterator second_end)
{
first_alphabet_t first_alpha;
for (FirstInputIterator e = first_begin; e != first_end; ++e)
first_alpha.insert(*e);
second_alphabet_t second_alpha;
for (SecondInputIterator e = second_begin; e != second_end; ++e)
second_alpha.insert(*e);
semiring_t semiring;
monoid_t freemonoidproduct (first_alpha, second_alpha);
series_set_t series (semiring, freemonoidproduct);
return automata_set_t (series);
}
template <class FirstInputIterator, class SecondInputIterator>
automaton_t make_automaton(const FirstInputIterator first_begin,
const FirstInputIterator first_end,
const SecondInputIterator second_begin,
const SecondInputIterator second_end)
{
return automaton_t (make_automata_set(first_begin, first_end,
second_begin, second_end));
}
template <class T1, class T2>
automaton_t make_automaton(const T1& first_alphabet,
const T2& second_alphabet)
{
return make_automaton(first_alphabet.begin(), first_alphabet.end(),
second_alphabet.begin(), second_alphabet.end());
}
template <class FirstIterator, class SecondIterator>
monoid_elt_t make_couple(const FirstIterator first_begin,
const FirstIterator first_end,
const SecondIterator second_begin,
const SecondIterator second_end,
const std::string& first_exp,
const std::string& second_exp)
{
first_alphabet_t first_alpha;
for (FirstIterator e = first_begin; e != first_end; ++e)
first_alpha.insert(*e);
second_alphabet_t second_alpha;
for (SecondIterator e = second_begin; e != second_end; ++e)
second_alpha.insert(*e);
monoid_t fmp (first_alpha, second_alpha);
monoid_elt_value_t fmp_elt_value (first_exp, second_exp);
return Element<monoid_t, monoid_elt_value_t> (fmp, fmp_elt_value);
}
template <class T1, class T2>
monoid_elt_t make_couple(const T1& first_alphabet,
const T2& second_alphabet,
const std::string& first_exp,
const std::string& second_exp)
{
return make_couple(first_alphabet.begin(), first_alphabet.end(),
second_alphabet.begin(), second_alphabet.end(),
first_exp, second_exp);
}
template <typename TransStruct,
typename TransImpl,
typename SeriesStruct,
typename SeriesImpl,
typename S,
typename T>
AUTOMATON_CONTEXT::rat_exp_t
do_evaluation(const vcsn::AutomataBase<TransStruct>&,
const TransImpl&,
const SeriesStruct&,
const vcsn::rat::exp<S, T>& input,
const Element<TransStruct, TransImpl>& t,
const Element<SeriesStruct, SeriesImpl>&)
{
AUTOMATON_CONTEXT::automaton_t w = AUTOMATON_CONTEXT::make_automaton(t.structure().series()
.monoid().first_monoid().alphabet());
AUTOMATON_CONTEXT::automaton_t result = AUTOMATON_CONTEXT::make_automaton(t.structure().series()
.monoid().second_monoid().alphabet());
standard_of(w, input);
evaluation_fmp(t, quotient(w), result);
return aut_to_exp(generalized(quotient(realtime(trim(result)))),
DMChooser());
}
template <typename TransStruct,
typename TransImpl,
typename ArgStruct,
typename ArgImpl>
AUTOMATON_CONTEXT::rat_exp_t
evaluation(const Element<TransStruct, TransImpl>& t,
const Element<ArgStruct, ArgImpl>& input)
{
return do_evaluation(t.structure(), t.value(),
input.structure(), input.value(),
t, input);
}
} // End of VCSN_CONTEXT_NAMESPACE.
} // End of VCSN_GRAPH_IMPL.
} // End of namespace vcsn.
......@@ -31,7 +31,7 @@ namespace vcsn
VCSN_CONTEXT_NAMESPACE
{
typedef vcsn::Graph<
typedef vcsn::VCSN_GRAPH_IMPL::Graph<
labels_are_series,
series_set_elt_t::value_t::monoid_elt_value_t,
series_set_elt_t::value_t::semiring_elt_value_t,
......
......@@ -26,30 +26,31 @@
namespace vcsn
{
VCSN_CONTEXT_NAMESPACE
namespace VCSN_GRAPH_IMPL
{
template <class T>
automaton_t make_automaton(const T& input_alphabet,
const T& output_alphabet);
template <class InputIterator>
automaton_t make_automaton(InputIterator input_alphabet_begin,
InputIterator input_alphabet_end,
InputIterator output_alphabet_begin,
InputIterator output_alphabet_end);
template <typename TransStruct,
typename TransImpl,
typename ArgStruct,
typename ArgImpl>
output_series_set_elt_t
evaluation(const Element<TransStruct, TransImpl>& t,
const Element<ArgStruct, ArgImpl>& input);
} // End of VCSN_CONTEXT_NAMESPACE.
VCSN_CONTEXT_NAMESPACE
{
template <class T>
automaton_t make_automaton(const T& input_alphabet,
const T& output_alphabet);
template <class InputIterator>
automaton_t make_automaton(InputIterator input_alphabet_begin,
InputIterator input_alphabet_end,
InputIterator output_alphabet_begin,
InputIterator output_alphabet_end);
template <typename TransStruct,
typename TransImpl,
typename ArgStruct,
typename ArgImpl>
output_series_set_elt_t
evaluation(const Element<TransStruct, TransImpl>& t,
const Element<ArgStruct, ArgImpl>& input);
} // End of VCSN_CONTEXT_NAMESPACE.
} // End of VCSN_GRAPH_IMPL
} // End of namespace vcsn.
#include <vaucanson/contexts/transducer_maker.thxx>
......
......@@ -30,105 +30,108 @@
namespace vcsn
{
VCSN_CONTEXT_NAMESPACE
namespace VCSN_GRAPH_IMPL
{
/*-----------------.
| make_automaton() |
`-----------------*/
template <class InputIterator>
automaton_t
make_automaton(InputIterator input_alphabet_begin,
InputIterator input_alphabet_end,
InputIterator output_alphabet_begin,
InputIterator output_alphabet_end)
{
alphabet_t input_alpha;
alphabet_t output_alpha;
for (InputIterator e = input_alphabet_begin;
e != input_alphabet_end; ++e)
input_alpha.insert(*e);
for (InputIterator e = output_alphabet_begin;
e != output_alphabet_end; ++e)
output_alpha.insert(*e);
monoid_t output_freemonoid (output_alpha);
typename output_series_set_t::semiring_t semiring;
output_series_set_t output_series (semiring, output_freemonoid);
monoid_t freemonoid (input_alpha);
series_set_t series (output_series, freemonoid);
automata_set_t automata_set (series);
return automaton_t (automata_set);
}
template <class T>
automaton_t make_automaton(const T& input_alphabet,
const T& output_alphabet)
{
return make_automaton(input_alphabet.begin(),
input_alphabet.end(),
output_alphabet.begin(),
output_alphabet.end());
}
template <typename TransStruct,
typename TransImpl,
typename MonoidStruct,
typename MonoidImpl>
output_series_set_elt_t
do_evaluation(const vcsn::TransducerBase<TransStruct>&,
const TransImpl&,
const vcsn::algebra::FreeMonoidBase<MonoidStruct>&,
const MonoidImpl& input,
const Element<TransStruct, TransImpl>& t,
const Element<MonoidStruct, MonoidImpl>&)
VCSN_CONTEXT_NAMESPACE
{
return eval(t, input);
}
template <typename TransStruct,
typename TransImpl,
typename SeriesStruct,
typename SeriesImpl,
typename S,
typename T>
output_series_set_elt_t
do_evaluation(const vcsn::TransducerBase<TransStruct>&,
const TransImpl&,
const SeriesStruct&,
const vcsn::rat::exp<S, T>& input,
const Element<TransStruct, TransImpl>& t,
const Element<SeriesStruct, SeriesImpl>&)
{
AUTOMATON_CONTEXT::automaton_t w = AUTOMATON_CONTEXT::make_automaton(t.structure().series().monoid().alphabet());
AUTOMATON_CONTEXT::gen_automaton_t result (w.structure());
standard_of(w, input);
evaluation(quotient(w), t, result);
return aut_to_exp(quotient(realtime(trim(result))), DMChooser());
}
template <typename TransStruct,
typename TransImpl,
typename ArgStruct,
typename ArgImpl>
output_series_set_elt_t
evaluation(const Element<TransStruct, TransImpl>& t,
const Element<ArgStruct, ArgImpl>& input)
{
return do_evaluation(t.structure(), t.value(),
input.structure(), input.value(),
t, input);
}
} // End of VCSN_CONTEXT_NAMESPACE.
/*-----------------.
| make_automaton() |
`-----------------*/
template <class InputIterator>
automaton_t
make_automaton(InputIterator input_alphabet_begin,
InputIterator input_alphabet_end,
InputIterator output_alphabet_begin,
InputIterator output_alphabet_end)
{
alphabet_t input_alpha;
alphabet_t output_alpha;
for (InputIterator e = input_alphabet_begin;
e != input_alphabet_end; ++e)
input_alpha.insert(*e);
for (InputIterator e = output_alphabet_begin;
e != output_alphabet_end; ++e)
output_alpha.insert(*e);
monoid_t output_freemonoid (output_alpha);
typename output_series_set_t::semiring_t semiring;
output_series_set_t output_series (semiring, output_freemonoid);
monoid_t freemonoid (input_alpha);
series_set_t series (output_series, freemonoid);
automata_set_t automata_set (series);
return automaton_t (automata_set);
}
template <class T>
automaton_t make_automaton(const T& input_alphabet,
const T& output_alphabet)
{
return make_automaton(input_alphabet.begin(),
input_alphabet.end(),
output_alphabet.begin(),
output_alphabet.end());
}
template <typename TransStruct,
typename TransImpl,
typename MonoidStruct,
typename MonoidImpl>
output_series_set_elt_t
do_evaluation(const vcsn::TransducerBase<TransStruct>&,
const TransImpl&,
const vcsn::algebra::FreeMonoidBase<MonoidStruct>&,
const MonoidImpl& input,
const Element<TransStruct, TransImpl>& t,
const Element<MonoidStruct, MonoidImpl>&)
{
return eval(t, input);
}
template <typename TransStruct,
typename TransImpl,
typename SeriesStruct,
typename SeriesImpl,
typename S,
typename T>
output_series_set_elt_t
do_evaluation(const vcsn::TransducerBase<TransStruct>&,
const TransImpl&,
const SeriesStruct&,
const vcsn::rat::exp<S, T>& input,
const Element<TransStruct, TransImpl>& t,
const Element<SeriesStruct, SeriesImpl>&)
{
AUTOMATON_CONTEXT::automaton_t w = AUTOMATON_CONTEXT::make_automaton(t.structure().series().monoid().alphabet());
AUTOMATON_CONTEXT::gen_automaton_t result (w.structure());
standard_of(w, input);
evaluation(quotient(w), t, result);
return aut_to_exp(quotient(realtime(trim(result))), DMChooser());
}
template <typename TransStruct,
typename TransImpl,
typename ArgStruct,
typename ArgImpl>
output_series_set_elt_t
evaluation(const Element<TransStruct, TransImpl>& t,
const Element<ArgStruct, ArgImpl>& input)
{
return do_evaluation(t.structure(), t.value(),