X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGraphBase%2FDataFlowBase_OutPort.cxx;h=d03f937aa6eb42ac52f5600151d2084db1d39b18;hb=82fc902879aadddeba4aad64af991ed52e9f5c0c;hp=67a16e1760062ec7787c8166a7e8a9e93a90e346;hpb=c46f174ce52809de76f2a22795db89d229aedc7e;p=modules%2Fsuperv.git diff --git a/src/GraphBase/DataFlowBase_OutPort.cxx b/src/GraphBase/DataFlowBase_OutPort.cxx index 67a16e1..d03f937 100644 --- a/src/GraphBase/DataFlowBase_OutPort.cxx +++ b/src/GraphBase/DataFlowBase_OutPort.cxx @@ -28,6 +28,7 @@ using namespace std; #include "DataFlowBase_OutPort.hxx" +#include "DataFlowBase_InPort.hxx" //GraphBase::OutPort::~OutPort() { // In GraphExecutor::OutPort @@ -50,9 +51,9 @@ const GraphBase::InPort * GraphBase::OutPort::GetInPort( if ( index > 0 && index <= _InPortsSize ) { anInPort = _InPorts[ index-1 ] ; if ( anInPort != toPort ) { - cout << "GraphBase::OutPort::GetInPort inconsistency toPort " - << hex << (void *) toPort << " != anInPort " << (void *) anInPort - << dec << endl ; + //cout << "GraphBase::OutPort::GetInPort inconsistency toPort " +// << hex << (void *) toPort << " != anInPort " << (void *) anInPort +// << dec << endl ; anInPort = NULL ; } } @@ -96,14 +97,40 @@ bool GraphBase::OutPort::AddInPortObjRef( GraphBase::InPort * toPort , return true ; } +bool GraphBase::OutPort::RemoveInPort() { + if ( _InPortsSize != 1 ) { + return false ; + } + int index = 1 ; + GraphBase::InPort * toPort = _InPorts[ index - 1 ] ; + _InPortsSize -= 1 ; + _InPorts.resize( _InPortsSize ) ; + _Links.resize( _InPortsSize ) ; + _MapOfInPorts.erase( toPort->NodePortName() ) ; + if ( _InPortsSize == 0 ) { + PortStatus(NotConnected ) ; + if ( IsSwitch() ) { + Kind( SUPERV::InLineParameter ) ; + } + } + toPort->RemoveOutPort() ; + cdebug << "OutPort::RemoveInPort " << NodeName() << "( " << PortName() << " " << PortStatus() + << " " << Kind() << " ) _InPortsSize " << _InPortsSize << " --> " + << toPort->NodeName() << "( " << toPort->PortName() << " " << toPort->PortStatus() + << " " << toPort->Kind() << " )" << endl ; + return true ; +} + bool GraphBase::OutPort::RemoveInPort( GraphBase::InPort * toPort ) { int i ; int index = _MapOfInPorts[ toPort->NodePortName() ] ; if ( index <= 0 || index > _InPortsSize ) { - cdebug << "GraphBase::OutPort::RemoveInPort Error " << NodePortName() - << " --> " << toPort->NodePortName() << endl ; + cdebug << "GraphBase::OutPort::RemoveInPort Error " << NodeName() << "( " << PortName()<< " ) --> " + << toPort->NodeName() << "( " << toPort->PortName() << " )" << endl ; return false ; } + cdebug << "OutPort::RemoveInPort " << NodeName() << "(" << PortName() << ") --> " + << _InPorts[ index - 1 ]->NodeName() << "(" << _InPorts[ index - 1 ]->PortName() << ")" << endl ; _InPortsSize -= 1 ; for ( i = index - 1 ; i < _InPortsSize ; i++ ) { _MapOfInPorts[ _InPorts[ i+1 ]->NodePortName() ] = i + 1 ; @@ -115,6 +142,9 @@ bool GraphBase::OutPort::RemoveInPort( GraphBase::InPort * toPort ) { _MapOfInPorts.erase( toPort->NodePortName() ) ; if ( _InPortsSize == 0 ) { PortStatus(NotConnected ) ; + if ( IsSwitch() ) { + Kind( SUPERV::InLineParameter ) ; + } } toPort->RemoveOutPort() ; return true ; @@ -124,7 +154,7 @@ bool GraphBase::OutPort::ReNameInPort( const char* OldNodePortName , const char* NewNodePortName ) { int index = _MapOfInPorts[ OldNodePortName ] ; if ( index <= 0 || index > _InPortsSize ) { - cdebug << "GraphBase::OutPort::ReNameLink Error " << OldNodePortName + cdebug << "GraphBase::OutPort::ReNameInPort Error " << OldNodePortName << " --> " << NewNodePortName << " index " << index << endl ; return false ; } @@ -153,12 +183,10 @@ bool GraphBase::OutPort::RemoveLinks() { ostream & operator<< (ostream &f ,const GraphBase::OutPort &P) { - f << P.PortName() << ", " - << "type : " << P.PortType() << ", " ; - - f << "from " - << P.NodeName() << ", "; - + f << P.PortName() << ", " << "type : " << P.PortType() << ", " ; + f << "kind " << P.Kind() << ", "; + f << "Status " << P.PortStatus() << ", "; + f << "from Node " << P.NodeName() << ", "; return f; }