Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/superv.git] / src / GraphBase / DataFlowBase_ComputingNode.cxx
index ad86cd829d763a4421e3fdcc3af6a8fd405fdd2b..cafe8512556b4e6437229d4ce2699ddf9cd5b304 100644 (file)
@@ -4,34 +4,36 @@
 //
 //
 //
-//  File   : DataFlowBase_Node.cxx
+//  File   : DataFlowBase_ComputingNode.cxx
 //  Author : Jean Rahuel, CEA
 //  Module : SUPERV
 //  $Header:
 
 using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
 
-#include "DataFlowBase_InLineNode.hxx"
-#include "DataFlowBase_LoopNode.hxx"
+#include "DataFlowBase_StreamGraph.hxx"
+//#include "DataFlowBase_LoopNode.hxx"
 
-static void InitFields( SUPERV::KindOfNode &_Kind ,
+static void InitFields( //SUPERV::KindOfNode &_Kind ,
                         SUPERV::SDate      &_FirstCreation ,
                         SUPERV::SDate      &_LastModification ,
-                        char *              &_EditorRelease ,
-                        char *              &_Author ,
-                        char *              &_Comment ,
-                        bool                &_HeadNode ,
-                        bool                &_GeneratedName ,
-                        int                 &_ConnectedInPortsNumber ,
-                        int                 &_DecrConnectedInPortsNumber,
-                        int                 &_LinkedNodesSize ,
-                        int                 &_SubGraphNumber ) {
+                        char *             &_EditorRelease ,
+                        char *             &_Author ,
+                        char *             &_Comment ,
+                        //bool               &_HeadNode ,
+                        bool               &_GeneratedName ,
+                        //int                &_DataStreamInPortsNumber ,
+                        //int                &_DataStreamOutPortsNumber ,
+                        int                &_ConnectedInPortsNumber ,
+                        int                &_DecrConnectedInPortsNumber ) {
+                        //int                &_LinkedNodesSize ,
+                        //int                &_SubGraphNumber ) {
   time_t T = time(NULL);
   struct tm * Tm = localtime(&T);
 
-  _Kind = SUPERV::DataFlowNode ;
+//  _Kind = SUPERV::DataFlowGraph ;
 
   _FirstCreation.Second = _LastModification.Second = Tm->tm_sec;
   _FirstCreation.Minute = _LastModification.Minute = Tm->tm_min;
@@ -47,85 +49,95 @@ static void InitFields( SUPERV::KindOfNode &_Kind ,
 //  strcpy( _Computer  , FACTORYSERVER ) ;
   _Comment = NULLSTRING ;
 
-  _SubGraphNumber = 0 ;
-  _HeadNode = false ;
+//  _SubGraphNumber = 0 ;
+//  _HeadNode = false ;
   _GeneratedName = false ;
 
+//  _DataStreamInPortsNumber = 0 ;
+//  _DataStreamOutPortsNumber = 0 ;
+
   _ConnectedInPortsNumber = 0 ;
   _DecrConnectedInPortsNumber = 0 ;
-  _LinkedNodesSize = 0 ;
-  _SubGraphNumber = 0 ;
+//  _LinkedNodesSize = 0 ;
+//  _SubGraphNumber = 0 ;
 }
 
 GraphBase::ComputingNode::ComputingNode() :
-  GraphBase::PortsOfNode::PortsOfNode() {
+//  GraphBase::PortsOfNode::PortsOfNode() {
+  GraphBase::StreamNode::StreamNode() {
 
-  InitFields( _Kind ,
+  InitFields( //_Kind ,
               _FirstCreation ,
               _LastModification ,
               _EditorRelease ,
               _Author ,
               _Comment ,
-              _HeadNode ,
+              //_HeadNode ,
               _GeneratedName ,
+              //_DataStreamInPortsNumber ,
+              //_DataStreamOutPortsNumber ,
               _ConnectedInPortsNumber ,
-              _DecrConnectedInPortsNumber ,
-              _LinkedNodesSize ,
-              _SubGraphNumber ) ;
+              _DecrConnectedInPortsNumber ) ;
+              //_LinkedNodesSize ,
+              //_SubGraphNumber ) ;
+  Kind( SUPERV::DataFlowGraph ) ;
   _NamingService = NULL ;
-  _Node = SUPERV::CNode::_nil() ;
+  _Node_var = SUPERV::CNode::_nil() ;
+  _Node_Impl = NULL ;
   _InNode = NULL ;
   _ThreadNo = pthread_self() ;
-  _Name = NULL ;
-  cdebug << "GraphBase::Node::Node "  << this 
-          << " _Name "
-         << (void *) _Name << " " << _Name << " _Comment "
-         << (void *) _Comment << " "  << _Comment << " "  << endl ;
+  cdebug << "GraphBase::Node::Node "  << this << " "  << endl ;
 
 }
 
 GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
                                          SALOME_NamingService* ptrNamingService ,
                                          const char * aDataFlowName ,
+                                         const SUPERV::KindOfNode DataFlowkind ,
                                          int * Graph_prof_debug ,
-                                         ostream * Graph_fdebug ) :
-  GraphBase::PortsOfNode::PortsOfNode( aDataFlowName ) {
+                                         ofstream * Graph_fdebug ) :
+//  GraphBase::PortsOfNode::PortsOfNode( aDataFlowName ) {
+  GraphBase::StreamNode::StreamNode( aDataFlowName , DataFlowkind ,
+                                     Graph_prof_debug , Graph_fdebug ) {
 
-  InitFields( _Kind ,
+//  MESSAGE( "GraphBase::ComputingNode::ComputingNode " << aDataFlowName << " Graph_prof_debug " << Graph_prof_debug ) ;
+  InitFields( //_Kind ,
               _FirstCreation ,
               _LastModification ,
               _EditorRelease ,
               _Author ,
               _Comment ,
-              _HeadNode ,
+              //_HeadNode ,
               _GeneratedName ,
+              //_DataStreamInPortsNumber ,
+              //_DataStreamOutPortsNumber ,
               _ConnectedInPortsNumber ,
-              _DecrConnectedInPortsNumber ,
-              _LinkedNodesSize ,
-              _SubGraphNumber ) ;
+              _DecrConnectedInPortsNumber ) ;
+              //_LinkedNodesSize ,
+              //_SubGraphNumber ) ;
 
+//  Kind( SUPERV::DataFlowGraph ) ;
+  Kind( DataFlowkind ) ;
   _ORB = CORBA::ORB::_duplicate( ORB ) ;
   _NamingService = ptrNamingService ;
-  _Graph_prof_debug = Graph_prof_debug ;
-  _Graph_fdebug = Graph_fdebug ;
-  _Node = SUPERV::CNode::_nil() ;
+  _Node_var = SUPERV::CNode::_nil() ;
+  _Node_Impl = NULL ;
   _InNode = NULL ;
   _ThreadNo = pthread_self() ;
 
-  if ( aDataFlowName && strlen( aDataFlowName ) ) {
-    _Name = new char[ strlen( aDataFlowName )+1 ] ;
-    strcpy( _Name , aDataFlowName ) ;
-  }
-  else
-    _Name = NULL ;
   if ( Graph_prof_debug ) {
+//    MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug" ) ;
+//    cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug" << endl ;
+    _Graph_prof_debug = Graph_prof_debug ;
+    _Graph_fdebug = Graph_fdebug ;
     SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-//    MESSAGE( "Invalid DataFlow Name." );
   }
+//  else {
+//    cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ;
+//  }
+  DefPortsOfNode( ORB , SALOME_ModuleCatalog::Service() , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
   cdebug << "GraphBase::ComputingNode::ComputingNode "  << this 
-         << "' _Name "
-         << (void *) _Name << " '" << _Name << " _Comment "
-         << (void *) _Comment << " "  << _Comment << " "  << _FirstCreation
+         << " Name '" << Name() << "' "  << _FirstCreation
          << " "  << _LastModification << endl ;
 }
 
@@ -143,18 +155,19 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
                                          const long   X ,
                                          const long   Y ,
                                          int * Graph_prof_debug ,
-                                         ostream * Graph_fdebug ) :
-  GraphBase::PortsOfNode::PortsOfNode() {
+                                         ofstream * Graph_fdebug ) :
+//  GraphBase::PortsOfNode::PortsOfNode() {
+  GraphBase::StreamNode::StreamNode( NodeName , akind , Graph_prof_debug , Graph_fdebug ) {
 
   _ORB = CORBA::ORB::_duplicate( ORB ) ;
   _NamingService = ptrNamingService ;
-  _Graph_prof_debug = Graph_prof_debug ;
-  _Graph_fdebug = Graph_fdebug ;
-  _Node = SUPERV::CNode::_nil() ;
+  _Node_var = SUPERV::CNode::_nil() ;
+  _Node_Impl = NULL ;
   _InNode = NULL ;
   _ThreadNo = pthread_self() ;
 
-  _Kind = akind ;
+  Kind( akind ) ;
+//  _Kind = akind ;
 
   time_t T = time(NULL);
   struct tm * Tm = localtime(&T);
@@ -166,7 +179,7 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
   _FirstCreation.Month  = _LastModification.Month  = Tm->tm_mon + 1;
   _FirstCreation.Year   = _LastModification.Year   = Tm->tm_year + 1900; 
 
-  if ( NodeEditorRelease ) {
+  if ( NodeEditorRelease != NULLSTRING ) {
     _EditorRelease = new char[ strlen( NodeEditorRelease ) + 1 ] ;
     strcpy( _EditorRelease , NodeEditorRelease ) ;
   }
@@ -175,51 +188,54 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
     strcpy( _EditorRelease , SuperVision_Version ) ;
   }
 
-  if ( NodeAuthor ) {
+  if ( NodeAuthor != NULLSTRING ) {
     _Author = new char[ strlen( NodeAuthor ) + 1 ] ;
     strcpy( _Author  , NodeAuthor ) ;
   }
-  else
+  else {
     _Author = NULLSTRING ;
+  }
 
-  if ( NodeComment  ) {
+  if ( NodeComment != NULLSTRING ) {
     _Comment = new char[ strlen( NodeComment ) + 1 ] ;
     strcpy( _Comment  , NodeComment ) ;
   }
-  else
+  else {
     _Comment = NULLSTRING ;
+  }
 
-  _SubGraphNumber = 0 ;
-  _HeadNode = false ;
+//  _SubGraphNumber = 0 ;
+//  _HeadNode = false ;
   _GeneratedName = GeneratedName ;
 
-  const char *aNodeName = NodeName ;
-  _Name = new char[strlen(aNodeName)+1];
-  strcpy(_Name , aNodeName);
+//  const char *aNodeName = NodeName ;
+//  _Name = new char[strlen(aNodeName)+1];
+//  strcpy(_Name , aNodeName);
+
+//  _DataStreamInPortsNumber = 0 ;
+//  _DataStreamOutPortsNumber = 0 ;
 
   _ConnectedInPortsNumber = 0 ;
   _DecrConnectedInPortsNumber = 0 ;
-  _LinkedNodesSize = 0 ;
+//  _LinkedNodesSize = 0 ;
 
   _X = X ;
   _Y = Y ;
 
-  if ( Graph_prof_debug )
-    SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-
-    DefPortsOfNode( ORB , aService , NamePtr() , Kind() ,
-                    Graph_prof_debug , Graph_fdebug ) ;
-
-  cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << ","
-            << aNodeName << "," << akind
-            << "," << NodeComment << ")" << endl;
+  _Graph_prof_debug = Graph_prof_debug ;
+  _Graph_fdebug = Graph_fdebug ;
+//  MESSAGE( "GraphBase::ComputingNode::ComputingNode " << NodeName
+//           << " _Graph_prof_debug " << _Graph_prof_debug ) ;
+  SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+  cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << NodeName << ","
+            << akind << ")" << endl;
   
+
+  DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
   cdebug << "GraphBase::ComputingNode::ComputingNode "  << this 
-         << " _Name "
-         << (void *) _Name << " '" << _Name << "' _Comment "
-         << (void *) _Comment << " "  << _Comment << " " 
-         << " KindOfNode " << _Kind
-         << " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
+         << " Name '" << Name()
+         << "' KindOfNode " << Kind()
+         << " ServiceName '" << ServiceName() << "' In(" << ServiceInParameter().length()
          << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
 
   cdebug_out << "GraphBase::ComputingNode::ComputingNode" << endl;
@@ -227,35 +243,26 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
 
 GraphBase::ComputingNode::~ComputingNode() {
   cdebug << "GraphBase::ComputingNode::~ComputingNode "  << this 
-         << " _Name "
-         << (void *) _Name << " " << _Name << " _Comment "
+         << " Name() "<< Name() << " _Comment "
          << (void *) _Comment << " "  << _Comment << " "  << endl ;
-//  if ( _ComponentName != NULLSTRING )
-//    delete [] _ComponentName ;
-//  delete [] _Name ;
-//  delete [] _EditorRelease ;
-//  if ( _Author != NULLSTRING )
-//    delete [] _Author ;
-//  if ( _Computer != FACTORYSERVER )
-//    delete [] _Computer;
-//  if ( _Comment != NULLSTRING )
-//    delete [] _Comment;
 }
 
-bool GraphBase::ComputingNode::Name( const char * aName) {
-  if ( _Name ) {
-    cdebug << "GraphBase::ComputingNode::ReName "  << _Name << " --> " << aName << endl ;
-    delete [] _Name ;
-  }
-  _Name = new char[strlen(aName)+1] ;
-  strcpy( _Name , aName ) ;
-  return true ;
-}
+//->StreamNode bool GraphBase::ComputingNode::Name( const char * aName) {
+//->StreamNode   cdebug_in << "GraphBase::ComputingNode::Name " << _Name << endl;
+//->StreamNode   if ( _Name ) {
+//->StreamNode     cdebug << "GraphBase::ComputingNode::ReName "  << _Name << " --> " << aName << endl ;
+//->StreamNode     delete [] _Name ;
+//->StreamNode   }
+//->StreamNode   _Name = new char[strlen(aName)+1] ;
+//->StreamNode   strcpy( _Name , aName ) ;
+//->StreamNode   cdebug_out << "GraphBase::ComputingNode::Name " << _Name << endl;
+//->StreamNode   return true ;
+//->StreamNode }
 
 SUPERV::SDate GraphBase::ComputingNode::FirstCreation () const {
-  cdebug << "GraphBase::ComputingNode::FirstCreation "
-         << "' _Name " << _Name << " "  << _FirstCreation << " "  
-         << _LastModification << endl ;
+//  cdebug << "GraphBase::ComputingNode::FirstCreation "
+//         << " Name '" << Name() << "' "  << _FirstCreation << " "  
+//         << _LastModification << endl ;
   return _FirstCreation;
 }
 
@@ -263,11 +270,6 @@ SUPERV::SDate GraphBase::ComputingNode::LastModification () const {
   return _LastModification ;
 }
 
-bool GraphBase::ComputingNode::Kind(const SUPERV::KindOfNode aKind) {
-  _Kind = aKind ;
-  return true ;
-}
-
 void GraphBase::ComputingNode::FirstCreation(const SUPERV::SDate aDate ) {
   _FirstCreation = aDate ;
 }
@@ -284,18 +286,20 @@ bool GraphBase::ComputingNode::EditorRelease(const char * c){
 }
 
 bool GraphBase::ComputingNode::Author(const char * a) {
+  cdebug_in << "GraphBase::ComputingNode::Author " << _Author << endl;
   if ( _Author && _Author != NULLSTRING )
     delete _Author;
   _Author = my_strdup(a);
+  cdebug_out << "GraphBase::ComputingNode::Author " << _Author << endl;
   return true ;
 }
 
 bool GraphBase::ComputingNode::Comment(const char *c) {
-  cdebug_in << "GraphBase::ComputingNode::Comment" << endl;
+  cdebug_in << "GraphBase::ComputingNode::Comment " << _Comment << endl;
   if ( _Comment != NULLSTRING )
     delete [] _Comment;
   _Comment = my_strdup(c);
-  cdebug_out << "GraphBase::ComputingNode::Comment" << endl;
+  cdebug_out << "GraphBase::ComputingNode::Comment " << _Comment << endl;
   return true ;
 }
 
@@ -307,31 +311,42 @@ void GraphBase::ComputingNode::NodePort( const char * NodeName ,
     *aPort = my_strdup( ServiceParameterName ) ;
   }
   else {
-    char * BPort = strchr( ServiceParameterName , '\\' ) ;
-    if ( BPort ) {
-      int len = BPort - ServiceParameterName ;
-      *aNode = new char [ len + 1 ] ;
-      strncpy( *aNode , ServiceParameterName , len ) ;
-      (*aNode)[ len ] = '\0' ;
-      *aPort = my_strdup( &BPort[ 1 ] ) ;
+//    char * BPort = strchr( ServiceParameterName , '\\' ) ;
+    char * BPort = (char * ) ServiceParameterName ;
+    while ( ( BPort = strchr( BPort , '_' ) ) ) {
+      if ( BPort[1] == '_' ) {
+        int len = BPort - ServiceParameterName ;
+        *aNode = new char [ len + 1 ] ;
+        strncpy( *aNode , ServiceParameterName , len ) ;
+        (*aNode)[ len ] = '\0' ;
+        *aPort = my_strdup( &BPort[ 2 ] ) ;
+        break ;
+      }
+      else {
+        BPort = &BPort[2] ;
+      }
     }
-    else {
+    if ( BPort == NULL ) {
       *aNode = my_strdup( NULLSTRING ) ;
       *aPort = my_strdup( NULLSTRING ) ;
     }
   }
 }
 
-bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName ) {
+bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName, bool isInput ) {
   bool RetVal = false ;
-  const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ;
-  if ( thePort ) {
-    RetVal = thePort->IsConnected() ;
+  if ( isInput ) { // mkr : PAL8060
+    // we have to know the type of the port, because of input and output ports 
+    // belong to one node may have the same names
+    const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ;
+    if ( thePort ) {
+      RetVal = thePort->IsPortConnected() ;
+    }
   }
   else {
     const GraphBase::OutPort * thePort = GetOutPort( ToServiceParameterName ) ;
     if ( thePort ) {
-      RetVal = thePort->IsConnected() ;
+      RetVal = thePort->IsPortConnected() ;
     }
   }
   return RetVal ;
@@ -339,17 +354,14 @@ bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName ) {
 
 bool GraphBase::ComputingNode::HasInput(const char * ToServiceParameterName ) {
   bool RetVal = false ;
-  const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ;
-  if ( IsDataFlowNode() && thePort ) {
-    RetVal = true ;
-  }
-  else if ( thePort ) {
-    RetVal = thePort->IsDataConnected() ;
+  const GraphBase::InPort * theInPort = GetInPort( ToServiceParameterName ) ;
+  if ( theInPort ) {
+    RetVal = theInPort->IsDataConnected() ;
   }
   else {
-    const GraphBase::OutPort * thePort = GetOutPort( ToServiceParameterName ) ;
-    if ( thePort ) {
-      RetVal = thePort->IsDataConnected() ;
+    const GraphBase::OutPort * theOutPort = GetOutPort( ToServiceParameterName ) ;
+    if ( theOutPort ) {
+      RetVal = theOutPort->IsDataConnected() ;
     }
   }
   return RetVal ;
@@ -362,6 +374,15 @@ GraphBase::SNode * GraphBase::ComputingNode::GetInfo() {
 //  Info->theInterfaceName = InterfaceName() ;
   Info->theName = Name() ;
   Info->theKind = Kind() ;
+  if ( IsDataStreamNode() ) {
+    CORBA::Long Timeout ;
+    SUPERV::KindOfDataStreamTrace DataStreamTrace ;
+    CORBA::Double DeltaTime ;
+    ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
+    Info->theTimeout = Timeout ;
+    Info->theDataStreamTrace = DataStreamTrace ;
+    Info->theDeltaTime = DeltaTime ;
+  }
   Info->theService = *GetService() ;
 //  Info->theListOfParameters = *GetListOfParameters() ;
   Info->theFirstCreation = FirstCreation() ;
@@ -376,89 +397,671 @@ GraphBase::SNode * GraphBase::ComputingNode::GetInfo() {
   return Info ;
 }
 
+void GraphBase::ComputingNode::SetMacroPorts( GraphBase::Graph * aGraph ) {
+  cdebug_in << "GraphBase::ComputingNode::SetMacroPorts fill ports of MacroNode" << endl;
+  int i ;
+  for ( i = 0 ; i < aGraph->GetNodeInPortsSize() ; i++ ) {
+    const GraphBase::InPort * anInPort = aGraph->GetNodeInPort( i ) ;
+    cdebug << "SetMacroPorts In" << i << " " << anInPort->PortName() << " " << anInPort->PortType()
+           << " " << anInPort->Kind() << endl ;
+    GraphBase::InPort * aNewInPort ;
+    if ( anInPort->IsDataStream() ) {
+      aNewInPort = AddInDataStreamPort( anInPort->PortName() , StringToDataStreamType( anInPort->PortType() ) ,
+                                        anInPort->Dependency() , anInPort->Kind() ) ;
+    }
+    else if ( anInPort->IsParam() || anInPort->IsInLine() ) {
+      aNewInPort = AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() ) ;
+    }
+  }
+  for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() ; i++ ) {
+    const GraphBase::OutPort * anOutPort = aGraph->GetNodeOutPort( i ) ;
+    cdebug << "SetMacroPorts Out" << i << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+           << " " << anOutPort->Kind() << endl ;
+    if ( anOutPort->IsDataStream() ) {
+      AddOutDataStreamPort( anOutPort->PortName() , StringToDataStreamType( anOutPort->PortType() ) ,
+                            anOutPort->Dependency() , anOutPort->Kind() ) ;
+    }
+    else if ( anOutPort->IsParam() || anOutPort->IsInLine() ) {
+      AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() ) ;
+    }
+  }
+  cdebug_out << "GraphBase::ComputingNode::SetMacroPorts" << endl;
+}
+
+void GraphBase::ComputingNode::UpdateMacroPorts( GraphBase::Graph * aGraph ) {
+  cdebug_in << "GraphBase::ComputingNode::UpdateMacroPorts fill ports of MacroNode from "
+            << aGraph->Name() << " InPorts(" << aGraph->GetNodeInPortsSize() << ") OutPorts("
+            << aGraph->GetNodeInPortsSize() << ") to MacroNode " << Name() << " InPorts(" << GetNodeInPortsSize()
+            << ") OutPorts(" << GetNodeInPortsSize() << ")" << endl;
+  cdebug << Name() << " : " << *GetService() << endl ;
+  cdebug << aGraph->Name() << " : " << *aGraph->GetService() << endl ;
+  int i ;
+// Loop over InPorts of MacroNode ; if it does not exist in the MacroGraph ===> DelInPort in the MacroNode
+  for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
+    GraphBase::InPort * anInPort = aGraph->GetChangeInPort( GetNodeInPort( i )->PortName() ) ;
+    if ( anInPort && !anInPort->IsGate() && !GetNodeInPort( i )->IsGate() ) {
+      if ( strcmp( GetNodeInPort( i )->PortType() , anInPort->PortType() ) ) {
+        cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
+               << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
+        cdebug << "  <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
+               << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
+        GetChangeNodeInPort( i )->PortType( (char * ) anInPort->PortType() ) ;
+      }
+      if ( GetNodeInPort( i )->Kind() != anInPort->Kind() ) {
+        cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
+               << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
+        cdebug << "  <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
+               << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
+        GetChangeNodeInPort( i )->Kind( anInPort->Kind() ) ;
+      }
+      if ( GetNodeInPort( i )->Dependency() != anInPort->Dependency() ) {
+        cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
+               << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
+        cdebug << "  <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
+               << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
+        GetChangeNodeInPort( i )->Dependency( anInPort->Dependency() ) ;
+      }
+    }
+    else if ( !GetNodeInPort( i )->IsGate() ) {
+      cdebug << "UpdateMacroPorts DelInPort In" << i << " " << GetNodeInPort( i )->PortName() << " "
+             << GetNodeInPort( i )->PortType() << " " << GetNodeInPort( i )->Kind() << endl ;
+      DelInPort( GetNodeInPort( i )->PortName() ) ;
+      i--; // mkr : fix for bug PAL8004
+    }
+  }
+  int index ;
+// Loop over InPorts of the MacroGraph : if it does not exist in the MacroNode ==> AddInPort in the MacroNode
+  for ( index = 0 ; index < aGraph->GetNodeInPortsSize() ; index++ ) {
+    GraphBase::InPort * anInPort = aGraph->GetChangeNodeInPort( index ) ;
+    GraphBase::InPort * aMacroInPort = GetChangeInPort( anInPort->PortName() ) ;
+    if ( !anInPort->IsGate() &&
+         strcmp( GetChangeNodeInPort( index )->PortName() , anInPort->PortName() ) ) {
+      cdebug << "UpdateMacroPorts Add/MoveInPort In" << index << " " << anInPort->PortName() << " "
+             << anInPort->PortType() << " " << anInPort->Kind() << endl ;
+      if ( aMacroInPort ) {
+        MoveInPort( anInPort->PortName() , index ) ;
+      }
+      else {
+        AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() , index ) ;
+      }
+    }
+  }
+// Loop over OutPorts of MacroNode ; if it does not exist in the MacroGraph ===> DelOutPort in the MacroNode
+  for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+    GraphBase::OutPort * anOutPort = aGraph->GetChangeOutPort( GetNodeOutPort( i )->PortName() ) ;
+    if ( anOutPort && !anOutPort->IsGate() && !GetNodeOutPort( i )->IsGate() ) {
+      if ( strcmp( GetNodeOutPort( i )->PortType() , anOutPort->PortType() ) ) {
+        cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
+               << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
+        cdebug << "  <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+               << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
+        GetChangeNodeOutPort( i )->PortType( (char * ) anOutPort->PortType() ) ;
+      }
+      if ( GetNodeOutPort( i )->Kind() != anOutPort->Kind() ) {
+        cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
+               << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
+        cdebug << "  <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+               << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
+        GetChangeNodeOutPort( i )->Kind( anOutPort->Kind() ) ;
+      }
+      if ( GetNodeOutPort( i )->Dependency() != anOutPort->Dependency() ) {
+        cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
+               << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
+        cdebug << "  <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+               << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
+        GetChangeNodeOutPort( i )->Dependency( anOutPort->Dependency() ) ;
+      }
+    }
+    else if ( !GetNodeOutPort( i )->IsGate() ) {
+      cdebug << "UpdateMacroPorts DelOutPort Out" << i << " " << GetNodeOutPort( i )->PortName() << " "
+             << GetNodeOutPort( i )->PortType() << " " << GetNodeOutPort( i )->Kind() << endl ;
+      DelOutPort( GetNodeOutPort( i )->PortName() ) ;
+    }
+  }
+// Loop over OutPorts of the MacroGraph : if it does not exist in the MacroNode ==> AddOutPort in the MacroNode
+  for ( index = 0 ; index < aGraph->GetNodeOutPortsSize() ; index++ ) {
+    GraphBase::OutPort * anOutPort = aGraph->GetChangeNodeOutPort( index ) ;
+    GraphBase::OutPort * aMacroOutPort = GetChangeOutPort( anOutPort->PortName() ) ;
+    if ( !anOutPort->IsGate() && strcmp( GetNodeOutPort( index )->PortName() , anOutPort->PortName() ) ) {
+      cdebug << "UpdateMacroPorts Add/MoveOutPort Out" << index << " " << anOutPort->PortName() << " "
+             << anOutPort->PortType() << " " << anOutPort->Kind() << endl ;
+      if ( aMacroOutPort ) {
+        MoveOutPort( anOutPort->PortName() , index ) ;
+      }
+      else {
+        AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() , index ) ;
+      }
+    }
+  }
+  bool ErrPort = false ;
+  if ( aGraph->GetNodeInPortsSize() != GetNodeInPortsSize() ||
+       aGraph->GetNodeOutPortsSize() != GetNodeOutPortsSize() ) {
+    ErrPort = true ;
+  }
+  for ( i = 0 ; i < aGraph->GetNodeInPortsSize() && i < GetNodeInPortsSize() ; i++ ) {
+    if ( !strcmp( aGraph->GetNodeInPort( i )->PortName() , GetNodeInPort( i )->PortName() ) ) {
+      ErrPort = true ;
+    }
+  }
+  for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() && i < GetNodeOutPortsSize() ; i++ ) {
+    if ( !strcmp( aGraph->GetNodeOutPort( i )->PortName() , GetNodeOutPort( i )->PortName() ) ) {
+      ErrPort = true ;
+    }
+  }
+  if ( ErrPort ) {
+    for ( i = 0 ; i < aGraph->GetNodeInPortsSize() || i < GetNodeInPortsSize() ; i++ ) {
+      if ( i < aGraph->GetNodeInPortsSize() && i < GetNodeInPortsSize() ) {
+        cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << aGraph->GetNodeInPort( i )->PortName()
+               << "  " << GetNodeInPort( i )->PortName() << endl ;
+      }
+      else if ( i >= GetNodeInPortsSize() ) {
+        cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << aGraph->GetNodeInPort( i )->PortName()
+               << endl ;
+      }
+      else {
+        cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << GetNodeInPort( i )->PortName()
+               << endl ;
+      }
+    }
+    for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() || i < GetNodeOutPortsSize() ; i++ ) {
+      if ( i < aGraph->GetNodeOutPortsSize() && i < GetNodeOutPortsSize() ) {
+        cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << aGraph->GetNodeOutPort( i )->PortName()
+               << " != " << GetNodeOutPort( i )->PortName() << endl ;
+      }
+      else if ( i >= GetNodeOutPortsSize() ) {
+        cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << aGraph->GetNodeOutPort( i )->PortName()
+               << endl ;
+      }
+      else {
+        cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << GetNodeOutPort( i )->PortName()
+               << endl ;
+      }
+    }
+  }
+  cdebug_out << "GraphBase::ComputingNode::UpdateMacroPorts"
+             << aGraph->Name() << " InPorts(" << aGraph->GetNodeInPortsSize() << ") OutPorts("
+             << aGraph->GetNodeOutPortsSize() << ") to MacroNode " << Name() << " InPorts("
+             << GetNodeInPortsSize() << ") OutPorts(" << GetNodeOutPortsSize() << ")" << endl;
+}
+
+void GraphBase::ComputingNode::SetMacroDatas( GraphBase::Graph * aGraph ,
+                                              GraphBase::Graph * aGraphOfMacroGraph ) {
+  cdebug_in << "GraphBase::ComputingNode::SetMacroDatas fill inputs of MacroNode" << endl;
+  int i ;
+  for ( i = 0 ; i < aGraph->GetNodeInPortsSize() ; i++ ) {
+    const GraphBase::InPort * anInPort = aGraph->GetNodeInPort( i ) ;
+    GraphBase::OutPort * anOutPort = aGraph->GetChangeNodeInDataNodePort(i) ;
+    cdebug << "                 " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+           << " " << anOutPort->Kind() << " " << anOutPort->PortStatus() << endl ;
+    if ( anOutPort->IsDataConnected() ) {
+//JR 30.03.2005      aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , *(anOutPort->Value()) ) ;
+      aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , anOutPort->Value() ) ;
+      anOutPort->PortStatus( ExternConnected ) ;
+    }
+  }
+  cdebug_out << "GraphBase::ComputingNode::SetMacroDatas" << endl;
+}
+
+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 ,
-                                                const char * InputParameterType ) {
+                                                         const char * InputParameterType ,
+                                                         const SUPERV::KindOfPort aKindOfPort ,
+                                                         int index ) {
+  cdebug << "AddInPort " << Name() << " ConnectedInPortsNumber " << ConnectedInPortsNumber() << endl ;
+// JR 12.01.2005 : InitLoop and DoLoop are reserved parameter names in LoopNodes :
+  if ( IsLoopNode() && ( strcmp( InputParameterName , "InitLoop" ) == 0 ||
+                         strcmp( InputParameterName , "DoLoop" ) == 0 ) ) {
+    return NULL ;
+  }
   return GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
                                             Kind() ,
                                             InputParameterName ,
                                             InputParameterType ,
+                                            aKindOfPort ,
+                                            index ,
                                             _Graph_prof_debug , _Graph_fdebug ) ;
 }
 GraphBase::OutPort * GraphBase::ComputingNode::AddOutPort( const char * OutputParameterName ,
-                                                  const char * OutputParameterType ) {
+                                                           const char * OutputParameterType ,
+                                                           const SUPERV::KindOfPort aKindOfPort ,
+                                                           int index ) {
+  cdebug << "AddOutPort " << Name() << " ConnectedInPortsNumber " << ConnectedInPortsNumber() << endl ;
   return GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() ,
                                              Kind() ,
                                              OutputParameterName ,
                                              OutputParameterType ,
+                                             aKindOfPort ,
+                                             index ,
                                              _Graph_prof_debug , _Graph_fdebug ) ;
 }
 
