Salome HOME
Some tests are modified to work in session less mode.
[modules/yacs.git] / src / runtime / TypeConversions.cxx
index 2c76e0e7acbbef49b4f1a527193efe24df734a81..8b910636dbfa341e6254040e35ff06cf5c82d90a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -59,22 +59,6 @@ namespace YACS
 {
   namespace ENGINE
   {
-    void printbin(const std::string& bin)
-      {
-        register char c;
-        for(int i=0;i<bin.length();i++)
-          {
-            c=bin[i];
-            if (c < ' ' || c >= 0x7f) 
-              {
-                fprintf(stderr,"\\x%02x",c & 0xff);
-              }
-            else
-              fprintf(stderr,"%c",c);
-          }
-        fprintf(stderr,"\n");
-      }
-
     std::string getImplName(ImplType impl)
       {
          switch(impl)
@@ -1616,7 +1600,7 @@ namespace YACS
     {
       static inline std::string convert(const TypeCode *t,YACS::ENGINE::Any* o,void*,int protocol)
         {
-          if(o->getType()->kind()==String)
+          if(o->getType()->kind()==String || o->getType()->kind()==Objref)
             return o->getStringValue();
           stringstream msg;
           msg << "Problem in conversion: a objref(string) is expected " ;
@@ -1702,7 +1686,7 @@ namespace YACS
         {
           //Check if objref is a GenericObj and register it if it is the case (workaround for bad management of GenericObj)
           if(o=="" || (t->isA(Runtime::_tc_file)) || (strncmp(t->id(),"python",6)==0) || (strncmp(t->id(),"json",4)==0))
-            return YACS::ENGINE::AtomAny::New(o);
+            return YACS::ENGINE::AtomAny::New(o, const_cast<TypeCode *>(t));
 
           //Objref CORBA. prefix=IOR,corbaname,corbaloc
           CORBA::Object_var obref;
@@ -1736,7 +1720,7 @@ namespace YACS
           else
               DEBTRACE("It's a CORBA::Object but not a SALOME::GenericObj");
 
-          return YACS::ENGINE::AtomAny::New(o);
+          return YACS::ENGINE::AtomAny::New(o, const_cast<TypeCode *>(t));
         }
     };