Salome HOME
Fix for bug PAL12235 : Init values on input port not retrievable after write/read...
[modules/superv.git] / src / GraphBase / DataFlowBase_XmlHandler.cxx
index 7578329fa25b547ee96ac882ecf538ebe6346756..01fe6d9d7eac643480b10143b65fee52738fa07b 100644 (file)
@@ -48,6 +48,8 @@ GraphBase::XmlHandler::XmlHandler( CORBA::ORB_ptr Orb ,
   }
   VXSize = 0 ;
   GraphsNumber = 0 ;
+
+  aLinkValue = CORBA::Any();
 }
 
 GraphBase::XmlHandler::XmlHandler() {}
@@ -259,7 +261,12 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             if ( constructor ) {
               int sizedata = aListOfDataFlows[ GraphsNumber ].Datas.size() ;
               aListOfDataFlows[ GraphsNumber ].Datas.resize( sizedata+1 ) ;                
-              aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ] = aLink ;               
+
+             if ( aLink.aLinkValue.type()->kind() == CORBA::tk_double ) // mkr : PAL12235
+               aLink.aLinkValue = *aLinkDoubleValue ;
+
+             aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ] = aLink ;               
+
               if ( VXSize ) {
                 aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords.resize( VXSize ) ;
                 int ic ;
@@ -357,7 +364,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
           else if ( qName == "streamgraph-deltatime" ) {
             if ( fieldvalue[depth] == NULLSTRING )
               return returnfalse( this , "depth3-3" , qName ) ;
-            sscanf( fieldvalue[depth].c_str() ,"%lf" , (int * ) &aNode.theDeltaTime ) ;
+            sscanf( fieldvalue[depth].c_str() ,"%lf" , (double * ) &aNode.theDeltaTime ) ;
             fieldvalue[depth] = NULLSTRING ;
             step[depth]++ ;
             step[4] = 0 ;
@@ -709,7 +716,8 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             aLink.aLinkValue = CORBA::Any() ;
             switch ( Kind ) {
             case CORBA::tk_string: {
-              aLink.aLinkValue <<= (char *) NULL ;
+//Mandrake 10.1/Salome 3              aLink.aLinkValue <<= (char *) NULL ;
+              aLink.aLinkValue <<= (char *) "" ;
               char * t;
               aLink.aLinkValue >>= t;
 #if TRACE
@@ -718,8 +726,9 @@ bool GraphBase::XmlHandler::endElement( const QString&,
               break;
            }
             case CORBA::tk_double: {
-              aLink.aLinkValue <<= (double ) 0. ;
-              double d;
+              //aLink.aLinkValue <<= (double ) 0. ;
+             double d = 0.;
+             aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
               aLink.aLinkValue >>= d;
 #if TRACE
               MESSAGE( d << " (double)" );
@@ -759,8 +768,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             if ( fieldvalue[depth] == NULLSTRING )
               return returnfalse( this , "depth4-4" , qName ) ;
             if ( !strcmp( fieldvalue[depth].c_str() , "?" ) ) {
-//              aLink.aLinkValue.Value = fieldvalue[depth].c_str() ;
-              aLink.aLinkValue = CORBA::Any() ; // ???
+              aLink.aLinkValue <<= "" ;
            }
             else {
               switch ( aLink.aLinkValue.type()->kind() ) {
@@ -776,9 +784,12 @@ bool GraphBase::XmlHandler::endElement( const QString&,
               case CORBA::tk_double: {
                 double d;
                 sscanf( fieldvalue[depth].c_str() , "%lf" , &d ) ;
-                aLink.aLinkValue <<= d;
+                //aLink.aLinkValue <<= d;
+               aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+               aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+               aLinkDoubleValue = new CORBA::Any( aLinkValue );
 #if TRACE
-                MESSAGE( d << " (double)" );
+               MESSAGE( d << " (double)" );
 #endif
                 break;
              }
@@ -971,7 +982,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             fieldvalue[depth] = NULLSTRING ;
 #if TRACE
   //cout << "InDataStreamParameter.inParameter-dependency " << anInDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
-                 << step[depth] << endl ;
+  //               << step[depth] << endl ;
 #endif
 //            step[depth]++ ;
 //            step[depth] = 4 ;
@@ -984,7 +995,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             fieldvalue[depth] = NULLSTRING ;
 #if TRACE
   //cout << "InDataStreamParameter.inParameter-schema " << anInDataStreamParameter.theKindOfSchema << " step[" << depth << "]"
-                 << step[depth] << endl ;
+  //               << step[depth] << endl ;
 #endif
 //            step[depth]++ ;
 //            step[depth] = 4 ;
@@ -997,7 +1008,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             fieldvalue[depth] = NULLSTRING ;
 #if TRACE
   //cout << "InDataStreamParameter.inParameter-interpolation " << anInDataStreamParameter.theKindOfInterpolation << " step[" << depth << "]"
-                 << step[depth] << endl ;
+  //               << step[depth] << endl ;
 #endif
 //            step[depth]++ ;
 //            step[depth] = 4 ;
@@ -1012,7 +1023,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             step[depth] = 4 ;
 #if TRACE
   //cout << "InDataStreamParameter.inParameter-extrapolation " << anInDataStreamParameter.theKindOfExtrapolation << " step[" << depth << "]"
-                 << step[depth] << endl ;
+  //               << step[depth] << endl ;
 #endif
             break ;
           }
@@ -1029,7 +1040,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             step[depth] = 7 ;
 #if TRACE
   //cout << "OutDataStreamParameter.outParameter-type " << anOutDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]"
-                 << step[depth] << endl ;
+  //               << step[depth] << endl ;
 #endif
           }
           else
@@ -1048,7 +1059,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             fieldvalue[depth] = NULLSTRING ;
 #if TRACE
   //cout << "OutDataStreamParameter.outParameter-name " << anOutDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]"
-                 << step[depth] << endl ;
+  //               << step[depth] << endl ;
 #endif
 //            step[depth]++ ;
 //            step[depth] = 6 ;
@@ -1060,7 +1071,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             fieldvalue[depth] = NULLSTRING ;
 #if TRACE
   //cout << "OutDataStreamParameter.outParameter-dependency " << anOutDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
-                 << step[depth] << endl ;
+  //               << step[depth] << endl ;
 #endif
 //            step[depth]++ ;
 //            step[depth] = 6 ;
@@ -1074,7 +1085,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             step[depth] = 6 ;
 #if TRACE
   //cout << "OutDataStreamParameter.outParameter-values " << anOutDataStreamParameter.theNumberOfValues << " step[" << depth << "]"
-                 << step[depth] << endl ;
+  //               << step[depth] << endl ;
 #endif
           }
           else