Commit f9af330b authored by Jerome Galtier's avatar Jerome Galtier
Browse files

Improve support representation in automaton makers.

	* include/vaucanson/contexts/automaton_maker.thh,
	* include/vaucanson/contexts/automaton_maker.thxx,
	* include/vaucanson/contexts/fmp_transducer_maker.thh,
	* include/vaucanson/contexts/fmp_transducer_maker.thxx: Add whenever
	  necessary arguments to `make_automaton' for passing `monoid_rep_t'
	  and `series_rep_t' structures (and their corresponding default
	  arguments).
parent bf6e97eb
2008-11-10 Jerome Galtier <jerome.galtier@lrde.epita.fr>
Improve support representation in automaton makers.
* include/vaucanson/contexts/automaton_maker.thh,
* include/vaucanson/contexts/automaton_maker.thxx,
* include/vaucanson/contexts/fmp_transducer_maker.thh,
* include/vaucanson/contexts/fmp_transducer_maker.thxx: Add whenever
necessary arguments to `make_automaton' for passing `monoid_rep_t'
and `series_rep_t' structures (and their corresponding default
arguments).
2008-11-10 Jerome Galtier <jerome.galtier@lrde.epita.fr>
 
Add the specialization for int based monoid representations.
......
......@@ -28,11 +28,23 @@ namespace vcsn
VCSN_CONTEXT_NAMESPACE
{
template <class T>
automaton_t make_automaton(const T& alphabet);
automaton_t make_automaton(const T& alphabet,
const monoid_rep_t& mrep = *(vcsn::algebra::
monoid_rep_default<monoid_t>::
get_instance()),
const series_rep_t& srep = *(vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()));
template <class InputIterator>
automaton_t make_automaton(InputIterator begin,
InputIterator end);
InputIterator end,
const monoid_rep_t& mrep = *(vcsn::algebra::
monoid_rep_default<monoid_t>::
get_instance()),
const series_rep_t& srep = *(vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()));
template <class T>
automaton_letter_t make_automaton_letter(const T& alphabet);
......@@ -52,28 +64,28 @@ namespace vcsn
rat_exp_t
make_rat_exp(const Iterator& begin,
const Iterator& end,
const std::string& exp = vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()->zero,
const std::string& exp = (vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()->zero),
const monoid_rep_t& mrep = *(vcsn::algebra::
monoid_rep_default<monoid_t>::
get_instance()),
monoid_rep_default<monoid_t>::
get_instance()),
const series_rep_t& srep = *(vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()));
series_rep_default<semiring_t, monoid_t>::
get_instance()));
template <class T>
rat_exp_t
make_rat_exp(const T& alphabet,
const std::string& exp = vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()->zero,
const std::string& exp = (vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()->zero),
const monoid_rep_t& mrep = *(vcsn::algebra::
monoid_rep_default<monoid_t>::
get_instance()),
monoid_rep_default<monoid_t>::
get_instance()),
const series_rep_t& srep = *(vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()));
series_rep_default<semiring_t, monoid_t>::
get_instance()));
template <class SeriesSet, class SeriesImpl>
automaton_t
......
......@@ -38,30 +38,48 @@ namespace vcsn
template <class InputIterator>
automata_set_t
make_automata_set(InputIterator begin,
InputIterator end)
InputIterator end,
const monoid_rep_t& mrep = *(vcsn::algebra::
monoid_rep_default<monoid_t>::
get_instance()),
const series_rep_t& srep = *(vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()))
{
alphabet_t alpha;
for (InputIterator e = begin; e != end; ++e)
alpha.insert(*e);
semiring_t semiring;
monoid_t freemonoid (alpha);
series_set_t series (semiring, freemonoid);
monoid_t freemonoid (alpha, mrep);
series_set_t series (semiring, freemonoid, srep);
return automata_set_t (series);
}
template <class InputIterator>
automaton_t
make_automaton(InputIterator begin,
InputIterator end)
InputIterator end,
const monoid_rep_t& mrep = *(vcsn::algebra::
monoid_rep_default<monoid_t>::
get_instance()),
const series_rep_t& srep = *(vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()))
{
return automaton_t (make_automata_set(begin, end));
return automaton_t (make_automata_set(begin, end, mrep, srep));
}
template <class T>
automaton_t
make_automaton(const T& alphabet)
make_automaton(const T& alphabet,
const monoid_rep_t& mrep = *(vcsn::algebra::
monoid_rep_default<monoid_t>::
get_instance()),
const series_rep_t& srep = *(vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()))
{
return make_automaton(alphabet.begin(), alphabet.end());
return make_automaton(alphabet.begin(), alphabet.end(), mrep, srep);
}
template <class InputIterator>
......@@ -102,15 +120,15 @@ namespace vcsn
rat_exp_t
make_rat_exp(const Iterator& begin,
const Iterator& end,
const std::string& exp = vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()->zero,
const std::string& exp = (vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()->zero),
const monoid_rep_t& mrep = *(vcsn::algebra::
monoid_rep_default<monoid_t>::
get_instance()),
monoid_rep_default<monoid_t>::
get_instance()),
const series_rep_t& srep = *(vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()))
series_rep_default<semiring_t, monoid_t>::
get_instance()))
{
alphabet_t alphabet;
for (Iterator i = begin; i != end; ++i)
......@@ -130,15 +148,15 @@ namespace vcsn
template <class T>
rat_exp_t
make_rat_exp(const T& alphabet,
const std::string& exp = vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()->zero,
const std::string& exp = (vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()->zero),
const monoid_rep_t& mrep = *(vcsn::algebra::
monoid_rep_default<monoid_t>::
get_instance()),
monoid_rep_default<monoid_t>::
get_instance()),
const series_rep_t& srep = *(vcsn::algebra::
series_rep_default<semiring_t, monoid_t>::
get_instance()))
series_rep_default<semiring_t, monoid_t>::
get_instance()))
{
return make_rat_exp(alphabet.begin(), alphabet.end(),
exp, mrep, srep);
......
......@@ -27,16 +27,39 @@ namespace vcsn
{
VCSN_CONTEXT_NAMESPACE
{
template <class T1, class T2>
automaton_t make_automaton(const T1& first_alphabet,
const T2& second_alphabet);
const T2& second_alphabet,
const monoid_rep_t& mrep =
*(vcsn::algebra::monoid_rep_default<monoid_t>::get_instance()),
const first_monoid_rep_t& mrep1 =
*(vcsn::algebra::monoid_rep_default<first_monoid_t>::get_instance()),
const second_monoid_rep_t& mrep2 =
*(vcsn::algebra::monoid_rep_default<second_monoid_t>::get_instance()),
const series_rep_t& srep =
*(vcsn::algebra::series_rep_default<semiring_t, monoid_t>::get_instance()),
const first_series_rep_t& srep1 =
*(vcsn::algebra::series_rep_default<semiring_t, first_monoid_t>::get_instance()),
const second_series_rep_t& srep2 =
*(vcsn::algebra::series_rep_default<semiring_t, second_monoid_t>::get_instance()));
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);
const FirstInputIterator first_end,
const SecondInputIterator second_begin,
const SecondInputIterator second_end,
const monoid_rep_t& mrep =
*(vcsn::algebra::monoid_rep_default<monoid_t>::get_instance()),
const first_monoid_rep_t& mrep1 =
*(vcsn::algebra::monoid_rep_default<first_monoid_t>::get_instance()),
const second_monoid_rep_t& mrep2 =
*(vcsn::algebra::monoid_rep_default<second_monoid_t>::get_instance()),
const series_rep_t& srep =
*(vcsn::algebra::series_rep_default<semiring_t, monoid_t>::get_instance()),
const first_series_rep_t& srep1 =
*(vcsn::algebra::series_rep_default<semiring_t, first_monoid_t>::get_instance()),
const second_series_rep_t& srep2 =
*(vcsn::algebra::series_rep_default<semiring_t, second_monoid_t>::get_instance()));
template <class T1, class T2>
monoid_elt_t make_couple(const T1& first_alphabet,
......
......@@ -36,9 +36,21 @@ namespace vcsn
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)
const FirstInputIterator first_end,
const SecondInputIterator second_begin,
const SecondInputIterator second_end,
const monoid_rep_t& mrep =
*(vcsn::algebra::monoid_rep_default<monoid_t>::get_instance()),
const first_monoid_rep_t& mrep1 =
*(vcsn::algebra::monoid_rep_default<first_monoid_t>::get_instance()),
const second_monoid_rep_t& mrep2 =
*(vcsn::algebra::monoid_rep_default<second_monoid_t>::get_instance()),
const series_rep_t& srep =
*(vcsn::algebra::series_rep_default<semiring_t, monoid_t>::get_instance()),
const first_series_rep_t& srep1 =
*(vcsn::algebra::series_rep_default<semiring_t, first_monoid_t>::get_instance()),
const second_series_rep_t& srep2 =
*(vcsn::algebra::series_rep_default<semiring_t, second_monoid_t>::get_instance()))
{
first_alphabet_t first_alpha;
for (FirstInputIterator e = first_begin; e != first_end; ++e)
......@@ -49,28 +61,58 @@ namespace vcsn
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);
first_monoid_t mA(first_alpha, mrep1);
second_monoid_t mB(second_alpha, mrep2);
monoid_t freemonoidproduct(mA, mB, mrep);
// FIXME: srep1 and srep2 cannot be used.
series_set_t series(semiring, freemonoidproduct, srep);
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)
const FirstInputIterator first_end,
const SecondInputIterator second_begin,
const SecondInputIterator second_end,
const monoid_rep_t& mrep =
*(vcsn::algebra::monoid_rep_default<monoid_t>::get_instance()),
const first_monoid_rep_t& mrep1 =
*(vcsn::algebra::monoid_rep_default<first_monoid_t>::get_instance()),
const second_monoid_rep_t& mrep2 =
*(vcsn::algebra::monoid_rep_default<second_monoid_t>::get_instance()),
const series_rep_t& srep =
*(vcsn::algebra::series_rep_default<semiring_t, monoid_t>::get_instance()),
const first_series_rep_t& srep1 =
*(vcsn::algebra::series_rep_default<semiring_t, first_monoid_t>::get_instance()),
const second_series_rep_t& srep2 =
*(vcsn::algebra::series_rep_default<semiring_t, second_monoid_t>::get_instance()))
{
return automaton_t (make_automata_set(first_begin, first_end,
second_begin, second_end));
second_begin, second_end,
mrep, mrep1, mrep2, srep, srep1, srep2));
}
template <class T1, class T2>
automaton_t make_automaton(const T1& first_alphabet,
const T2& second_alphabet)
const T2& second_alphabet,
const monoid_rep_t& mrep =
*(vcsn::algebra::monoid_rep_default<monoid_t>::get_instance()),
const first_monoid_rep_t& mrep1 =
*(vcsn::algebra::monoid_rep_default<first_monoid_t>::get_instance()),
const second_monoid_rep_t& mrep2 =
*(vcsn::algebra::monoid_rep_default<second_monoid_t>::get_instance()),
const series_rep_t& srep =
*(vcsn::algebra::series_rep_default<semiring_t, monoid_t>::get_instance()),
const first_series_rep_t& srep1 =
*(vcsn::algebra::series_rep_default<semiring_t, first_monoid_t>::get_instance()),
const second_series_rep_t& srep2 =
*(vcsn::algebra::series_rep_default<semiring_t, second_monoid_t>::get_instance()))
{
return make_automaton(first_alphabet.begin(), first_alphabet.end(),
second_alphabet.begin(), second_alphabet.end());
second_alphabet.begin(), second_alphabet.end(),
mrep, mrep1, mrep2, srep, srep1, srep2);
}
template <class FirstIterator, class SecondIterator>
......
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