rw.hh

Go to the documentation of this file.
00001 // rw.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2007, 2008 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 
00018 #ifndef VCSN_XML_CONTEXTS_RW_HH
00019 # define VCSN_XML_CONTEXTS_RW_HH
00020 
00031 # include <string>
00032 
00033 # include <xercesc/sax2/Attributes.hpp>
00034 # include <xercesc/util/XMLString.hpp>
00035 
00036 # include <vaucanson/xml/handlers_base.hh>
00037 # include <vaucanson/xml/builders.hh>
00038 # include <vaucanson/xml/regexp.hh>
00039 # include <vaucanson/xml/xml_exp_visitor.hh>
00040 
00041 # include <vaucanson/automata/concept/transducer.hh>
00042 # include <vaucanson/algebra/implementation/series/series.hh>
00043 
00044 # define TRANStype                              \
00045     Element<Transducer<S>, T>
00046 
00047 # define TRANSseries                            \
00048     Element<vcsn::algebra::Series<vcsn::algebra::Series<R, S>, T>, U>
00049 
00050 # define SParamTRANS \
00051     template <typename R, typename S, typename T, typename U>
00052 
00053 # define TRANSsemiring \
00054   vcsn::algebra::Series<S, T>
00055 
00056 namespace vcsn
00057 {
00058   namespace xml
00059   {
00063     template <typename T>
00064     class SeriesSemiringHandler : public Handler
00065     {
00066       public:
00067         SeriesSemiringHandler (xercesc::SAX2XMLReader* parser,
00068                      Handler& root,
00069                      T& semiring);
00070 
00071         void
00072         start (const XMLCh* const uri,
00073                       const XMLCh* const localname,
00074                       const XMLCh* const qname,
00075                       const xercesc::Attributes& attrs);
00076         void
00077         end (const XMLCh* const uri,
00078                     const XMLCh* const localname,
00079                     const XMLCh* const qname);
00080       private:
00081         T&              semiring_;
00082         Handler*        ssemiringh_;
00083         Handler*        monoidh_;
00084         UnsupHandler    unsuph_;
00085     };
00086 
00087     SParamTRANS
00088     class WeightHandler<TRANSseries > : public RegexpHandler<TRANSseries >
00089     {
00090       // Access to base class protected members.
00091       using RegexpHandler<TRANSseries >::eq_;
00092       using RegexpHandler<TRANSseries >::parser_;
00093       using RegexpHandler<TRANSseries >::param_;
00094       using RegexpHandler<TRANSseries >::root_;
00095       using RegexpHandler<TRANSseries >::end_;
00096 
00097       public:
00098         WeightHandler (xercesc::SAX2XMLReader* parser,
00099                        Handler& root,
00100                        TRANSseries param);
00101 
00102         void
00103         start (const XMLCh* const uri,
00104                       const XMLCh* const localname,
00105                       const XMLCh* const qname,
00106                       const xercesc::Attributes& attrs);
00107         void
00108         end (const XMLCh* const uri,
00109                     const XMLCh* const localname,
00110                     const XMLCh* const qname);
00111 
00112       protected:
00113         typedef typename TRANSseries::set_t::semiring_t series_set_t;
00114         typedef typename TRANSseries::value_t::semiring_elt_value_t     series_set_elt_value_t;
00115         typedef vcsn::Element<series_set_t, series_set_elt_value_t> series_set_elt_t;
00116 
00117         RegexpHandler<series_set_elt_t>*
00118         create_weighth(const XMLCh* const localname);
00119 
00120         RegexpHandler<series_set_elt_t>*        weighth_;
00121     };
00122 
00123     namespace builders
00124     {
00125       template <typename S, typename T>
00126       typename TRANStype::semiring_t*
00127       create_semiring (TRANStype&,
00128                        const XMLCh* const localname,
00129                        const xercesc::Attributes& attrs);
00130 
00131       template <typename S, typename T>
00132       Handler*
00133       create_semiringh(TRANSsemiring& semiring,
00134                         const xercesc::Attributes& attrs,
00135                         xercesc::SAX2XMLReader* parser,
00136                         Handler& root);
00137 
00138     } // !builders
00139 
00140     namespace builders
00141     {
00142       SParamTRANS
00143       RegexpHandler<TRANSseries >*
00144       create_weighth(xercesc::SAX2XMLReader* parser,
00145                      RegexpHandler<TRANSseries >& root,
00146                      TRANSseries param,
00147                      const xercesc::Attributes& attrs);
00148     }
00152     namespace builders
00153     {
00154       template <typename S, typename T>
00155       const char* get_semiring_operations(const vcsn::algebra::Series<S, T>&);
00156     } // !builders
00157 
00158     namespace builders
00159     {
00160       template <typename S, typename T>
00161       void
00162       create_semiring_node(const TRANStype&,
00163                            xercesc::DOMDocument* doc,
00164                            xercesc::DOMElement* root);
00165     }
00166   } // !xml
00167 } // !vcsn
00168 
00169 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00170 #  include <vaucanson/xml/contexts/rw.hxx>
00171 # endif // VCSN_USE_INTERFACE_ONLY || !VCSN_USE_LIB
00172 
00173 # undef TRANStype
00174 # undef TRANSseries
00175 # undef SParamTRANS
00176 # undef TRANSsemiring
00177 
00178 #endif // !VCSN_XML_CONTEXTS_RW_HH

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