Salome HOME
Manage correctly DISBLED state for ElementaryNode.
[modules/yacs.git] / src / runtime / TypeConversions.cxx
index bd24737a98159ac2bdcd4e3a765451898e7587f2..9f5b145d847c265487f92e52f4f39969d5c1057f 100644 (file)
@@ -35,6 +35,7 @@
 #include "SALOME_GenericObj.hh"
 
 #include <iostream>
+#include <iomanip>
 #include <sstream>
 
 #ifdef WIN32
@@ -256,6 +257,17 @@ namespace YACS
                 if( t1->isA(t2->id()) )
                   return 1;
               }
+            else if(t1->kind() == Sequence)
+              {
+                const TypeCodeSeq *t1c(dynamic_cast<const TypeCodeSeq *>(t1));
+                if(!t1c)
+                  return 0;
+                const TypeCode *t1cc(t1c->contentType());
+                if(t1cc==t2)
+                  return 1;
+                if(t1cc->kind() == Objref && std::string(t1cc->id())==std::string(t2->id()))
+                  return 1;
+              }
             return 0;
           }
       };
@@ -1305,6 +1317,17 @@ namespace YACS
                     }
                   return mystr;
                 }
+              else if ((!xmlStrcmp(cur->name, (const xmlChar *)"string")))// <- here case where pyobj value has been stored in XML. pyobj has kind==ObjRef. And the stored format is String ! EDF11027
+                {
+                  //wait a string, got a string
+                  xmlChar * s = NULL;
+                  s = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+                  if(s==0)return "";
+                  DEBTRACE( "convertToYacsString " << (const char *)s );
+                  std::string mystr=std::string((const char *)s);
+                  xmlFree(s);
+                  return mystr;
+                }
               cur = cur->next;
             }
           stringstream msg;
@@ -1423,7 +1446,7 @@ namespace YACS
       static inline std::string convert(const TypeCode *t,double o)
         {
           stringstream msg ;
-          msg << "<value><double>" << o << "</double></value>\n";
+          msg << "<value><double>" << setprecision(16) << o << "</double></value>\n";
           return msg.str();
         }
     };
@@ -2267,7 +2290,7 @@ namespace YACS
     {
       PyObject *s;
       PyGILState_STATE gstate = PyGILState_Ensure(); 
-      s=PyObject_Repr(ob);
+      s=PyObject_Str(ob);
       std::string ss(PyString_AsString(s),PyString_Size(s));
       Py_DECREF(s);
       PyGILState_Release(gstate);