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, 2006, 2007, 2008 The
00006 // Vaucanson Group.
00007 //
00008 // This program is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU General Public License
00010 // as published by the Free Software Foundation; either version 2
00011 // of the License, or (at your option) any later version.
00012 //
00013 // The complete GNU General Public Licence Notice can be found as the
00014 // `COPYING' file in the root directory.
00015 //
00016 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00017 //
00018 #ifndef VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HH
00019 # define VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HH
00020 
00021 # include <iterator>
00022 # include <vaucanson/design_pattern/design_pattern.hh>
00023 # include <vaucanson/design_pattern/predecls.hh>
00024 # include <vaucanson/automata/concept/automata_base.hh>
00025 # include <vaucanson/misc/usual_macros.hh>
00026 
00027 namespace vcsn {
00028     
00032   /*---------------------.
00033   | TransducerBase<Self> |
00034   `----------------------*/
00041   template <typename Self>
00042   struct TransducerBase
00043     : AutomataBase<Self>
00044   {
00045     public:
00047       typedef typename virtual_types<Self>::series_set_t  series_set_t;
00048 
00049     protected:
00051       TransducerBase();
00052 
00054       TransducerBase(const TransducerBase& other);
00055   };
00056 
00058   template <typename T>
00059   struct transducer_traits
00060   {
00061       typedef undefined_type input_monoid_elt_value_t;
00062       typedef undefined_type output_monoid_elt_value_t;
00063   };
00064 
00065   template <typename T>
00066   struct extension_traits
00067   {
00068       typedef undefined_type ret;
00069   };
00070 
00071   template <class T>
00072   struct input_projection_traits
00073   {
00074       typedef undefined_type    ret;
00075   };
00076 
00077   template <class T>
00078   struct fmp_input_projection_traits
00079   {
00080       typedef undefined_type    ret;
00081   };
00082 
00083   // FIXME: the semantic should be defined more precisely.
00084   // What is the output "on a graph" (it is well defined with
00085   // transducers)
00086   template <class T>
00087   struct output_projection_traits
00088   {
00089     typedef undefined_type      ret;
00090   };
00091 
00092   template <class T>
00093   struct fmp_output_projection_traits
00094   {
00095     typedef undefined_type      ret;
00096   };
00097 
00098   /*-----------------------------------.
00099   | virtual_types<AutomataBase<Self> > |
00100   `-----------------------------------*/
00101   template <class S>
00102   struct virtual_types<TransducerBase<S> >
00103     : virtual_types<AutomataBase<S> >
00104   { };
00105 
00106   /*------------------------------------.
00107   | dynamic_traits<AutomataBase<Self> > |
00108   `------------------------------------*/
00109   template <class S>
00110   struct dynamic_traits<TransducerBase<S> >
00111     : dynamic_traits<AutomataBase<S> >
00112   { };
00113 
00114   /*-------------------------------------.
00115   | MetaElement<TransducerBase<Self>, T> |
00116   `-------------------------------------*/
00124   template <typename Self, typename T>
00125   struct MetaElement<TransducerBase<Self>, T>
00126     : MetaElement<AutomataBase<Self>, T>
00127   {
00129       typedef MetaElement<TransducerBase<Self>, T> self_t;
00130 
00132       typedef MetaElement<AutomataBase<Self>, T> super_t;
00133 
00135       typedef MetaElement<AutomataBase<Self>, T> automaton_t;
00136 
00138       IMPORT_TYPEDEF_(automaton_t, series_set_t);
00139 
00141       IMPORT_TYPEDEF_(automaton_t, series_set_elt_value_t);
00142 
00144       IMPORT_TYPEDEF_(automaton_t, series_set_elt_t);
00145 
00147       IMPORT_TYPEDEF_(automaton_t, monoid_t);
00148 
00150       IMPORT_TYPEDEF_(automaton_t, monoid_elt_t);
00151 
00153       IMPORT_TYPEDEF_(automaton_t, monoid_elt_value_t);
00154 
00156       IMPORT_TYPEDEF_(automaton_t, letter_t);
00157 
00159       IMPORT_TYPEDEF_(automaton_t, semiring_t);
00160 
00162       IMPORT_TYPEDEF_(automaton_t, semiring_elt_t);
00163 
00165       IMPORT_TYPEDEF_(automaton_t, semiring_elt_value_t);
00166 
00168       IMPORT_TYPEDEF_(automaton_t, tag_t);
00169 
00171       IMPORT_TYPEDEF_(automaton_t, label_t);
00172 
00174       IMPORT_TYPEDEF_(automaton_t, states_t);
00175 
00177       IMPORT_TYPEDEF_(automaton_t, state_iterator);
00178 
00180       IMPORT_TYPEDEF_(automaton_t, transitions_t);
00181 
00183       IMPORT_TYPEDEF_(automaton_t, transition_iterator);
00184 
00186       IMPORT_TYPEDEF_(automaton_t, initial_support_t);
00187 
00189       IMPORT_TYPEDEF_(automaton_t, initial_iterator);
00190 
00192       IMPORT_TYPEDEF_(automaton_t, final_support_t);
00193 
00195       IMPORT_TYPEDEF_(automaton_t, final_iterator);
00196 
00198       typedef typename super_t::semiring_elt_t output_series_set_elt_t;
00199 
00200       typedef typename algebra::series_traits<semiring_elt_value_t>::monoid_elt_value_t
00201       output_monoid_elt_value_t;
00202 
00204       typedef typename semiring_t::monoid_t     output_monoid_t;
00205 
00207       typedef Element<output_monoid_t, output_monoid_elt_value_t>
00208       output_monoid_elt_t;
00209 
00210       typedef typename output_monoid_t::letter_t output_letter_t;
00211 
00213       typedef typename super_t::monoid_elt_value_t input_monoid_elt_value_t;
00214 
00216       typedef typename super_t::monoid_t                input_monoid_t;
00217 
00219       typedef Element<input_monoid_t, input_monoid_elt_value_t>
00220       input_monoid_elt_t;
00221 
00222       typedef typename input_monoid_t::letter_t input_letter_t;
00223 
00225       typedef typename algebra::series_traits<semiring_elt_value_t>::semiring_elt_value_t
00226       output_semiring_elt_value_t;
00227 
00229       typedef typename semiring_t::semiring_t   output_semiring_t;
00230 
00232       typedef Element<output_semiring_t, output_semiring_elt_value_t>
00233       output_semiring_elt_t;
00234 
00236       input_monoid_elt_t input_of(typename automaton_traits<T>::htransition_t) const;
00237 
00239       output_series_set_elt_t output_of(typename automaton_traits<T>::htransition_t) const;
00240 
00243       template <typename U, typename V>
00244       typename automaton_traits<T>::htransition_t
00245       add_io_transition(typename automaton_traits<T>::hstate_t, typename automaton_traits<T>::hstate_t,
00246                         const U&,
00247                         const V&,
00248                         output_semiring_elt_t = output_semiring_elt_t());
00249 
00251       template <typename U>
00252       typename automaton_traits<T>::htransition_t
00253       add_o_transition(typename automaton_traits<T>::hstate_t, typename automaton_traits<T>::hstate_t,
00254                        const U&,
00255                        output_semiring_elt_t = output_semiring_elt_t());
00256 
00258       template <typename U>
00259       typename automaton_traits<T>::htransition_t
00260       add_i_transition(typename automaton_traits<T>::hstate_t, typename automaton_traits<T>::hstate_t,
00261                        const U&,
00262                        output_semiring_elt_t = output_semiring_elt_t());
00263 
00265       template <typename U>
00266       void set_o_final(typename automaton_traits<T>::hstate_t, const U&);
00267 
00270       template <typename U>
00271       void set_o_initial(typename automaton_traits<T>::hstate_t, const U&);
00272 
00273     protected:
00274       MetaElement();
00275       MetaElement(const MetaElement& other);
00276   };
00277 
00278 
00282 } // vcsn
00283 
00284 
00285 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00286 #  include <vaucanson/automata/concept/transducer_base.hxx>
00287 # endif // VCSN_USE_INTERFACE_ONLY
00288 
00289 
00290 #endif // ! VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HH

Generated on Thu Oct 9 20:22:42 2008 for Vaucanson by  doxygen 1.5.1