Salome HOME
MacroNodes and omniORB4 porting and state of nodes when an other node has aborted
authorrahuel <rahuel@opencascade.com>
Wed, 26 Oct 2005 12:51:36 +0000 (12:51 +0000)
committerrahuel <rahuel@opencascade.com>
Wed, 26 Oct 2005 12:51:36 +0000 (12:51 +0000)
src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx

index 8befd46338cac854ffcd303a1da80288b22da16e..7ff605e1421b7f46e2cab2b2b2dbb5221c6dba96 100644 (file)
@@ -126,6 +126,7 @@ 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
   }
   else {
@@ -1442,19 +1443,18 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
 #endif
       if ( IsComputingNode() ) {
         ObjInterface( true ) ;
+//JR 05.08.2005 DEBUG : that code runs with SALOME_3 (OMNIOrb4) ...
+#if OMNIORB_VERSION >= 4
+        CORBA::Object * obj ;
+        InParametersList[0].Value >>= obj ;
+        myObjComponent = Engines::Component::_narrow( obj ) ;
 //JR 05.08.2005 DEBUG : the folowing code runs with OMNIOrb3 but gives
 //                      unpredictable results with SALOME_3 (OMNIOrb4) ...
-#if !omniORB_4_0_5
+#else
         CORBA::Object_ptr obj ;
         InParametersList[0].Value >>= obj ;
         CORBA::Object_var objvar = CORBA::Object_var( obj ) ;
         myObjComponent = Engines::Component::_duplicate( Engines::Component::_narrow( objvar ) ) ;
-//JR 05.08.2005 DEBUG : that code runs with SALOME_3 (OMNIOrb4) ...
-#else
-        CORBA::Object * obj ;
-        InParametersList[0].Value >>= obj ;
-        Engines::Component_var theObjComponent ;
-        myObjComponent = Engines::Component::_narrow( obj ) ;
 #endif
       }
       else {
@@ -1659,11 +1659,11 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                  << " Node(Component) Dynamic Call Exception catched ERROR"
                  << endl ;
 //Reset of _ThreadId in the Container ...
-          try {
-            myObjComponent->Kill_impl() ;
-          }
-          catch( ... ) {
-          }
+//          try {
+//            myObjComponent->Kill_impl() ;
+//          }
+//          catch( ... ) {
+//          }
         }
       }
     }
