Salome HOME
NRI : Merge delta [V1_2, V1_2c].
[modules/superv.git] / src / Supervision / Port_Impl.cxx
index 96d13d68bace5abd31cd8c64d0e192c74c48bc9a..3883bd47b6e9cf1192f543209fc48b487b3dbe10 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "Graph_Impl.hxx"
 #include "Port_Impl.hxx"
@@ -236,8 +236,8 @@ SUPERV::Link_ptr Port_Impl::Link() {
     beginService( "Port_Impl::Link" ) ;
     begin = false ;
     SUPERV::ListOfLinks_var Links = new SUPERV::ListOfLinks ;
-    cout << "Port_Impl::Link " << _DataFlowNode->Name() << " "
-         << _DataFlowPort->PortName() << endl ;
+//    cout << "Port_Impl::Link " << _DataFlowNode->Name() << " "
+//         << _DataFlowPort->PortName() << endl ;
     Links = _DataFlowEditor->ObjImpl()->Links(
                                         _DataFlowNode->ComputingNode() ,
                                         _DataFlowPort->PortName() ) ;
@@ -261,7 +261,13 @@ SUPERV::Link_ptr Port_Impl::Link() {
       GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _DataFlowPort->PortName() ) ;
       if ( anInPort->GetOutPort() ) {
         GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
-        if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+        if ( _DataFlowNode->IsEndLoopNode() && !strcmp( _DataFlowNode->CoupledNode()->Name() ,
+                                                        anOutPort->NodeName() ) ) {
+//          MESSAGE( "Link " << anOutPort->NodeName() << "("
+//                  << anOutPort->PortName() << ") --> " << _DataFlowNode->Name() << "("
+//                  << anInPort->PortName() << ")" << " ignored" ) ;
+       }
+        else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
           if ( begin ) {
             beginService( "Port_Impl::Link" ) ;
             begin = false ;
@@ -294,22 +300,28 @@ SUPERV::Link_ptr Port_Impl::Link() {
 bool Port_Impl::IsInput() {
 //  beginService( "Port_Impl::IsInput" ) ;
   bool RetVal = _InputPort ;
+//  MESSAGE( Name() << "IsInput() " << _InputPort ) ;
 //  endService( "Port_Impl::IsInput" ) ;
   return RetVal ;
 }
 
 bool Port_Impl::IsLinked() {
 //  beginService( "Port_Impl::IsLinked" ) ;
-  bool RetVal = true ;
-#if 0
-  if ( _DataFlowNode->IsEndSwitchNode() && _DataFlowPort->IsBus() ) {
+  bool RetVal = false ;
+  GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _DataFlowPort->PortName() ) ;
+  GraphBase::OutPort * anOutPort = NULL ;
+  if ( anInPort) {
+    anOutPort = anInPort->GetOutPort() ;
+  }
+  if ( _DataFlowNode->IsEndLoopNode() && anOutPort &&
+       !strcmp( _DataFlowNode->CoupledNode()->Name() , anOutPort->NodeName() ) ) {
+//    MESSAGE( "Link " << anOutPort->NodeName() << "("
+//            << anOutPort->PortName() << ") --> " << _DataFlowNode->Name() << "("
+//            << anInPort->PortName() << ")" << " ignored" ) ;
   }
   else {
-#endif
     RetVal = _DataFlowNode->IsLinked( _DataFlowPort->PortName() ) ;
-#if 0
   }
-#endif
 //  endService( "Port_Impl::IsLinked" ) ;
   return RetVal ;
 }