Salome HOME
PAL8624
authorrahuel <rahuel@opencascade.com>
Tue, 30 Aug 2005 07:53:35 +0000 (07:53 +0000)
committerrahuel <rahuel@opencascade.com>
Tue, 30 Aug 2005 07:53:35 +0000 (07:53 +0000)
src/GraphExecutor/DataFlowExecutor_DataFlow.cxx

index 801e9f1145b8ab7dcd9690f83e66f2425b685d87..2eb3d0df34ddcbfb3ef63dc24ad867d6c4104365 100644 (file)
@@ -118,17 +118,19 @@ bool GraphExecutor::DataFlow::ContainerKill( const char *aNodeName ) {
 bool GraphExecutor::DataFlow::InputOfAny( const char * ToServiceParameterName ,
                                           const CORBA::Any & aValue ,
                                           bool SomeDataReady ) {
-  cdebug_in <<"GraphExecutor::DataFlow::InputOfAny" << endl ;
+  cdebug_in <<"GraphExecutor::DataFlow::InputOfAny( " << ToServiceParameterName
+            << " SomeDataReady " << SomeDataReady << " )" << endl ;
   bool RetVal = false ;
-  cdebug << pthread_self() << "GraphExecutor::DataFlow::::InputOfAny " << Graph()->Name() << "("
-         << ToServiceParameterName << ")" << endl ;
+  cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny " << Name() << "( "
+         << ToServiceParameterName << " , aValue , SomeDataReady " << SomeDataReady << " ) "
+         << endl ;
   if ( Graph()->GraphMacroLevel() ) {
     GraphBase::OutPort * anOutPort ;
     anOutPort = Graph()->GetChangeInDataNodePort( ToServiceParameterName ) ;
-    cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny " << Graph()->Name()
+    cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny " << Name()
            << " " << State() << " " << ToServiceParameterName << " " << anOutPort->PortState()
            << " Done : " << anOutPort->PortDone() << endl ;
-    RetVal = AddInputData( Graph()->Name() , ToServiceParameterName , aValue ) ;
+    RetVal = AddInputData( Name() , ToServiceParameterName , aValue ) ;
     anOutPort->PortState(  SUPERV::ReadyState ) ;
 // There is only one port :
     anOutPort->ChangeInPorts( 0 )->PortState( SUPERV::ReadyState ) ;
@@ -136,30 +138,68 @@ bool GraphExecutor::DataFlow::InputOfAny( const char * ToServiceParameterName ,
 // There is only one inport of a Node in an ReversedOutport of a graph :
     GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) Graph()->GetChangeGraphNode( anOutPort->InPorts( 0 )->NodeName() )->GetInNode() ;
     cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny : " << anInNode->Name()
-           << "->SendSomeDataReady( " << Graph()->Name() << " ) for Port " << anOutPort->InPorts( 0 )->PortName()
-           << endl ;
+           << "->SendSomeDataReady( " << Name() << " ) for Port "
+           << anOutPort->InPorts( 0 )->PortName() << " SomeDataReady " << SomeDataReady << endl ;
     if ( SomeDataReady ) {
-      MESSAGE( "GraphExecutor::InputOfAny " << Graph()->Name() << " SendSomeDataReady --> " << anInNode->Name()
+      MESSAGE( "GraphExecutor::InputOfAny " << Name() << " SendSomeDataReady --> " << anInNode->Name()
                << " " << anInNode->State() << " " << anOutPort->InPorts( 0 )->PortName() ) ;
-      int sts = anInNode->SendSomeDataReady( Graph()->Name() ) ;
+      int sts = anInNode->SendSomeDataReady( Name() ) ;
       cdebug << "GraphExecutor::DataFlow::InputOfAny " << anInNode->Name()
-             << "->SendSomeDataReady( " << Graph()->Name() << " ) sts " << sts << endl ;
-      if ( sts && anInNode->IsReady() ) {
-        cdebug << pthread_self() << "/" << anInNode->ThreadNo() << "GraphExecutor::DataFlow::InputOfAny : "
+             << "->SendSomeDataReady( " << Name() << " ) sts " << sts << " State "
+             << anInNode->State() << " IsReady " << anInNode->IsReady()
+             << " SomeDataReady " << SomeDataReady << endl ;
+//JR 15.04.2005 Debug PAL8624 RetroConception :
+      if ( sts && anInNode->HasAllDataReady() ) {
+        cdebug << pthread_self() << "/" << anInNode->ThreadNo()
+               << "GraphExecutor::DataFlow::InputOfAny : "
                << anInNode->Name() << "->SendEvent( GraphExecutor::ExecuteEvent ) "
-               << " " << anInNode->Name() << "->IsReady() " << anInNode->IsReady() << " State "
-               << anInNode->State() << endl ;
-        if ( anInNode->IsLockedDataWait() ) {
-          cdebug << pthread_self() << "/" << anInNode->ThreadNo() << "GraphExecutor::DataFlow::InputOfAny : "
-                 << anInNode->Name() << " IsLockedDataWait() ==> UnLockDataWait" << endl ;
-          anInNode->UnLockDataWait() ;
-        }
+               << " " << anInNode->Name() << "->HasAllDataReady() " << anInNode->HasAllDataReady()
+               << " State " << anInNode->State() << endl ;
         anInNode->ThreadNo( 0 ) ;
         anInNode->CreateNewThread( true ) ;
-        anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ;
-//        State( GraphExecutor::ExecutingState ) ;
+        if ( !anInNode->SendEvent( GraphExecutor::AllDataReadyEvent ) ) { // ==> Ready to execute
+//JR 06.05.2005 Debug PAL8624 RetroConception :
+#if 0
+        if ( res && anInNode->IsReady() ) {
+          cdebug << pthread_self() << "/" << anInNode->ThreadNo() << "GraphExecutor::DataFlow::InputOfAny : "
+                 << anInNode->Name() << "->SendEvent( GraphExecutor::ExecuteEvent ) "
+                 << " " << anInNode->Name() << "->IsReady() " << anInNode->IsReady() << " State "
+                 << anInNode->State() << endl ;
+//JR 15.04.2005 Debug PAL8624 RetroConception :
+//          if ( anInNode->IsLockedDataWait() ) {
+//            cdebug << pthread_self() << "/" << anInNode->ThreadNo() << "GraphExecutor::DataFlow::InputOfAny : "
+//                   << anInNode->Name() << " IsLockedDataWait() ==> UnLockDataWait" << endl ;
+//            anInNode->UnLockDataWait() ;
+//          }
+          anInNode->ThreadNo( 0 ) ;
+          anInNode->CreateNewThread( true ) ;
+          anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ;
+//          State( GraphExecutor::ExecutingState ) ;
+        }
+        else {
+          RetVal = false ;
+#endif
+          cdebug << pthread_self() << "/" << anInNode->ThreadNo()
+                 << "GraphExecutor::DataFlow::InputOfAny : NotAllDataReady ERROR : "
+                 << anInNode->Name() << "->SendEvent( GraphExecutor::ExecuteEvent ) "
+                 << " " << anInNode->Name() << "->IsReady() " << anInNode->IsReady() << " State "
+                 << anInNode->State() << endl ;
+       }
+      }
+      else {
+        cdebug << pthread_self() << "/" << anInNode->ThreadNo()
+               << "GraphExecutor::DataFlow::InputOfAny : NotAllDataReady : "
+               << anInNode->Name() << "->SendEvent( GraphExecutor::ExecuteEvent ) "
+               << " " << anInNode->Name() << "->IsReady() " << anInNode->IsReady() << " State "
+               << anInNode->State() << endl ;
       }
     }
+    else {
+      cdebug << "GraphExecutor::DataFlow::InputOfAny " << anInNode->Name()
+             << "->SendSomeDataReady( " << Name() << " ) State "
+             << anInNode->State() << " IsReady " << anInNode->IsReady()
+             << " SomeDataReady " << SomeDataReady << endl ;
+    }
   }
   else {
     cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny GraphMacroLevel "
@@ -176,7 +216,7 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName ,
                                            const CORBA::Any & aValue ) {
   cdebug_in << pthread_self() << "/" << ThreadNo() << "GraphExecutor::DataFlow::OutputOfAny( " << aNodeName
             << " , " << ToServiceParameterName
-            << " , aValue ) from " << Graph()->Name() << endl ;
+            << " , aValue ) from " << Name() << endl ;
   bool RetVal = false ;
   GraphBase::Graph * aMacroNode = (GraphBase::Graph * ) Graph()->GetChangeGraphNode( aNodeName ) ;
 //  GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) aMacroGraph->GetInNode() ;
@@ -188,25 +228,26 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName ,
     const char * ToNodeName = anOutPort->ChangeInPorts( i )->NodeName() ;
     const char * ToParameterName = anOutPort->ChangeInPorts( i )->PortName() ;
     GraphBase::ComputingNode * aComputingNode = Graph()->GetChangeGraphNode( ToNodeName ) ;
-    if ( strcmp( ToNodeName , Graph()->Name() ) ) {
+    if ( strcmp( ToNodeName , Name() ) ) {
       GraphExecutor::InNode * aLinkedNode = (GraphExecutor::InNode * ) aComputingNode->GetInNode() ;
       cdebug << pthread_self() << "/" << aLinkedNode->ThreadNo()
              << "GraphExecutor::DataFlow::OutputOfAny to Node "
              << ToNodeName << "(" << ToParameterName << ") from MacroNode " << aNodeName << endl ;
       int sts ;
-      if ( aLinkedNode->IsLockedDataWait() ) {
-        cdebug << "GraphExecutor::DataFlow::OutputOfAny " << aLinkedNode->Name()
-               << " IsLockedDataWait --> UnLockDataWait" << endl ;
-      }
+//JR 15.04.2005 Debug PAL8624 RetroConception :
+//      if ( aLinkedNode->IsLockedDataWait() ) {
+//        cdebug << "GraphExecutor::DataFlow::OutputOfAny " << aLinkedNode->Name()
+//               << " IsLockedDataWait --> UnLockDataWait" << endl ;
+//      }
       sts = aLinkedNode->SendSomeDataReady( (char * ) aNodeName ) ;
       cdebug << pthread_self() << "/" << aLinkedNode->ThreadNo()
              << "GraphExecutor::DataFlow::OutputOfAny " << aLinkedNode->Name()
              << "->SendSomeDataReady( " << aNodeName << " ) sts " << sts << " " << aLinkedNode->State() << endl ;
       if ( sts ) {
         if ( aLinkedNode->State() == GraphExecutor::DataReadyState ) {
-          aLinkedNode->CreateNewThreadIf( true ) ;
-          aLinkedNode->UnLockDataWait() ;
-//          aLinkedNode->DataUndef_AllDataReadyAction() ;
+//JR 15.04.2005 Debug PAL8624 RetroConception :
+//          aLinkedNode->CreateNewThreadIf( true ) ;
+//          aLinkedNode->UnLockDataWait() ;
           aLinkedNode->SendEvent( GraphExecutor::ExecuteEvent ) ;
         }
       }