Salome HOME
Update copyright information
[modules/superv.git] / src / GraphExecutor / DataFlowExecutor_DataFlow.cxx
index 699a0d8e2ceae9e21b46f10c1ac826da66ee7531..f6a6ef54c52942634e01926f53cb6aeb24c97752 100644 (file)
@@ -1,29 +1,28 @@
-//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
 //
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
 //  File   : DataFlowExecutor_DataFlow.cxx
 //  Module : SUPERV
-
+//
 using namespace std;
 #include "DataFlowExecutor_DataFlow.hxx"
 #include "DataFlowEditor_DataFlow.hxx"
@@ -239,8 +238,8 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName ,
   for ( i = 0 ; i < anOutPort->InPortsSize() ; i++ ) {
     const char * ToNodeName = anOutPort->ChangeInPorts( i )->NodeName() ;
     const char * ToParameterName = anOutPort->ChangeInPorts( i )->PortName() ;
-    GraphBase::ComputingNode * aComputingNode = Graph()->GetChangeGraphNode( ToNodeName ) ;
     if ( strcmp( ToNodeName , Name() ) ) {
+      GraphBase::ComputingNode * aComputingNode = Graph()->GetChangeGraphNode( ToNodeName ) ;
       GraphExecutor::InNode * aLinkedNode = (GraphExecutor::InNode * ) aComputingNode->GetInNode() ;
       cdebug << pthread_self() << "/" << aLinkedNode->ThreadNo()
              << "GraphExecutor::DataFlow::OutputOfAny to Node "
@@ -293,8 +292,9 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName ,
                                                             anOutPort->Value() ) ;
     }
     else {
-      cdebug << "GraphExecutor::DataFlow::OutputOfAny to Graph " << ToNodeName
-             << "(" << ToParameterName << ") ignored" << endl ;
+      cdebug << pthread_self() << "GraphExecutor::DataFlow::OutputOfAny to Node "
+             << ToNodeName << "(" << ToParameterName << ") from MacroNode " << aNodeName
+             << ") ignored" << endl ;
     }
   }
   cdebug_out << pthread_self() << "/" << ThreadNo() << " GraphExecutor::DataFlow::OutputOfAny " << RetVal
@@ -302,6 +302,31 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName ,
   return RetVal ;
 }
 
+//JR NPAL14110 09.02.2007 : SetWaitingStates was missing in SubGraph of MacroNode !...
+bool GraphExecutor::DataFlow::SetWaitingStates( const char * ToServiceParameterName ) {
+  cdebug_in << pthread_self() << "/" << ThreadNo() << "GraphExecutor::DataFlow::SetWaitingStates( "
+            << ToServiceParameterName << " ) MacroGraph " << Name() << endl ;
+  bool RetVal = true ;
+  State( GraphExecutor::DataWaitingState ) ;
+  Done( false ) ;
+  GraphBase::OutPort * anOutPort ;
+  anOutPort = Graph()->GetChangeInDataNodePort( ToServiceParameterName ) ;
+  anOutPort->PortState(  SUPERV::WaitingState ) ;
+  anOutPort->PortDone( false ) ;
+  cdebug << pthread_self() << "GraphExecutor::DataFlow::SetWaitingStates " << Name()
+         << " " << State() << " " << ToServiceParameterName << " " << anOutPort->PortState()
+         << " Done : " << anOutPort->PortDone() << endl ;
+  if ( ! anOutPort->IsGate() ) {
+    GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) Graph()->GetChangeGraphNode( anOutPort->InPorts( 0 )->NodeName() )->GetInNode() ;
+    cdebug << pthread_self() << "GraphExecutor::DataFlow::SetWaitingStates : "
+           << anInNode->Name() << "->SetWaitingStates( NULL ) for Port "
+           << anOutPort->InPorts( 0 )->PortName() << endl ;
+    anInNode->SetWaitingStates( NULL ) ;
+  }
+  cdebug_out << "GraphExecutor::DataFlow::SetWaitingStates() " << RetVal << endl;
+  return RetVal ;
+}
+
 bool GraphExecutor::DataFlow::Kill() {
   cdebug_in << "GraphExecutor::DataFlow::Kill()" << endl;
   bool RetVal = GraphExecutor::OutNode::Kill() ;