transducer_base.hxx

00001 // transducer_base.hxx: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HXX
00018 # define VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HXX
00019 
00020 # include <vaucanson/automata/concept/transducer_base.hh>
00021 # include <vaucanson/automata/concept/transducer_ops.hh>
00022 
00023 namespace vcsn {
00024 
00025   template <typename Self>
00026   TransducerBase<Self>::TransducerBase()
00027   {}
00028 
00029   template <typename Self>
00030   TransducerBase<Self>::TransducerBase(const TransducerBase& other) :
00031     AutomataBase<Self>(other)
00032   {}
00033 
00035   template <typename Self, typename T>
00036   MetaElement<TransducerBase<Self>, T>::MetaElement()
00037   {}
00038 
00040   template <typename Self, typename T>
00041   MetaElement<TransducerBase<Self>, T>::MetaElement(const MetaElement& a):
00042     MetaElement<AutomataBase<Self>, T>::MetaElement(a)
00043   {}
00044 
00045   template <typename Self, typename T>
00046   typename MetaElement<TransducerBase<Self>, T>::input_monoid_elt_t
00047   MetaElement<TransducerBase<Self>, T>::input_of(htransition_t e) const
00048   {
00049     return op_input_of(this->structure(), this->value(), e);
00050   }
00051 
00052   template <typename Self, typename T>
00053   typename MetaElement<TransducerBase<Self>, T>::output_series_set_elt_t
00054   MetaElement<TransducerBase<Self>, T>::output_of(htransition_t e) const
00055   {
00056     return op_output_of(this->structure(), this->value(), e);
00057   }
00058 
00059   template <typename Self, typename T>
00060   htransition_t
00061   MetaElement<TransducerBase<Self>, T>::
00062   add_io_transition(hstate_t from,
00063                     hstate_t to,
00064                     input_monoid_elt_value_t i,
00065                     output_monoid_elt_value_t o,
00066                     output_semiring_elt_t w)
00067   {
00068     if (w == output_semiring_elt_t())
00069       w = algebra::identity_as<output_semiring_elt_value_t>
00070         ::of(this->series().semiring().semiring());
00071     Element<input_monoid_t, input_monoid_elt_value_t>
00072       i_elt (this->structure().series().monoid(), i);
00073     Element<output_monoid_t, output_monoid_elt_value_t>
00074       o_elt (this->structure().series().semiring().monoid(), o);
00075     return op_add_io_transition(this->structure(), this->value(),
00076                                 from, to, i_elt, o_elt, w);
00077   }
00078 
00079 
00080   template <typename Self, typename T>
00081   htransition_t
00082   MetaElement<TransducerBase<Self>, T>::add_io_transition(hstate_t from,
00083                                                           hstate_t to,
00084                                                           input_letter_t i,
00085                                                           output_letter_t o,
00086                                                           output_semiring_elt_t w)
00087   {
00088     if (w == output_semiring_elt_t())
00089       w = algebra::identity_as<output_semiring_elt_value_t>
00090 	::of(this->series().semiring().semiring());
00091     return op_add_io_transition(this->structure(), this->value(),
00092                                 from, to, i, o, w);
00093   }
00094 
00095   template <typename Self, typename T>
00096   htransition_t
00097   MetaElement<TransducerBase<Self>, T>::add_o_transition(hstate_t from,
00098                                                          hstate_t to,
00099                                                          output_letter_t o,
00100                                                          output_semiring_elt_t w)
00101   {
00102     if (w == output_semiring_elt_t())
00103       w = algebra::identity_as<output_semiring_elt_value_t>
00104         ::of(this->series().semiring().semiring());
00105 
00106     return op_add_o_transition(this->structure(), this->value(),
00107                                from, to, o, w);
00108   }
00109 
00110   template <typename Self, typename T>
00111   htransition_t
00112   MetaElement<TransducerBase<Self>, T>::add_i_transition(hstate_t from,
00113                                                          hstate_t to,
00114                                                          input_letter_t i,
00115                                                          output_semiring_elt_t w)
00116   {
00117     if (w == output_semiring_elt_t())
00118       w = algebra::identity_as<output_semiring_elt_value_t>
00119 	::of(this->series().semiring().semiring());
00120 
00121     return op_add_i_transition(this->structure(), this->value(),
00122                                from, to, i, w);
00123   }
00124 
00125   template <typename Self, typename T>
00126   void
00127   MetaElement<TransducerBase<Self>, T>::
00128   set_o_final(hstate_t final,
00129               output_monoid_elt_value_t o)
00130   {
00131     op_set_o_final(this->structure(), this->value(), final, o);
00132   }
00133 
00134   template <typename Self, typename T>
00135   void
00136   MetaElement<TransducerBase<Self>, T>::
00137   set_o_initial(hstate_t initial,
00138                 output_monoid_elt_value_t o)
00139   {
00140     op_set_o_initial(this->structure(), this->value(), initial, o);
00141   }
00142 
00143 } // vcsn
00144 
00145 #endif // ! VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HXX

Generated on Fri Jul 28 12:18:55 2006 for Vaucanson by  doxygen 1.4.6