-void GraphBase::ComputingNode::AddLink( GraphBase::ComputingNode * ToNode ) {
-  int index = GetLinkedNodeIndex( ToNode->Name() ) ;
-  if ( index < 0 ) {
-    cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name()
-           << " ) new LinkedNode " << endl ;
-    _LinkedNodes.resize( _LinkedNodesSize+1 ) ;
-    _LinkedInPortsNumber.resize( _LinkedNodesSize+1 ) ;
-    _LinkedNodes[ _LinkedNodesSize ] = ToNode ;
-    _LinkedInPortsNumber[ _LinkedNodesSize ] = 1 ;
-    SetLinkedNodeIndex( ToNode->Name() , _LinkedNodesSize ) ;
-    index = _LinkedNodesSize ;
-    _LinkedNodesSize++ ;
+void GraphBase::ComputingNode::DelInDataStreamPort( const char * InputParameterName ) {
+  GraphBase::PortsOfNode::DelInPort( InputParameterName ) ;
+}
+void GraphBase::ComputingNode::DelOutDataStreamPort( const char * OutputParameterName ) {
+  GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ;
+}
+
+GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( const char * InputParameterName ,
+                                                                             const SALOME_ModuleCatalog::DataStreamType InputParameterType ,
+                                                                             const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
+                                                                             const SUPERV::KindOfPort aKindOfPort ,
+                                                                             int index ) {
+//  IncrDataStreamInPorts() ;
+  GraphBase::InDataStreamPort * aDataStreamPort ;
+  aDataStreamPort = (GraphBase::InDataStreamPort * ) GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
+                                                                                        Kind() ,
+                                                                                        InputParameterName ,
+                                                                                        DataStreamTypeToString( InputParameterType ).c_str() ,
+                                                                                        aKindOfPort ,
+                                                                                        index ,
+                                                                                        _Graph_prof_debug ,
+                                                                                        _Graph_fdebug ) ;
+  aDataStreamPort->Dependency( aDependency ) ;
+  if ( aDependency == SALOME_ModuleCatalog::DATASTREAM_TEMPORAL ) {
+    aDataStreamPort->SetParams( SUPERV::TI , SUPERV::L1 , SUPERV::EXTRANULL ) ;
   }
-  else {
-    cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name()
-           << " ) old LinkedNode " << _LinkedNodes[index ]->Name() << endl ;
-    _LinkedInPortsNumber[ index ] += 1 ;
-  }
-  cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name()
-         << " ) LinkedNodesSize " << _LinkedNodesSize << " [ " << index
-         << " ] _LinkedInPortsNumber " << _LinkedInPortsNumber[ index ]
-         << " ConnectedInPortsNumber " << ToNode->ConnectedInPortsNumber()
-         << " + 1 Service " << ServiceName() << endl ;
-  ToNode->IncrConnectedInPortsNumber() ;
+  return aDataStreamPort ;
+}
+GraphBase::OutDataStreamPort * GraphBase::ComputingNode::AddOutDataStreamPort( const char * OutputParameterName ,
+                                                                               const SALOME_ModuleCatalog::DataStreamType OutputParameterType ,
+                                                                               const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
+                                                                               const SUPERV::KindOfPort aKindOfPort ,
+                                                                               int index ) {
+//  IncrDataStreamOutPorts() ;
+  GraphBase::OutDataStreamPort * aDataStreamPort ;
+  aDataStreamPort = (GraphBase::OutDataStreamPort * ) GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() ,
+                                                                                          Kind() ,
+                                                                                          OutputParameterName ,
+                                                                                          DataStreamTypeToString( OutputParameterType ).c_str() ,
+                                                                                          aKindOfPort ,
+                                                                                          index ,
+                                                                                          _Graph_prof_debug ,
+                                                                                          _Graph_fdebug ) ;
+  aDataStreamPort->Dependency( aDependency ) ;
+  return aDataStreamPort ;
 }
 
