Commit 03a6cbf6 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Many functions like make_automaton were declared in

	contexts/*_functions.thh.
	They are now declared in new files: *_maker.t{hh,hxx}.
	These new files are included in the *_structures.hh.

	This patch will be useful for libvcsn-*.
	We may be able to instantiate the make_automaton functions
	in a .cc file to speed up the compilation.


	Include the make_automaton functions in the structures' headers.
	* include/Makefile.am: Add the new files in the list.
	* include/vaucanson/boolean_automaton_structures.hh: .
	* include/vaucanson/boolean_transducer_structures.hh: .
	* include/vaucanson/contexts/automaton_functions.thh: .
	* include/vaucanson/contexts/automaton_functions.thxx: Remove.
	* include/vaucanson/contexts/automaton_maker.thh: New.
	* include/vaucanson/contexts/automaton_maker.thxx: New.
	* include/vaucanson/contexts/fmp_transducer_functions.thh: .
	* include/vaucanson/contexts/fmp_transducer_functions.thxx: Remove.
	* include/vaucanson/contexts/fmp_transducer_maker.thh: New.
	* include/vaucanson/contexts/fmp_transducer_maker.thxx: New.
	* include/vaucanson/contexts/transducer_functions.thh: .
	* include/vaucanson/contexts/transducer_functions.thxx: Remove.
	* include/vaucanson/contexts/transducer_maker.thh: New.
	* include/vaucanson/contexts/transducer_maker.thxx: New.
	* include/vaucanson/fmp_transducer_structures.hh: .
	* include/vaucanson/r_automaton_structures.hh: .
	* include/vaucanson/z_automaton_structures.hh: .
	* include/vaucanson/z_fmp_transducer.hh: .
	* include/vaucanson/z_fmp_transducer_structures.hh: .
	* include/vaucanson/z_transducer_structures.hh: .
parent 1923c904
Many functions like make_automaton were declared in
contexts/*_functions.thh.
They are now declared in new files: *_maker.t{hh,hxx}.
These new files are included in the *_structures.hh.
This patch will be useful for libvcsn-*.
We may be able to instantiate the make_automaton functions
in a .cc file to speed up the compilation.
2007-03-06 Guillaume Lazzara <z@lrde.epita.fr>
Include the make_automaton functions in the structures' headers.
* include/Makefile.am: Add the new files in the list.
* include/vaucanson/boolean_automaton_structures.hh: .
* include/vaucanson/boolean_transducer_structures.hh: .
* include/vaucanson/contexts/automaton_functions.thh: .
* include/vaucanson/contexts/automaton_functions.thxx: Remove.
* include/vaucanson/contexts/automaton_maker.thh: New.
* include/vaucanson/contexts/automaton_maker.thxx: New.
* include/vaucanson/contexts/fmp_transducer_functions.thh: .
* include/vaucanson/contexts/fmp_transducer_functions.thxx: Remove.
* include/vaucanson/contexts/fmp_transducer_maker.thh: New.
* include/vaucanson/contexts/fmp_transducer_maker.thxx: New.
* include/vaucanson/contexts/transducer_functions.thh: .
* include/vaucanson/contexts/transducer_functions.thxx: Remove.
* include/vaucanson/contexts/transducer_maker.thh: New.
* include/vaucanson/contexts/transducer_maker.thxx: New.
* include/vaucanson/fmp_transducer_structures.hh: .
* include/vaucanson/r_automaton_structures.hh: .
* include/vaucanson/z_automaton_structures.hh: .
* include/vaucanson/z_fmp_transducer.hh: .
* include/vaucanson/z_fmp_transducer_structures.hh: .
* include/vaucanson/z_transducer_structures.hh: .
This patch is the continuation of the patch #1573.
These files were forgotten in the patch #1573.
......
......@@ -57,8 +57,6 @@ vaucanson/misc/misc.hh \
vaucanson/misc/random.hh \
vaucanson/misc/random.hxx \
vaucanson/misc/selectors.hh \
vaucanson/misc/self_iterator.hh \
vaucanson/misc/self_iterator.hxx \
vaucanson/misc/sparse_interval.hh \
vaucanson/misc/sparse_interval.hxx \
vaucanson/misc/special_char_traits.hh \
......@@ -408,22 +406,34 @@ vaucanson/automata/implementation/transpose_view.hxx
nobase_include_HEADERS += \
vaucanson/boolean_automaton.hh \
vaucanson/boolean_automaton_structures.hh \
vaucanson/boolean_transducer.hh \
vaucanson/boolean_transducer_structures.hh \
vaucanson/contexts/automaton_functions.thh \
vaucanson/contexts/automaton_functions.thxx \
vaucanson/contexts/automaton_maker.thh \
vaucanson/contexts/automaton_maker.thxx \
vaucanson/contexts/fmp_transducer_functions.thh \
vaucanson/contexts/fmp_transducer_functions.thxx \
vaucanson/contexts/fmp_transducer_maker.thh \
vaucanson/contexts/fmp_transducer_maker.thxx \
vaucanson/contexts/transducer_functions.thh \
vaucanson/contexts/transducer_functions.thxx \
vaucanson/contexts/transducer_maker.thh \
vaucanson/contexts/transducer_maker.thxx \
vaucanson/fmp_transducer.hh \
vaucanson/fmp_transducer_structures.hh \
vaucanson/r_automaton.hh \
vaucanson/r_automaton_structures.hh \
vaucanson/standard_algorithms.hh \
vaucanson/vaucanson.hh \
vaucanson/z_automaton.hh \
vaucanson/z_automaton_structures.hh \
vaucanson/z_fmp_transducer.hh \
vaucanson/z_fmp_transducer_structures.hh \
vaucanson/z_max_plus_automaton.hh \
vaucanson/z_max_plus_automaton_structures.hh \
vaucanson/z_min_plus_automaton.hh \
vaucanson/z_transducer.hh
vaucanson/z_min_plus_automaton_structures.hh \
vaucanson/z_transducer.hh \
vaucanson/z_transducer_structures.hh
nobase_include_HEADERS += \
vaucanson/xml/XML.hh \
......
......@@ -36,6 +36,8 @@ namespace vcsn
}
}
# include <vaucanson/contexts/automaton_maker.thh>
# undef VCSN_CONTEXT_NAMESPACE
#endif // !VCSN_BOOLEAN_AUTOMATON_STRUCTURES_HH
......@@ -55,6 +55,8 @@ namespace vcsn
} // End of namespace VCSN_CONTEXT_NAMESPACE
} // End of namespace vcsn
# include <vaucanson/contexts/transducer_maker.thh>
# undef AUTOMATON_CONTEXT
# undef VCSN_CONTEXT_NAMESPACE
......
......@@ -25,7 +25,6 @@
#include <vaucanson/misc/usual_macros.hh>
#ifndef VCSN_WITHOUT_ALGORITHM_INCLUDES
# include <vaucanson/algorithms/accessible.hh>
# include <vaucanson/algorithms/complement.hh>
# include <vaucanson/algorithms/complete.hh>
......@@ -50,64 +49,8 @@
# include <vaucanson/algorithms/trim.hh>
# include <vaucanson/algorithms/krat_exp_expand.hh>
#endif // ! VCSN_WITHOUT_ALGORITHM_INCLUDES
#include <vaucanson/algorithms/aut_to_exp.hh>
#include <vaucanson/algorithms/standard_of.hh>
#include <vaucanson/algorithms/thompson.hh>
namespace vcsn
{
VCSN_CONTEXT_NAMESPACE
{
template <class T>
automaton_t make_automaton(const T& alphabet);
template <class InputIterator>
automaton_t make_automaton(InputIterator begin,
InputIterator end);
template <class T>
gen_automaton_t make_gen_automaton(const T& alphabet);
template <class InputIterator>
gen_automaton_t make_gen_automaton(InputIterator begin,
InputIterator end);
template <class Iterator>
rat_exp_t
make_rat_exp(const Iterator& begin,
const Iterator& end,
const std::string& exp = "0");
template <class T>
rat_exp_t
make_rat_exp(const T& alphabet, const std::string& exp = "0");
template <class SeriesSet, class SeriesImpl>
automaton_t
standard_of(const Element<SeriesSet, SeriesImpl>& e);
template <class SeriesSet, class SeriesImpl>
automaton_t
thompson_of(const Element<SeriesSet, SeriesImpl>& e);
rat_exp_t
aut_to_exp(const automaton_t& a);
template <class Chooser>
rat_exp_t
aut_to_exp(const automaton_t& a, const Chooser& c);
} // End of VCSN_CONTEXT_NAMESPACE.
} // End of namespace vcsn.
#ifndef VCSN_USE_INTERFACE_ONLY
# include <vaucanson/contexts/automaton_functions.thxx>
#endif // ! VCSN_USE_INTERFACE_ONLY
// -*- C++ -*-
// automaton_maker.thh: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2007 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.
//
/*
* CPP guard should not be inserted here as
* VCSN_CONTEXT_NAMESPACE could be changed.
*/
namespace vcsn
{
VCSN_CONTEXT_NAMESPACE
{
template <class T>
automaton_t make_automaton(const T& alphabet);
template <class InputIterator>
automaton_t make_automaton(InputIterator begin,
InputIterator end);
template <class T>
gen_automaton_t make_gen_automaton(const T& alphabet);
template <class InputIterator>
gen_automaton_t make_gen_automaton(InputIterator begin,
InputIterator end);
template <class Iterator>
rat_exp_t
make_rat_exp(const Iterator& begin,
const Iterator& end,
const std::string& exp = "0");
template <class T>
rat_exp_t
make_rat_exp(const T& alphabet, const std::string& exp = "0");
template <class SeriesSet, class SeriesImpl>
automaton_t
standard_of(const Element<SeriesSet, SeriesImpl>& e);
template <class SeriesSet, class SeriesImpl>
automaton_t
thompson_of(const Element<SeriesSet, SeriesImpl>& e);
rat_exp_t
aut_to_exp(const automaton_t& a);
template <class Chooser>
rat_exp_t
aut_to_exp(const automaton_t& a, const Chooser& c);
}
}
# include <vaucanson/contexts/automaton_maker.thxx>
// -*- C++ -*-
// automaton_functions.thxx: this file is part of the Vaucanson project.
// automaton_maker.thxx: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2004, 2005, 2006 The Vaucanson Group.
// Copyright (C) 2004, 2005, 2006, 2007 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
......@@ -21,6 +21,11 @@
* VCSN_CONTEXT_NAMESPACE could be changed.
*/
#include <vaucanson/algorithms/krat_exp_expand.hh>
#include <vaucanson/algorithms/aut_to_exp.hh>
#include <vaucanson/algorithms/standard_of.hh>
#include <vaucanson/algorithms/thompson.hh>
namespace vcsn
{
......@@ -32,40 +37,45 @@ namespace vcsn
`-----------------*/
template <class InputIterator>
automata_set_t make_automata_set(InputIterator begin,
InputIterator end)
automata_set_t
make_automata_set(InputIterator begin,
InputIterator end)
{
alphabet_t alpha;
for (InputIterator e = begin; e != end; ++e)
alpha.insert(*e);
semiring_t semiring;
monoid_t freemonoid (alpha);
monoid_t freemonoid (alpha);
series_set_t series (semiring, freemonoid);
return automata_set_t (series);
}
template <class InputIterator>
automaton_t make_automaton(InputIterator begin,
InputIterator end)
automaton_t
make_automaton(InputIterator begin,
InputIterator end)
{
return automaton_t (make_automata_set(begin, end));
}
template <class T>
automaton_t make_automaton(const T& alphabet)
automaton_t
make_automaton(const T& alphabet)
{
return make_automaton(alphabet.begin(), alphabet.end());
}
template <class InputIterator>
gen_automaton_t make_gen_automaton(InputIterator begin,
InputIterator end)
gen_automaton_t
make_gen_automaton(InputIterator begin,
InputIterator end)
{
return gen_automaton_t (make_automata_set(begin, end));
}
template <class T>
gen_automaton_t make_gen_automaton(const T& alphabet)
gen_automaton_t
make_gen_automaton(const T& alphabet)
{
return make_gen_automaton(alphabet.begin(), alphabet.end());
}
......@@ -76,9 +86,10 @@ namespace vcsn
`---------------*/
template <class Iterator>
rat_exp_t make_rat_exp(const Iterator& begin,
const Iterator& end,
const std::string& exp)
rat_exp_t
make_rat_exp(const Iterator& begin,
const Iterator& end,
const std::string& exp)
{
alphabet_t alphabet;
for (Iterator i = begin; i != end; ++i)
......@@ -96,7 +107,8 @@ namespace vcsn
}
template <class T>
rat_exp_t make_rat_exp(const T& alphabet, const std::string& exp)
rat_exp_t
make_rat_exp(const T& alphabet, const std::string& exp)
{
return make_rat_exp(alphabet.begin(), alphabet.end(), exp);
}
......
......@@ -24,7 +24,6 @@
#include <vaucanson/algebra/concept/alphabets_base.hh>
#include <vaucanson/misc/usual_macros.hh>
#ifndef VCSN_WITHOUT_ALGORITHM_INCLUDES
# include <vaucanson/algorithms/composition_cover.hh>
# include <vaucanson/algorithms/eps_removal.hh>
# include <vaucanson/algorithms/evaluation_fmp.hh>
......@@ -35,51 +34,4 @@
# include <vaucanson/algorithms/sub_normalize.hh>
# include <vaucanson/algorithms/transpose.hh>
# include <vaucanson/algorithms/invert.hh>
#endif // ! VCSN_WITHOUT_ALGORITHM_INCLUDES
namespace vcsn
{
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>
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 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 <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 namespace vcsn.
#ifndef VCSN_USE_INTERFACE_ONLY
# include <vaucanson/contexts/fmp_transducer_functions.thxx>
#endif // ! VCSN_USE_INTERFACE_ONLY
// -*- C++ -*-
// fmp_automaton_maker.thh: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2005, 2006 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.
//
/*
* CPP guard should not be inserted here as
* VCSN_CONTEXT_NAMESPACE could be changed.
*/
namespace vcsn
{
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>
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 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 <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 namespace vcsn.
# include <vaucanson/contexts/fmp_transducer_maker.thxx>
// -*- C++ -*-
// fmp_transducer_functions.thxx: this file is part of the Vaucanson project.
// fmp_transducer_maker.thxx: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
......@@ -21,8 +21,8 @@
* VCSN_CONTEXT_NAMESPACE could be changed.
*/
#include <vaucanson/algorithms/evaluation_fmp.hh>
#include <vaucanson/algorithms/minimization_hopcroft.hh>
#include <vaucanson/algorithms/evaluation_fmp.hh>
#include <vaucanson/algorithms/aut_to_exp.hh>
#include <vaucanson/algorithms/trim.hh>
#include <vaucanson/algorithms/realtime.hh>
......@@ -119,12 +119,10 @@ namespace vcsn
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());
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)))),
......
......@@ -21,7 +21,6 @@
* VCSN_CONTEXT_NAMESPACE could be changed.
*/
#ifndef VCSN_WITHOUT_ALGORITHM_INCLUDES
# include <vaucanson/algorithms/eps_removal.hh>
# include <vaucanson/algorithms/evaluation.hh>
# include <vaucanson/algorithms/krat_exp_expand.hh>
......@@ -32,36 +31,4 @@
# include <vaucanson/algorithms/transpose.hh>
# include <vaucanson/algorithms/trim.hh>
# include <vaucanson/algorithms/invert.hh>
#endif // ! VCSN_WITHOUT_ALGORITHM_INCLUDES
namespace vcsn
{
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 namespace vcsn.
#ifndef VCSN_USE_INTERFACE_ONLY
# include <vaucanson/contexts/transducer_functions.thxx>
#endif // ! VCSN_USE_INTERFACE_ONLY
// -*- C++ -*-
// transducer_maker.thh: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2004, 2005, 2006 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.
//
/*
* CPP guard should not be inserted here as
* VCSN_CONTEXT_NAMESPACE could be changed.
*/
namespace vcsn
{
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 namespace vcsn.
#include <vaucanson/contexts/transducer_maker.thxx>
// -*- C++ -*-
// transducer_functions.thxx: this file is part of the Vaucanson project.
// transducer_maker.thxx: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
......@@ -107,8 +107,7 @@ namespace vcsn
const Element<TransStruct, TransImpl>& t,
const Element<SeriesStruct, SeriesImpl>&)
{
AUTOMATON_CONTEXT::automaton_t w = AUTOMATON_CONTEXT::
make_automaton(t.structure().series().monoid().alphabet());
automaton_t w = make_automaton(t.structure().series().monoid().alphabet());
AUTOMATON_CONTEXT::gen_automaton_t result (w.structure());
standard_of(w, input);
evaluation(quotient(w), t, result);
......