Commit b10c2a56 authored by Jérôme Galtier's avatar Jérôme Galtier
Browse files

Overhaul generalized_traits.

* include/vaucanson/automata/concept/automata.hh,
include/vaucanson/automata/concept/automata.hxx (generalized): Remove
this specialization.
* include/vaucanson/automata/concept/automata_base.hh: Move the
generalized function to generalized_traits, so that it will be easier
to refactor the code later.
* include/vaucanson/automata/concept/automata_base.hxx
(VCSN_MAKE_GENERALIZED_AUTOMATON_TRAITS_IMPL): New macro to define the
generalized function.
* include/vaucanson/automata/implementation/bmig_graph_impl.hxx,
include/vaucanson/automata/implementation/listg_graph_impl.hxx: Use
the new VCSN_MAKE_GENERALIZED_AUTOMATON_TRAITS_IMPL macro.
parent 9316cfd6
2009-09-29 Jrme Galtier <jerome.galtier@lrde.epita.fr>
Overhaul generalized_traits.
* include/vaucanson/automata/concept/automata.hh,
include/vaucanson/automata/concept/automata.hxx (generalized): Remove
this specialization.
* include/vaucanson/automata/concept/automata_base.hh: Move the
generalized function to generalized_traits, so that it will be easier
to refactor the code later.
* include/vaucanson/automata/concept/automata_base.hxx
(VCSN_MAKE_GENERALIZED_AUTOMATON_TRAITS_IMPL): New macro to define the
generalized function.
* include/vaucanson/automata/implementation/bmig_graph_impl.hxx,
include/vaucanson/automata/implementation/listg_graph_impl.hxx: Use
the new VCSN_MAKE_GENERALIZED_AUTOMATON_TRAITS_IMPL macro.
2009-09-29 Jrme Galtier <jerome.galtier@lrde.epita.fr>
 
Remove aut_to_exp() from automaton_maker.
......
......@@ -175,10 +175,6 @@ namespace vcsn
bool
operator==(const Automata<Series, Kind>&, const Automata<Series, Kind>&);
template <typename Series, typename T>
typename generalized_traits<Element<Automata<Series, labels_are_letters>, T> >::automaton_t
generalized(const Element<Automata<Series, labels_are_letters>, T>& from);
} // ! vcsn
......
......@@ -141,13 +141,6 @@ namespace vcsn {
# undef PROJECTION_TRAITS
template <typename Series, typename T>
typename generalized_traits<Element<Automata<Series, labels_are_letters>, T> >::automaton_t
generalized(const Element<Automata<Series, labels_are_letters>, T>& from)
{
static_error(no_generalized_from_labels_are_letters);
}
} // ! vcsn
#endif // ! VCSN_AUTOMATA_CONCEPT_AUTOMATA_HXX
......@@ -169,6 +169,7 @@ namespace vcsn {
> automaton_t; \
typedef typename automaton_t::hstate_t hstate_t; \
typedef typename automaton_t::htransition_t htransition_t; \
automaton_t generalized(const Auto_& from); \
}
// traits to construct an automaton type from a rational expression type,
......@@ -1329,9 +1330,6 @@ namespace vcsn {
template <typename S, typename St, typename T>
St& op_rout(const AutomataBase<S>& s, St& st, const T& r);
template <typename Auto_>
typename generalized_traits<Auto_>::automaton_t
generalized(const Auto_& from);
} // vcsn
# if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
......
......@@ -880,13 +880,26 @@ namespace vcsn {
| automaton to generalized automaton conversion |
`----------------------------------------------*/
template <typename Auto_>
typename generalized_traits<Auto_>::automaton_t
generalized(const Auto_& from)
{
typename generalized_traits<Auto_>::automaton_t to(from.structure());
auto_copy(to, from);
return to;
# define VCSN_MAKE_GENERALIZED_AUTOMATON_TRAITS_IMPL(Type) \
template <typename Struct, \
typename Kind, \
typename WordValue, \
typename WeightValue, \
typename SeriesValue, \
typename Letter, \
typename Tag, \
typename GeometryCoords> \
typename generalized_traits<Element<Struct, Type<Kind, WordValue, \
WeightValue, SeriesValue, Letter, \
Tag, GeometryCoords> > >::automaton_t \
generalized_traits<Element<Struct, Type<Kind, WordValue, \
WeightValue, SeriesValue, Letter, \
Tag, \
GeometryCoords> > >::generalized(const Auto_& from)\
{ \
automaton_t to(from.structure()); \
auto_copy(to, from); \
return to; \
}
} // ! vcsn
......
......@@ -648,6 +648,9 @@ namespace vcsn
# undef BMIGRAPH_TPARAM
# undef BMIGRAPH
} // End of namespace bmig
VCSN_MAKE_GENERALIZED_AUTOMATON_TRAITS_IMPL(bmig::Graph);
} // End of namespace vcsn
#endif // !VCSN_AUTOMATA_IMPLEMENTATION_BMIG_GRAPH_IMPL_HXX_ //
......@@ -462,11 +462,13 @@ namespace vcsn
return geometry_;
}
// Remove macros to avoid name clashes.
# undef TParam
# undef GClass
}
VCSN_MAKE_GENERALIZED_AUTOMATON_TRAITS_IMPL(listg::Graph);
}
#endif // ! VCSN_AUTOMATA_IMPLEMENTATION_LISTG_GRAPH_IMPL_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