Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/superv.git] / src / GraphExecutor / DataFlowExecutor_InNodeThreads.cxx
index 980aa5062c74a3cd860d87b3bf01f35cbf7551b7..ea4f2387aad11691bfdca773d0192e53d701e0f3 100644 (file)
@@ -85,6 +85,9 @@ int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) {
   _OldState = State() ;
   _NextState = Automaton()->NextState( _OldState , anEvent ) ;
   if ( _NextState == _OldState ) {
+    string anErrorMessage = string( "Automaton error for node " ) +
+                            string( Name() ) + " (SuperVision executor error)." ;
+    _OutNode->Graph()->SetMessages( anErrorMessage ) ;
     cdebug << pthread_self() << "/" << ThreadNo() << " " << Name()
            << " GraphExecutor::InNodeThreads::SendEvent SameStates ERROR _OldState/_NextState "
            << _OldState << " Event " << Automaton()->EventName( anEvent ) << endl ;
@@ -620,8 +623,8 @@ int GraphExecutor::InNode::executeAction() {
         char * msg = "Cannot pthread_create " ;
         perror( msg ) ;
         cdebug << ThreadNo() << " " << msg << " --> sleep(5)" << endl ;
-        cdebug << ThreadNo() << " PTHREAD_THREADS_MAX : "
-               << PTHREAD_THREADS_MAX << " pthread_create status : " ;
+       //        cdebug << ThreadNo() << " PTHREAD_THREADS_MAX : "
+        //       << PTHREAD_THREADS_MAX << " pthread_create status : " ;
         if ( pthread_sts == EAGAIN ) {
           cdebug << "EAGAIN(" << pthread_sts << ")" << endl ;
           cdebug << _OutNode->CreatedThreads() << " was created (and exited)" << endl ;
@@ -634,6 +637,7 @@ int GraphExecutor::InNode::executeAction() {
         delete [] msg ;
         pthread_exit( msg ) ;
       }
+      _OutNode->setRunFuncThread( T ) ; // mkr : IPAL14711
 #if ActionsTrace
       cdebug << pthread_self() << "/" << ThreadNo() << " " << Name()
              << " executeAction has created thread " << T << endl ;
@@ -888,7 +892,8 @@ int GraphExecutor::InNode::VoidAction() {
 int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
 #if SomeDataReadyActionTrace
   cdebug_in << pthread_self() << "/" << ThreadNo() << " " << Name()
-            << " DataWaiting_SomeDataReadyAction from " << DataFromNode() << endl;
+            << " DataWaiting_SomeDataReadyAction from " << DataFromNode()
+            << " " << GetNodeInPortsSize() << " Inport(s)" << endl;
 #endif
   unsigned int k;
   int InReady = 0 ;
@@ -979,7 +984,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
       anOutPort = anInPort->GetOutPort() ;
       if ( anOutPort ) {
 #if SomeDataReadyActionTrace
-        cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+        cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort"
+               << k << " "
                << anInPort->PortName() << " already setted to OutPort " << anOutPort->NodeName()
                << "( " << anOutPort->PortName() << " )" << endl ;
 #endif
@@ -988,7 +994,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
         anOutPort = CoupledNode()->GetChangeOutPort( anInPort->PortName() ) ;
         if ( anOutPort ) {
 #if SomeDataReadyActionTrace
-          cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+          cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort"
+                 << k << " "
                  << anInPort->PortName() << " change of OutPort from "
                  << anInPort->GetOutPort()->NodeName() << "( " << anInPort->GetOutPort()->PortName()
                  << " ) to " << anOutPort->NodeName() << "( " << anOutPort->PortName() << " )"
@@ -996,7 +1003,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
 #endif
        }
         else {
-          cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+          cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort"
+                 << k << " "
                  << anInPort->PortName() << " have NO OutPort ERROR " << endl ;
           return 0 ;
        }
@@ -1007,7 +1015,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
       anOutPort = anInPort->GetOutPort() ;
     }
 #if SomeDataReadyActionTrace
-    cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+    cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort"
+           << k << " "
            << anInPort->PortName() << " " << anInPort->PortState() << " "
            << anInPort->PortStatus() << " " << anInPort->Kind()  ;
     if ( anOutPort ) {
@@ -1044,6 +1053,21 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
        }
 #endif
         cdebug << endl ;
+#endif
+//JR 30.01.2007 : wrong debug for PAL12455
+#if 0
+        // mkr : PAL12455 -->
+        // MacroNode : give immediately the value to the corresponding graph
+        if ( IsMacroNode() ) {
+          GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphEditor()->Executor() ;
+          cdebug << "SomeDataReadyAction MacroNode " << aMacroGraph->Name() << " --> InputOfAny "
+                 << InReady << "/" << GetNodeInPortsSize() << " InPorts are Ready ( "
+                 << anInPort->PortName() << " ) ===> InputOfAny" << endl ;
+//        GraphMacroNode()->MacroObject()->InputOfAny( anInPort->PortName() , *anOutPort->Value() ) ;
+//JR 30.03.2005        aMacroGraph->InputOfAny( anInPort->PortName() , *anOutPort->Value() ) ;
+          aMacroGraph->InputOfAny( anInPort->PortName() , anOutPort->Value() ) ;
+        }
+        // mkr : PAL12455 <--
 #endif
       }
       else if ( IsLoopNode() && anInPort->IsDataConnected() ) {
@@ -1101,8 +1125,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
         InReady += 1 ;
 //JR 21.02.2005 Debug Memory leak :        CORBA::Any * anAny = new CORBA::Any() ;
         CORBA::Any anAny = CORBA::Any() ;
-//JR 21.02.2005 Debug Memory leak :        *anAny <<= (long ) 1 ;
-        anAny <<= (long ) 1 ;
+//JR 21.02.2005 Debug Memory leak :        *anAny <<= (CORBA::Long ) 1 ;
+        anAny <<= (CORBA::Long ) 1 ;
         _OutNode->Graph()->GetGraphNode( anOutPort->NodeName() )->GetChangeNodeOutGate()->SetValue( anAny ) ;
 #if SomeDataReadyActionTrace
         cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " "
@@ -1134,7 +1158,7 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
     else if ( anInPort->IsGate() ) {
 //JR 30.03.2005      const CORBA::Any * theValue = anOutPort->Value() ;
       const CORBA::Any theValue = anOutPort->Value() ;
-      long GateOpened ;
+      CORBA::Long GateOpened ;
 //JR 30.03.2005      (*theValue) >>= GateOpened ;
       theValue >>= GateOpened ;
       if ( GateOpened != 0 ) {
@@ -1228,10 +1252,32 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
     cdebug << pthread_self() << "/" << ThreadNo() << " Node " << Name() << " HasAllDataReady"
            << endl ;
 #endif
+//JR 30.01.2007 Right Debug PAL12455 --->
+//That must be done only for DataConnected ports and only once
+    if ( IsMacroNode() ) {
+      GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphEditor()->Executor() ;
+      for ( k = 0 ; k < (unsigned int ) GetNodeInPortsSize() ; k++ ) {
+        GraphBase::InPort * anInPort = GetChangeNodeInPort(k) ;
+        GraphBase::OutPort * anOutPort ;
+        anOutPort = anInPort->GetOutPort() ;
+        if ( anInPort->IsDataConnected() ) {
+          cdebug << "SomeDataReadyAction MacroNode " << aMacroGraph->Name()
+                 << " --> InputOfAny " << InReady << "/" << GetNodeInPortsSize()
+                 << " InPorts are Ready ( " << anInPort->PortName()
+                 << " ) ===> InputOfAny" << endl ;
+          aMacroGraph->InputOfAny( anInPort->PortName() , anOutPort->Value() ) ;
+        }
+      }
+    }
+// <--- JR 30.01.2007 Right Debug PAL12455
     HasAllDataReady( true ) ; // ==> Ready to execute
     res = 1 ;
   }
   else { // At least one Flag == 0 :
+#if SomeDataReadyActionTrace
+    cdebug << pthread_self() << "/" << ThreadNo() << " Node " << Name() << " HasNOTAllDataReady "
+           << InReady << "/" << GetNodeInPortsSize() << " DoAllDataReadyIf " << DoAllDataReadyIf << endl ;
+#endif
     HasAllDataReady( false ) ;
     res = SendEvent( GraphExecutor::NotAllDataReadyEvent );
   }
@@ -1780,7 +1826,7 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
 //JR 29.09.2005 Debug for CEA (examples/GraphMacroNodes1) :
 // Set of value of the OutGate of the corresponding MacroNode was missing
     CORBA::Any anAny = CORBA::Any() ;
-    anAny <<= (long ) 1 ;
+    anAny <<= (CORBA::Long ) 1 ;
     GraphMacroNode()->GraphEditor()->Executor()->OutputOfAny( Name() , "Gate" , anAny ) ;
 #if TraceDataReady_ExecuteAction
     cdebug << "DataReady_ExecuteAction OutputOfAny( " << Name() << " , Gate , 1 )" << endl ;
@@ -2310,7 +2356,7 @@ int GraphExecutor::InNode::Errored_ExecutingAction() {
 }
 
 #define SetWaitingStatesTrace 0
-// Set SUPERV::WaitingState to all InPorts 
+// Set SUPERV::WaitingState to all InPorts and Nodes
 void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) {
   int i ;
   int j ;
@@ -2332,9 +2378,9 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) {
       if ( anOutPort ) {
 //JR 21.02.2005 Debug Memory leak :        CORBA::Any * anAny = new CORBA::Any() ;
         CORBA::Any anAny = CORBA::Any() ;
-//        *anAny <<= (long ) 1 ;
-//JR 21.02.2005 Debug Memory leak :        *anAny <<= (long ) 0 ;
-        anAny <<= (long ) 0 ;
+//        *anAny <<= (CORBA::Long ) 1 ;
+//JR 21.02.2005 Debug Memory leak :        *anAny <<= (CORBA::Long ) 0 ;
+        anAny <<= (CORBA::Long ) 0 ;
         anOutPort->SetValue( anAny ) ;
         anInPort->PortState( SUPERV::WaitingState ) ;
 //        delete anAny ;
@@ -2357,6 +2403,17 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) {
     cdebug << "               --> InPort " << Name() << "( " << anInPort->PortName() << " ) "
            << anInPort->PortStatus() << " " << anInPort->PortState() << endl ;
 #endif
+//JR NPAL14110 09.02.2007 : SetWaitingStates was missing in the corresponding SubGraph !...
+    if ( IsMacroNode() ) {
+      GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphEditor()->Executor() ;
+#if SetWaitingStatesTrace
+      cdebug << ThreadNo()
+             << " --> GraphExecutor::InNodeThreads::SetWaitingStates MacroNode " << Name()
+             << " ---> MacroGraph " << aMacroGraph->Name() << " Inport "
+             << anInPort->PortName() << endl;
+#endif
+      aMacroGraph->SetWaitingStates( anInPort->PortName() ) ;
+    }
   }
   for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
     GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ;
@@ -2507,8 +2564,8 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
       if ( anOutPort ) {
 //JR 21.02.2005 Debug Memory leak :        CORBA::Any * anAny = new CORBA::Any() ;
         CORBA::Any anAny = CORBA::Any() ;
-//JR 21.02.2005 Debug Memory leak :        *anAny <<= (long ) 1 ;
-        anAny <<= (long ) 1 ;
+//JR 21.02.2005 Debug Memory leak :        *anAny <<= (CORBA::Long ) 1 ;
+        anAny <<= (CORBA::Long ) 1 ;
         anOutPort->SetValue( anAny ) ;
         aLabelNode->GetChangeNodeInGate()->PortState( SUPERV::ReadyState ) ;
 //        delete anAny ;
@@ -2698,8 +2755,8 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
             LoopOutPort->PortDone( true ) ;
 //JR 21.02.2005 Debug Memory leak :          CORBA::Any * anAny = new CORBA::Any() ; // InitLoop
             CORBA::Any anAny = CORBA::Any() ; // InitLoop
-//JR 21.02.2005 Debug Memory leak :          *anAny <<= (long ) 1 ;
-            anAny <<= (long ) 1 ;
+//JR 21.02.2005 Debug Memory leak :          *anAny <<= (CORBA::Long ) 1 ;
+            anAny <<= (CORBA::Long ) 1 ;
             LoopOutPort->SetValue( anAny ) ;
             int j ;
             for ( j = 0 ; j < toNode->GetNodeInPortsSize() ; j++ ) {
@@ -3193,14 +3250,15 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
       if ( anInPort->IsGate() ) {
 //JR 21.02.2005 Debug Memory leak :        CORBA::Any * anAny = new CORBA::Any() ;
         CORBA::Any anAny = CORBA::Any() ;
-//JR 21.02.2005 Debug Memory leak :        *anAny <<= (long ) 0 ;
-        anAny <<= (long ) 0 ;
+//JR 21.02.2005 Debug Memory leak :        *anAny <<= (CORBA::Long ) 0 ;
+        anAny <<= (CORBA::Long ) 0 ;
         theOutPort->SetValue( anAny ) ;
 //        delete anAny ;
       }
-      if ( !anInPort->IsDataStream() &&
+      if ( !anInPort->IsDataStream() 
+          && 
            !anInPort->IsDataConnected() ) {
-        anInPort->PortState( SUPERV::WaitingState ) ;
+          anInPort->PortState( SUPERV::WaitingState ) ;
       }
 //JR 18.02.2005 Debug Memory leak : delete does not destroy that string ...
 //      D.Name = CORBA::string_dup( anInPort->GetServicesParameter().Parametername ) ;
@@ -3219,7 +3277,7 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
       const char * Type = anInPort->GetServicesParameter().Parametertype ;
       switch ( D.Value.type()->kind() ) { // { string , long , double , objref }
       case CORBA::tk_string:
-        char * t;
+        const char * t;
         D.Value >>= t;
 #if InParametersSetTrace
         cdebug << t << " (string)" ;
@@ -3257,11 +3315,12 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 //          theOutPort->Value( D.Value ) ;
         }
         else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
-          long l ;
-          sscanf( t , "%ld" , &l ) ;
+          long ll ;
+          sscanf( t , "%ld" , &ll ) ;
+          CORBA::Long l = ll ;
           D.Value <<=  l ;
 #if InParametersSetTrace
-          cdebug << "string '" << t << " --> long " << l ;
+          cdebug << "string '" << t << " --> CORBA::Long " << l ;
 #endif
 //          theOutPort->Value( D.Value ) ;
         }
@@ -3272,7 +3331,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 #ifdef REDHAT // mkr : debug for PAL12255
           D.Value <<= f ;
 #else
-         D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+//JR     D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+          D.Value <<= (CORBA::Float) f ;
 #endif
 #if InParametersSetTrace
           cdebug << "string '" << t << "' --> " << setw(25) << setprecision(18) << d << " --> float " << " = "
@@ -3286,7 +3346,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 #ifdef REDHAT // mkr : debug for PAL12255
           D.Value <<= d ;
 #else
-         D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//JR     D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+          D.Value <<= (CORBA::Double) d ;
 #endif
 #if InParametersSetTrace
           cdebug << "string '" << t << " --> double " << setw(25) << setprecision(18) << d ;
@@ -3320,14 +3381,14 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
         theOutPort->StringValue( *GraphBase::Base::_fdebug ) ;
         cdebug << endl ;
 #endif
-        long l;
+        CORBA::Long l;
         D.Value >>= l;
 #if InParametersSetTrace
-        cdebug << l << " (long)" << endl ;
+        cdebug << l << " (CORBA::Long)" << endl ;
 #endif
         if ( !strcmp( Type , "string" ) ) {
           char t[40] ;
-          sprintf( t , "%ld" , l ) ;
+          sprintf( t , "%ld" , (long)l ) ;
           D.Value <<= t ;
 //          theOutPort->Value( D.Value ) ;
         }
@@ -3357,7 +3418,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 #ifdef REDHAT // mkr : debug for PAL12255
           D.Value <<= f ;
 #else
-         D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+//JR     D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+          D.Value <<= (CORBA::Float) f ;
 #endif
 //          theOutPort->Value( D.Value ) ;
         }
@@ -3367,7 +3429,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 #ifdef REDHAT // mkr : debug for PAL12255
           D.Value <<= d ;
 #else
-          D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//JR      D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+          D.Value <<= (CORBA::Double) d ;
 #endif
 //          theOutPort->Value( D.Value ) ;
         }
@@ -3384,7 +3447,7 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 #endif
         break;
       case CORBA::tk_double:
-        double d;
+        CORBA::Double d;
         D.Value >>= d;
 #if InParametersSetTrace
         cdebug << d << " (double)" << endl ;
@@ -3414,8 +3477,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 //          theOutPort->Value( D.Value ) ;
         }
         else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
-          long l ;
-          l = (long ) d ;
+          CORBA::Long l ;
+          l = (CORBA::Long ) d ;
           D.Value <<= l ;
 //          theOutPort->Value( D.Value ) ;
         }
@@ -3425,7 +3488,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 #ifdef REDHAT // mkr : debug for PAL12255
           D.Value <<= f ;
 #else
-          D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+//JR      D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+          D.Value <<= (CORBA::Float) f ;
 #endif
 //          theOutPort->Value( D.Value ) ;
         }
@@ -3480,7 +3544,7 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 //          theOutPort->Value( D.Value ) ;
         }
         else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
-          long l = 0 ;
+          CORBA::Long l = 0 ;
           D.Value <<= l ;
 //          theOutPort->Value( D.Value ) ;
         }
@@ -3489,7 +3553,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 #ifdef REDHAT // mkr : debug for PAL12255
           D.Value <<= f ;
 #else
-          D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+//JR      D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+          D.Value <<= (CORBA::Float) f ;
 #endif
 //          theOutPort->Value( D.Value ) ;
         }
