17 #ifndef VCSN_AUTOMATA_IMPLEMENTATION_KIND_ADAPTER_HH
18 # define VCSN_AUTOMATA_IMPLEMENTATION_KIND_ADAPTER_HH
20 # include <vaucanson/automata/concept/automata_kind.hh>
27 #define ADAPT_ADD_LETTER_TRANSITION_TO_SERIES_LABEL(T...) \
28 typename automaton_traits<T>::htransition_t \
29 op_add_letter_transition(const AutomataBase<S>& s, \
31 const typename automaton_traits<T>::hstate_t& from,\
32 const typename automaton_traits<T>::hstate_t& to,\
33 const typename Element<S, T >::letter_t & l) \
35 typedef typename S::series_set_t series_set_t; \
36 typedef typename series_set_t::monoid_t monoid_t; \
37 typedef typename series_set_t::semiring_t semiring_t; \
38 typedef typename Element<S, T >::monoid_elt_value_t \
40 typedef typename Element<S, T >::semiring_elt_value_t \
41 semiring_elt_value_t; \
42 typedef typename Element<S, T >::series_set_elt_value_t \
43 series_set_elt_value_t; \
45 Element<series_set_t, series_set_elt_value_t> label (s.series()); \
47 Element<monoid_t, monoid_elt_value_t> word (s.series().monoid(), l); \
49 s.series().semiring().identity(SELECT(semiring_elt_value_t))); \
51 return op_add_transition(s, v, from, to, label.value()); \
54 #define ADAPT_LETTER_OF_TO_SERIES_LABEL(T...) \
55 typename Element<AutomataBase<S>, T >::letter_t \
56 op_letter_of(const AutomataBase<S>& s, \
58 const typename automaton_traits<T>::htransition_t& e) \
60 typedef typename S::series_set_t series_set_t; \
61 typedef typename series_set_t::monoid_t monoid_t; \
62 typedef typename Element<S, T >::monoid_elt_value_t \
64 typedef typename Element<S, T >::series_set_elt_value_t \
65 series_set_elt_value_t; \
67 Element<series_set_t, series_set_elt_value_t> sl = op_series_of(s, v, e); \
68 precondition(sl.supp().size() == 1); \
69 Element<monoid_t, word_value_t> w = sl.choose_from_supp(); \
70 precondition(w.length() == 1); \
74 #define ADAPT_WORD_OF_TO_SERIES_LABEL(T...) \
75 typename Element<AutomataBase<S>, T >::monoid_elt_t \
76 op_word_of(const AutomataBase<S>& s, \
78 const typename automaton_traits<T>::htransition_t& e) \
80 typedef typename S::series_set_t series_set_t; \
81 typedef typename series_set_t::monoid_t monoid_t; \
82 typedef typename Element<S, T >::monoid_elt_value_t \
84 typedef typename Element<S, T >::series_set_elt_value_t \
85 series_set_elt_value_t; \
87 Element<series_set_t, series_set_elt_value_t> sl = op_series_of(s, v, e); \
88 precondition(sl.supp().size() == 1); \
89 Element<monoid_t, word_value_t> w = sl.choose_from_supp(); \
95 #define ADAPT_ADD_SERIE_TRANSITION_TO_LETTERS_LABEL(T...) \
96 typename automaton_traits<T>::htransition_t \
97 op_add_series_transition(const AutomataBase<S>& a_set, \
99 const typename automaton_traits<T>::hstate_t& from,\
100 const typename automaton_traits<T>::hstate_t& to, \
101 const typename Element<S,T>::series_set_elt_t& s) \
103 assertion(s.supp().size() == 1); \
104 typedef typename Element<S, T>::series_set_elt_t::value_t::monoid_elt_value_t\
105 monoid_elt_value_t; \
106 typename automaton_traits<T>::htransition_t res; \
107 monoid_elt_value_t supp = *s.supp().begin(); \
108 for (typename monoid_elt_value_t::const_iterator it = supp.begin(); \
109 it != supp.end(); ++it) \
110 res = op_add_letter_transition(a_set, v, from, to, *it); \
114 #define ADAPT_WORD_OF_TO_LETTERS_LABEL(T...) \
115 typename Element<AutomataBase<S>, T >::monoid_elt_t \
116 op_word_of(const AutomataBase<S>& a_set, \
118 const typename automaton_traits<T>::htransition_t& e)\
121 typedef typename S::series_set_t series_set_t; \
122 typedef typename series_set_t::monoid_t monoid_t; \
123 typedef typename Element<S, value_t>::monoid_elt_value_t \
125 Element<monoid_t, word_value_t> \
126 w(a_set.series().monoid()); \
127 w += op_letter_of(a_set, v, e); \
131 #define ADAPT_SERIE_OF_TO_LETTERS_LABEL(T...) \
132 typename Element<AutomataBase<S>, T >::series_set_elt_t \
133 op_series_of(const AutomataBase<S>& a_set, \
135 const typename automaton_traits<T>::htransition_t& e) \
139 typedef typename S::series_set_t series_set_t; \
140 typedef typename series_set_t::monoid_t monoid_t; \
141 typedef typename Element<S, value_t>::monoid_elt_value_t \
143 typedef typename Element<S, value_t>::semiring_elt_value_t \
144 semiring_elt_value_t; \
145 typedef typename Element<S, value_t>::series_set_elt_value_t \
146 series_set_elt_value_t; \
147 Element<monoid_t, word_value_t> w(a_set.series().monoid()); \
148 w = op_letter_of(a_set, v, e); \
149 Element<series_set_t, series_set_elt_value_t> s(a_set.series()); \
150 s.assoc(w, algebra::identity_as<semiring_elt_value_t> \
151 ::of(a_set.series().semiring())); \
157 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
158 # include <vaucanson/automata/implementation/kind_adapter.hxx>
159 # endif // VCSN_USE_INTERFACE_ONLY
161 #endif // ! VCSN_AUTOMATA_IMPLEMENTATION_KIND_ADAPTER_HH