-void GraphBase::ComputingNode::RemoveLink( GraphBase::ComputingNode * ToNode ) {
-  int index = GetLinkedNodeIndex( ToNode->Name() ) ;
-  if ( index >= 0 ) {
-    cdebug << "GraphBase::ComputingNode::RemoveLink( to " << ToNode->Name() << " from "
-           << Name() << " index : " << index << " ConnectedInPortsNumber "
-           << ToNode->ConnectedInPortsNumber() - 1 << " LinkedInPortsNumber "
-           << _LinkedInPortsNumber[ index ] << " - 1" << endl ;
-    ToNode->DecrConnectedInPortsNumber() ;
-    _LinkedInPortsNumber[ index ] -= 1 ;
-    if ( _LinkedInPortsNumber[ index ] == 0 ) {
-      _LinkedNodesSize-- ;
-      cdebug << "GraphBase::ComputingNode::RemoveLink new LinkedNodesSize "
-             << _LinkedNodesSize << " " << ToNode->Name() << " removed from "
-             << " linkednodes of " << Name() << endl ;
-      int i ;
-      for ( i = index ; i < _LinkedNodesSize ; i++ ) {
-        _LinkedNodes[ i ] = _LinkedNodes[ i+1 ] ;
-        _LinkedInPortsNumber[ i ] =  _LinkedInPortsNumber[ i+1 ] ;
-        SetLinkedNodeIndex( _LinkedNodes[ i ]->Name() , i ) ;
+
+bool GraphBase::ComputingNode::CheckLoop( GraphBase::LoopNode * aLoopNode ,
+                                          GraphBase::EndOfLoopNode * anEndLoopNode ,
+                                          string & anErrorMessage ) const {
+  cdebug_in << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , "
+            << anEndLoopNode->Name() << ") LinkedNodesSize "
+            << LinkedNodesSize() << endl;
+
+  int i ;
+  if ( LinkedNodesSize() == 0 && !IsDataFlowNode() && !IsDataStreamNode() ) {
+    anErrorMessage = anErrorMessage + string( "The node " ) + string( Name() ) +
+                     string( " has no linked Nodes. Loop not valid\n" ) ;
+    cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name()
+               << " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
+               << LinkedNodesSize() << " ERROR false" << endl;
+    return false ;
+  }
+// We check that all nodes linked to that node go to the end of LoopNode :
+  for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
+    GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
+    cdebug << i << ". " << Name() << " Linked to " << aNode->Name() << endl ;
+    if ( !aNode->IsEndLoopNode() || aNode != anEndLoopNode ) {
+      if ( !aNode->CheckLoop( aLoopNode , anEndLoopNode , anErrorMessage) ) {
+        cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name()
+                   << " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
+                   << LinkedNodesSize() << " ERROR false" << endl;
+        return false ;
       }
-      DelLinkedNodeIndex( ToNode->Name() ) ;
-      _LinkedNodes.resize( _LinkedNodesSize+1 ) ;
-      _LinkedInPortsNumber.resize( _LinkedNodesSize+1 ) ;
     }
   }
-  else {
-    cdebug << " Error index " << index << endl ;
+  cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , "
+             << anEndLoopNode->Name() << ") LinkedNodesSize "
+             << LinkedNodesSize() << " true" << endl;
+  return true ;
+}
+
+bool GraphBase::ComputingNode::CheckEndLoop(GraphBase::LoopNode * aLoopNode ,
+                                            GraphBase::EndOfLoopNode * anEndLoopNode ,
+                                            string & anErrorMessage ) const {
+  cdebug_in << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , "
+            << anEndLoopNode->Name() << ") LinkedFromNodesSize "
+            << LinkedFromNodesSize() << endl;
+
+  int i ;
+  if ( LinkedFromNodesSize() == 0 ) {
+    anErrorMessage = anErrorMessage + string( "The node " ) + string( Name() ) +
+                     string( " has no reversed linked Nodes. Loop not valid\n" ) ;
+    cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name()
+               << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
+               << LinkedFromNodesSize() << " ERROR false" << endl;
+    return false ;
+  }
+// We have to check that all nodes linked from that node go to the beginning of LoopNode : 
+  for ( i = 0 ; i < LinkedFromNodesSize() ; i++ ) {
+    GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedFromNodes( i ) ;
+    cdebug << i << ". " << Name() << " Linked from " << aNode->Name() << endl ;
+    if ( !aNode->IsLoopNode() || aNode != aLoopNode ) {
+      if ( !aNode->CheckEndLoop( aLoopNode , anEndLoopNode , anErrorMessage ) ) {
+        cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name()
+                   << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
+                   << LinkedFromNodesSize() << " ERROR false" << endl;
+        return false ;
+      }
+    }
+  }
+  cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , "
+             << anEndLoopNode->Name() << ") LinkedFromNodesSize "
+             << LinkedFromNodesSize() << " true" << endl;
+  return true ;
+}
+
+bool GraphBase::ComputingNode::InitBranchOfSwitchDone( bool AllInit ,
+                                                       GraphBase::EndOfSwitchNode * anEndSwitchNode ,
+                                                       string & anErrorMessage ) {
+  bool RetVal = true ;
+  bool sts = BranchOfSwitchDone( false ) ;
+  if ( !sts && !AllInit && anEndSwitchNode != this ) {
+// Common Node in branchs :
+    anErrorMessage = anErrorMessage + string( "Common Node between some SwitchBranches : " ) +
+                     string( Name() ) + string("\n" ) ;
+    cdebug << Name() << "->ComputingNode::InitBranchOfSwitchDone ERROR false"
+           << endl ;
+    RetVal = false ;
+  }
+  int i ;
+  if ( !IsGOTONode() && anEndSwitchNode != this ) {
+    for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
+      GraphBase::ComputingNode * aNode ;
+      aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
+      if ( !aNode->InitBranchOfSwitchDone( AllInit , anEndSwitchNode , anErrorMessage ) ) {
+        RetVal = false ;
+      }
+    }
   }
+  return RetVal ;
 }
 
-void GraphBase::ComputingNode::ReNameLink( const char* OldNodeName ,
-                                  const char* NewNodeName ) {
-  cdebug_in << "GraphBase::ComputingNode::ReNameLink (" << OldNodeName << " , "
-            << NewNodeName << ")" << endl;
-  int index = GetLinkedNodeIndex( OldNodeName ) ;
-  if ( index >= 0 ) {
-    _MapOfLinkedNodes.erase( OldNodeName ) ;
-    SetLinkedNodeIndex( NewNodeName , index ) ;
+bool GraphBase::ComputingNode::CheckSwitch( GraphBase::EndOfSwitchNode * anEndSwitchNode ,
+                                            string & anErrorMessage ) {
+  bool RetVal = true ;
+  cdebug_in << Name() << "->ComputingNode::CheckSwitch( "
+            << anEndSwitchNode->Name() << " ) " << Kind() << endl;
+  if ( anEndSwitchNode == this ) {
+  }
+// if it is a SwitchNode, continue the check at the corresponding EndSwitchNode
+  else if ( IsSwitchNode() ) {
+    GraphBase::EndOfSwitchNode * anOtherEndSwitchNode ;
+    anOtherEndSwitchNode = (GraphBase::EndOfSwitchNode * ) ((GraphBase::SwitchNode * ) this)->CoupledNode() ;
+    cdebug << Name() << "->ComputingNode::CheckSwitch will Check "
+           << anOtherEndSwitchNode->Name() << endl ;
+    if ( !anOtherEndSwitchNode->CheckSwitch( anEndSwitchNode , anErrorMessage ) ) {
+      cdebug_out << Name() << "->ComputingNode::CheckSwitch "
+                 << anOtherEndSwitchNode->Name() << " ERROR false" << endl;
+      RetVal = false ;
+    }
+  }
+  else {
+    int i ;
+    for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+      GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ;
+      if ( !anOutPort->IsDataStream() ) {
+        int j ;
+        for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
+          GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ;
+          if ( !anInPort->IsDataStream() ) {
+            GraphBase::ComputingNode * aNode ;
+            aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
+            GraphBase::LoopNode * aLoopNode = NULL ;
+            GraphBase::EndOfLoopNode * aEndLoopNode = NULL ;
+            if ( IsLoopNode() ) {
+              aEndLoopNode = (GraphBase::EndOfLoopNode * ) ((GraphBase::LoopNode * ) this)->CoupledNode() ;
+              cdebug << Name() << "->ComputingNode::CheckSwitch LoopNode " << Name() << " coupled to "
+                     << aEndLoopNode << " " << aEndLoopNode->Name() << " aNode " << aNode << endl ;
+            }
+            else if ( IsEndLoopNode() ) {
+              aLoopNode = (GraphBase::LoopNode * ) ((GraphBase::EndOfLoopNode * ) this)->CoupledNode() ;
+              cdebug << Name() << "->ComputingNode::CheckSwitch EndLoopNode " << Name()
+                     << " coupled to "
+                     << aLoopNode << " " << aLoopNode->Name() << " aNode " << aNode << endl ;
+            }
+            if ( aNode == NULL ) {
+              cdebug << Name() << "->ComputingNode::CheckSwitch ignore "
+                     << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
+            }
+            else if ( aNode == anEndSwitchNode ) {
+              if ( !((GraphBase::EndOfSwitchNode * ) aNode)->DecrEndSwitchInPortLinked( anInPort ,
+                                                                                        anErrorMessage ) ) {
+                RetVal = false ;
+             }
+            }
+            else if ( aNode->BranchOfSwitchDone() ) {
+              cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
+                     << anInPort->NodeName() << "( " << anInPort->PortName() << " ) : already checked"
+                     << endl ;
+            }
+            else if ( IsLoopNode() && aNode == aEndLoopNode ) {
+              cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
+                     << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
+            }
+            else if ( IsEndLoopNode() && aNode == aLoopNode ) {
+              cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
+                     << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
+            }
+            else if ( aNode->IsGOTONode() ) {
+              cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
+                     << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
+              anEndSwitchNode->SetSwitchWithGOTO() ;
+            }
+            else {
+              cdebug << Name() << "->ComputingNode::CheckSwitch will Check "
+                     << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
+              if ( !aNode->CheckSwitch( anEndSwitchNode , anErrorMessage ) ) {
+                cdebug_out << Name() << "->ComputingNode::CheckSwitch "
+                         << anEndSwitchNode->Name() << " ERROR false" << endl;
+                RetVal =  false ;
+             }
+//            aNode->BranchOfSwitchDone( true ) ;
+            }
+          }
+        }
+      }
+    }
+  }
+  if ( RetVal ) {
+    BranchOfSwitchDone( true ) ;
   }
-  cdebug_out << "GraphBase::ComputingNode::ReNameLink" << endl ;
+  cdebug_out << Name() << "->ComputingNode::CheckSwitch "
+             << anEndSwitchNode->Name() << " RetVal " << RetVal << endl;
+  return RetVal ;
 }
 
 #include <sys/time.h>
@@ -507,6 +1110,7 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
                                         const ListOfFuncName FuncNames ,
                                         const ListOfPythonFunctions PythonFunctions ,
                                         int XCoordinate , int YCoordinate ) const {
+  cdebug_in << "SaveXML Node " << Name() << endl ;
   QDomElement node = Graph.createElement( "node" ) ;
   info.appendChild( node ) ;
   QDomElement componentname = Graph.createElement( "component-name" ) ;
@@ -549,14 +1153,50 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
 //  f << Tabs << "<kind>" << (int ) Kind() << "</kind>" << endl ;
   QDomElement kind = Graph.createElement( "kind" ) ;
   QString aKind ;
-  aKind = aKind.setNum( Kind() ) ;
+
+  // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph
+// JR : the bug was at line 566 : && HasDataStream() != 0 was missing
+  if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) {
+    aKind = aKind.setNum( SUPERV::DataFlowGraph ) ;
+  }
+  else {
+    aKind = aKind.setNum( Kind() ) ;
+  }
   aField = Graph.createTextNode( aKind ) ;
   node.appendChild( kind ) ;
   kind.appendChild( aField ) ;
 
+  if ( IsDataStreamNode() && HasDataStream() != 0 ) {
+    CORBA::Long Timeout ;
+    SUPERV::KindOfDataStreamTrace DataStreamTrace ;
+    CORBA::Double DeltaTime ;
+    ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
+
+    QDomElement timeout = Graph.createElement("streamgraph-timeout") ;
+    QString aTimeout ;
+    aTimeout = aTimeout.setNum( Timeout ) ;
+    aField = Graph.createTextNode( aTimeout ) ;
+    node.appendChild( timeout ) ;
+    timeout.appendChild( aField ) ;
+
+    QDomElement datastreamtrace = Graph.createElement("streamgraph-datastreamtrace") ;
+    QString aDataStreamTrace ;
+    aDataStreamTrace = aDataStreamTrace.setNum( DataStreamTrace ) ;
+    aField = Graph.createTextNode( aDataStreamTrace ) ;
+    node.appendChild( datastreamtrace ) ;
+    datastreamtrace.appendChild( aField ) ;
+
+    QDomElement deltatime = Graph.createElement("streamgraph-deltatime") ;
+    QString aDeltaTime ;
+    aDeltaTime = aDeltaTime.setNum( DeltaTime ) ;
+    aField = Graph.createTextNode( aDeltaTime ) ;
+    node.appendChild( deltatime ) ;
+    deltatime.appendChild( aField ) ;
+  }
+
   QDomElement couplednode = Graph.createElement("coupled-node") ;
   if ( IsGOTONode() || IsLoopNode() || IsEndLoopNode() ||
-       IsSwitchNode() || IsEndSwitchNode() ) {
+       IsSwitchNode() || IsEndSwitchNode() || IsMacroNode() ) {
 //    f << Tabs << "<coupled-node>" << CoupledNode << "</coupled-node>"
 //      << endl ;
     aField = Graph.createTextNode( CoupledNode ) ;
@@ -583,97 +1223,177 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
   service.appendChild(servicename) ;
   servicename.appendChild( aField ) ;
 
-//  f << Tabs << "     <inParameter-list>" << endl ;
+  cdebug << "SaveXML " << Name() << " In(" << ServiceInParameter().length()
+         << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
   QDomElement inParameterlist = Graph.createElement("inParameter-list") ;
   service.appendChild(inParameterlist) ;
   unsigned int i;
+  GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) this ;
   for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
-//    f << Tabs << "           <inParameter>" << endl ;
-    QDomElement inParameter = Graph.createElement("inParameter") ;
-    inParameterlist.appendChild(inParameter) ;
-//    f << Tabs << "                   <inParameter-type>"
-//      << ServiceInParameter()[i].Parametertype << "</inParameter-type>"
-//      << endl ;
-    QDomElement inParametertype = Graph.createElement("inParameter-type") ;
-    // mpv: Linux 8.0 compiler compatibility
-//    aField = Graph.createTextNode( (char *)ServiceInParameter()[i].Parametertype ) ;
-    aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametertype) ) ;
-    inParameter.appendChild(inParametertype) ;
-    inParametertype.appendChild( aField ) ;
-//    f << Tabs << "                   <inParameter-name>"
-//      << ServiceInParameter()[i].Parametername << "</inParameter-name>"
-//      << endl ;
-    QDomElement inParametername = Graph.createElement("inParameter-name") ;
-    // mpv: Linux 8.0 compiler compatibility
-//    aField = Graph.createTextNode( (char *) ServiceInParameter()[i].Parametername ) ;
-    aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
-    inParameter.appendChild(inParametername) ;
-    inParametername.appendChild( aField ) ;
-//    f << Tabs << "           </inParameter>" << endl ;
-  }
-//  f << Tabs << "     </inParameter-list>" << endl ;
-//  f << Tabs << "     <outParameter-list>" << endl ;
+    const GraphBase::InPort * anInPort ;
+    anInPort = aNode->GetInPort( ServiceInParameter()[i].Parametername ) ;
+    if ( !anInPort->IsDataStream() ) {
+      cdebug << "SaveXML " << i << ". " << ServiceInParameter()[i].Parametername
+             << " InParameterPort " << anInPort->Kind() << endl ;
+      QDomElement inParameter = Graph.createElement("inParameter") ;
+      inParameterlist.appendChild(inParameter) ;
+      QDomElement inParametertype = Graph.createElement("inParameter-type") ;
+      if ( strlen( ServiceInParameter()[i].Parametertype ) ) {
+        aField = Graph.createTextNode( strdup( ServiceInParameter()[i].Parametertype ) ) ;
+      }
+      else {
+        aField = Graph.createTextNode( "?" ) ;
+      }
+      inParameter.appendChild(inParametertype) ;
+      inParametertype.appendChild( aField ) ;
+      QDomElement inParametername = Graph.createElement("inParameter-name") ;
+      if ( strlen( ServiceInParameter()[i].Parametername ) ) {
+        aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
+      }
+      else {
+        aField = Graph.createTextNode( "?" ) ;
+      }
+      inParameter.appendChild(inParametername) ;
+      inParametername.appendChild( aField ) ;
+    }
+  }
   QDomElement outParameterlist = Graph.createElement("outParameter-list") ;
   service.appendChild(outParameterlist) ;
   for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) {
-//    f << Tabs << "           <outParameter>" << endl ;
-    QDomElement outParameter = Graph.createElement("outParameter") ;
-    outParameterlist.appendChild(outParameter) ;
-//    f << Tabs << "                   <outParameter-type>"
-//      << ServiceOutParameter()[i].Parametertype << "</outParameter-type>"
-//      << endl ;
-    QDomElement outParametertype = Graph.createElement("outParameter-type") ;
-    // mpv: Linux 8.0 compiler compatibility
-//    aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametertype ) ;
-    aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
-    outParameter.appendChild(outParametertype) ;
-    outParametertype.appendChild( aField ) ;
-//    f << Tabs << "                   <outParameter-name>"
-//      << ServiceOutParameter()[i].Parametername << "</outParameter-name>"
-//      << endl ;
-    QDomElement outParametername = Graph.createElement("outParameter-name") ;
-    // mpv: Linux 8.0 compiler compatibility
-//    aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametername ) ;
-    aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
-    outParameter.appendChild(outParametername) ;
-    outParametername.appendChild( aField ) ;
-//    f << Tabs << "           </outParameter>" << endl ;
-  }
-//  f << Tabs << "     </outParameter-list>" << endl ;
-//  f << Tabs << "</service>" << endl ;
-
-//  f << Tabs << "<Parameter-list>" << endl ;
-  QDomElement Parameterlist = Graph.createElement("Parameter-list") ;
-  node.appendChild( Parameterlist ) ;
-#if 0
-  if ( IsInLineNode() || IsGOTONode() ||
-       IsLoopNode() || IsEndLoopNode() ||
-       IsSwitchNode() || IsEndSwitchNode() ) {
-    unsigned int i;
-    for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
-      const InPort * anInPort = GetNodeInPort( i ) ;
-      if ( anInPort->IsBus() ) {
-        f << Tabs << " <inParameter>" << endl ;
-        f << Tabs << "         <inParameter-type>"
-          << anInPort->PortType() << "</inParameter-type>"
-          << endl ;
-        f << Tabs << "         <inParameter-name>"
-          << anInPort->PortName() << "</inParameter-name>"
-          << endl ;
-        f << Tabs << " </inParameter>" << endl ;
-        const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
-        f << Tabs << " <outParameter>" << endl ;
-        f << Tabs << "         <outParameter-type>"
-          << anOutPort->PortType() << "</outParameter-type>"
-          << endl ;
-        f << Tabs << "         <outParameter-name>"
-          << anOutPort->PortName() << "</outParameter-name>"
-          << endl ;
-        f << Tabs << " </outParameter>" << endl ;
+    const GraphBase::OutPort * anOutPort ;
+    anOutPort = aNode->GetOutPort( ServiceOutParameter()[i].Parametername ) ;
+    if ( !anOutPort->IsDataStream() ) {
+      cdebug << "SaveXML " << i << ". " << ServiceOutParameter()[i].Parametername
+             << " OutParameterPort " << anOutPort->Kind() << endl ;
+      QDomElement outParameter = Graph.createElement("outParameter") ;
+      outParameterlist.appendChild(outParameter) ;
+      QDomElement outParametertype = Graph.createElement("outParameter-type") ;
+      if ( strlen( ServiceOutParameter()[i].Parametertype ) ) {
+        aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
       }
+      else {
+        aField = Graph.createTextNode( "?" ) ;
+      }
+      outParameter.appendChild(outParametertype) ;
+      outParametertype.appendChild( aField ) ;
+      QDomElement outParametername = Graph.createElement("outParameter-name") ;
+      if ( strlen( ServiceOutParameter()[i].Parametername ) ) {
+        aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
+      }
+      else {
+        aField = Graph.createTextNode( "?" ) ;
+      }
+      outParameter.appendChild(outParametername) ;
+      outParametername.appendChild( aField ) ;
+    }
+  }
+
+  QDomElement DataStreamlist = Graph.createElement("DataStream-list") ;
+  node.appendChild( DataStreamlist ) ;
+  for ( i = 0 ; i < (unsigned int ) GetNodeInPortsSize() ; i++ ) {
+    const GraphBase::InPort * anInPort ;
+    anInPort = aNode->GetNodeInPort( i ) ;
+    if ( anInPort->IsDataStream() ) {
+      cdebug << "SaveXML " << i << " " << Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
+             << " InDataStreamPort " << anInPort->Kind() << endl ;
+      QDomElement inParameter = Graph.createElement("inParameter") ;
+      DataStreamlist.appendChild(inParameter) ;
+      QDomElement inParametertype = Graph.createElement("inParameter-type") ;
+      QString aType ;
+      aType = aType.setNum( StringToDataStreamType( anInPort->PortType() ) ) ;
+      cdebug << "SaveXML " << anInPort->PortType() << " --> " << StringToDataStreamType( anInPort->PortType() )
+             << " " << aType << endl ;
+      aField = Graph.createTextNode( aType ) ;
+      inParameter.appendChild(inParametertype) ;
+      inParametertype.appendChild( aField ) ;
+      QDomElement inParametername = Graph.createElement("inParameter-name") ;
+      if ( strlen( anInPort->PortName() ) ) {
+        aField = Graph.createTextNode( strdup(anInPort->PortName()) ) ;
+      }
+      else {
+        aField = Graph.createTextNode( "?" ) ;
+      }
+      inParameter.appendChild(inParametername) ;
+      inParametername.appendChild( aField ) ;
+      cdebug << "SaveXML " << anInPort->PortName() << endl ;
+      QDomElement inParameterdependency = Graph.createElement("inParameter-dependency") ;
+      QString aDependency ;
+      aDependency = aDependency.setNum( anInPort->Dependency() ) ;
+      aField = Graph.createTextNode( aDependency ) ;
+      inParameter.appendChild(inParameterdependency) ;
+      inParameterdependency.appendChild( aField ) ;
+      cdebug << "SaveXML Dependency " << anInPort->Dependency() << endl ;
+      SUPERV::KindOfSchema        aKindOfSchema ;
+      SUPERV::KindOfInterpolation aKindOfInterpolation ;
+      SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
+      ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
+      QDomElement inParameterKindOfSchema = Graph.createElement("inParameter-schema") ;
+      QString aSchema ;
+      aSchema = aSchema.setNum( aKindOfSchema ) ;
+      aField = Graph.createTextNode( aSchema ) ;
+      inParameter.appendChild(inParameterKindOfSchema) ;
+      inParameterKindOfSchema.appendChild( aField ) ;
+      cdebug << "SaveXML aKindOfSchema " << aKindOfSchema << endl ;
+      QDomElement inParameterKindOfInterpolation = Graph.createElement("inParameter-interpolation") ;
+      QString anInterpolation ;
+      anInterpolation = anInterpolation.setNum( aKindOfInterpolation ) ;
+      aField = Graph.createTextNode( anInterpolation ) ;
+      inParameter.appendChild(inParameterKindOfInterpolation) ;
+      inParameterKindOfInterpolation.appendChild( aField ) ;
+      cdebug << "SaveXML aKindOfInterpolation " << aKindOfInterpolation << endl ;
+      QDomElement inParameterKindOfExtrapolation = Graph.createElement("inParameter-extrapolation") ;
+      QString anExtrapolation ;
+      anExtrapolation = anExtrapolation.setNum( aKindOfExtrapolation ) ;
+      aField = Graph.createTextNode( anExtrapolation ) ;
+      inParameter.appendChild(inParameterKindOfExtrapolation) ;
+      inParameterKindOfExtrapolation.appendChild( aField ) ;
+      cdebug << "SaveXML aKindOfExtrapolation " << aKindOfExtrapolation << endl ;
+    }
+  }
+  for ( i = 0 ; i < (unsigned int ) GetNodeOutPortsSize() ; i++ ) {
+    const GraphBase::OutPort * anOutPort ;
+    anOutPort = aNode->GetNodeOutPort( i ) ;
+    if ( anOutPort->IsDataStream() ) {
+      cdebug << "SaveXML " << i << " " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+             << " OutDataStreamPort " << anOutPort->Kind() << endl ;
+      QDomElement outParameter = Graph.createElement("outParameter") ;
+      DataStreamlist.appendChild(outParameter) ;
+      QDomElement outParametertype = Graph.createElement("outParameter-type") ;
+      QString aType ;
+      aType = aType.setNum( StringToDataStreamType( anOutPort->PortType() ) ) ;
+      cdebug << "SaveXML " << anOutPort->PortType() << " --> " << StringToDataStreamType( anOutPort->PortType() )
+             << " " << aType << endl ;
+      aField = Graph.createTextNode( aType ) ;
+      outParameter.appendChild(outParametertype) ;
+      outParametertype.appendChild( aField ) ;
+      QDomElement outParametername = Graph.createElement("outParameter-name") ;
+      if ( strlen( anOutPort->PortName() ) ) {
+        aField = Graph.createTextNode( strdup(anOutPort->PortName() ) ) ;
+      }
+      else {
+        aField = Graph.createTextNode( "?" ) ;
+      }
+      outParameter.appendChild(outParametername) ;
+      outParametername.appendChild( aField ) ;
+      cdebug << "SaveXML " << anOutPort->PortName() << endl ;
+      QDomElement outParameterdependency = Graph.createElement("outParameter-dependency") ;
+      QString aDependency ;
+      aDependency = aDependency.setNum( anOutPort->Dependency() )  ;
+      aField = Graph.createTextNode( aDependency ) ;
+      outParameter.appendChild(outParameterdependency) ;
+      outParameterdependency.appendChild( aField ) ;
+      cdebug << "SaveXML Dependency " << anOutPort->Dependency() << endl ;
+      long aNumberOfValues ;
+      aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
+      QDomElement outParameterNumberOfValues = Graph.createElement("outParameter-values") ;
+      QString aValues ;
+      aValues = aValues.setNum( aNumberOfValues ) ;
+      aField = Graph.createTextNode( aValues ) ;
+      outParameter.appendChild(outParameterNumberOfValues) ;
+      outParameterNumberOfValues.appendChild( aField ) ;
+      cdebug << "SaveXML NumberOfValues " << ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() << endl ;
     }
   }
-#endif
 //  f << Tabs << "</Parameter-list>" << endl ;    
 
 //  f << Tabs << "<PyFunction-list>" << endl ;
@@ -684,55 +1404,44 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
     QDomElement PyFunction = Graph.createElement("PyFunction") ;
     PyFunctionlist.appendChild( PyFunction ) ;
     int j ;
-    for ( j = 0 ; j < (*PythonFunctions[i]).length() ; j++ ) {
-      if ( j == 0 ) {
-//        if ( i == 0 ) {
-//          f << Tabs << "             <FuncName>" << FuncNames[i].c_str()
-//            << "</FuncName>" << endl ;
-          QDomElement FuncName = Graph.createElement("FuncName") ;
-          if ( strlen( FuncNames[i].c_str() ) ) {
-            aField = Graph.createTextNode( FuncNames[i].c_str() ) ;
-         }
-          else {
-            aField = Graph.createTextNode( "?" ) ;
-         }
-          PyFunction.appendChild( FuncName ) ;
-          FuncName.appendChild( aField ) ;
-//     }
-//        else if ( i == 1 ) {
-//          f << Tabs << "             <FuncName>" << FuncNames[i].c_str()
-//            << "</FuncName>" << endl ;
-//     }
-//        else if ( i == 2 ) {
-//          f << Tabs << "             <FuncName>" << FuncNames[i].c_str()
-//            << "</FuncName>" << endl ;
-//     }
-      }
-//      f << Tabs << "         <PyFunc>" << (*PythonFunctions[i])[j]
-//        << "</PyFunc>" << endl ;
-      QDomElement PyFunc = Graph.createElement("PyFunc") ;
-      QDomCDATASection aCDATA ;
+    QDomElement FuncName = Graph.createElement("FuncName") ;
+    if ( strlen( FuncNames[i].c_str() ) ) {
+      aField = Graph.createTextNode( FuncNames[i].c_str() ) ;
+    }
+    else {
+      aField = Graph.createTextNode( "?" ) ;
+    }
+    PyFunction.appendChild( FuncName ) ;
+    FuncName.appendChild( aField ) ;
+    if ( (*PythonFunctions[i]).length() ) {
+      for ( j = 0 ; j < (int ) (*PythonFunctions[i]).length() ; j++ ) {
+        QDomElement PyFunc = Graph.createElement("PyFunc") ;
+        QDomCDATASection aCDATA ;
       // mpv: Linux 8.0 compiler compatibility
-//       char * aCDATAChar = (char *) (*PythonFunctions[i])[j] ;
-      char * aCDATAChar = strdup ((*PythonFunctions[i])[j]) ;
-      int i ;
-      for ( i = 0 ; i < strlen( aCDATAChar ) ; i++ ) {
-        if ( aCDATAChar[ i ] != ' ' ) {
-          break ;
-       }
-      }
-      if ( i == strlen( aCDATAChar ) ) {
-        aCDATA = Graph.createCDATASection( "?" ) ;
-      }
-      else {
-        aCDATA = Graph.createCDATASection( aCDATAChar ) ;
+        char * aCDATAChar = strdup ((*PythonFunctions[i])[j]) ;
+        int i ;
+        for ( i = 0 ; i < (int ) strlen( aCDATAChar ) ; i++ ) {
+          if ( aCDATAChar[ i ] != ' ' ) {
+            break ;
+         }
+        }
+        if ( i == (int ) strlen( aCDATAChar ) ) {
+          aCDATA = Graph.createCDATASection( "?" ) ;
+        }
+        else {
+          aCDATA = Graph.createCDATASection( aCDATAChar ) ;
+        }
+        PyFunction.appendChild( PyFunc ) ;
+        PyFunc.appendChild( aCDATA ) ;
       }
+    }
+    else {
+      QDomElement PyFunc = Graph.createElement("PyFunc") ;
+      QDomCDATASection aCDATA = Graph.createCDATASection( "?" ) ;
       PyFunction.appendChild( PyFunc ) ;
       PyFunc.appendChild( aCDATA ) ;
     }
-//    f << Tabs << "   </PyFunction>" << endl ;
   }
-//  f << Tabs << "</PyFunction-list>" << endl ;
 
 //  f << Tabs << "<creation-date>" << FirstCreation() << "</creation-date>"
 //    << endl ;
@@ -803,6 +1512,7 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
   aField = Graph.createTextNode( aYCoordinate ) ;
   node.appendChild( yposition ) ;
   yposition.appendChild( aField ) ;
+  cdebug_out << "SaveXML Node " << Name() << endl ;
   return true ;
 }
 
@@ -814,169 +1524,445 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
                                        const ListOfFuncName FuncNames ,
                                        const ListOfPythonFunctions PythonFunctions ,
                                        int XCoordinate , int YCoordinate ) const {
-  if ( IsDataFlowNode() ) {
-    f << Name() << " = Graph( '" << Name() << "' )" << endl ;
+  cdebug_in << "ComputingNode::SavePY " << Name() << endl ;
+  // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph
+// JR : the bug was at line 927 : && HasDataStream() != 0 was missing
+  if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) {
+    f << "    " << Name() << " = Graph( '" << Name() << "' )" << endl ;
+     if ( GraphMacroLevel() ) {
+      f << "    " << Name() << ".SetCoupled( '"
+        << ((GraphBase::GOTONode * ) this)->CoupledNodeName() << "' )" << endl ;
+    }
+  }
+  else if ( IsDataStreamNode() && HasDataStream() != 0 ) {
+    f << "    " << Name() << " = StreamGraph( '" << Name() << "' )" << endl ;
+    CORBA::Long Timeout ;
+    SUPERV::KindOfDataStreamTrace DataStreamTrace ;
+    CORBA::Double DeltaTime ;
+    ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
+    f << "    " << aGraphName << ".SetStreamParams( " << Timeout << " , SUPERV." << DataStreamTrace
+      << " , " << DeltaTime << " )" << endl ;
   }
   else if ( IsComputingNode() ) {
     int i ;
-    f << Name() << "_ServiceinParameter = []" << endl ;
-    for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
-      f << Name() << "_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
+    f << "    " << Name() << "_ServiceinParameter = []" << endl ;
+    for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
+      f << "    " << Name() << "_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
         << ServiceInParameter()[i].Parametertype << "' , '"
         << ServiceInParameter()[i].Parametername << "' ) )" << endl ;
     }
-    f << Name() << "_ServiceoutParameter = []" << endl ;
-    for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) {
-      f << Name() << "_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
+    f << "    " << Name() << "_ServiceoutParameter = []" << endl ;
+    for ( i = 0 ; i < (int ) ServiceOutParameter().length() ; i++ ) {
+      f << "    " << Name() << "_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
         << ServiceOutParameter()[i].Parametertype << "' , '"
         << ServiceOutParameter()[i].Parametername << "' ) )" << endl ;
     }
-    f << Name() << "_Service = SALOME_ModuleCatalog.Service( '" << ServiceName()
-      << "' , " << Name() << "_ServiceinParameter" << " , "
-      << Name() << "_ServiceoutParameter" << " , 0 )" << endl ;
-    f << Name() << " = " << aGraphName << ".CNode( " << Name() << "_Service" << " )"
+    f << "    " << Name() << "_ServiceinStreamParameter = []" << endl ;
+    for ( i = 0 ; i < (int ) ServiceInStreamParameter().length() ; i++ ) {
+      f << "    " << Name() << "_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog."
+        << ServiceInStreamParameter()[i].Parametertype << " , '"
+        << ServiceInStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog."
+        << ServiceInStreamParameter()[i].Parameterdependency << " ) )" << endl ;
+    }
+    f << "    " << Name() << "_ServiceoutStreamParameter = []" << endl ;
+    for ( i = 0 ; i < (int ) ServiceOutStreamParameter().length() ; i++ ) {
+      f << "    " << Name() << "_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog."
+        << ServiceOutStreamParameter()[i].Parametertype << " , '"
+        << ServiceOutStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog."
+        << ServiceOutStreamParameter()[i].Parameterdependency << " ) )" << endl ;
+    }
+    f << "    " << Name() << "_Service = SALOME_ModuleCatalog.Service( '" << ServiceName()
+      << "' , " << Name() << "_ServiceinParameter"
+      << " , " << Name() << "_ServiceoutParameter"
+      << " , " << Name() << "_ServiceinStreamParameter"
+      << " , " << Name() << "_ServiceoutStreamParameter"
+      << " , 0 , 0 )" << endl ;
+    f << "    " << Name() << " = " << aGraphName << ".CNode( " << Name() << "_Service" << " )"
       << endl ;
   }
   else if ( IsFactoryNode() ) {
-    f << Name() << " = " << aGraphName << ".FNode( '" << ComponentName
+    f << "    " << Name() << " = " << aGraphName << ".FNode( '" << ComponentName
       << "' , '" << InterfaceName << "' , '" << ServiceName() << "' )"
       << endl ;
   }