@@ -3498,7 +3563,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
 #ifdef REDHAT // mkr : debug for PAL12255
           D.Value <<= d ;
 #else
-          D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//JR      D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+          D.Value <<= (CORBA::Double) d ;
 #endif
 //          theOutPort->Value( D.Value ) ;
         }
@@ -3583,14 +3649,15 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams ,
       D.Value <<=  s ;
     }
     else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
-      D.Value <<= (long ) 0 ;
+      D.Value <<= (CORBA::Long ) 0 ;
     }
     else if ( !strcmp( Type , "float" ) ) {
       float f = 0 ;
 #ifdef REDHAT // mkr : debug for PAL12255
       D.Value <<= f ;
 #else
-      D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+//JR  D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+      D.Value <<= (CORBA::Float) f ;
 #endif
     }
     else if ( !strcmp( Type , "double" ) ) {
@@ -3598,7 +3665,8 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams ,
 #ifdef REDHAT // mkr : debug for PAL12255
       D.Value <<= d ;
 #else
-      D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//JR  D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+      D.Value <<= (CORBA::Double) d ;
 #endif
     }
     else {
@@ -3607,7 +3675,7 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams ,
 #if InParametersSetTrace
     switch (D.Value.type()->kind()) { // { string , long , double , objref }
     case CORBA::tk_string:
-      char * t;
+      const char * t;
       D.Value >>= t;
       cdebug << ThreadNo() << " " << t << "(string)" << endl ;
       break;
@@ -3622,22 +3690,22 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams ,
       cdebug << ThreadNo() << " " << c << "(char)" << endl ;
       break;
     case CORBA::tk_short:
-      short s;
+      CORBA::Short s;
       D.Value >>= s;
       cdebug << ThreadNo() << " " << s << "(short)" << endl ;
       break;
     case CORBA::tk_long:
-      long l;
+      CORBA::Long l;
       D.Value >>= l;
-      cdebug << ThreadNo() << " " << l << "(long)" << endl ;
+      cdebug << ThreadNo() << " " << l << "(CORBA::Long)" << endl ;
       break;
     case CORBA::tk_float:
-      float f;
+      CORBA::Float f;
       D.Value >>= f;
       cdebug << ThreadNo() << " " << f << "(float)" << endl ;
       break;
     case CORBA::tk_double:
-      double d;
+      CORBA::Double d;
       D.Value >>= d;
       cdebug << ThreadNo() << " " << d << "(double)" << endl ;
       break;
@@ -3696,7 +3764,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
         ServicesAnyData D = OutParametersList[i] ;
         switch (D.Value.type()->kind()) { // { string , long , double , objref }
         case CORBA::tk_string: {
-          char * t;
+          const char * t;
           D.Value >>= t;
 #if OutParametersSetTrace
           cdebug << ThreadNo() << " " << t << "(string)" << endl ;
@@ -3706,7 +3774,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
         case CORBA::tk_boolean: {
           bool b ;
           D.Value >>= (CORBA::Any::to_boolean ) b;
-          long l = (long ) b ;
+          CORBA::Long l = (CORBA::Long ) b ;
           D.Value <<= l ;
 #if OutParametersSetTrace
           cdebug << ThreadNo() << " " << b << "(boolean)" << endl ;
@@ -3716,7 +3784,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
         case CORBA::tk_char: {
           unsigned char c ;
           D.Value >>= (CORBA::Any::to_char ) c;
-          long l = (long ) c ;
+          CORBA::Long l = (CORBA::Long ) c ;
           D.Value <<= l ;
 #if OutParametersSetTrace
           cdebug << ThreadNo() << " " << c << "(char)" << endl ;
@@ -3724,9 +3792,9 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
           break;
        }
         case CORBA::tk_short: {
-          short s;
+          CORBA::Short s;
           D.Value >>= s;
-          long l = (long ) s ;
+          CORBA::Long l = (CORBA::Long ) s ;
           D.Value <<= l ;
 #if OutParametersSetTrace
           cdebug << ThreadNo() << " " << s << "(short)" << endl ;
@@ -3734,21 +3802,22 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
           break;
        }
         case CORBA::tk_long: {
-          long l;
+          CORBA::Long l;
           D.Value >>= l;
 #if OutParametersSetTrace
-          cdebug << ThreadNo() << " " << l << "(long)" << endl ;
+          cdebug << ThreadNo() << " " << l << "(CORBA::Long)" << endl ;
 #endif
           break;
        }
         case CORBA::tk_float: {
-          float f;
+          CORBA::Float f;
           D.Value >>= f;
           double d = (double ) f ;
 #ifdef REDHAT // mkr : debug for PAL12255
           D.Value <<= d ;
 #else
-          D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+//JR      D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+          D.Value <<= (CORBA::Double) d ;
 #endif
 #if OutParametersSetTrace
           cdebug << ThreadNo() << " " << f << "(float)" << endl ;
@@ -3756,7 +3825,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
           break;
        }
         case CORBA::tk_double: {
-          double d;
+          CORBA::Double d;
           D.Value >>= d;
 #if OutParametersSetTrace
           cdebug << ThreadNo() << " " << d << "(double)" << endl ;
@@ -3795,7 +3864,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
 #if OutParametersSetTrace
             cdebug << " Gate " ;
 #endif
-            long l = 1;
+            CORBA::Long l = 1;
             OutParametersList[i].Value <<= l;
             anOutPort->SetValue( OutParametersList[i].Value );
           }
@@ -3868,6 +3937,10 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
           const char * ToNodeName = anOutPort->ChangeInPorts( j )->NodeName() ;
           if ( !strcmp( ToNodeName , _OutNode->Name() ) &&
                _OutNode->Graph()->GraphMacroLevel() != 0 ) {
+//JR NPAL14110 09.02.2007 : That must be done only at the end of SubGraph because we may
+//                          have an output of the SubGraph in a Loop !...
+//                          So that code must be done in CheckAllDone
+#if 0
 #if OutParametersSetTrace
             cdebug << "OutParametersSet ToNodeName " << _OutNode->Name() << " CoupledNode "
                    << _OutNode->Graph()->CoupledNodeName() << _OutNode->Graph()->CoupledNode()
@@ -3883,7 +3956,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
                    << _OutNode->Graph()->CoupledNodeName() << " , "
                    << anOutPort->ChangeInPorts( j )->PortName() << " , value )" << endl ;
 #endif
-
+#endif
          }
           else {
            GraphBase::ComputingNode * ToNode = _OutNode->Graph()->GetChangeGraphNode( ToNodeName ) ;
@@ -3926,7 +3999,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
 #if OutParametersSetTrace
         switch ( anOutPort->Value().type()->kind() ) {
         case CORBA::tk_string:
-          char * t;
+          const char * t;
           (anOutPort->Value()) >>= t;
           cdebug << ThreadNo() << " Out" << i << " : " << t << "(string)" << endl ;
           break;
@@ -3941,22 +4014,22 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
           cdebug << ThreadNo() << " Out" << i << " : " << c << "(char)" << endl ;
           break;
         case CORBA::tk_short:
-          short s;
+          CORBA::Short s;
           (anOutPort->Value()) >>= s;
           cdebug << ThreadNo() << " Out" << i << " : " << s << "(short)" << endl ;
           break;
         case CORBA::tk_long:
-          long l;
+          CORBA::Long l;
           (anOutPort->Value()) >>= l;
-          cdebug << ThreadNo() << " Out" << i << " : " << l << "(long)" << endl ;
+          cdebug << ThreadNo() << " Out" << i << " : " << l << "(CORBA::Long)" << endl ;
           break;
         case CORBA::tk_float:
-          float f;
+          CORBA::Float f;
           (anOutPort->Value()) >>= f;
           cdebug << ThreadNo() << " Out" << i << " : " << f << "(float)" << endl ;
           break;
         case CORBA::tk_double:
-          double d;
+          CORBA::Double d;
           (anOutPort->Value()) >>= d;
           cdebug << ThreadNo() << " Out" << i << " : " << d << "(double)" << endl ;
           break;
@@ -4010,7 +4083,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
                  << aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " WITH DefaultPort"
                  << endl ;
 #endif
-          long l = 1;
+          CORBA::Long l = 1;
           OutParametersList[0].Value <<= l ;
           aGateOutPort->SetValue( OutParametersList[0].Value ) ;
        }
@@ -4037,7 +4110,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
                << aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " NO DefaultPort"
                << " OrSwitch " << OrSwitch << " DefaultSwitch " << DefaultSwitch << endl ;
 #endif
-        long l = 0;
+        CORBA::Long l = 0;
         OutParametersList[0].Value <<= l ;
         aGateOutPort->SetValue( OutParametersList[0].Value ) ;
       }