00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef VCSN_XML_XML_HXX
00018 # define VCSN_XML_XML_HXX
00019 
00030 # include <vaucanson/misc/usual_macros.hh>
00031 # include <vaucanson/xml/xml_converter.hh>
00032 
00033 namespace vcsn
00034 {
00035   namespace xml
00036   {
00037 
00038     XML::XML(const std::string& name, bool use_label_node)
00039       : name_(name), use_label_node_(use_label_node)
00040     {}
00041 
00042     template<typename Saver, typename Conv>
00043     void XML::operator()(std::ostream& out, const Saver& s,
00044                          const Conv&) const
00045     {
00046       xercesc::XMLPlatformUtils::Initialize();
00047 
00048       typedef typename Saver::automaton_t automaton_t;
00049 
00050       xml_converter<automaton_t> xc(use_label_node_);
00051       xc.save(s.automaton(), out, name_);
00052 
00053       xercesc::XMLPlatformUtils::Terminate();
00054     }
00055 
00056 
00057     template <typename Loader>
00058     void
00059     XML::operator()(std::istream& in, Loader& l)
00060     {
00061       xercesc::XMLPlatformUtils::Initialize();
00062 
00063       typedef typename Loader::automaton_t automaton_t;
00064 
00065       xml_converter<automaton_t> xc(use_label_node_);
00066       xc.load(l.automaton(), in);
00067 
00068       xercesc::XMLPlatformUtils::Terminate();
00069     }
00070 
00071 
00072   } 
00073 
00074 } 
00075 
00076 
00077 #endif // ! VCSN_XML_XML_HXX