@@ -1751,12 +1751,49 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
   else {
     GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphEditor()->Executor() ;
 #if TraceDataReady_ExecuteAction
+    int i ;
+    for ( i = 0 ; i < GraphMacroNode()->GetNodeOutPortsSize() ; i++ ) {
+      cdebug << "Out" << i << " " << GraphMacroNode()->GetNodeOutPort( i )->PortName() << " "
+             << GraphMacroNode()->GetChangeNodeOutPort( i )->PortState() << " Done="
+             << GraphMacroNode()->GetChangeNodeOutPort( i )->PortDone() << " " ;
+      if ( GraphBase::Base::_prof_debug ) {
+        GraphMacroNode()->GetNodeOutPort( i )->StringValue( *GraphBase::Base::_fdebug ) ;
+      }
+      if ( GraphMacroNode()->GetChangeNodeOutPort( i )->IsGate() ) {
+        cdebug << " BoolValue " << GraphMacroNode()->GetChangeNodeOutPort( i )->BoolValue() ;
+      }
+      cdebug << endl ;
+    }
     cdebug << ThreadNo() << " DataReady_ExecuteAction " << aMacroGraph << " "
            << aMacroGraph->Name() << " ->DoneWait()"
            << " State " << aMacroGraph->State() << endl;
 #endif
     aMacroGraph->DoneWait() ;
 #if TraceDataReady_ExecuteAction
+    cdebug << ThreadNo() << " DataReady_ExecuteAction " << Name() << " State "
+           << aMacroGraph->State() << endl;
+#endif
+
+//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 ;
+    GraphMacroNode()->GraphEditor()->Executor()->OutputOfAny( Name() , "Gate" , anAny ) ;
+#if TraceDataReady_ExecuteAction
+    cdebug << "DataReady_ExecuteAction OutputOfAny( " << Name() << " , Gate , 1 )" << endl ;
+
+    for ( i = 0 ; i < GraphMacroNode()->GetNodeOutPortsSize() ; i++ ) {
+      cdebug << "Out" << i << " " << GraphMacroNode()->GetNodeOutPort( i )->PortName() << " "
+             << GraphMacroNode()->GetChangeNodeOutPort( i )->PortState() << " Done="
+             << GraphMacroNode()->GetChangeNodeOutPort( i )->PortDone() << " " ;
+      if ( GraphBase::Base::_prof_debug ) {
+        GraphMacroNode()->GetNodeOutPort( i )->StringValue( *GraphBase::Base::_fdebug ) ;
+      }
+      if ( GraphMacroNode()->GetChangeNodeOutPort( i )->IsGate() ) {
+        cdebug << " BoolValue " << GraphMacroNode()->GetChangeNodeOutPort( i )->BoolValue() ;
+      }
+      cdebug << endl ;
+    }
     cdebug << ThreadNo() << " DataReady_ExecuteAction " << Name() << " State " << aMacroGraph->State() << endl;
 #endif
     if ( aMacroGraph->State() == SUPERV::DoneState ) {
@@ -2261,7 +2298,7 @@ int GraphExecutor::InNode::Errored_ExecutingAction() {
   return 1 ;
 }
 
-#define SetWaitingStatesTrace 1
+#define SetWaitingStatesTrace 0
 // Set SUPERV::WaitingState to all InPorts 
 void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) {
   int i ;
@@ -2420,7 +2457,7 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
 
   if ( IsMacroNode() ) {
 #if SuccessActionTrace
-      cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " LinkedNodes->SomeDataReady already done"
+      cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " LinkedNodes->SomeDataReady already done for that MacroNode"
              << endl ;
 #endif
     return 1;
@@ -3380,7 +3417,11 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
           CORBA::Object_ptr ObjRef ;
           char * retstr ;
           try {
+#if OMNIORB_VERSION >= 4
+            D.Value >>= (CORBA::Any::to_object ) ObjRef ;
+#else
             D.Value >>= ObjRef ;
+#endif
             retstr = ObjectToString( ObjRef ) ;
             D.Value <<= retstr ;
 //            theOutPort->Value( D.Value ) ;
@@ -3427,7 +3468,11 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
           CORBA::Object_ptr obj ;
           char * retstr ;
           try {
+#if OMNIORB_VERSION >= 4
+            D.Value >>= (CORBA::Any::to_object ) obj ;
+#else
             D.Value >>= obj ;
+#endif
             retstr = ObjectToString( obj ) ;
 #if InParametersSetTrace
             cdebug << retstr << endl ;
@@ -3553,7 +3598,11 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams ,
       try {
         CORBA::Object_ptr obj ;
         char * retstr ;
+#if OMNIORB_VERSION >= 4
+            D.Value >>= (CORBA::Any::to_object ) obj ;
+#else
         D.Value >>= obj ;
+#endif
         retstr = ObjectToString( obj ) ;
         cdebug << ThreadNo() << retstr << endl ;
       }
@@ -3666,7 +3715,11 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
         case CORBA::tk_objref: {
           try {
             CORBA::Object_ptr obj ;
+#if OMNIORB_VERSION >= 4
+            D.Value >>= (CORBA::Any::to_object ) obj ;
+#else
             D.Value >>= obj ;
+#endif
 #if OutParametersSetTrace
             char * retstr ;
             retstr = ObjectToString( obj ) ;
@@ -3768,12 +3821,18 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
             cdebug << "OutParametersSet ToNodeName " << _OutNode->Name() << " CoupledNode "
                    << _OutNode->Graph()->CoupledNodeName() << _OutNode->Graph()->CoupledNode()
                    << endl ;
-            cdebug << " GraphExecutor " << _OutNode->Graph()->CoupledNode()->GraphEditor()->Executor() << endl ;
+            cdebug << "OutParametersSet GraphExecutor " << _OutNode->Graph()->CoupledNode()->GraphEditor()->Executor() << endl ;
 #endif
             _OutNode->Graph()->CoupledNode()->GraphEditor()->Executor()->OutputOfAny( _OutNode->Graph()->CoupledNodeName() ,
                                                                             anOutPort->ChangeInPorts( j )->PortName() ,
 //JR 30.03.2005                                                                            *anOutPort->Value() ) ;
                                                                             anOutPort->Value() ) ;
+#if OutParametersSetTrace
+            cdebug << "OutParametersSet OutputOfAny( "
+                   << _OutNode->Graph()->CoupledNodeName() << " , "
+                   << anOutPort->ChangeInPorts( j )->PortName() << " , value )" << endl ;
+#endif
+
          }
           else {
            GraphBase::ComputingNode * ToNode = _OutNode->Graph()->GetChangeGraphNode( ToNodeName ) ;
@@ -3857,7 +3916,11 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
 //JR 02.08.2005 Debug SEGV            anOutPort->Value() >>= obj ;
             CORBA::Any anAny ;
             anAny = anOutPort->Value() ;
+#if OMNIORB_VERSION >= 4
+            anAny >>= (CORBA::Any::to_object ) obj ;
+#else
             anAny >>= obj ;
+#endif
             retstr = ObjectToString( obj );
             cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) "
                    << retstr << endl ;