From e93b78cecd5b1053eff79fdf7c7541ba1a8e1c82 Mon Sep 17 00:00:00 2001 From: rahuel Date: Fri, 10 Jun 2005 07:39:49 +0000 Subject: [PATCH] PAL9122 --- src/GraphBase/DataFlowBase_ComputingNode.cxx | 185 +++++++++++++++++++ src/GraphBase/DataFlowBase_ComputingNode.hxx | 2 + 2 files changed, 187 insertions(+) diff --git a/src/GraphBase/DataFlowBase_ComputingNode.cxx b/src/GraphBase/DataFlowBase_ComputingNode.cxx index 5978f09..aca8d70 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.cxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.cxx @@ -598,10 +598,195 @@ void GraphBase::ComputingNode::SetMacroDatas( GraphBase::Graph * aGraph , } void GraphBase::ComputingNode::DelInPort( const char * InputParameterName ) { +//PAL9122 +//JR 07.06.2005 Debug : LinkedNodes and LinkedFromNode must be updated +// LinkedInPortsNumber and LinkedFromInPortsNumber must be updated + cdebug_in << "ComputingNode::DelInPort " << Name() << "( " << InputParameterName << " )" + << endl; + bool RetVal = true ; + if ( !IsEndSwitchNode() ) { + GraphBase::InPort * anInPort = GetChangeInPort( InputParameterName ) ; + cdebug << "ComputingNode::DelInPort InPort " << Name() << "( " + << anInPort->PortName() << " ) " << anInPort->PortStatus() << " <-- " ; + GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ; + if ( anOutPort && !( IsEndLoopNode() && anInPort->IsLoop() ) ) { + cdebug << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") " + << anOutPort->PortStatus() ; + } + cdebug << endl ; + if ( !anInPort->IsNotConnected() ) { + GraphBase::ComputingNode * FromNode = NULL ; + RetVal = true ; + if ( anOutPort->IsDataConnected() || anOutPort->IsExternConnected() ) { + cdebug << " Data/Extern ignored" << endl ; + } + else { + FromNode = GraphOfNode()->GetChangeGraphNode( anOutPort->NodeName() ) ; + } + if ( FromNode ) { + cdebug << "FromNode " << FromNode->Name() << " LinkedNodesSize " + << FromNode->LinkedNodesSize() << " and " << Name() + << " LinkedFromNodesSize " << LinkedFromNodesSize() << endl ; + if ( !FromNode->IsGOTONode() && + !( FromNode->IsEndLoopNode() && anInPort->IsLoop() ) ) { + if ( anInPort->IsDataStream() ) { + RetVal = FromNode->RemoveStreamLinkedNode( this ) ; + } + else { + RetVal = FromNode->RemoveLinkedNode( this ) ; + } + if ( !RetVal ) { + cdebug << "ComputingNode::DelInPort anOutPort->RemoveLinkedNode Error RetVal " + << RetVal << endl ; + } + } + } + } + } +//We have an EndSwitchNode : + else { + int i ; + for ( i = LinkedFromNodesSize() - 1 ; i >= 0 ; i-- ) { + GraphBase::ComputingNode * aLinkedFromNode = (GraphBase::ComputingNode * ) LinkedFromNodes( i ) ; + cdebug << aLinkedFromNode->Name() << " linked to " << Name() << endl ; + int j ; + for ( j = aLinkedFromNode->GetNodeOutPortsSize() - 1 ; j >= 0 ; j-- ) { + GraphBase::OutPort * anOutPort = aLinkedFromNode->GetChangeNodeOutPort( j ) ; + cdebug << "ComputingNode::DelInPort OutPort" << j << ". Remove " << anOutPort->InPortsSize() + << " InPortsof OutPort : " << anOutPort->NodeName() << "( " + << anOutPort->PortName() << ") " + << anOutPort->PortStatus() << " :" << endl ; + int k ; +//Process concerned OutPorts of LinkedFromNodes of that EndSwitchNode + for ( k = anOutPort->InPortsSize() - 1 ; k >= 0 ; k-- ) { + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ; + if ( !strcmp( anInPort->NodeName() , Name() ) && + !strcmp( anInPort->PortName() , InputParameterName ) ) { +// InPort of the EndSwitchNode + cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( " + << anInPort->PortName() << ") " + << anInPort->PortStatus() << endl ; + anInPort->RemoveOutPort() ; + if ( anOutPort->IsDataStream() ) { + aLinkedFromNode->RemoveStreamLinkedNode( this ) ; + } + else { +// false ==> No error for aNode->LinkedFromNode() + RetVal = aLinkedFromNode->RemoveLinkedNode( this , false ) ; + if ( !RetVal ) { + cdebug << "ComputingNode::DelInPort aLinkedFromNode->RemoveLinkedNode Error RetVal " + << RetVal << endl ; + break ; + } + } +// Remove the InPort of the EndSwitchNode from that OutPort + RetVal = anOutPort->RemoveInPort( anInPort ) ; + if ( !RetVal ) { + cdebug << "ComputingNode::DelInPort anOutPort->RemoveInPort( anInPort ) Error RetVal " + << RetVal << endl ; + break ; + } + } + } + } + } + } + GraphBase::PortsOfNode::DelInPort( InputParameterName ) ; + cdebug_out << "ComputingNode::DelInPort " << Name() << "( " << InputParameterName << " )" + << endl; } void GraphBase::ComputingNode::DelOutPort( const char * OutputParameterName ) { +//PAL9122 +//JR 07.06.2005 Debug : LinkedNodes and LinkedFromNode must be updated +// LinkedInPortsNumber and LinkedFromInPortsNumber must be updated + cdebug_in << "ComputingNode::DelOutPort " << Name() << "( " << OutputParameterName << " )" + << endl; + bool RetVal = true ; + GraphBase::OutPort * anOutPort = GetChangeOutPort( OutputParameterName ) ; + cdebug << "ComputingNode::DelOutPort OutPort " << " InPortof OutPort : " + << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") " + << anOutPort->PortStatus() << " :" << endl ; + int j ; + for ( j = anOutPort->InPortsSize() - 1 ; j >= 0 ; j-- ) { + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ; + GraphBase::ComputingNode * ToNode = NULL ; + cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( " + << anInPort->PortName() << ") " << anInPort->PortStatus() ; + if ( anInPort->IsExternConnected() ) { + cdebug << " ExternConnected ignored" << endl ; + } + else { + cdebug << endl ; + ToNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ; + } + if ( ToNode ) { + RetVal = anInPort->RemoveOutPort() ; +// JR 04.02.2005 : Bug if it is a link to an EndSwitchNode. The InPort may be multiple linked !!! +// PAL7990 + if ( !RetVal ) { + cdebug << "ComputingNode::DelOutPort anOutPort->RemoveOutPort Error RetVal " << RetVal + << endl ; + break ; + } + if ( ( IsGOTONode() && ToNode->IsOneOfInLineNodes() ) || + ( IsEndLoopNode() && ToNode->IsLoopNode( ) ) ) { + } + else if ( anOutPort->IsDataStream() ) { + RetVal = RemoveStreamLinkedNode( ToNode ) ; + } + else { + RetVal = RemoveLinkedNode( ToNode ) ; + } + if ( !RetVal ) { + cdebug << "ComputingNode::DelOutPort anOutPort->RemoveLinkedNode Error RetVal " << RetVal + << endl ; + break ; + } + if ( ToNode->IsEndSwitchNode() ) { + int i ; + int done = false ; + for ( i = 0 ; i < ToNode->LinkedFromNodesSize() ; i++ ) { + GraphBase::StreamNode * fromNode = ToNode->LinkedFromNodes( i ) ; +// Not the node that we are deleting ... : + if ( strcmp( fromNode->Name() , Name() ) ) { + int j ; + for ( j = 0 ; j < fromNode->GetNodeOutPortsSize() ; j++ ) { + GraphBase::OutPort * fromOutPort = fromNode->GetChangeNodeOutPort( j ) ; + int k ; + for ( k = 0 ; k < fromOutPort->InPortsSize() ; k++ ) { + if ( strcmp( ToNode->Name() , fromOutPort->InPorts( k )->NodeName() ) == 0 ) { + if ( strcmp( anInPort->PortName() , fromOutPort->InPorts( k )->PortName() ) == 0 ) { +// Restore an OutPort in the InPort + anInPort->ChangeOutPort( fromOutPort ) ; + cdebug << "ComputingNode::DelOutPort reestablish " << fromOutPort->NodeName() << "( " + << fromOutPort->PortName() << " ) in the InPort of EndSwitch : " + << ToNode->Name() << "( " << anInPort->PortName() << " )" + << anInPort->Kind() << " " << anInPort->PortStatus() << endl; + done = true ; + break ; + } + } + } + if ( done ) { + break ; + } + } + if ( done ) { + break ; + } + } + } + } + } + } + if ( !RetVal ) { + cdebug << "Error RetVal " << RetVal << endl ; + } + GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ; + cdebug_out << "ComputingNode::DelOutPort " << Name() << "( " << OutputParameterName << " )" + << endl; } GraphBase::InPort * GraphBase::ComputingNode::AddInPort( const char * InputParameterName , diff --git a/src/GraphBase/DataFlowBase_ComputingNode.hxx b/src/GraphBase/DataFlowBase_ComputingNode.hxx index ba8bd6a..d0b3069 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.hxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.hxx @@ -252,6 +252,8 @@ namespace GraphBase { << _ConnectedInPortsNumber+1 << endl ; _ConnectedInPortsNumber++ ; } ; void DecrConnectedInPortsNumber() { + cdebug << "ComputingNode::DecrConnectedInPortsNumber " << Name() << " -> " + << _ConnectedInPortsNumber-1 << endl ; _ConnectedInPortsNumber-- ; } ; int ConnectedInPortsNumber() const { return _ConnectedInPortsNumber ; } ; -- 2.39.2