From ece51006e20b13c0d0e151f9c51a82ddc85a88d0 Mon Sep 17 00:00:00 2001 From: rahuel Date: Tue, 30 Aug 2005 06:38:06 +0000 Subject: [PATCH] RemoveOutPort with optionnal remove of the InPort in that OutPort --- src/GraphBase/DataFlowBase_InPort.cxx | 9 +++++++-- src/GraphBase/DataFlowBase_InPort.hxx | 2 +- src/GraphBase/DataFlowBase_OutPort.cxx | 10 +++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/GraphBase/DataFlowBase_InPort.cxx b/src/GraphBase/DataFlowBase_InPort.cxx index 7e0dedb..8390bfd 100644 --- a/src/GraphBase/DataFlowBase_InPort.cxx +++ b/src/GraphBase/DataFlowBase_InPort.cxx @@ -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 ; diff --git a/src/GraphBase/DataFlowBase_InPort.hxx b/src/GraphBase/DataFlowBase_InPort.hxx index 89217ab..c4416ea 100644 --- a/src/GraphBase/DataFlowBase_InPort.hxx +++ b/src/GraphBase/DataFlowBase_InPort.hxx @@ -92,7 +92,7 @@ namespace GraphBase { return true ; } return false ; } ; - bool RemoveOutPort() ; + bool RemoveOutPort( bool DoRemoveInPort = true ) ; bool BranchOfSwitchLinked( bool aInPortLinked ) { if ( aInPortLinked && _BranchOfSwitchLinked ) { diff --git a/src/GraphBase/DataFlowBase_OutPort.cxx b/src/GraphBase/DataFlowBase_OutPort.cxx index d03f937..0aa4499 100644 --- a/src/GraphBase/DataFlowBase_OutPort.cxx +++ b/src/GraphBase/DataFlowBase_OutPort.cxx @@ -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 ; } -- 2.39.2