toPort->Kind( SUPERV::EndSwitchParameter ) ;
}
}
+// JR 12.01.2005 : an OutPort of a SwitchNode connected to a Gate can be connected only to Gate
+ else if ( fromNode->IsSwitchNode() && fromPort->IsSwitch() && !toPort->IsGate() ) {
+ cdebug << "toPort->AddLink Error( fromPort->IsSwitch() && !toPort->IsGate())." << endl ;
+ cdebug_out << "GraphBase::Graph::AddLink 0" << endl;
+ return false ;
+ }
else if ( !fromPort->AddInPort( toPort ) ) { // --> MapOfInports in the OutPort
cdebug << "!fromPort->AddLink Error." << endl ;
cdebug_out << "GraphBase::Graph::AddLink 0" << endl;
if ( anInPort && ( anInPort->IsPortConnected() ||
anInPort->IsDataConnected() ||
anInPort->IsExternConnected() ) ) {
- GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
- RetVal = anOutPort->RemoveInPort( anInPort ) ; // ==> :
-// anInPort->RemoveOutPort() ;
- const char * FromNodeName = anOutPort->NodeName() ;
+// JR 13.01.2005 : Bug if it is a link to an EndSwitchNode. The OutPort may be an other one !!!
GraphBase::ComputingNode * fromNode = GetChangeGraphNode( FromNodeName ) ;
+ GraphBase::OutPort * anOutPort = NULL ;
+ if ( toNode->IsEndSwitchNode() ) {
+ anOutPort = fromNode->GetChangeOutPort( FromServiceParameterName ) ;
+ RetVal = anOutPort->RemoveInPort( anInPort ) ;
+ }
+ else {
+ anOutPort = anInPort->GetOutPort() ;
+ RetVal = anOutPort->RemoveInPort( anInPort ) ;
+ }
+// anInPort->RemoveOutPort() ; // Already done in RemoveInPort
+// const char * FromNodeName = anOutPort->NodeName() ;
if ( RetVal ) {
if ( fromNode ) {
if ( anInPort->IsDataStream() ) {
if ( fromNode->IsSwitchNode() && !anOutPort->IsGate() && !toNode->IsEndSwitchNode() ) {
anOutPort->Kind( SUPERV::InLineParameter ) ;
}
+// JR 13.01.2005 : Bug if it is a link to an EndSwitchNode. The InPort may be linked !!!
+ if ( toNode->IsEndSwitchNode() ) {
+ int i ;
+ int done = false ;
+ for ( i = 0 ; i < toNode->LinkedFromNodesSize() ; i++ ) {
+ GraphBase::StreamNode * fromNode = toNode->LinkedFromNodes( i ) ;
+ 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 ) {
+// Restore an OutPort in the InPort
+ anInPort->ChangeOutPort( fromOutPort ) ;
+ cdebug << "Graph::RemoveLink reestablish " << fromOutPort->NodeName() << "( "
+ << fromOutPort->PortName() << " ) in the InPort of EndSwitch : "
+ << toNode->Name() << "( " << anInPort->PortName() << " )" << endl;
+ done = true ;
+ break ;
+ }
+ }
+ if ( done ) {
+ break ;
+ }
+ }
+ if ( done ) {
+ break ;
+ }
+ }
+ }
}
}
}