]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Mandriva 2006 porting.
authormkr <mkr@opencascade.com>
Mon, 6 Mar 2006 15:36:25 +0000 (15:36 +0000)
committermkr <mkr@opencascade.com>
Mon, 6 Mar 2006 15:36:25 +0000 (15:36 +0000)
src/GraphBase/DataFlowBase_DataPort.cxx
src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx
src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx

index ca0d432894958ca4f1d03b04999e855cb002374b..7830313800b12bb80ab126b94023e4d02d4833a5 100644 (file)
@@ -231,8 +231,10 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
       }
       else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
         double d = l ;
-        *theValue <<= d ;
+       theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+        //*theValue <<= d ;
         *theValue >>= d ;
+
 #if ValueTrace
         cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
 #endif
@@ -250,8 +252,13 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
                << theValue->type()->kind() ;
 #endif
       }
-      _theValue = theValue ;
-      *_Value = theValue ;
+
+      //_theValue = theValue ;
+      _theValue = new CORBA::Any( *theValue ) ;
+
+      //*_Value = theValue ;
+      _Value = &_theValue ;
+
 //JR 21.02.2005 Debug Memory leak : 
       delete aDataValue ;
     }
@@ -264,8 +271,12 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
     cdebug << "Value( " << d << ") (double)";
 #endif
     if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { // SuperVision Value
-      _theValue = aDataValue ;
-      *_Value = aDataValue ;
+      //_theValue = aDataValue ;
+      _theValue = new CORBA::Any( *aDataValue ) ;
+
+      //*_Value = aDataValue ;
+      _Value = &_theValue ;
+
       *_theValue >>= d;
 #if ValueTrace
       cdebug << " == Value( " << d << ") (double)";
@@ -305,8 +316,12 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
                << theValue->type()->kind() ;
 #endif
       }
-      _theValue = theValue ;
-      *_Value = theValue ;
+      //_theValue = theValue ;
+      _theValue = new CORBA::Any( *theValue ) ;
+
+      //*_Value = theValue ;
+      _Value = &_theValue ;
+
 //JR 21.02.2005 Debug Memory leak : 
       delete aDataValue ;
     }
@@ -361,14 +376,19 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) {
       }
       else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
         double d = (double ) 0. ;
-        *theValue <<= d ;
+       theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+        //*theValue <<= d ;
         *theValue >>= d;
 #if ValueTrace
         cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
 #endif
       }
-      _theValue = theValue ;
-      *_Value = theValue ;
+      //_theValue = theValue ;
+      _theValue = new CORBA::Any( *theValue ) ;
+
+      //*_Value = theValue ;
+      _Value = &_theValue ;
+
 //JR 21.02.2005 Debug Memory leak : 
       delete aDataValue ;
     }
