transducer.hh

00001 // transducer.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_HH
00018 # define VCSN_AUTOMATA_CONCEPT_TRANSDUCER_HH
00019 
00020 # include <vaucanson/design_pattern/design_pattern.hh>
00021 # include <vaucanson/automata/concept/automata.hh>
00022 # include <vaucanson/automata/concept/automata_base.hh>
00023 # include <vaucanson/automata/concept/transducer_base.hh>
00024 
00025 namespace vcsn {
00026 
00027   template <class Series>
00028   struct Transducer;
00029 
00031   template <class Series>
00032   struct dynamic_traits<Transducer<Series> >
00033     : dynamic_traits<TransducerBase<Series> >
00034   {
00035     static const bool ret = dynamic_traits<Series>::ret;
00036   };
00037 
00039   template <class Series, typename T>
00040   struct MetaElement<Transducer<Series>, T>
00041     : MetaElement<TransducerBase<Transducer<Series> >, T>
00042   {};
00043 
00045   template <class Series>
00046   struct virtual_types<Transducer<Series> >
00047   {
00048     typedef Series              series_set_t;
00049   };
00050 
00052   template <class Series>
00053   class Transducer
00054     : public TransducerBase<Transducer<Series> >,
00055       private SetSlot<Series>
00056   {
00057   public:
00058     typedef Transducer<Series>                               self_t;
00059     typedef typename virtual_types<self_t>::series_set_t     series_set_t;
00060 
00061     Transducer(const series_set_t&);
00062 
00063     const series_set_t& series() const;
00064 
00065   };
00066 
00067   template <class S, class T>
00068   struct input_projection_helper
00069   {
00070     typedef typename S::series_set_t::semiring_t
00071     typeof_auto_series_set_t;
00072 
00074     typedef typename S::series_set_t::monoid_t auto_monoid_t;
00075 
00076     typedef typename typeof_auto_series_set_t::semiring_t auto_semiring_t;
00077     typedef typename algebra::mute_series_traits<typeof_auto_series_set_t,
00078                                                  auto_semiring_t,
00079                                                  auto_monoid_t>::ret
00080     auto_series_set_t;
00081 
00082     typedef typename output_projection_traits<T>::ret auto_impl_t;
00083     typedef Element<Automata<auto_series_set_t>, auto_impl_t> ret;
00084   };
00085 
00086   template <class S, class T>
00087   struct output_projection_helper
00088   {
00089     typedef typename S::series_set_t::semiring_t typeof_auto_series_set_t;
00090 
00091     typedef typename S::series_set_t::semiring_t::monoid_t auto_monoid_t;
00092 
00093     typedef typename typeof_auto_series_set_t::semiring_t auto_semiring_t;
00094     typedef typename algebra::mute_series_traits<typeof_auto_series_set_t,
00095                                                  auto_semiring_t,
00096                                                  auto_monoid_t>::ret
00097     auto_series_set_t;
00098 
00099     typedef typename output_projection_traits<T>::ret auto_impl_t;
00100     typedef Element<Automata<auto_series_set_t>, auto_impl_t> ret;
00101   };
00102 
00103   template <class S, class T>
00104   struct identity_transducer_helper
00105   {
00106     typedef typename S::series_set_t     series_set_t;
00107     typedef typename series_set_t::monoid_t  monoid_t;
00108     typedef typename series_set_t::semiring_t semiring_t;
00109     typedef typename algebra::mute_series_traits<series_set_t, series_set_t, monoid_t>
00110     ::ret    tseries_set_t;
00111     typedef typename extension_traits<T>::ret impl_t;
00112     typedef Element<Transducer<tseries_set_t>, impl_t> ret;
00113   };
00114 
00115   template <class S, class T>
00116   typename identity_transducer_helper<S, T>::ret
00117   partial_identity(const Element<S, T>&);
00118 
00119   template <class Series>
00120   bool
00121   operator==(const Transducer<Series>&, const Transducer<Series>&);
00122 
00123 } // vcsn
00124 
00125 
00126 #ifndef VCSN_USE_INTERFACE_ONLY
00127 # include <vaucanson/automata/concept/transducer.hxx>
00128 #endif // VCSN_USE_INTERFACE_ONLY
00129 
00130 
00131 #endif // ! VCSN_AUTOMATA_CONCEPT_TRANSDUCER_HH

Generated on Sat Jul 29 17:13:12 2006 for Vaucanson by  doxygen 1.4.6