]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Fix for bug PAL12575 : Superv: GNode - unexpected abort.
authormkr <mkr@opencascade.com>
Mon, 15 Jan 2007 12:28:52 +0000 (12:28 +0000)
committermkr <mkr@opencascade.com>
Mon, 15 Jan 2007 12:28:52 +0000 (12:28 +0000)
src/GraphBase/DataFlowBase_Graph.cxx
src/GraphBase/DataFlowBase_Graph.hxx
src/GraphEditor/DataFlowEditor_OutNode.cxx
src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx

index 016498d3e65ac9e201e81d71c534d57ee2db6899..909577bd4a726c6ed51cd540978c19a811fa6839 100644 (file)
@@ -2792,6 +2792,59 @@ bool GraphBase::Graph::Sort( int & SubStreamGraphsNumber ) {
   return true ;
 }
 
+// mkr : PAL12575
+bool GraphBase::Graph::ValidGOTO() {
+  cdebug_in << "GraphBase::Graph::ValidGOTO" << endl;
+  bool RetVal = true ;
+  int i, j ;
+  GraphBase::ComputingNode * aNode ;
+  for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
+    aNode = GraphNodes( i ) ;
+    if ( aNode->IsGOTONode() ) {
+      GraphBase::GOTONode * aGoToNode = (GraphBase::GOTONode * ) aNode ;
+      GraphBase::InLineNode * aCoupledNode ;
+      aCoupledNode = (GraphBase::InLineNode * ) aGoToNode->CoupledNode() ;
+      if ( aCoupledNode ) {
+       ostringstream ErrorMessage ;
+       // 1. Check the number of ports (the number of OutPorts of a GOTONode and of InPorts of its linked
+       //    InLine node must be the same)
+       if ( aNode->GetNodeOutPortsSize() != aCoupledNode->GetNodeInPortsSize() ) {
+         cdebug << "GraphBase::Graph::ValidGOTO : Different ports number!" << endl ;
+         ReSetMessages() ;
+         ErrorMessage << "Different ports number : the number of OutPorts of a " << aNode->Name()
+                      << " node (GoTo node) and of InPorts of its linked " << aCoupledNode->Name()
+                      << " node (InLine node) must be the same!\n" ;
+         SetMessages( ErrorMessage.str() ) ;
+         RetVal = false ;
+       }
+       // 2. Check ports names (the names of OutPorts of a GOTONode and of InPorts of its linked
+       //    InLine node must be the same)
+       else {
+         for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
+           GraphBase::OutPort * aBusParamOutPort = aNode->GetChangeNodeOutPort( j ) ;
+           if ( !aBusParamOutPort->IsGate() ) {
+             GraphBase::InPort * aBusParamChangeInPort = NULL ;
+             aBusParamChangeInPort = aCoupledNode->GetChangeInPort( aBusParamOutPort->PortName() ) ;
+             if ( !aBusParamChangeInPort ) {
+               cdebug << "GraphBase::Graph::ValidGOTO : Different names of ports!" << endl ;
+               ReSetMessages() ;
+               ErrorMessage << "Different names of ports : there is no input port of " << aCoupledNode->Name()
+                            << " node (InLine node) coupled to " << aBusParamOutPort->PortName() 
+                            << " output port of a " << aNode->Name()
+                            << " node (GoTo node)\n" ;
+               SetMessages( ErrorMessage.str() ) ;
+               RetVal = false ;
+             }
+           }
+         }
+       }
+      }
+    }
+  }
+  cdebug_out << "GraphBase::Graph::ValidGOTO RetVal " << RetVal << endl;
+  return RetVal ;
+}
+
 bool GraphBase::Graph::ValidLoops() const {
   cdebug_in << "GraphBase::Graph::ValidLoops" << endl;
   bool RetVal = true ;
index 47e53acf102868a71b702e2b4dfb928eef08685a..a5a026cf92fbbcca6a7638cf755519a028f2952f 100644 (file)
@@ -342,6 +342,7 @@ namespace GraphBase {
       bool InLineServices() ;
 
       bool Sort( int & SubStreamGraphsNumber ) ;
+      bool ValidGOTO() ; // mkr : PAL12575
       bool ValidLoops() const ;
       bool ValidSwitchs() const ;
       bool ComputingNodes() const ;
index cb6736d80083b385c22d06dd1ea61e6ab5a25d5d..babb50e6ecf1df36d2ce78ddcf4af253ae95e1b0 100644 (file)
@@ -1019,6 +1019,11 @@ bool GraphEditor::OutNode::Valid() {
   Graph()->ComputingNodes() ;
 #endif
 
+  if ( !Graph()->ValidGOTO() ) { // mkr : PAL12575
+    cdebug << "Editor::OutNode::Valid This DataFlow have not valid GOTO(ValidGOTO)." << endl ;
+    RetVal = false ;
+  }
+
   if ( RetVal ) {
     _Valid = true ;
   }
@@ -1063,7 +1068,7 @@ bool GraphEditor::OutNode::Executable() {
     StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ;
 
   Graph()->InLineServices() ;
-
+  
 //  if ( kLoopSwitch ) {
     if ( !Graph()->ValidLoops() ) {
       cdebug << "Editor::OutNode::Executable This DataFlow have not valid Loops(ValidLoops)." << endl ;
index 9ae6293eb4577d86b0acfe4cb70b13ce44bce4c9..1789aa7075f871526c598aa466ae7ed8f8f7e9b2 100644 (file)
@@ -2543,7 +2543,6 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
                << " Successed_SuccessAction # number of ports " << GetNodeOutPortsSize()
                << " != " << aLabelNode-> GetNodeInPortsSize() << endl ;
         SendEvent( GraphExecutor::ErrorEvent ) ;
-        aLabelNode->State( GraphExecutor::ErroredState ) ; // PAL12575
         return 0 ;
       }
       else {
@@ -2574,7 +2573,6 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
                      << " Successed_SuccessAction # names of ports "
                      << aBusParamOutPort->PortName() << endl ;
               SendEvent( GraphExecutor::ErrorEvent ) ;
-              aLabelNode->State( GraphExecutor::ErroredState ) ; // PAL12575
               return 0 ;
            }
          }
@@ -2651,24 +2649,6 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
         IgnoreForDefaultSwitch = true ;
       }
     }
-
-// PAL12575 -->
-    if ( IsInLineNode() && !IsEndSwitchNode() ) {
-      GraphBase::InPort *toInGatePort = GetChangeNodeInGate() ;
-      GraphBase::OutPort *fromOutPort = toInGatePort->GetOutPort() ;
-      if ( fromOutPort && fromOutPort->IsGate() ) {
-        GraphExecutor::InNode * fromNode = (GraphExecutor::InNode *) _OutNode->Graph()->GetChangeGraphNode( fromOutPort->NodeName() )->GetInNode() ;
-        if ( fromNode && fromNode->IsGOTONode() && fromOutPort->PortState() != SUPERV::ReadyState ) {
-          cdebug << pthread_self() << "/" << ThreadNo()
-                << " Successed_SuccessAction # problem with connection of GoTo node with its coupled node!" << endl ;
-          State( GraphExecutor::ErroredState ) ;
-          SendEvent( GraphExecutor::ErrorEvent ) ;
-          return 0 ;
-        }
-      }
-    }
-// PAL12575 <--
-
 //Loop of LinkedNodes for SendSomeDataReady :
     for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
       GraphBase::ComputingNode * aComputingNode ;