transducer_base.hh

00001 // transducer_base.hh: 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 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_HH
00018 # define VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HH
00019 
00020 # include <iterator>
00021 # include <vaucanson/design_pattern/design_pattern.hh>
00022 # include <vaucanson/design_pattern/predecls.hh>
00023 # include <vaucanson/automata/concept/automata_base.hh>
00024 # include <vaucanson/tools/usual_macros.hh>
00025 
00026 namespace vcsn {
00027     
00031   /*---------------------.
00032   | TransducerBase<Self> |
00033   `----------------------*/
00035 
00040   template <typename Self>
00041   struct TransducerBase
00042     : AutomataBase<Self>
00043   {
00044     public:
00046       typedef typename virtual_types<Self>::series_set_t  series_set_t;
00047 
00048     protected:
00050       TransducerBase();
00051 
00053       TransducerBase(const TransducerBase& other);
00054   };
00055 
00056   // traits for transducer implementation.
00057   template <typename T>
00058   struct transducer_traits
00059   {
00060       typedef undefined_type input_monoid_elt_value_t;
00061       typedef undefined_type output_monoid_elt_value_t;
00062   };
00063 
00064   template <typename T>
00065   struct extension_traits
00066   {
00067       typedef undefined_type ret;
00068   };
00069 
00070   template <class S, class T>
00071   struct projection_traits
00072   {
00073       typedef undefined_type    ret;
00074   };
00075 
00076   template <class T>
00077   struct output_projection_traits
00078   {
00079       typedef undefined_type    ret;
00080   };
00081 
00082   /*-----------------------------------.
00083   | virtual_types<AutomataBase<Self> > |
00084   `-----------------------------------*/
00085   template <class S>
00086   struct virtual_types<TransducerBase<S> >
00087     : virtual_types<AutomataBase<S> >
00088   { };
00089 
00090   /*------------------------------------.
00091   | dynamic_traits<AutomataBase<Self> > |
00092   `------------------------------------*/
00093   template <class S>
00094   struct dynamic_traits<TransducerBase<S> >
00095     : dynamic_traits<AutomataBase<S> >
00096   { };
00097 
00098   /*-------------------------------------.
00099   | MetaElement<TransducerBase<Self>, T> |
00100   `-------------------------------------*/
00102 
00108   template <typename Self, typename T>
00109   struct MetaElement<TransducerBase<Self>, T>
00110     : MetaElement<AutomataBase<Self>, T>
00111   {
00113       typedef MetaElement<AutomataBase<Self>, T>                      automaton_t;
00114 
00116       INHERIT_TYPEDEF_(automaton_t, series_set_t);
00117 
00119       INHERIT_TYPEDEF_(automaton_t, series_set_elt_value_t);
00120 
00122       INHERIT_TYPEDEF_(automaton_t, series_set_elt_t);
00123 
00125       INHERIT_TYPEDEF_(automaton_t, monoid_t);
00126 
00128       INHERIT_TYPEDEF_(automaton_t, monoid_elt_t);
00129 
00131       INHERIT_TYPEDEF_(automaton_t, monoid_elt_value_t);
00132 
00134       INHERIT_TYPEDEF_(automaton_t, letter_t);
00135 
00137       INHERIT_TYPEDEF_(automaton_t, semiring_t);
00138 
00140       INHERIT_TYPEDEF_(automaton_t, semiring_elt_t);
00141 
00143       INHERIT_TYPEDEF_(automaton_t, semiring_elt_value_t);
00144 
00146       INHERIT_TYPEDEF_(automaton_t, tag_t);
00147 
00149       INHERIT_TYPEDEF_(automaton_t, label_t);
00150 
00152       INHERIT_TYPEDEF_(automaton_t, states_t);
00153 
00155       INHERIT_TYPEDEF_(automaton_t, state_iterator);
00156 
00158       INHERIT_TYPEDEF_(automaton_t, transitions_t);
00159 
00161       INHERIT_TYPEDEF_(automaton_t, transition_iterator);
00162 
00164       INHERIT_TYPEDEF_(automaton_t, initial_t);
00165 
00167       INHERIT_TYPEDEF_(automaton_t, initial_support_t);
00168 
00170       INHERIT_TYPEDEF_(automaton_t, initial_iterator);
00171 
00173       INHERIT_TYPEDEF_(automaton_t, final_t);
00174 
00176       INHERIT_TYPEDEF_(automaton_t, final_iterator);
00177 
00179       typedef MetaElement<TransducerBase<Self>, T>            self_t;
00180 
00182       typedef MetaElement<AutomataBase<Self>, T>                      mother_t;
00183 
00185       typedef typename mother_t::semiring_elt_t output_series_set_elt_t;
00186 
00187       typedef typename algebra::series_traits<semiring_elt_value_t>::monoid_elt_value_t
00188       output_monoid_elt_value_t;
00189 
00191       typedef typename semiring_t::monoid_t     output_monoid_t;
00192 
00194       typedef Element<output_monoid_t, output_monoid_elt_value_t>
00195       output_monoid_elt_t;
00196 
00197       typedef typename output_monoid_t::letter_t output_letter_t;
00198 
00200       typedef typename mother_t::monoid_elt_value_t input_monoid_elt_value_t;
00201 
00203       typedef typename mother_t::monoid_t               input_monoid_t;
00204 
00205       /* type of the input monoid element. */
00206       typedef Element<input_monoid_t, input_monoid_elt_value_t>
00207       input_monoid_elt_t;
00208 
00209       typedef typename input_monoid_t::letter_t input_letter_t;
00210 
00212       typedef typename algebra::series_traits<semiring_elt_value_t>::semiring_elt_value_t
00213       output_semiring_elt_value_t;
00214 
00216       typedef typename semiring_t::semiring_t   output_semiring_t;
00217 
00219       typedef Element<output_semiring_t, output_semiring_elt_value_t>
00220       output_semiring_elt_t;
00221 
00223       input_monoid_elt_t input_of(htransition_t) const;
00224 
00226       output_series_set_elt_t output_of(htransition_t) const;
00227 
00230       htransition_t add_io_transition(hstate_t, hstate_t, input_monoid_elt_value_t,
00231                                       output_monoid_elt_value_t,
00232                                       output_semiring_elt_t = output_semiring_elt_t());
00233 
00236       htransition_t add_io_transition(hstate_t, hstate_t, input_letter_t, output_letter_t,
00237                                       output_semiring_elt_t = output_semiring_elt_t());
00238 
00240       htransition_t add_o_transition(hstate_t, hstate_t, output_letter_t,
00241                                      output_semiring_elt_t = output_semiring_elt_t());
00242 
00244       htransition_t add_i_transition(hstate_t, hstate_t, input_letter_t,
00245                                      output_semiring_elt_t = output_semiring_elt_t());
00246 
00248       void set_o_final(hstate_t, output_monoid_elt_value_t);
00249 
00252       void set_o_initial(hstate_t, output_monoid_elt_value_t);
00253 
00254     protected:
00255       MetaElement();
00256       MetaElement(const MetaElement& other);
00257   };
00258 
00259 
00262 } // vcsn
00263 
00264 
00265 #ifndef VCSN_USE_INTERFACE_ONLY
00266 # include <vaucanson/automata/concept/transducer_base.hxx>
00267 #endif // VCSN_USE_INTERFACE_ONLY
00268 
00269 
00270 #endif // ! VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HH

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