Salome HOME
RemoveOutPort with optionnal remove of the InPort in that OutPort
authorrahuel <rahuel@opencascade.com>
Tue, 30 Aug 2005 06:38:06 +0000 (06:38 +0000)
committerrahuel <rahuel@opencascade.com>
Tue, 30 Aug 2005 06:38:06 +0000 (06:38 +0000)
src/GraphBase/DataFlowBase_InPort.cxx
src/GraphBase/DataFlowBase_InPort.hxx
src/GraphBase/DataFlowBase_OutPort.cxx

index 7e0dedb1f4c6887fa615d23a6c6aa63d271ac590..8390bfd3b0db48d95f0331104fb1682630d6158c 100644 (file)
@@ -106,7 +106,7 @@ bool GraphBase::InPort::ChangeOutPort( OutPort * anOutPort ) {
   return true ;
 }
 
-bool GraphBase::InPort::RemoveOutPort() {
+bool GraphBase::InPort::RemoveOutPort( bool DoRemoveInPort ) {
 // Before to return the real status, callers should be checked ...
   if ( _OutPort == NULL ) {
     cdebug << "InPort::RemoveOutPort no OutPort in InPort " << PortName() << " of " << NodeName() << endl ;
@@ -114,11 +114,16 @@ bool GraphBase::InPort::RemoveOutPort() {
   }
   cdebug << "InPort::RemoveOutPort " << _OutPort->NodeName() << "(" << _OutPort->PortName() << ") --> "
          << NodeName() << "(" << PortName() << ") in InPort " << PortName() << " of " << NodeName() << endl ;
-  _OutPort = NULL ;
   if ( !IsEndSwitch() ) {
+//JR 08.06.2005 : RemoveOutPort <==> delete of a link ==> RemoveInPort corresponding
+    if ( DoRemoveInPort ) {
+      _OutPort->RemoveInPort( this ) ;
+    }
     RemoveCoords() ;
+    _OutPort = NULL ;
   }
   else {
+    _OutPort = NULL ;
     Kind( SUPERV::InLineParameter ) ;
   }
   return true ;
index 89217ab92de84f71768599827720291c1d53288c..c4416ea592f9a71864871b4190d0fc176df451f6 100644 (file)
@@ -92,7 +92,7 @@ namespace GraphBase {
              return true ;
           }
            return false ; } ;
-      bool RemoveOutPort() ;
+      bool RemoveOutPort( bool DoRemoveInPort = true ) ;
 
       bool BranchOfSwitchLinked( bool aInPortLinked ) {
            if ( aInPortLinked && _BranchOfSwitchLinked ) {
index d03f937aa6eb42ac52f5600151d2084db1d39b18..0aa449950628f8f33cfe5ba06dbc52b3a30dbb3e 100644 (file)
@@ -113,7 +113,9 @@ bool GraphBase::OutPort::RemoveInPort() {
       Kind( SUPERV::InLineParameter ) ;
     }
   }
-  toPort->RemoveOutPort() ;
+  if ( toPort->GetOutPort() ) {
+    toPort->RemoveOutPort( false ) ;
+  }
   cdebug << "OutPort::RemoveInPort " << NodeName() << "( " << PortName() << " " << PortStatus()
          << " " << Kind() << " ) _InPortsSize " << _InPortsSize << " --> "
          << toPort->NodeName() << "( " << toPort->PortName() << " " << toPort->PortStatus()
@@ -146,7 +148,9 @@ bool GraphBase::OutPort::RemoveInPort( GraphBase::InPort * toPort ) {
       Kind( SUPERV::InLineParameter ) ;
     }
   }
-  toPort->RemoveOutPort() ;
+  if ( toPort->GetOutPort() ) {
+    toPort->RemoveOutPort( false ) ;
+  }
   return true ;
 }
 
@@ -154,7 +158,7 @@ bool GraphBase::OutPort::ReNameInPort( const char* OldNodePortName ,
                                        const char* NewNodePortName ) {
   int index = _MapOfInPorts[ OldNodePortName ] ;
   if ( index <= 0 || index > _InPortsSize ) {
-    cdebug << "GraphBase::OutPort::ReNameInPort Error " << OldNodePortName
+    cdebug << "GraphBase::OutPort::ReNameInPort Error in Node " << NodeName() << " " << OldNodePortName
            << " --> " << NewNodePortName << " index " << index << endl ;
     return false ;
   }