index 7ff605e1421b7f46e2cab2b2b2dbb5221c6dba96..d5bfc533ef18d20f571f1f9524d4403754a2ae8f 100644 (file)
@@ -126,8 +126,9 @@ int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) {
 #if SendEventTrace
     cdebug << pthread_self() << "/" << ThreadNo() << " SendedEvent Node " << Name()
            << " will exit : a node was aborted ..." << endl ;
-    State( _NextState ) ;
 #endif
+    State( _NextState ) ;
+    sts = false;
   }
   else {
     sts = executeAction() ;
@@ -586,6 +587,7 @@ void GraphExecutor::InNode::ThreadStartAction() {
 }
 
 int GraphExecutor::InNode::executeAction() {
+  
   int oldRewindStack = ( _RewindStack > MAXSTACKTHREADSIZE ) ;
   if ( !CreateNewThread() && oldRewindStack ) {
 #if ActionsTrace
@@ -1406,6 +1408,7 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
   nOutParams = GetNodeOutPortsSize() ;
   OutParametersList = new ServicesAnyData[nOutParams];
   InOutParametersSet( nOutParams , OutParametersList ) ;
+
 #if 0
   if ( !Err && IsComputingNode() ) {
     cdebug << ThreadNo() << " DataReady_ExecuteAction " << Name() << " "
@@ -1879,6 +1882,7 @@ int GraphExecutor::InNode::DataReady_ExecuteActionInLineNodes( ServicesAnyData *
                                     InLineNode()->PyFuncName() ,
                                     InParametersList , ServiceInParameter().length() ,
                                     OutParametersList , ServiceOutParameter().length() ) ;
+
       if ( !StsPyDynInvoke ) {
         string anErrorMessage = string( "Dynamic Python call for node " ) +
                                 string( Name() ) + " function " +
@@ -1894,10 +1898,12 @@ int GraphExecutor::InNode::DataReady_ExecuteActionInLineNodes( ServicesAnyData *
              << InLineNode()->PyFuncName()
              << "' IsGOTONode PyDynInvoke"  << endl ;
 #endif
+
       StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
                                     InLineNode()->PyFuncName() ,
                                     InParametersList , ServiceInParameter().length() ,
                                     OutParametersList , ServiceOutParameter().length() ) ;
+
       if ( !StsPyDynInvoke ) {
         string anErrorMessage = string( "Dynamic Python call for node " ) +
                                 string( Name() ) + " function " +
@@ -1913,10 +1919,12 @@ int GraphExecutor::InNode::DataReady_ExecuteActionInLineNodes( ServicesAnyData *
              << InLineNode()->PyFuncName()
              << "' IsSwitchNode PyDynInvoke"  << endl ;
 #endif
+
       StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
                                     InLineNode()->PyFuncName() ,
                                     InParametersList , ServiceInParameter().length() ,
                                     OutParametersList , ServiceOutParameter().length() ) ;
+
       if ( !StsPyDynInvoke ) {
         string anErrorMessage = string( "Dynamic Python call for node " ) +
                                 string( Name() ) + " function " +
@@ -1932,10 +1940,12 @@ int GraphExecutor::InNode::DataReady_ExecuteActionInLineNodes( ServicesAnyData *
              << InLineNode()->PyFuncName()
              << "' IsSwitchNode PyDynInvoke"  << endl ;
 #endif
+
       StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
                                     InLineNode()->PyFuncName() ,
                                     InParametersList , ServiceInParameter().length() + 1 ,
                                     OutParametersList , ServiceOutParameter().length() + 1 ) ;
+
       if ( !StsPyDynInvoke ) {
         string anErrorMessage = string( "Dynamic Python call for node " ) +
                                 string( Name() ) + " function " +
@@ -1980,6 +1990,7 @@ int GraphExecutor::InNode::DataReady_ExecuteActionInLineNodes( ServicesAnyData *
       else {
         for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
           OutParametersList[argout0 + i].Value = InParametersList[argin0 + i].Value ;
+
 #if TraceDataReady_ExecuteAction
           cdebug << "ArgOut->In" << InParametersList[argin0 + i].Name.c_str()
                  << " " << AnyValue( InParametersList[argin0 + i].Value )
@@ -3258,7 +3269,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
           double d ;
           sscanf( t , "%lf" , &d ) ;
           float f = d ;
-          D.Value <<= f ;
+          D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+//        D.Value <<= f ;
 #if InParametersSetTrace
           cdebug << "string '" << t << "' --> " << setw(25) << setprecision(18) << d << " --> float " << " = "
                  << setw(25) << setprecision(18) << f ;
@@ -3268,7 +3280,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
         else if ( !strcmp( Type , "double" ) ) {
           double d ;
           sscanf( t , "%lf" , &d ) ;
-          D.Value <<= d ;
+          D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//        D.Value <<= d ;
 #if InParametersSetTrace
           cdebug << "string '" << t << " --> double " << setw(25) << setprecision(18) << d ;
 #endif
@@ -3335,13 +3348,15 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
         else if ( !strcmp( Type , "float" ) ) {
           float f ;
           f = (float ) l ;
-          D.Value <<= f ;
+          D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+//        D.Value <<= f ;
 //          theOutPort->Value( D.Value ) ;
         }
         else if ( !strcmp( Type , "double" ) ) {
           double d ;
           d = (double ) l ;
-          D.Value <<= d ;
+          D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//        D.Value <<= d ;
 //          theOutPort->Value( D.Value ) ;
         }
 //        else if ( !strcmp( Type , "objref" ) ) {
@@ -3395,7 +3410,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
         else if ( !strcmp( Type , "float" ) ) {
           float f ;
           f = (float ) d ;
-          D.Value <<= f ;
+          D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+//        D.Value <<= f ;
 //          theOutPort->Value( D.Value ) ;
         }
         else if ( !strcmp( Type , "double" ) ) {
@@ -3455,12 +3471,14 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
         }
         else if ( !strcmp( Type , "float" ) ) {
           float f = 0 ;
-          D.Value <<= f ;
+          D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+//        D.Value <<= f ;
 //          theOutPort->Value( D.Value ) ;
         }
         else if ( !strcmp( Type , "double" ) ) {
           double d = 0 ;
-          D.Value <<= d ;
+          D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//        D.Value <<= d ;
 //          theOutPort->Value( D.Value ) ;
         }
 //        else if ( !strcmp( Type , "objref" ) ) {
@@ -3548,11 +3566,13 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams ,
     }
     else if ( !strcmp( Type , "float" ) ) {
       float f = 0 ;
-      D.Value <<= f ;
+      D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+//    D.Value <<= f ;
     }
     else if ( !strcmp( Type , "double" ) ) {
       double d = 0 ;
-      D.Value <<= d ;
+      D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//    D.Value <<= d ;
     }
     else {
       D.Value <<= CORBA::Object::_nil() ;
@@ -3698,7 +3718,8 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
           float f;
           D.Value >>= f;
           double d = (double ) f ;
-          D.Value <<= d ;
+          D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//        D.Value <<= d ;
 #if OutParametersSetTrace
           cdebug << ThreadNo() << " " << f << "(float)" << endl ;
 #endif
index 85fc431b5bea453571f46a6746135542b7c1a930..68211dadd9ae588aadae2d0d05cbb5600e5e35c3 100644 (file)
@@ -392,8 +392,12 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
         ArgValue = Py_BuildValue( "O" , ResultObj ) ;
         PyTuple_SetItem( ArgsList , i , ArgValue ) ;
 #if PyDynInvokeTrace
-        cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value  (objref) ArgsList->ob_refcnt"
-               << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ;
+       if ( ArgValue )
+         cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value  (objref) ArgsList->ob_refcnt"
+                << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ;
+       else
+         cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value  (objref) ArgsList->ob_refcnt"
+                << ArgsList->ob_refcnt << " ArgValue is NULL" << endl ;
         cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ;
 #endif
         Py_DECREF( MyPyObjRefList ) ;
@@ -402,9 +406,13 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
         }
         else {
 #if PyDynInvokeTrace
-          cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ;
+         if ( ResultObj )
+           cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ;
+         else
+           cdebug << "ResultObj is NULL" << endl ;
 #endif
-          Py_DECREF( ResultObj ) ;
+         if ( ResultObj )
+           Py_DECREF( ResultObj ) ;
         }
         break ;
       }
@@ -573,7 +581,8 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
           else {
             f = PyFloat_AsDouble( ArgValue ) ;
          }
-          data <<= f ;
+         data.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+          //data <<= f ;
 #if PyDynInvokeTrace
           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << f << " (float)"
                  << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
@@ -597,7 +606,8 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
           else {
             d = PyFloat_AsDouble( ArgValue ) ;
          }
-          data <<= d ;
+         data.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+          //data <<= d ;
 #if PyDynInvokeTrace
           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)"
                  << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"