Salome HOME
Debug in CheckDataServerNode
authorrahuel <rahuel@opencascade.com>
Tue, 30 Aug 2005 06:19:27 +0000 (06:19 +0000)
committerrahuel <rahuel@opencascade.com>
Tue, 30 Aug 2005 06:19:27 +0000 (06:19 +0000)
src/GraphBase/DataFlowBase_DataNode.cxx

index b0644c839e1712cbed4d51420524d101f58a75b6..1b0a191f9827acd9e73f48780e3a24bf67b5dfac 100644 (file)
@@ -28,6 +28,7 @@
 
 using namespace std;
 #include "DataFlowBase_DataNode.hxx"
+#include "DataFlowBase_Graph.hxx"
 
 GraphBase::DataNode::DataNode() :
            GOTONode() {
@@ -96,49 +97,77 @@ void GraphBase::DataNode::DataService( CORBA::ORB_ptr ORB ,
 
 int GraphBase::DataNode::CheckDataServerNodes() const {
 
-  cdebug << "GraphBase::DataNode::CheckDataServerNodes :" << endl;
+  cdebug_in << "GraphBase::DataNode::CheckDataServerNodes :" << endl;
 
   int i , ierr = 0 ;
 
   for ( i = 0 ; i < _DataFlowDataPorts->GetNodeOutPortsSize() ; i++ ) {
-// Not a BUG : Reversed Service of the graph 
+// Not a BUG : Reversed Service of the graph : OutPort of the Graph give input values to nodes
     const GraphBase::OutPort * anOutPort = _DataFlowDataPorts->GetNodeOutPort(i) ;
 //    if ( !anOutPort->IsGate() && !anOutPort->IsDataStream() && !anOutPort->IsDataConnected() ) {
     if ( !anOutPort->IsGate() && !anOutPort->IsDataConnected() ) {
       if ( anOutPort->IsExternConnected() && GraphMacroLevel() != 0 ) {
-        cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
+        cdebug << "Base::DataNode::CheckDataServerNodes InPort " << anOutPort->PortName() << " "
+               << anOutPort->PortType() << " "
                << anOutPort->PortStatus() << " of DataFlow " << Name()
                << " is ExternConnected. GraphMacroLevel " << GraphMacroLevel() << endl ;
       }
       else {
-        cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
-               << anOutPort->PortStatus() << " of DataFlow " << Name() << " has NO Data. GraphMacroLevel "
-               << GraphMacroLevel() << endl ;
-        ierr++ ;
+        cdebug << "Base::DataNode::CheckDataServerNodes InPort " << anOutPort->PortName() << " "
+               << anOutPort->PortType() << " " << anOutPort->PortStatus() << " of DataFlow " << Name()
+               << " has NO Data. GraphMacroLevel " << GraphMacroLevel() << " InPortsSize "
+               << anOutPort->InPortsSize() << " corresponding to :"
+               << endl ;
+        int i ;
+        for ( i = 0 ; i < anOutPort->InPortsSize() ; i++ ) {
+          cdebug << "           " << anOutPort->InPorts( i )->NodeName() << "( "
+                 << anOutPort->InPorts( i )->PortName() << " ) " << endl ;
+       }
+        if ( anOutPort->InPortsSize() == 1 &&
+             GraphOfNode()->GetGraphNode( anOutPort->InPorts( 0 )->NodeName() )->IsEndSwitchNode() ) {
+          cdebug << "Base::DataNode::CheckDataServerNodes InPort " << anOutPort->PortName()
+                 << " is connected to an EndSwitchNode. Input Data is controlled by ValidSwitchs."
+                 << endl ;
+       }
+        else {
+          ostringstream astr ;
+          astr << anOutPort->PortStatus() ;
+          string anErrorMessage = string( "InPort " ) + string( anOutPort->NodeName() ) +
+                                  string( "( " ) + string( anOutPort->PortName() ) + string( " ) " ) +
+                                  astr.str() + string( " has NO Input Data.\n" ) ;
+          GraphOfNode()->SetMessages( anErrorMessage ) ;
+          ierr++ ;
+       }
       }
     }
     else {
-      cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
-             << anOutPort->PortStatus() << " of DataFlow " << Name()  << " has Data : "
+      cdebug << "Base::DataNode::CheckDataServerNodes InPort " << anOutPort->PortName() << " "
+             << anOutPort->PortType() << " "
+             << anOutPort->PortStatus() << " of DataFlow " << Name()  << " has Data or IsGate"
              << endl ;
     }
   }
 
   for ( i = 0 ; i < _DataFlowDataPorts->GetNodeInPortsSize() ; i++ ) {
     if ( _DataFlowDataPorts->GetNodeInPort(i)->IsPortConnected() ) {
-      cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
+      cdebug << "Base::DataNode::CheckDataServerNodes OutPort "
+             << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
              << " of DataFlow " << Name()  << " is Connected" << endl ;
     }
     else {
-      cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
+      cdebug << "Base::DataNode::CheckDataServerNodes OutPort "
+             << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
              << " of DataFlow " << Name()  << " is NOT Connected" << endl ;
     }
   }
 
   if ( ierr ) {
-    cdebug << "In the DataFlow " << Name() << " " << ierr << " Some Input Data is missing" << endl ;
+    GraphOfNode()->SetMessages( "Some Input Data are missing.\n" ) ;
+    cdebug << "Base::DataNode::CheckDataServerNodes In the DataFlow " << Name() << " " << ierr
+           << " Some Input Data are missing" << endl ;
   }
 
+  cdebug_out << "GraphBase::DataNode::CheckDataServerNodes ierr " << ierr << endl;
   return ierr ;
 }