xml_chooser.hxx

Go to the documentation of this file.
00001 // xml_chooser.hxx: 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 #ifndef VCSN_XML_XML_CHOOSER_HXX
00018 # define VCSN_XML_XML_CHOOSER_HXX
00019 
00032 namespace vcsn
00033 {
00034   namespace xml
00035   {
00036     /*-------------.
00037     | Base chooser |
00038     `-------------*/
00039 
00040     template <class S, class T>
00041     void
00042     xml_chooser_base<S, T>::create_type_tag(const Element<S, T>& aut,
00043                                             xercesc::DOMDocument* doc,
00044                                             xercesc::DOMElement* root)
00045     {
00046       xercesc::DOMElement* type = tools::create_element(doc, "labelType");
00047       xercesc::DOMElement* monoid =
00048         tools::create_monoid(aut.structure().series().monoid(), doc, type);
00049       tools::create_alphabet(aut.structure().series().monoid().alphabet(),
00050                              doc, monoid);
00051       tools::create_semiring(aut, aut.structure().series().semiring(),
00052                              doc, type);
00053       root->appendChild(type);
00054     }
00055 
00056 
00057     template <class S, class T>
00058     void
00059     xml_chooser_base<S, T>::create_label(xercesc::DOMDocument* doc,
00060                                          htransition_t e,
00061                                          const Element<S, T>& aut,
00062                                          xercesc::DOMElement* elt,
00063                                          bool use_label_node)
00064 
00065     {
00066       if (use_label_node)
00067         tools::add_xml_label(doc, elt, aut, aut.series_of(e));
00068       else
00069         tools::add_label(elt, aut, aut.series_of(e));
00070     }
00071 
00072 
00073     template <class S, class T>
00074     void
00075     xml_chooser_base<S, T>::create_initial_label(xercesc::DOMDocument* doc,
00076                                                  hstate_t s,
00077                                                  const Element<S, T>& aut,
00078                                                  xercesc::DOMElement* elt,
00079                                                  bool use_label_node)
00080     {
00081       if (use_label_node)
00082         tools::add_xml_label(doc, elt, aut, aut.get_initial(s));
00083       else
00084         tools::add_label(elt, aut, aut.get_initial(s));
00085     }
00086 
00087     template <class S, class T>
00088     void
00089     xml_chooser_base<S, T>::create_final_label(xercesc::DOMDocument* doc,
00090                                                hstate_t s,
00091                                                const Element<S, T>& aut,
00092                                                xercesc::DOMElement* elt,
00093                                                bool use_label_node)
00094     {
00095       if (use_label_node)
00096         tools::add_xml_label(doc, elt, aut, aut.get_final(s));
00097       else
00098         tools::add_label(elt, aut, aut.get_final(s));
00099     }
00100 
00101 
00102     /*---------------------.
00103     | Transducers on P(B*) |
00104     `---------------------*/
00105 
00106     template <class S, class T>
00107     void
00108     xml_chooser<Transducer<S>, T>
00109     ::create_type_tag(const Element<Transducer<S>, T>& aut,
00110                       xercesc::DOMDocument* doc,
00111                       xercesc::DOMElement* root)
00112     {
00113       xercesc::DOMElement* type = tools::create_element(doc, "labelType");
00114       xercesc::DOMElement* in_monoid =
00115         tools::create_monoid(aut.structure().series().monoid(), doc, type);
00116       tools::create_alphabet(aut.structure().series().monoid().alphabet(),
00117                              doc, in_monoid);
00118       xercesc::DOMElement* semiring =
00119         tools::create_semiring(aut, aut.structure().series().semiring(),
00120                                doc, type);
00121       xercesc::DOMElement* out_monoid =
00122         tools::create_monoid(aut.structure().series().semiring().monoid(),
00123                              doc, semiring);
00124       tools::create_alphabet(aut.structure().series().semiring()
00125                              .monoid().alphabet(), doc, out_monoid);
00126       tools::create_semiring(aut,
00127                              aut.structure().series().semiring().semiring(),
00128                              doc, semiring);
00129       root->appendChild(type);
00130     }
00131 
00132 
00133     /*----------------.
00134     | FMP Transducers |
00135     `----------------*/
00136 
00137     template <class S, class T, class M1, class M2>
00138     void
00139     xml_chooser<FMPtype>::create_type_tag(const Element<FMPtype>& aut,
00140                                           xercesc::DOMDocument* doc,
00141                                           xercesc::DOMElement* root)
00142     {
00143       xercesc::DOMElement* type = tools::create_element(doc, "labelType");
00144       xercesc::DOMElement* monoid =
00145         tools::create_monoid(aut.structure().series().monoid(), doc, type);
00146 
00147       xercesc::DOMElement* first_monoid =
00148         tools::create_monoid(aut.structure().series().monoid().first_monoid(),
00149                              doc, monoid);
00150       tools::create_alphabet(aut.structure().series().monoid()
00151                              .first_monoid().alphabet(),
00152                              doc, first_monoid);
00153 
00154       xercesc::DOMElement* second_monoid =
00155         tools::create_monoid(aut.structure().series().monoid().second_monoid(),
00156                              doc, monoid);
00157       tools::create_alphabet(aut.structure().series().monoid()
00158                              .second_monoid().alphabet(),
00159                              doc, second_monoid);
00160 
00161       tools::create_semiring(aut, aut.structure().series().semiring(),
00162                              doc, type);
00163       root->appendChild(type);
00164     }
00165 
00166 
00167   } // !xml
00168 
00169 } // !vcsn
00170 
00171 #endif // ! VCSN_XML_XML_CHOOSER_HXX

Generated on Sun Jul 29 19:35:31 2007 for Vaucanson by  doxygen 1.5.2