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

# builders.hh

Go to the documentation of this file.

    00001 // builders.hh: this file is part of the Vaucanson project.
    00002 //
    00003 // Vaucanson, a generic library for finite state machines.
    00004 //
    00005 // Copyright (C) 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
    00018 #ifndef BUILDERS_HH
    00019 # define BUILDERS_HH
    00020
    00031 # include <string>
    00032 # include <xercesc/sax2/Attributes.hpp>
    00033 # include <xercesc/sax2/SAX2XMLReader.hpp>
    00034 # include <xercesc/sax2/DefaultHandler.hpp>
    00035
    00036 # include <xercesc/sax/SAXException.hpp>
    00037 # include <xercesc/util/XMLString.hpp>
    00038
    00039
    00040 # include <vaucanson/design_pattern/element.hh>
    00041 # include <vaucanson/automata/concept/automata.hh>
    00042 # include <vaucanson/automata/concept/transducer.hh>
    00043 # include <vaucanson/algebra/implementation/series/series.hh>
    00044 # include <vaucanson/algebra/concept/freemonoid_product.hh>
    00045 # include <vaucanson/xml/tools.hh>
    00046 # include <vaucanson/xml/xmleq.hh>
    00047
    00048 # define TParm                                  \
    00049     template <class S, class T>
    00050 # define TParmFMP                                       \
    00051     template <class S, class T, class M1, class M2>
    00052 # define AUTtype                                \
    00053     Element<Automata<S>, T>
    00054 # define TRANStype                              \
    00055     Element<Transducer<S>, T>
    00056
    00057 # define FMPtype                                                        \
    00058     Element<                                                            \
    00059       Automata<                                                         \
    00060         vcsn::algebra::Series<S, vcsn::algebra::FreeMonoidProduct<M1, M2> > \
    00061         >,                                                              \
    00062       T>
    00063
    00064 namespace vcsn
    00065 {
    00066   namespace xml
    00067   {
    00068     class MonoidHandler;
    00069     class SemiringHandler;
    00070     template <typename T>
    00071     class RegExpHandler;
    00072     template <typename T>
    00073     class LabelHandler;
    00074
    00075     namespace builders
    00076     {
    00077       // Processing monoid
    00078
    00079       template <typename T>
    00080       typename T::monoid_t*
    00081       create_monoid (T&,
    00082                      const xercesc::Attributes& attrs);
    00083
    00084       TParmFMP
    00085       typename FMPtype::monoid_t*
    00086       create_monoid (FMPtype&,
    00087                      const xercesc::Attributes& attrs);
    00088
    00089       template <typename T>
    00090       MonoidHandler*
    00091       monoidh_factory(T& monoid,
    00092                       const xercesc::Attributes& attrs,
    00093                       xercesc::DefaultHandler& root,
    00094                       xercesc::SAX2XMLReader* parser,
    00095                       XMLEq& eq);
    00096
    00097       template <typename T>
    00098       void
    00099       insert_letter (T& monoid,
    00100                      std::string letter);
    00101
    00102       // Processing semiring
    00103
    00104       template <typename T>
    00105       typename T::semiring_t*
    00106       create_semiring (T&,
    00107                        const xercesc::Attributes& attrs);
    00108
    00109       TParm
    00110       typename TRANStype::semiring_t*
    00111       create_semiring (TRANStype&,
    00112                        const xercesc::Attributes& attrs);
    00113
    00114       template <typename V, typename T>
    00115       SemiringHandler*
    00116       semiringh_factory(V& param,
    00117                         const xercesc::Attributes& attrs,
    00118                         T& semiring,
    00119                         xercesc::DefaultHandler& root,
    00120                         xercesc::SAX2XMLReader* parser,
    00121                         XMLEq& eq);
    00122
    00123       TParm
    00124       SemiringHandler*
    00125       semiringh_factory(TRANStype& param,
    00126                         const xercesc::Attributes& attrs,
    00127                         typename TRANStype::semiring_t& semiring,
    00128                         xercesc::DefaultHandler& root,
    00129                         xercesc::SAX2XMLReader* parser,
    00130                         XMLEq& eq);
    00131
    00132       // Processing label attributes
    00133
    00134       template <typename T>
    00135       typename T::series_set_elt_t
    00136       get_series (T& aut,
    00137                   std::map<std::string, std::string>& attrs,
    00138                   const char * token);
    00139
    00140       // Ensuring correct attributes
    00141
    00142       void
    00143       check_consistency (const xercesc::Attributes& attrs,
    00144                          const std::string& kind,
    00145                          const char* key,
    00146                          const std::string& expected);
    00147
    00148       // Getters
    00149
    00150       bool
    00151       has_attribute (const xercesc::Attributes& attrs,
    00152                      const char* key,
    00153                      const XMLCh* const uri = 0);
    00154
    00155       const XMLCh*
    00156       get_attribute (const xercesc::Attributes& attrs,
    00157                      const char* key,
    00158                      const XMLCh* uri = 0);
    00159
    00160       template <typename T>
    00161       RegExpHandler<T>*
    00162       labelh_factory(xercesc::DefaultHandler& root,
    00163                      T& aut,
    00164                      xercesc::SAX2XMLReader* parser,
    00165                      XMLEq& eq,
    00166                      const XMLCh* const localname,
    00167                      const xercesc::Attributes& attrs);
    00168
    00169       template <typename T>
    00170       typename T::series_set_elt_t
    00171       get_series_transition(T& aut,
    00172                             std::map<std::string, std::string>& attrs,
    00173                             LabelHandler<T>& labelh);
    00174     } // !builders
    00175   } // !xml
    00176 } // !vcsn
    00177
    00178 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
    00179 #  include <vaucanson/xml/builders.hxx>
    00180 # endif // VCSN_USE_INTERFACE_ONLY || !VCSN_USE_LIB
    00181
    00182 # undef AUTtype
    00183 # undef FMPtype
    00184 # undef TParm
    00185 # undef TParmFMP
    00186 # undef TRANStype
    00187
    00188 #endif // !BUILDERS_HH