]> SALOME platform Git repositories - modules/superv.git/blobdiff - src/GraphBase/DataFlowBase_PortsOfNode.cxx
Salome HOME
*** empty log message ***
[modules/superv.git] / src / GraphBase / DataFlowBase_PortsOfNode.cxx
index e3ec6da61320edfb595198e3019cd9175373b7b0..b8dcc3ea9a7b2d011ed43d352f93c413af171441 100644 (file)
@@ -75,13 +75,13 @@ void GraphBase::PortsOfNode::DefPortsOfNode(
   const bool WithInLoop = (aKind == SUPERV::LoopNode) || (aKind == SUPERV::EndLoopNode) ;
 // WithInGate : InGate or Default
   const bool WithInGate = (aKind == SUPERV::ComputingNode) || (aKind == SUPERV::FactoryNode) ||
-                          (aKind == SUPERV::InLineNode) || (aKind == SUPERV::LoopNode) ||
-                          (aKind == SUPERV::SwitchNode) || (aKind == SUPERV::EndSwitchNode) ||
-                          (aKind == SUPERV::GOTONode) ;
+                          (aKind == SUPERV::InLineNode) || (aKind == SUPERV::GOTONode) ||
+                          (aKind == SUPERV::LoopNode) || (aKind == SUPERV::EndLoopNode) ||
+                          (aKind == SUPERV::SwitchNode) || (aKind == SUPERV::EndSwitchNode) ;
 // WithOutGate : OutGate or Default
   const bool WithOutGate = (aKind == SUPERV::ComputingNode) || (aKind == SUPERV::FactoryNode) ||
-                           (aKind == SUPERV::InLineNode) || (aKind == SUPERV::SwitchNode) ||
-                           (aKind == SUPERV::GOTONode) ;
+                           (aKind == SUPERV::InLineNode) || (aKind == SUPERV::GOTONode) ||
+                           (aKind == SUPERV::SwitchNode) || (aKind == SUPERV::EndSwitchNode) ;
   SUPERV::KindOfPort aPortKind = SUPERV::ServiceParameter ;
   if ( aKind == SUPERV::InLineNode ) {
     aPortKind = SUPERV::InLineParameter ;
@@ -269,57 +269,42 @@ GraphBase::InPort * GraphBase::PortsOfNode::AddInPort( CORBA::ORB_ptr ORB ,
   cdebug_in << "DefPortsOfNode::AddInPort : " << *NodeName << " " << aKind << " "
             << InputParameterName << " " << InputParameterType << endl ;
   GraphBase::InPort * anInPort = NULL ;
-  SUPERV::KindOfPort aPortKind = SUPERV::UndefinedParameter ;
-  if ( aKind == SUPERV::InLineNode || aKind == SUPERV::LoopNode ||
-       aKind == SUPERV::EndLoopNode || aKind == SUPERV::SwitchNode ||
-       aKind == SUPERV::EndSwitchNode || aKind == SUPERV::GOTONode ) {
-    aPortKind = SUPERV::ServiceParameter ;
-  }
+  SUPERV::KindOfPort aPortKind = SUPERV::InLineParameter ;
+  anInPort = GetChangeInPort( InputParameterName ) ;
+  if ( anInPort == NULL ) {
+    _NodeInPortsSize = _NodeInPortsSize + 1 ;
+    _NodeInPorts.resize(_NodeInPortsSize);
+    SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
+    aServiceParameter.Parametername = InputParameterName ;
+    aServiceParameter.Parametertype = InputParameterType ;
+//    if ( aKind != SUPERV::EndLoopNode ) {
+      _NodeInPorts[ _NodeInPortsSize-1 ] = _NodeInPorts[ _NodeInPortsSize-2 ] ; // Gate - Default
+      _MapOfNodeInPorts.erase( _NodeInPorts[ _NodeInPortsSize-1 ]->PortName() ) ;
+      _MapOfNodeInPorts[ _NodeInPorts[ _NodeInPortsSize-1 ]->PortName() ] =  _NodeInPortsSize-1 + 1 ;
+      _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize-2 + 1 ;
+      _NodeInPorts[_NodeInPortsSize-2] = new GraphBase::InPort( NodeName ,
+                                                                aServiceParameter ,
+                                                                aPortKind ) ;
+      _NodeInPorts[_NodeInPortsSize-2]->Kind( SUPERV::InLineParameter ) ;
+      _NodeInPorts[_NodeInPortsSize-2]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+      anInPort = _NodeInPorts[_NodeInPortsSize-2] ;
+      cdebug << "NodeInPorts[ " << _NodeInPortsSize-2 << " ]" << endl ;
+    }
+//    else { // EndLoopNode
+//      _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize-1 + 1 ;
+//      _NodeInPorts[_NodeInPortsSize-1] = new GraphBase::InPort( NodeName ,
+//                                                                aServiceParameter ,//
+//                                                                aPortKind ) ;
+//      _NodeInPorts[_NodeInPortsSize-1]->Kind( SUPERV::InLineParameter ) ;
+//      MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << InputParameterName << " --> SetDebug" ) ;
+//      _NodeInPorts[_NodeInPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+//      anInPort = _NodeInPorts[_NodeInPortsSize-1] ;
+//      cdebug << "NodeInPorts[ " << _NodeInPortsSize-1 << " ]" << endl ;
+//    }
+//  }
   else {
-    aPortKind = SUPERV::DataStreamParameter ;
+    cdebug << "InPort already exists" << endl ;
   }
-
-    //    SUPERV::KindOfPort aPortKind = SUPERV::InLineParameter ;
-    //    if ( aKind == SUPERV::EndSwitchNode ) {
-    //      aPortKind = SUPERV::EndSwitchParameter ;
-    //    }
-    anInPort = GetChangeInPort( InputParameterName ) ;
-    if ( anInPort == NULL ) {
-      _NodeInPortsSize = _NodeInPortsSize + 1 ;
-      _NodeInPorts.resize(_NodeInPortsSize);
-      SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
-      aServiceParameter.Parametername = InputParameterName ;
-      aServiceParameter.Parametertype = InputParameterType ;
-      if ( aKind != SUPERV::EndLoopNode ) {
-        _NodeInPorts[ _NodeInPortsSize-1 ] = _NodeInPorts[ _NodeInPortsSize-2 ] ; // Gate - Default
-        _MapOfNodeInPorts.erase( _NodeInPorts[ _NodeInPortsSize-1 ]->PortName() ) ;
-        _MapOfNodeInPorts[ _NodeInPorts[ _NodeInPortsSize-1 ]->PortName() ] =  _NodeInPortsSize-1 + 1 ;
-        _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize-2 + 1 ;
-        _NodeInPorts[_NodeInPortsSize-2] = new GraphBase::InPort( NodeName ,
-                                                                  aServiceParameter ,
-                                                                  aPortKind ) ;
-        _NodeInPorts[_NodeInPortsSize-2]->Kind( SUPERV::InLineParameter ) ;
-//        MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << InputParameterName << " --> SetDebug" ) ;
-        _NodeInPorts[_NodeInPortsSize-2]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-        anInPort = _NodeInPorts[_NodeInPortsSize-2] ;
-        cdebug << "NodeInPorts[ " << _NodeInPortsSize-2 << " ]" << endl ;
-      }
-      else {
-        _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize-1 + 1 ;
-        _NodeInPorts[_NodeInPortsSize-1] = new GraphBase::InPort( NodeName ,
-                                                                  aServiceParameter ,
-                                                                  aPortKind ) ;
-        _NodeInPorts[_NodeInPortsSize-1]->Kind( SUPERV::InLineParameter ) ;
-//        MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << InputParameterName << " --> SetDebug" ) ;
-        _NodeInPorts[_NodeInPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-        anInPort = _NodeInPorts[_NodeInPortsSize-1] ;
-        cdebug << "NodeInPorts[ " << _NodeInPortsSize-1 << " ]" << endl ;
-      }
-    }
-    else {
-      cdebug << "InPort already exists" << endl ;
-    }
-    //  }
   cdebug_out << "DefPortsOfNode::AddInPort _NodeInPortsSize " << _NodeInPortsSize
              << " " << anInPort->Kind() << endl ;
   return anInPort ;
@@ -335,52 +320,44 @@ GraphBase::OutPort * GraphBase::PortsOfNode::AddOutPort( CORBA::ORB_ptr ORB ,
   cdebug_in << "DefPortsOfNode::AddOutPort : " << *NodeName << " " << aKind << " "
             << OutputParameterName << " " << OutputParameterType << endl ;
   GraphBase::OutPort * anOutPort = NULL ;
-  SUPERV::KindOfPort aPortKind = SUPERV::UndefinedParameter ;
-  if ( aKind == SUPERV::InLineNode || aKind == SUPERV::LoopNode ||
-       aKind == SUPERV::EndLoopNode || aKind == SUPERV::SwitchNode ||
-       aKind == SUPERV::EndSwitchNode || aKind == SUPERV::GOTONode ) {
-    aPortKind = SUPERV::InLineParameter ;
+  SUPERV::KindOfPort aPortKind = SUPERV::InLineParameter ;
+  anOutPort = GetChangeOutPort( OutputParameterName ) ;
+  if ( anOutPort == NULL ) {
+    _NodeOutPortsSize = _NodeOutPortsSize + 1 ;
+    _NodeOutPorts.resize(_NodeOutPortsSize);
+    SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
+    aServiceParameter.Parametername = OutputParameterName ;
+    aServiceParameter.Parametertype = OutputParameterType ;
+    if ( aKind != SUPERV::LoopNode && aKind != SUPERV::EndLoopNode ) {
+//         && aKind != SUPERV::EndSwitchNode ) {
+      _NodeOutPorts[ _NodeOutPortsSize-1 ] = _NodeOutPorts[ _NodeOutPortsSize-2 ] ; // Gate - Default
+      _MapOfNodeOutPorts.erase( _NodeOutPorts[ _NodeOutPortsSize-1 ]->PortName() ) ;
+      _MapOfNodeOutPorts[ _NodeOutPorts[ _NodeOutPortsSize-1 ]->PortName() ] =  _NodeOutPortsSize-1 + 1 ;
+      _MapOfNodeOutPorts[ OutputParameterName ] = _NodeOutPortsSize - 1 ;
+      _NodeOutPorts[_NodeOutPortsSize-2] = new GraphBase::OutPort( NodeName ,
+                                                                   aServiceParameter ,
+                                                                   aPortKind );
+      _NodeOutPorts[_NodeOutPortsSize-2]->Kind( SUPERV::InLineParameter ) ;
+//    MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << OutputParameterName << " --> SetDebug" ) ;
+      _NodeOutPorts[_NodeOutPortsSize-2]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+      anOutPort = _NodeOutPorts[_NodeOutPortsSize-2] ;
+      cdebug << "NodeOutPorts[ " << _NodeOutPortsSize-2 << " ]" << endl ;
+    }
+    else { // LoopNode || EndLoopNode
+      _MapOfNodeOutPorts[ OutputParameterName ] = _NodeOutPortsSize ;
+      _NodeOutPorts[_NodeOutPortsSize-1] = new GraphBase::OutPort( NodeName ,
+                                                                   aServiceParameter ,
+                                                                   aPortKind );
+      _NodeOutPorts[_NodeOutPortsSize-1]->Kind( SUPERV::InLineParameter ) ;
+//    MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << OutputParameterName << " --> SetDebug" ) ;
+      _NodeOutPorts[_NodeOutPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+      anOutPort = _NodeOutPorts[_NodeOutPortsSize-1] ;
+      cdebug << "NodeOutPorts[ " << _NodeOutPortsSize-1 << " ]" << endl ;
+    }
   }
   else {
-    aPortKind = SUPERV::DataStreamParameter ;
+    cdebug << "OutPort already exists" << endl ;
   }
-    anOutPort = GetChangeOutPort( OutputParameterName ) ;
-    if ( anOutPort == NULL ) {
-      _NodeOutPortsSize = _NodeOutPortsSize + 1 ;
-      _NodeOutPorts.resize(_NodeOutPortsSize);
-      SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
-      aServiceParameter.Parametername = OutputParameterName ;
-      aServiceParameter.Parametertype = OutputParameterType ;
-      if ( aKind != SUPERV::SwitchNode ) {
-        _NodeOutPorts[ _NodeOutPortsSize-1 ] = _NodeOutPorts[ _NodeOutPortsSize-2 ] ; // Gate - Default
-        _MapOfNodeOutPorts.erase( _NodeOutPorts[ _NodeOutPortsSize-1 ]->PortName() ) ;
-        _MapOfNodeOutPorts[ _NodeOutPorts[ _NodeOutPortsSize-1 ]->PortName() ] =  _NodeOutPortsSize-1 + 1 ;
-        _MapOfNodeOutPorts[ OutputParameterName ] = _NodeOutPortsSize - 1 ;
-        _NodeOutPorts[_NodeOutPortsSize-2] = new GraphBase::OutPort( NodeName ,
-                                                                     aServiceParameter ,
-                                                                     aPortKind );
-        _NodeOutPorts[_NodeOutPortsSize-2]->Kind( SUPERV::InLineParameter ) ;
-//      MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << OutputParameterName << " --> SetDebug" ) ;
-        _NodeOutPorts[_NodeOutPortsSize-2]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-        anOutPort = _NodeOutPorts[_NodeOutPortsSize-2] ;
-        cdebug << "NodeInPorts[ " << _NodeInPortsSize-2 << " ]" << endl ;
-      }
-      else {
-        _MapOfNodeOutPorts[ OutputParameterName ] = _NodeOutPortsSize ;
-        _NodeOutPorts[_NodeOutPortsSize-1] = new GraphBase::OutPort( NodeName ,
-                                                                     aServiceParameter ,
-                                                                     aPortKind );
-        _NodeOutPorts[_NodeOutPortsSize-1]->Kind( SUPERV::InLineParameter ) ;
-//      MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << OutputParameterName << " --> SetDebug" ) ;
-        _NodeOutPorts[_NodeOutPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-        anOutPort = _NodeOutPorts[_NodeOutPortsSize-1] ;
-        cdebug << "NodeInPorts[ " << _NodeInPortsSize-1 << " ]" << endl ;
-      }
-    }
-    else {
-      cdebug << "OutPort already exists" << endl ;
-    }
-    //  }
   cdebug_out << "DefPortsOfNode::AddOutPort _NodeOutPortsSize "
              << _NodeOutPortsSize << " " << anOutPort->Kind() << endl ;
   return anOutPort ;