+  else if ( IsEndLoopNode() || IsEndSwitchNode() ) {
+// It is done with LoopNode or SwitchNode with CoupledNode()
+  }
   else {
-    f << "Py" << Name() << " = []" << endl ;
+    if ( !IsMacroNode() ) {
+      f << "    " << "Py" << Name() << " = []" << endl ;
+    }
     int i ;
     SUPERV::ListOfStrings aPyFunc ;
     if ( PythonFunctions.size() ) {
       aPyFunc = *PythonFunctions[0] ;
-      for ( i = 0 ; i < aPyFunc.length() ; i++ ) {
-        f << "Py" << Name() << ".append( '" << aPyFunc[i] << "' )" << endl ;
+      for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
+        f << "    " << "Py" << Name() << ".append( '" << aPyFunc[i] << "' )" << endl ;
       }
     }
     if ( IsInLineNode() ) {
-      f << Name() << " = " << aGraphName << ".INode( '" << FuncNames[0].c_str() << "' , Py"
+      f << "    " << Name() << " = " << aGraphName << ".INode( '" << FuncNames[0].c_str() << "' , Py"
         << Name() << " )" << endl ;
     }
     else if ( IsGOTONode() ) {
       if ( aCoupledNode ) {
-        f << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
+        f << "    " << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
           << Name() << " , '" << aCoupledNode->Name() << "' )" << endl ;
       }
       else {
-        f << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
+        f << "    " << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
           << Name() << " , '' )" << endl ;
       }
     }
+    else if ( IsMacroNode() ) {
+      if ( aCoupledNode ) {
+        f << "    " << aCoupledNode->Name() << " = Def" << aCoupledNode->Name() << "()" << endl ;
+        f << "    " << Name() << " = " << aGraphName << ".GraphMNode( " << aCoupledNode->Name() << " )" << endl ;
+      }
+      else {
+        f << "    " << Name() << " = " << aGraphName << ".GraphMNode( ? )" << endl ;
+      }
+      f << "    " << Name() << ".SetCoupled( '" << aCoupledNode->Name() << "' )" << endl ;
+    }
     else {
 //      char * EndName = NULL ;
 //      EndName = new char[ 3 + strlen( Name() ) + 1 ] ;
 //      strcpy( EndName , "End" ) ;
 //      strcat( EndName , Name() ) ;
       char * EndName = aCoupledNode->Name() ;
+      cdebug << "ComputingNode::SavePY Node " << Name() << " EndName " << EndName
+             << endl ;
       if ( IsLoopNode() ) {
+        int i ;
         SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ;
         SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ;
-        f << "PyMore" << Name() << " = []" << endl ;
-        for ( i = 0 ; i < aPyMore.length() ; i++ ) {
-          f << "PyMore" << Name() << ".append( '" << aPyMore[i] << "' )" << endl ;
+        f << "    " << "PyMore" << Name() << " = []" << endl ;
+        for ( i = 0 ; i < (int ) aPyMore.length() ; i++ ) {
+          f << "    " << "PyMore" << Name() << ".append( '" << aPyMore[i] << "' )" << endl ;
         }
-        f << "PyNext" << Name() << " = []" << endl ;
-        for ( i = 0 ; i < aPyNext.length() ; i++ ) {
-          f << "PyNext" << Name() << ".append( '" << aPyNext[i] << "' )" << endl ;
+        f << "    " << "PyNext" << Name() << " = []" << endl ;
+        for ( i = 0 ; i < (int ) aPyNext.length() ; i++ ) {
+          f << "    " << "PyNext" << Name() << ".append( '" << aPyNext[i] << "' )" << endl ;
         }
-        f << Name() << "," << EndName << " = " << aGraphName << ".LNode( '"
+        f << "    " << Name() << "," << EndName << " = " << aGraphName << ".LNode( '"
           << FuncNames[0].c_str() << "' , Py" << Name() << " , '"
           << FuncNames[1].c_str() << "' , PyMore" << Name()
           << " , '" << FuncNames[2].c_str() << "' , PyNext"
           << Name() << " )" << endl ;
-        f << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
-        f << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
-        f << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
-        f << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
+        f << "    " << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
+        f << "    " << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
+        f << "    " << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
+        f << "    " << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
           << aCoupledNode->YCoordinate() << " )" << endl ;
+        SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
+        f << "    " << "Py" << aCoupledNode->Name() << " = []" << endl ;
+        for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
+          f << "    " << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
+            << endl ;
+        }
+        f << "    " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
+        for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
+          const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
+          cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
+                 << " " << anInPort->Kind() << endl ;
+          if ( anInPort->IsLoop() ) {
+            f << "    " << "I" << Name() << anInPort->PortName() << " = "
+              << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
+         }
+          else if ( anInPort->IsInLine() ) {
+            f << "    " << "I" << Name() << anInPort->PortName() << " = "
+              << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
+              << anInPort->PortType() << "' )" << endl ;
+          }
+          else if ( anInPort->IsDataStream() ) {
+            f << "    " << "I" << Name() << anInPort->PortName() << " = " << Name()
+              << ".InStreamPort( '" << anInPort->PortName()
+              << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
+              << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
+            SUPERV::KindOfSchema        aKindOfSchema ;
+            SUPERV::KindOfInterpolation aKindOfInterpolation ;
+            SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
+            ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
+            f << "    " << "I" << Name() << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
+              << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
+         }
+          else if ( anInPort->IsGate() ) {
+            f << "    " << "I" << Name() << anInPort->PortName() << " = "
+              << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
+         }
+        }
+        for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+          const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
+          cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
+                 << " " << anOutPort->Kind() << endl ;
+          if ( anOutPort->IsInLine() || anOutPort->IsLoop() ) {
+            f << "    " << "O" << Name() << anOutPort->PortName() << " = "
+              << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
+          }
+          else if ( anOutPort->IsDataStream() ) {
+            f << "    " << "O" << Name() << anOutPort->PortName() << " = " << Name()
+              << ".OutStreamPort( '" << anOutPort->PortName()
+              << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
+              << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
+            long aNumberOfValues ;
+            aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
+            f << "    " << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
+              << endl ;
+         }
+//JR 02.09.2005 : GetOutPort for Gates was missing
+          else if ( anOutPort->IsGate() ) {
+            f << "    " << "O" << Name() << anOutPort->PortName() << " = "
+              << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
+          }
+        }
+        for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
+          const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
+          cdebug << "Node " << aCoupledNode->Name() << " InPort " << anInPort->PortName()
+                 << " " << anInPort->Kind() << endl ;
+          if ( anInPort->IsInLine() || anInPort->IsLoop() || anInPort->IsGate() ) {
+            f << "    " << "I" << EndName << anInPort->PortName() << " = " << EndName
+              << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
+          }
+          else if ( anInPort->IsDataStream() ) {
+            f << "    " << "I" << EndName << anInPort->PortName() << " = " << EndName
+              << ".InStreamPort( '" << anInPort->PortName()
+              << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
+              << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
+            SUPERV::KindOfSchema        aKindOfSchema ;
+            SUPERV::KindOfInterpolation aKindOfInterpolation ;
+            SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
+            ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
+            f << "    " << "I" << EndName << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
+              << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
+         }
+        }
+        for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) {
+          const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ;
+          cdebug << "Node " << aCoupledNode->Name() << " OutPort " << anOutPort->PortName()
+                 << " " << anOutPort->Kind() << endl ;
+          if ( anOutPort->IsInLine() || anOutPort->IsLoop() || anOutPort->IsGate() ) {
+            f << "    " << "O" << EndName << anOutPort->PortName() << " = " << EndName
+              << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
+          }
+          else if ( anOutPort->IsDataStream() ) {
+            f << "    " << "O" << EndName << anOutPort->PortName() << " = " << EndName
+              << ".OutStreamPort( '" << anOutPort->PortName()
+              << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
+              << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
+            long aNumberOfValues ;
+            aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
+            f << "    " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
+              << endl ;
+         }
+        }
       }
       else if ( IsSwitchNode() ) {
-        f << Name() << "," << EndName << " = " << aGraphName << ".SNode( '"
+        f << "    " << Name() << "," << EndName << " = " << aGraphName << ".SNode( '"
           << FuncNames[0].c_str() << "' , Py" << Name() << " )" << endl ;
-        f << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
-        f << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
-        f << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
-        f << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
+        f << "    " << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
+        f << "    " << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
+        f << "    " << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
+        f << "    " << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
           << aCoupledNode->YCoordinate() << " )" << endl ;
         SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
-        f << "Py" << aCoupledNode->Name() << " = []" << endl ;
-        for ( i = 0 ; i < aPyFunc.length() ; i++ ) {
-          f << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
+        f << "    " << "Py" << aCoupledNode->Name() << " = []" << endl ;
+        for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
+          f << "    " << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
             << endl ;
         }
-        f << EndName << ".SetPyFunction( 'End" << FuncNames[0].c_str() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
+        f << "    " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
         for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
           const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
-          if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
-            f << EndName << ".InPort( '" << anInPort->PortName()
+          cdebug << "Node " << aCoupledNode->Name() << " InPort " << anInPort->PortName()
+                 << " " << anInPort->Kind() << endl ;
+//          if ( anInPort->IsGate() || anInPort->IsEndSwitch() ) {
+          if ( anInPort->IsGate() ) {
+            f << "    " << "I" << EndName << anInPort->PortName() << " = " << EndName
+              << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
+          }
+          else if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
+            f << "    " << "I" << EndName << anInPort->PortName() << " = " << EndName
+              << ".InPort( '" << anInPort->PortName()
               << "' , '" << anInPort->PortType() << "' )" << endl ;
           }
