synaps/upol/xml.h

00001 /*********************************************************************
00002 *    This file is part of the source code of SYNAPS library.         *
00003 *    Author(s): B. Mourrain, GALAAD, INRIA                           *
00004 **********************************************************************/
00005 #ifndef synaps_upol_xml_H_
00006 #define synaps_upol_xml_H_
00007 //--------------------------------------------------------------------
00008 #include <synaps/init.h>
00009 #include <synaps/base/xml.h>
00010 //--------------------------------------------------------------------
00011 __BEGIN_NAMESPACE_SYNAPS
00012 //--------------------------------------------------------------------
00013 template<typename C,typename R> struct UPolDse;
00014 //--------------------------------------------------------------------
00015 namespace xml 
00016 {
00017   //  using namespace SYNAPS;
00018 
00020   template<class ISTREAM, typename T>
00021   bool read_upol(ISTREAM& is, T& p)
00022   {
00023     if(skip(is,begin_polynomial))
00024       {
00025         std::string s; char c;
00026         while((c=is.get()) != EOF && c != '<') 
00027           {
00028             if(c != ' ' && c != '\n') s+=c;
00029           }
00030         s+='\0';
00031         p = T(s.data());
00032         return true;
00033       }
00034     else 
00035       {
00036         p=T(0); return false;
00037       }
00038   }
00039 
00041   template<class ISTREAM, typename C,typename R>
00042   bool read(ISTREAM& is, UPolDse<C,R>& p)
00043   {
00044     return read_upol(is,p);
00045   }
00046 
00048   template<class OSTREAM, typename C,typename R>
00049   OSTREAM& print(OSTREAM& os, const UPolDse<C,R>& p)
00050   {
00051     xml::print(os,p,"polynomial");
00052     return os;
00053   }
00054 
00055 }
00056 //----------------------------------------------------------------------
00057 __END_NAMESPACE_SYNAPS
00058 //----------------------------------------------------------------------
00059 #endif //synaps_upol_xml_H_

SYNAPS DOCUMENTATION
logo