- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

# 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 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/misc/usual_macros.hh>
    00025
    00026 namespace vcsn {
    00027
    00031   /*---------------------.
    00032   | TransducerBase<Self> |
    00033   `----------------------*/
    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
    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   `-------------------------------------*/
    00108   template <typename Self, typename T>
    00109   struct MetaElement<TransducerBase<Self>, T>
    00110     : MetaElement<AutomataBase<Self>, T>
    00111   {
    00113       typedef MetaElement<TransducerBase<Self>, T> self_t;
    00114
    00116       typedef MetaElement<AutomataBase<Self>, T> super_t;
    00117
    00119       typedef MetaElement<AutomataBase<Self>, T> automaton_t;
    00120
    00122       IMPORT_TYPEDEF_(automaton_t, series_set_t);
    00123
    00125       IMPORT_TYPEDEF_(automaton_t, series_set_elt_value_t);
    00126
    00128       IMPORT_TYPEDEF_(automaton_t, series_set_elt_t);
    00129
    00131       IMPORT_TYPEDEF_(automaton_t, monoid_t);
    00132
    00134       IMPORT_TYPEDEF_(automaton_t, monoid_elt_t);
    00135
    00137       IMPORT_TYPEDEF_(automaton_t, monoid_elt_value_t);
    00138
    00140       IMPORT_TYPEDEF_(automaton_t, letter_t);
    00141
    00143       IMPORT_TYPEDEF_(automaton_t, semiring_t);
    00144
    00146       IMPORT_TYPEDEF_(automaton_t, semiring_elt_t);
    00147
    00149       IMPORT_TYPEDEF_(automaton_t, semiring_elt_value_t);
    00150
    00152       IMPORT_TYPEDEF_(automaton_t, tag_t);
    00153
    00155       IMPORT_TYPEDEF_(automaton_t, label_t);
    00156
    00158       IMPORT_TYPEDEF_(automaton_t, states_t);
    00159
    00161       IMPORT_TYPEDEF_(automaton_t, state_iterator);
    00162
    00164       IMPORT_TYPEDEF_(automaton_t, transitions_t);
    00165
    00167       IMPORT_TYPEDEF_(automaton_t, transition_iterator);
    00168
    00170       IMPORT_TYPEDEF_(automaton_t, initial_support_t);
    00171
    00173       IMPORT_TYPEDEF_(automaton_t, initial_iterator);
    00174
    00176       IMPORT_TYPEDEF_(automaton_t, final_support_t);
    00177
    00179       IMPORT_TYPEDEF_(automaton_t, final_iterator);
    00180
    00182       typedef typename super_t::semiring_elt_t output_series_set_elt_t;
    00183
    00184       typedef typename algebra::series_traits<semiring_elt_value_t>::monoid_elt_value_t
    00185       output_monoid_elt_value_t;
    00186
    00188       typedef typename semiring_t::monoid_t     output_monoid_t;
    00189
    00191       typedef Element<output_monoid_t, output_monoid_elt_value_t>
    00192       output_monoid_elt_t;
    00193
    00194       typedef typename output_monoid_t::letter_t output_letter_t;
    00195
    00197       typedef typename super_t::monoid_elt_value_t input_monoid_elt_value_t;
    00198
    00200       typedef typename super_t::monoid_t                input_monoid_t;
    00201
    00203       typedef Element<input_monoid_t, input_monoid_elt_value_t>
    00204       input_monoid_elt_t;
    00205
    00206       typedef typename input_monoid_t::letter_t input_letter_t;
    00207
    00209       typedef typename algebra::series_traits<semiring_elt_value_t>::semiring_elt_value_t
    00210       output_semiring_elt_value_t;
    00211
    00213       typedef typename semiring_t::semiring_t   output_semiring_t;
    00214
    00216       typedef Element<output_semiring_t, output_semiring_elt_value_t>
    00217       output_semiring_elt_t;
    00218
    00220       input_monoid_elt_t input_of(htransition_t) const;
    00221
    00223       output_series_set_elt_t output_of(htransition_t) const;
    00224
    00227       htransition_t
    00228       add_io_transition(hstate_t, hstate_t,
    00229                         input_monoid_elt_value_t,
    00230                         output_monoid_elt_value_t,
    00231                         output_semiring_elt_t = output_semiring_elt_t());
    00232
    00235       htransition_t
    00236       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
    00241       add_o_transition(hstate_t, hstate_t, output_letter_t,
    00242                        output_semiring_elt_t = output_semiring_elt_t());
    00243
    00245       htransition_t
    00246       add_i_transition(hstate_t, hstate_t, input_letter_t,
    00247                        output_semiring_elt_t = output_semiring_elt_t());
    00248
    00250       void set_o_final(hstate_t, output_monoid_elt_value_t);
    00251
    00254       void set_o_initial(hstate_t, output_monoid_elt_value_t);
    00255
    00256     protected:
    00257       MetaElement();
    00258       MetaElement(const MetaElement& other);
    00259   };
    00260
    00261
    00265 } // vcsn
    00266
    00267
    00268 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
    00269 #  include <vaucanson/automata/concept/transducer_base.hxx>
    00270 # endif // VCSN_USE_INTERFACE_ONLY
    00271
    00272
    00273 #endif // ! VCSN_AUTOMATA_CONCEPT_TRANSDUCER_BASE_HH