+          else if ( anInPort->IsDataStream() ) {
+            f << "    " << "I" << EndName << anInPort->PortName() << " = " << EndName
+              << ".InStreamPort( '" << anInPort->PortName()
+              << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
+              << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
+            SUPERV::KindOfSchema        aKindOfSchema ;
+            SUPERV::KindOfInterpolation aKindOfInterpolation ;
+            SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
+            ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
+            f << "    " << "I" << EndName << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
+              << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
+         }
         }
         for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) {
           const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ;
-          if ( anOutPort->IsInLine() ) {
-            f << EndName << ".OutPort( '" << anOutPort->PortName()
+          cdebug << "Node " << aCoupledNode->Name() << " OutPort " << anOutPort->PortName()
+                 << " " << anOutPort->Kind() << endl ;
+//          if ( anOutPort->IsGate() || anOutPort->IsEndSwitch() ) {
+          if ( anOutPort->IsGate() ) {
+            f << "    " << "O" << EndName << anOutPort->PortName() << " = " << EndName
+              << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
+          }
+          else if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
+            f << "    " << "O" << EndName << anOutPort->PortName() << " = " << EndName
+              << ".OutPort( '" << anOutPort->PortName()
               << "' , '" << anOutPort->PortType() << "' )" << endl ;
           }
+          else if ( anOutPort->IsDataStream() ) {
+            f << "    " << "O" << EndName << anOutPort->PortName() << " = " << EndName
+              << ".OutStreamPort( '" << anOutPort->PortName()
+              << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
+              << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
+            long aNumberOfValues ;
+            aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
+            f << "    " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
+              << endl ;
+         }
         }
       }
