Vaucanson  1.4.1
transducer_base.hxx
1 // transducer_base.hxx: 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 The Vaucanson Group.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // The complete GNU General Public Licence Notice can be found as the
13 // `COPYING' file in the root directory.
14 //
15 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
16 //
17 #ifndef VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HXX
18 # define VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HXX
19 
20 # include <vaucanson/automata/concept/transducer_base.hh>
21 # include <vaucanson/automata/concept/transducer_ops.hh>
22 
23 namespace vcsn {
24 
25  template <typename Self>
27  {}
28 
29  template <typename Self>
31  AutomataBase<Self>(other)
32  {}
33 
34  template <typename Self, typename T>
36  {}
37 
38  template <typename Self, typename T>
41  {}
42 
43  template <typename Self, typename T>
44  typename MetaElement<TransducerBase<Self>, T>::input_monoid_elt_t
45  MetaElement<TransducerBase<Self>, T>::input_of(typename automaton_traits<T>::htransition_t e) const
46  {
47  return op_input_of(this->structure(), this->value(), e);
48  }
49 
50  template <typename Self, typename T>
51  typename MetaElement<TransducerBase<Self>, T>::output_series_set_elt_t
52  MetaElement<TransducerBase<Self>, T>::output_of(typename automaton_traits<T>::htransition_t e) const
53  {
54  return op_output_of(this->structure(), this->value(), e);
55  }
56 
57  template <typename Self, typename T>
58  template <typename U, typename V>
59  typename automaton_traits<T>::htransition_t
61  add_io_transition(typename automaton_traits<T>::hstate_t from,
62  typename automaton_traits<T>::hstate_t to,
63  const U& i,
64  const V& o,
66  {
67  if (w == output_semiring_elt_t())
68  w = algebra::identity_as<output_semiring_elt_value_t>
69  ::of(this->series().semiring().semiring());
71  i_elt (this->structure().series().monoid(), i);
73  o_elt (this->structure().series().semiring().monoid(), o);
74  return op_add_io_transition(this->structure(), this->value(),
75  from, to, i_elt, o_elt, w);
76  }
77 
78  template <typename Self, typename T>
79  template <typename U>
80  typename automaton_traits<T>::htransition_t
82  add_o_transition(typename automaton_traits<T>::hstate_t from,
83  typename automaton_traits<T>::hstate_t to,
84  const U& o,
86  {
87  if (w == output_semiring_elt_t())
88  w = algebra::identity_as<output_semiring_elt_value_t>
89  ::of(this->series().semiring().semiring());
91  o_elt (this->structure().series().semiring().monoid(), o);
92  return op_add_o_transition(this->structure(), this->value(),
93  from, to, o_elt, w);
94  }
95 
96  template <typename Self, typename T>
97  template <typename U>
98  typename automaton_traits<T>::htransition_t
100  add_i_transition(typename automaton_traits<T>::hstate_t from,
101  typename automaton_traits<T>::hstate_t to,
102  const U& i,
104  {
105  if (w == output_semiring_elt_t())
106  w = algebra::identity_as<output_semiring_elt_value_t>
107  ::of(this->series().semiring().semiring());
109  i_elt (this->structure().series().monoid(), i);
110  return op_add_i_transition(this->structure(), this->value(),
111  from, to, i_elt, w);
112  }
113 
114  template <typename Self, typename T>
115  template <typename U>
116  void
118  set_o_final(typename automaton_traits<T>::hstate_t final,
119  const U& o)
120  {
122  o_elt (this->structure().series().semiring().monoid(), o);
123  op_set_o_final(this->structure(), this->value(), final, o_elt.value());
124  }
125 
126  template <typename Self, typename T>
127  template <typename U>
128  void
130  set_o_initial(typename automaton_traits<T>::hstate_t initial,
131  const U& o)
132  {
134  o_elt (this->structure().series().semiring().monoid(), o);
135  op_set_o_initial(this->structure(), this->value(), initial, o_elt.value());
136  }
137 
138 } // vcsn
139 
140 #endif // ! VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HXX