Vaucanson  1.4.1
transducer_base.hh
1 // transducer_base.hh: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The
6 // Vaucanson Group.
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
12 //
13 // The complete GNU General Public Licence Notice can be found as the
14 // `COPYING' file in the root directory.
15 //
16 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
17 //
18 #ifndef VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HH
19 # define VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HH
20 
21 # include <iterator>
22 # include <vaucanson/design_pattern/design_pattern.hh>
24 # include <vaucanson/automata/concept/automata_base.hh>
25 # include <vaucanson/misc/usual_macros.hh>
26 
27 namespace vcsn {
28 
32  /*---------------------.
33  | TransducerBase<Self> |
34  `----------------------*/
41  template <typename Self>
43  : AutomataBase<Self>
44  {
45  public:
47  typedef typename virtual_types<Self>::series_set_t series_set_t;
48  typedef typename virtual_types<Self>::kind_t kind_t;
49 
50  protected:
53 
55  TransducerBase(const TransducerBase& other);
56  };
57 
59  template <typename T>
61  {
62  typedef undefined_type input_monoid_elt_value_t;
63  typedef undefined_type output_monoid_elt_value_t;
64  };
65 
66  template <typename T>
67  struct extension_traits
68  {
69  typedef undefined_type ret;
70  };
71 
72  template <class T>
73  struct input_projection_traits
74  {
75  typedef undefined_type ret;
76  };
77 
78  template <class T>
79  struct fmp_input_projection_traits
80  {
81  typedef undefined_type ret;
82  };
83 
84  // FIXME: the semantics should be defined more precisely.
85  // What is the output "on a graph" (it is well defined with
86  // transducers)
87  template <class T>
88  struct output_projection_traits
89  {
90  typedef undefined_type ret;
91  };
92 
93  template <class T>
94  struct fmp_output_projection_traits
95  {
96  typedef undefined_type ret;
97  };
98 
99  /*-----------------------------------.
100  | virtual_types<AutomataBase<Self> > |
101  `-----------------------------------*/
102  template <class S>
103  struct virtual_types<TransducerBase<S> >
104  : virtual_types<AutomataBase<S> >
105  { };
106 
107  /*------------------------------------.
108  | dynamic_traits<AutomataBase<Self> > |
109  `------------------------------------*/
110  template <class S>
111  struct dynamic_traits<TransducerBase<S> >
112  : dynamic_traits<AutomataBase<S> >
113  { };
114 
115  /*-------------------------------------.
116  | MetaElement<TransducerBase<Self>, T> |
117  `-------------------------------------*/
125  template <typename Self, typename T>
126  struct MetaElement<TransducerBase<Self>, T>
127  : MetaElement<AutomataBase<Self>, T>
128  {
131 
134 
137 
139  IMPORT_TYPEDEF_(automaton_t, series_set_t);
140 
142  IMPORT_TYPEDEF_(automaton_t, series_set_elt_value_t);
143 
145  IMPORT_TYPEDEF_(automaton_t, series_set_elt_t);
146 
148  IMPORT_TYPEDEF_(automaton_t, monoid_t);
149 
151  IMPORT_TYPEDEF_(automaton_t, monoid_elt_t);
152 
154  IMPORT_TYPEDEF_(automaton_t, monoid_elt_value_t);
155 
157  IMPORT_TYPEDEF_(automaton_t, letter_t);
158 
160  IMPORT_TYPEDEF_(automaton_t, semiring_t);
161 
163  IMPORT_TYPEDEF_(automaton_t, semiring_elt_t);
164 
166  IMPORT_TYPEDEF_(automaton_t, semiring_elt_value_t);
167 
169  IMPORT_TYPEDEF_(automaton_t, tag_t);
170 
172  IMPORT_TYPEDEF_(automaton_t, label_t);
173 
175  IMPORT_TYPEDEF_(automaton_t, states_t);
176 
178  IMPORT_TYPEDEF_(automaton_t, state_iterator);
179 
181  IMPORT_TYPEDEF_(automaton_t, transitions_t);
182 
184  IMPORT_TYPEDEF_(automaton_t, transition_iterator);
185 
187  IMPORT_TYPEDEF_(automaton_t, initial_support_t);
188 
190  IMPORT_TYPEDEF_(automaton_t, initial_iterator);
191 
193  IMPORT_TYPEDEF_(automaton_t, final_support_t);
194 
196  IMPORT_TYPEDEF_(automaton_t, final_iterator);
197 
200 
201  typedef typename algebra::series_traits<semiring_elt_value_t>::monoid_elt_value_t
202  output_monoid_elt_value_t;
203 
205  typedef typename semiring_t::monoid_t output_monoid_t;
206 
210 
211  typedef typename output_monoid_t::letter_t output_letter_t;
212 
215 
218 
222 
223  typedef typename input_monoid_t::letter_t input_letter_t;
224 
226  typedef typename algebra::series_traits<semiring_elt_value_t>::semiring_elt_value_t
228 
230  typedef typename semiring_t::semiring_t output_semiring_t;
231 
235 
237  input_monoid_elt_t input_of(typename automaton_traits<T>::htransition_t) const;
238 
240  output_series_set_elt_t output_of(typename automaton_traits<T>::htransition_t) const;
241 
244  template <typename U, typename V>
245  typename automaton_traits<T>::htransition_t
246  add_io_transition(typename automaton_traits<T>::hstate_t, typename automaton_traits<T>::hstate_t,
247  const U&,
248  const V&,
250 
252  template <typename U>
253  typename automaton_traits<T>::htransition_t
254  add_o_transition(typename automaton_traits<T>::hstate_t, typename automaton_traits<T>::hstate_t,
255  const U&,
257 
259  template <typename U>
260  typename automaton_traits<T>::htransition_t
261  add_i_transition(typename automaton_traits<T>::hstate_t, typename automaton_traits<T>::hstate_t,
262  const U&,
264 
266  template <typename U>
267  void set_o_final(typename automaton_traits<T>::hstate_t, const U&);
268 
271  template <typename U>
272  void set_o_initial(typename automaton_traits<T>::hstate_t, const U&);
273 
274  protected:
275  MetaElement();
276  MetaElement(const MetaElement& other);
277  };
278 
279 
283 } // vcsn
284 
285 
286 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
287 # include <vaucanson/automata/concept/transducer_base.hxx>
288 # endif // VCSN_USE_INTERFACE_ONLY
289 
290 
291 #endif // ! VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HH