-      delete [] EndName ;
-    }
-    for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
-      const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
-      if ( anInPort->IsInLine() ) {
-        f << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
-          << anInPort->PortType() << "' )" << endl ;
-      }
-    }
-    for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
-      const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
-      if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
-        f << Name() << ".OutPort( '" << anOutPort->PortName()
-          << "' , '" << anOutPort->PortType() << "' )" << endl ;
-      }
+      cdebug << "ComputingNode::SavePY Node " << Name() << " EndName " << EndName
+             << endl ;
+// PAL8507
+//JR 24.02.2005 Debug !!!... : I should not delete myself : what a stupid thing !
+//      delete [] EndName ;
     }
   }
 
-  f << Name() << ".SetName( '" << Name() << "' )" << endl ;
-  f << Name() << ".SetAuthor( '" << Author() << "' )" << endl ;
-  if ( IsFactoryNode() ) {
-    f << Name() << ".SetContainer( '" << Computer << "' )" << endl ;
+  if ( IsEndLoopNode() || IsEndSwitchNode() ) {
+// It is done with LoopNode or SwitchNode with CoupledNode()
   }
-  f << Name() << ".SetComment( '" << Comment() << "' )" << endl ;
-  f << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ;
+  else {
+    f << "    " << Name() << ".SetName( '" << Name() << "' )" << endl ;
+    f << "    " << Name() << ".SetAuthor( '" << Author() << "' )" << endl ;
+    if ( IsFactoryNode() ) {
+      f << "    " << Name() << ".SetContainer( '" << Computer << "' )" << endl ;
+    }
+    f << "    " << Name() << ".SetComment( '" << Comment() << "' )" << endl ;
+    f << "    " << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ;
 
-#if 0
-  if ( IsLoopNode() || IsSwitchNode() ) {
-    f << EndName << ".SetName( '" << CoupledNode
-      << "' )" << endl ;
-    f << EndName << ".SetAuthor( '" << CoupledNode->Author()
-      << "' )" << endl ;
-    f << EndName << ".SetComment( '" << CoupledNode->Comment()
-      << "' )" << endl ;
-    f << EndName << ".Coords( " << CoupledNode->XCoordinate() << " , "
-      << CoupledNode->YCoordinate() << " )" << endl ;
-    unsigned int i;
-    for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
-      const InPort * anInPort = GetNodeInPort( i ) ;
-      if ( anInPort->IsBus() ) {
-        const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
-        f << Name() << ".BusPorts( '" << anInPort->PortName() << "' , '"
-          << anInPort->PortType() << "' , '" << anOutPort->PortName()
-          << "' , '" << anOutPort->PortType() << "' )" << endl ;
+    if ( IsComputingNode() || IsFactoryNode() ) {
+      int i ;
+      for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
+        const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
+        if ( !anInPort->IsDataStream() ) {
+          cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
+                 << " " << anInPort->Kind() << endl ;
+          f << "    " << "I" << Name() << anInPort->PortName() << " = "
+            << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
+       }
+      }
+      for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+        const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
+        if ( !anOutPort->IsDataStream() ) {
+          cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
+                 << " " << anOutPort->Kind() << endl ;
+          f << "    " << "O" << Name() << anOutPort->PortName() << " = "
+            << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
+       }
+      }
+    }
+    else if ( IsOneOfInLineNodes() && !IsLoopNode() ) {
+      int i ;
+      for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
+        const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
+        cdebug << "ComputingNode::SavePY Node " << Name() << " InPort " << anInPort->PortName()
+               << " " << anInPort->Kind() << endl ;
+//        if ( anInPort->IsGate() || ( anInPort->IsInLine() && IsMacroNode() ) ) {
+        if ( anInPort->IsGate() || IsMacroNode() ) {
+          f << "    " << "I" << Name() << anInPort->PortName() << " = "
+            << Name() << ".GetInPort( '" << anInPort->PortName()  << "' )" << endl ;
+        }
+        else if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
+          f << "    " << "I" << Name() << anInPort->PortName() << " = "
+            << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
+            << anInPort->PortType() << "' )" << endl ;
+        }
+        else {
+          cdebug << "Ignored " << Name() << " " << anInPort->PortName() << " " << anInPort->PortStatus() << endl ;
+//          f << "    " << "I" << Name() << anInPort->PortName() << " = "
+//            << Name() << ".GetInPort( '" << anInPort->PortName()  << "' )" << endl ;
+        }
+      }
+      for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+        const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
+        cdebug << "ComputingNode::SavePY Node " << Name() << " OutPort " << anOutPort->PortName()
+               << " " << anOutPort->Kind() << endl ;
+//        if ( anOutPort->IsGate() || ( anOutPort->IsInLine() && IsMacroNode() ) ) {
+        if ( anOutPort->IsGate() || IsMacroNode() ) {
+          f << "    " << "O" << Name() << anOutPort->PortName() << " = "
+            << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
+        }
+        else if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
+          f << "    " << "O" << Name() << anOutPort->PortName() << " = "
+            << Name() << ".OutPort( '" << anOutPort->PortName()
+            << "' , '" << anOutPort->PortType() << "' )" << endl ;
+        }
+        else {
+          cdebug << "Ignored " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortStatus() << endl ;
+//          f << "    " << "O" << Name() << anOutPort->PortName() << " = "
+//            << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
+        }
+      }
+    }
+    if ( !IsDataFlowNode() && !IsDataStreamNode() ) {
+      int i ;
+      for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
+        const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
+        cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
+               << " " << anInPort->Kind() << endl ;
+        if ( anInPort->IsDataStream() ) {
+          if ( IsOneOfInLineNodes() ) {
+            f << "    " << "I" << Name() << anInPort->PortName() << " = "
+              << Name() << ".InStreamPort( '" << anInPort->PortName() << "' , SALOME_ModuleCatalog."
+              << StringToDataStreamType( anInPort->PortType() ) << " , SALOME_ModuleCatalog."
+              << anInPort->Dependency() << " )" << endl ;
+         }
+          else {
+            f << "    " << "I" << Name() << anInPort->PortName() << " = "
+              << Name() << ".GetInStreamPort( '" << anInPort->PortName() << "' )" << endl ;
+         }
+          SUPERV::KindOfSchema        aKindOfSchema ;
+          SUPERV::KindOfInterpolation aKindOfInterpolation ;
+          SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
+          ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
+          f << "    " << "I" << Name() << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
+            << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
+        }
+      }
+      for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+        const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
+        cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
+               << " " << anOutPort->Kind() << endl ;
+        if ( anOutPort->IsDataStream() ) {
+          if ( IsOneOfInLineNodes() ) {
+            f << "    " << "O" << Name() << anOutPort->PortName() << " = "
+              << Name() << ".OutStreamPort( '" << anOutPort->PortName() << "' , SALOME_ModuleCatalog."
+              << StringToDataStreamType( anOutPort->PortType() ) << " , SALOME_ModuleCatalog."
+              << anOutPort->Dependency() << " )" << endl ;
+         }
+          else {
+            f << "    " << "O" << Name() << anOutPort->PortName() << " = "
+              << Name() << ".GetOutStreamPort( '" << anOutPort->PortName() << "' )" << endl ;
+         }
+          long aNumberOfValues ;
+          aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
+          f << "    " << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" << endl ;
+        }
       }
     }
   }
