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, 2005, 2006 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 
00034   template <typename Self, typename T>
00035   MetaElement<TransducerBase<Self>, T>::MetaElement()
00036   {}
00037 
00038   template <typename Self, typename T>
00039   MetaElement<TransducerBase<Self>, T>::MetaElement(const MetaElement& a):
00040     MetaElement<AutomataBase<Self>, T>::MetaElement(a)
00041   {}
00042 
00043   template <typename Self, typename T>
00044   typename MetaElement<TransducerBase<Self>, T>::input_monoid_elt_t
00045   MetaElement<TransducerBase<Self>, T>::input_of(htransition_t e) const
00046   {
00047     return op_input_of(this->structure(), this->value(), e);
00048   }
00049 
00050   template <typename Self, typename T>
00051   typename MetaElement<TransducerBase<Self>, T>::output_series_set_elt_t
00052   MetaElement<TransducerBase<Self>, T>::output_of(htransition_t e) const
00053   {
00054     return op_output_of(this->structure(), this->value(), e);
00055   }
00056 
00057   template <typename Self, typename T>
00058   htransition_t
00059   MetaElement<TransducerBase<Self>, T>::
00060   add_io_transition(hstate_t from,
00061                     hstate_t to,
00062                     input_monoid_elt_value_t i,
00063                     output_monoid_elt_value_t o,
00064                     output_semiring_elt_t w)
00065   {
00066     if (w == output_semiring_elt_t())
00067       w = algebra::identity_as<output_semiring_elt_value_t>
00068 	::of(this->series().semiring().semiring());
00069     Element<input_monoid_t, input_monoid_elt_value_t>
00070       i_elt (this->structure().series().monoid(), i);
00071     Element<output_monoid_t, output_monoid_elt_value_t>
00072       o_elt (this->structure().series().semiring().monoid(), o);
00073     return op_add_io_transition(this->structure(), this->value(),
00074                                 from, to, i_elt, o_elt, w);
00075   }
00076 
00077 
00078   template <typename Self, typename T>
00079   htransition_t
00080   MetaElement<TransducerBase<Self>, T>::add_io_transition(hstate_t from,
00081                                                           hstate_t to,
00082                                                           input_letter_t i,
00083                                                           output_letter_t o,
00084                                                           output_semiring_elt_t w)
00085   {
00086     if (w == output_semiring_elt_t())
00087       w = algebra::identity_as<output_semiring_elt_value_t>
00088 	::of(this->series().semiring().semiring());
00089     return op_add_io_transition(this->structure(), this->value(),
00090                                 from, to, i, o, w);
00091   }
00092 
00093   template <typename Self, typename T>
00094   htransition_t
00095   MetaElement<TransducerBase<Self>, T>::add_o_transition(hstate_t from,
00096                                                          hstate_t to,
00097                                                          output_letter_t o,
00098                                                          output_semiring_elt_t w)
00099   {
00100     if (w == output_semiring_elt_t())
00101       w = algebra::identity_as<output_semiring_elt_value_t>
00102 	::of(this->series().semiring().semiring());
00103 
00104     return op_add_o_transition(this->structure(), this->value(),
00105                                from, to, o, w);
00106   }
00107 
00108   template <typename Self, typename T>
00109   htransition_t
00110   MetaElement<TransducerBase<Self>, T>::add_i_transition(hstate_t from,
00111                                                          hstate_t to,
00112                                                          input_letter_t i,
00113                                                          output_semiring_elt_t w)
00114   {
00115     if (w == output_semiring_elt_t())
00116       w = algebra::identity_as<output_semiring_elt_value_t>
00117 	::of(this->series().semiring().semiring());
00118 
00119     return op_add_i_transition(this->structure(), this->value(),
00120                                from, to, i, w);
00121   }
00122 
00123   template <typename Self, typename T>
00124   void
00125   MetaElement<TransducerBase<Self>, T>::
00126   set_o_final(hstate_t final,
00127               output_monoid_elt_value_t o)
00128   {
00129     op_set_o_final(this->structure(), this->value(), final, o);
00130   }
00131 
00132   template <typename Self, typename T>
00133   void
00134   MetaElement<TransducerBase<Self>, T>::
00135   set_o_initial(hstate_t initial,
00136                 output_monoid_elt_value_t o)
00137   {
00138     op_set_o_initial(this->structure(), this->value(), initial, o);
00139   }
00140 
00141 } // vcsn
00142 
00143 #endif // ! VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HXX

Generated on Wed Jun 13 17:00:30 2007 for Vaucanson by  doxygen 1.5.1