-#endif
+
+  cdebug_out << "ComputingNode::SavePY " ;
+  NodeInfo( *_fdebug ) ;
+  cdebug << endl ;
   return true ;
 }
 
-void GraphBase::ComputingNode::NodeInfo(ostrstream & s) const {
-  int i ;
+void GraphBase::ComputingNode::NodeInfo(ostream & s) const {
   s << *this ;
   ListPorts( s , true ) ;
   s << ends ;
@@ -984,10 +1970,12 @@ void GraphBase::ComputingNode::NodeInfo(ostrstream & s) const {
 
 ostream & operator<< (ostream & f,const GraphBase::ComputingNode & G) {
 //  f << "ComponentName    " << G.ComponentName() << endl ;
-  if ( G.IsComputingNode() )
+  if ( G.IsComputingNode() ) {
     f << "NodeName         " << G.Name() << endl ;
-  else
+  }
+  else {
     f << "DataFlowName     " << G.Name() << endl ;
+  }
   f << "Kind             " << G.Kind() << endl ;
   f << "Service          " << *G.GetService() ;
   f << "FirstCreation    " << G.FirstCreation () << endl ;
@@ -1008,8 +1996,9 @@ void GraphBase::ComputingNode::ListLinks(ostream &f ) const {
     if ( fromPort->IsPortConnected() ) {
       int j ;
       for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) {
-        if ( j == 0 )
+        if ( j == 0 ) {
           f << "FromNode " << Name() << endl ;
+       }
         f << "         FromServiceParameterName "
           << fromPort->GetServicesParameter().Parametername ;
         const GraphBase::InPort* toPort = fromPort->InPorts( j ) ;