]> SALOME platform Git repositories - modules/superv.git/blob - src/GraphBase/DataFlowBase_ComputingNode.cxx
Salome HOME
Fix for bug IPAL9558 : Maintainance Mandrake porting: black rectangle in table view.
[modules/superv.git] / src / GraphBase / DataFlowBase_ComputingNode.cxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : DataFlowBase_ComputingNode.cxx
8 //  Author : Jean Rahuel, CEA
9 //  Module : SUPERV
10 //  $Header:
11
12 using namespace std;
13 //#include <sstream>
14 //#include <iostream>
15
16 #include "DataFlowBase_StreamGraph.hxx"
17 //#include "DataFlowBase_LoopNode.hxx"
18
19 static void InitFields( //SUPERV::KindOfNode &_Kind ,
20                         SUPERV::SDate      &_FirstCreation ,
21                         SUPERV::SDate      &_LastModification ,
22                         char *             &_EditorRelease ,
23                         char *             &_Author ,
24                         char *             &_Comment ,
25                         //bool               &_HeadNode ,
26                         bool               &_GeneratedName ,
27                         //int                &_DataStreamInPortsNumber ,
28                         //int                &_DataStreamOutPortsNumber ,
29                         int                &_ConnectedInPortsNumber ,
30                         int                &_DecrConnectedInPortsNumber ) {
31                         //int                &_LinkedNodesSize ,
32                         //int                &_SubGraphNumber ) {
33   time_t T = time(NULL);
34   struct tm * Tm = localtime(&T);
35
36 //  _Kind = SUPERV::DataFlowGraph ;
37
38   _FirstCreation.Second = _LastModification.Second = Tm->tm_sec;
39   _FirstCreation.Minute = _LastModification.Minute = Tm->tm_min;
40   _FirstCreation.Hour   = _LastModification.Hour   = Tm->tm_hour;
41   _FirstCreation.Day    = _LastModification.Day    = Tm->tm_mday;
42   _FirstCreation.Month  = _LastModification.Month  = Tm->tm_mon + 1;
43   _FirstCreation.Year   = _LastModification.Year   = Tm->tm_year + 1900; 
44
45   _EditorRelease = new char[ strlen( SuperVision_Version ) + 1 ] ;
46   strcpy( _EditorRelease , SuperVision_Version ) ;
47   _Author = NULLSTRING ;
48 //  _Computer = new char[ strlen( FACTORYSERVER ) + 1 ] ;
49 //  strcpy( _Computer  , FACTORYSERVER ) ;
50   _Comment = NULLSTRING ;
51
52 //  _SubGraphNumber = 0 ;
53 //  _HeadNode = false ;
54   _GeneratedName = false ;
55
56 //  _DataStreamInPortsNumber = 0 ;
57 //  _DataStreamOutPortsNumber = 0 ;
58
59   _ConnectedInPortsNumber = 0 ;
60   _DecrConnectedInPortsNumber = 0 ;
61 //  _LinkedNodesSize = 0 ;
62 //  _SubGraphNumber = 0 ;
63 }
64
65 GraphBase::ComputingNode::ComputingNode() :
66 //  GraphBase::PortsOfNode::PortsOfNode() {
67   GraphBase::StreamNode::StreamNode() {
68
69   InitFields( //_Kind ,
70               _FirstCreation ,
71               _LastModification ,
72               _EditorRelease ,
73               _Author ,
74               _Comment ,
75               //_HeadNode ,
76               _GeneratedName ,
77               //_DataStreamInPortsNumber ,
78               //_DataStreamOutPortsNumber ,
79               _ConnectedInPortsNumber ,
80               _DecrConnectedInPortsNumber ) ;
81               //_LinkedNodesSize ,
82               //_SubGraphNumber ) ;
83   Kind( SUPERV::DataFlowGraph ) ;
84   _NamingService = NULL ;
85   _Node_var = SUPERV::CNode::_nil() ;
86   _Node_Impl = NULL ;
87   _InNode = NULL ;
88   _ThreadNo = pthread_self() ;
89   cdebug << "GraphBase::Node::Node "  << this << " "  << endl ;
90
91 }
92
93 GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
94                                          SALOME_NamingService* ptrNamingService ,
95                                          const char * aDataFlowName ,
96                                          const SUPERV::KindOfNode DataFlowkind ,
97                                          int * Graph_prof_debug ,
98                                          ofstream * Graph_fdebug ) :
99 //  GraphBase::PortsOfNode::PortsOfNode( aDataFlowName ) {
100   GraphBase::StreamNode::StreamNode( aDataFlowName , DataFlowkind ,
101                                      Graph_prof_debug , Graph_fdebug ) {
102
103 //  MESSAGE( "GraphBase::ComputingNode::ComputingNode " << aDataFlowName << " Graph_prof_debug " << Graph_prof_debug ) ;
104   InitFields( //_Kind ,
105               _FirstCreation ,
106               _LastModification ,
107               _EditorRelease ,
108               _Author ,
109               _Comment ,
110               //_HeadNode ,
111               _GeneratedName ,
112               //_DataStreamInPortsNumber ,
113               //_DataStreamOutPortsNumber ,
114               _ConnectedInPortsNumber ,
115               _DecrConnectedInPortsNumber ) ;
116               //_LinkedNodesSize ,
117               //_SubGraphNumber ) ;
118
119 //  Kind( SUPERV::DataFlowGraph ) ;
120   Kind( DataFlowkind ) ;
121   _ORB = CORBA::ORB::_duplicate( ORB ) ;
122   _NamingService = ptrNamingService ;
123   _Node_var = SUPERV::CNode::_nil() ;
124   _Node_Impl = NULL ;
125   _InNode = NULL ;
126   _ThreadNo = pthread_self() ;
127
128   if ( Graph_prof_debug ) {
129 //    MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug" ) ;
130 //    cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug" << endl ;
131     _Graph_prof_debug = Graph_prof_debug ;
132     _Graph_fdebug = Graph_fdebug ;
133     SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
134   }
135 //  else {
136 //    cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ;
137 //  }
138   DefPortsOfNode( ORB , SALOME_ModuleCatalog::Service() , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
139   cdebug << "GraphBase::ComputingNode::ComputingNode "  << this 
140          << " Name '" << Name() << "' "  << _FirstCreation
141          << " "  << _LastModification << endl ;
142 }
143
144 GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
145                                          SALOME_NamingService* ptrNamingService ,
146                                          const SALOME_ModuleCatalog::Service& aService ,
147                                          const char *NodeName ,
148                                          const SUPERV::KindOfNode akind ,
149                                          const SUPERV::SDate NodeFirstCreation ,
150                                          const SUPERV::SDate NodeLastModification  ,
151                                          const char * NodeEditorRelease ,
152                                          const char * NodeAuthor ,
153                                          const char * NodeComment ,
154                                          const bool   GeneratedName ,
155                                          const long   X ,
156                                          const long   Y ,
157                                          int * Graph_prof_debug ,
158                                          ofstream * Graph_fdebug ) :
159 //  GraphBase::PortsOfNode::PortsOfNode() {
160   GraphBase::StreamNode::StreamNode( NodeName , akind , Graph_prof_debug , Graph_fdebug ) {
161
162   _ORB = CORBA::ORB::_duplicate( ORB ) ;
163   _NamingService = ptrNamingService ;
164   _Node_var = SUPERV::CNode::_nil() ;
165   _Node_Impl = NULL ;
166   _InNode = NULL ;
167   _ThreadNo = pthread_self() ;
168
169   Kind( akind ) ;
170 //  _Kind = akind ;
171
172   time_t T = time(NULL);
173   struct tm * Tm = localtime(&T);
174
175   _FirstCreation.Second = _LastModification.Second = Tm->tm_sec;
176   _FirstCreation.Minute = _LastModification.Minute = Tm->tm_min;
177   _FirstCreation.Hour   = _LastModification.Hour   = Tm->tm_hour;
178   _FirstCreation.Day    = _LastModification.Day    = Tm->tm_mday;
179   _FirstCreation.Month  = _LastModification.Month  = Tm->tm_mon + 1;
180   _FirstCreation.Year   = _LastModification.Year   = Tm->tm_year + 1900; 
181
182   if ( NodeEditorRelease != NULLSTRING ) {
183     _EditorRelease = new char[ strlen( NodeEditorRelease ) + 1 ] ;
184     strcpy( _EditorRelease , NodeEditorRelease ) ;
185   }
186   else {
187     _EditorRelease = new char[ strlen( SuperVision_Version ) + 1 ] ;
188     strcpy( _EditorRelease , SuperVision_Version ) ;
189   }
190
191   if ( NodeAuthor != NULLSTRING ) {
192     _Author = new char[ strlen( NodeAuthor ) + 1 ] ;
193     strcpy( _Author  , NodeAuthor ) ;
194   }
195   else {
196     _Author = NULLSTRING ;
197   }
198
199   if ( NodeComment != NULLSTRING ) {
200     _Comment = new char[ strlen( NodeComment ) + 1 ] ;
201     strcpy( _Comment  , NodeComment ) ;
202   }
203   else {
204     _Comment = NULLSTRING ;
205   }
206
207 //  _SubGraphNumber = 0 ;
208 //  _HeadNode = false ;
209   _GeneratedName = GeneratedName ;
210
211 //  const char *aNodeName = NodeName ;
212 //  _Name = new char[strlen(aNodeName)+1];
213 //  strcpy(_Name , aNodeName);
214
215 //  _DataStreamInPortsNumber = 0 ;
216 //  _DataStreamOutPortsNumber = 0 ;
217
218   _ConnectedInPortsNumber = 0 ;
219   _DecrConnectedInPortsNumber = 0 ;
220 //  _LinkedNodesSize = 0 ;
221
222   _X = X ;
223   _Y = Y ;
224
225   _Graph_prof_debug = Graph_prof_debug ;
226   _Graph_fdebug = Graph_fdebug ;
227 //  MESSAGE( "GraphBase::ComputingNode::ComputingNode " << NodeName
228 //           << " _Graph_prof_debug " << _Graph_prof_debug ) ;
229   SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
230   cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << NodeName << ","
231             << akind << ")" << endl;
232   
233
234   DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
235   cdebug << "GraphBase::ComputingNode::ComputingNode "  << this 
236          << " Name '" << Name()
237          << "' KindOfNode " << Kind()
238          << " ServiceName '" << ServiceName() << "' In(" << ServiceInParameter().length()
239          << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
240
241   cdebug_out << "GraphBase::ComputingNode::ComputingNode" << endl;
242 }
243
244 GraphBase::ComputingNode::~ComputingNode() {
245   cdebug << "GraphBase::ComputingNode::~ComputingNode "  << this 
246          << " Name() "<< Name() << " _Comment "
247          << (void *) _Comment << " "  << _Comment << " "  << endl ;
248 }
249
250 //->StreamNode bool GraphBase::ComputingNode::Name( const char * aName) {
251 //->StreamNode   cdebug_in << "GraphBase::ComputingNode::Name " << _Name << endl;
252 //->StreamNode   if ( _Name ) {
253 //->StreamNode     cdebug << "GraphBase::ComputingNode::ReName "  << _Name << " --> " << aName << endl ;
254 //->StreamNode     delete [] _Name ;
255 //->StreamNode   }
256 //->StreamNode   _Name = new char[strlen(aName)+1] ;
257 //->StreamNode   strcpy( _Name , aName ) ;
258 //->StreamNode   cdebug_out << "GraphBase::ComputingNode::Name " << _Name << endl;
259 //->StreamNode   return true ;
260 //->StreamNode }
261
262 SUPERV::SDate GraphBase::ComputingNode::FirstCreation () const {
263 //  cdebug << "GraphBase::ComputingNode::FirstCreation "
264 //         << " Name '" << Name() << "' "  << _FirstCreation << " "  
265 //         << _LastModification << endl ;
266   return _FirstCreation;
267 }
268
269 SUPERV::SDate GraphBase::ComputingNode::LastModification () const {
270   return _LastModification ;
271 }
272
273 void GraphBase::ComputingNode::FirstCreation(const SUPERV::SDate aDate ) {
274   _FirstCreation = aDate ;
275 }
276
277 void GraphBase::ComputingNode::LastModification(const SUPERV::SDate aDate ) {
278   _LastModification = aDate ;
279 }
280
281 bool GraphBase::ComputingNode::EditorRelease(const char * c){
282   if ( _EditorRelease && _EditorRelease != NULLSTRING )
283     delete _EditorRelease;
284   _EditorRelease = my_strdup(c);
285   return true ;
286 }
287
288 bool GraphBase::ComputingNode::Author(const char * a) {
289   cdebug_in << "GraphBase::ComputingNode::Author " << _Author << endl;
290   if ( _Author && _Author != NULLSTRING )
291     delete _Author;
292   _Author = my_strdup(a);
293   cdebug_out << "GraphBase::ComputingNode::Author " << _Author << endl;
294   return true ;
295 }
296
297 bool GraphBase::ComputingNode::Comment(const char *c) {
298   cdebug_in << "GraphBase::ComputingNode::Comment " << _Comment << endl;
299   if ( _Comment != NULLSTRING )
300     delete [] _Comment;
301   _Comment = my_strdup(c);
302   cdebug_out << "GraphBase::ComputingNode::Comment " << _Comment << endl;
303   return true ;
304 }
305
306 void GraphBase::ComputingNode::NodePort( const char * NodeName ,
307                                 const char * ServiceParameterName ,
308                                 char ** aNode , char ** aPort ) {
309   if ( strcmp( NodeName , Name() ) ) {
310     *aNode = my_strdup( NodeName ) ;
311     *aPort = my_strdup( ServiceParameterName ) ;
312   }
313   else {
314 //    char * BPort = strchr( ServiceParameterName , '\\' ) ;
315     char * BPort = (char * ) ServiceParameterName ;
316     while ( ( BPort = strchr( BPort , '_' ) ) ) {
317       if ( BPort[1] == '_' ) {
318         int len = BPort - ServiceParameterName ;
319         *aNode = new char [ len + 1 ] ;
320         strncpy( *aNode , ServiceParameterName , len ) ;
321         (*aNode)[ len ] = '\0' ;
322         *aPort = my_strdup( &BPort[ 2 ] ) ;
323         break ;
324       }
325       else {
326         BPort = &BPort[2] ;
327       }
328     }
329     if ( BPort == NULL ) {
330       *aNode = my_strdup( NULLSTRING ) ;
331       *aPort = my_strdup( NULLSTRING ) ;
332     }
333   }
334 }
335
336 bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName ) {
337   bool RetVal = false ;
338   const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ;
339   if ( thePort ) {
340     RetVal = thePort->IsPortConnected() ;
341   }
342   else {
343     const GraphBase::OutPort * thePort = GetOutPort( ToServiceParameterName ) ;
344     if ( thePort ) {
345       RetVal = thePort->IsPortConnected() ;
346     }
347   }
348   return RetVal ;
349 }
350
351 bool GraphBase::ComputingNode::HasInput(const char * ToServiceParameterName ) {
352   bool RetVal = false ;
353   const GraphBase::InPort * theInPort = GetInPort( ToServiceParameterName ) ;
354   if ( theInPort ) {
355     RetVal = theInPort->IsDataConnected() ;
356   }
357   else {
358     const GraphBase::OutPort * theOutPort = GetOutPort( ToServiceParameterName ) ;
359     if ( theOutPort ) {
360       RetVal = theOutPort->IsDataConnected() ;
361     }
362   }
363   return RetVal ;
364 }
365
366 GraphBase::SNode * GraphBase::ComputingNode::GetInfo() {
367   cdebug_in << "GraphBase::ComputingNode::GetInfo" << endl;
368   GraphBase::SNode * Info = new GraphBase::SNode ;
369 //  Info->theComponentName = ComponentName() ;
370 //  Info->theInterfaceName = InterfaceName() ;
371   Info->theName = Name() ;
372   Info->theKind = Kind() ;
373   if ( IsDataStreamNode() ) {
374     long Timeout ;
375     SUPERV::KindOfDataStreamTrace DataStreamTrace ;
376     double DeltaTime ;
377     ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
378     Info->theTimeout = Timeout ;
379     Info->theDataStreamTrace = DataStreamTrace ;
380     Info->theDeltaTime = DeltaTime ;
381   }
382   Info->theService = *GetService() ;
383 //  Info->theListOfParameters = *GetListOfParameters() ;
384   Info->theFirstCreation = FirstCreation() ;
385   Info->theLastModification = LastModification() ;
386   Info->theEditorRelease = EditorRelease() ;
387   Info->theAuthor = Author() ;
388 //  Info->theContainer = Computer() ;
389   Info->theComment = Comment() ;
390   Info->theCoords.theX = GraphBase::ComputingNode::XCoordinate() ;
391   Info->theCoords.theY = GraphBase::ComputingNode::YCoordinate() ;
392   cdebug_out << "GraphBase::ComputingNode::GetInfo" << endl;
393   return Info ;
394 }
395
396 void GraphBase::ComputingNode::SetMacroPorts( GraphBase::Graph * aGraph ) {
397   cdebug_in << "GraphBase::ComputingNode::SetMacroPorts fill ports of MacroNode" << endl;
398   int i ;
399   for ( i = 0 ; i < aGraph->GetNodeInPortsSize() ; i++ ) {
400     const GraphBase::InPort * anInPort = aGraph->GetNodeInPort( i ) ;
401     cdebug << "SetMacroPorts In" << i << " " << anInPort->PortName() << " " << anInPort->PortType()
402            << " " << anInPort->Kind() << endl ;
403     GraphBase::InPort * aNewInPort ;
404     if ( anInPort->IsDataStream() ) {
405       aNewInPort = AddInDataStreamPort( anInPort->PortName() , StringToDataStreamType( anInPort->PortType() ) ,
406                                         anInPort->Dependency() , anInPort->Kind() ) ;
407     }
408     else if ( anInPort->IsParam() || anInPort->IsInLine() ) {
409       aNewInPort = AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() ) ;
410     }
411   }
412   for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() ; i++ ) {
413     const GraphBase::OutPort * anOutPort = aGraph->GetNodeOutPort( i ) ;
414     cdebug << "SetMacroPorts Out" << i << " " << anOutPort->PortName() << " " << anOutPort->PortType()
415            << " " << anOutPort->Kind() << endl ;
416     if ( anOutPort->IsDataStream() ) {
417       AddOutDataStreamPort( anOutPort->PortName() , StringToDataStreamType( anOutPort->PortType() ) ,
418                             anOutPort->Dependency() , anOutPort->Kind() ) ;
419     }
420     else if ( anOutPort->IsParam() || anOutPort->IsInLine() ) {
421       AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() ) ;
422     }
423   }
424   cdebug_out << "GraphBase::ComputingNode::SetMacroPorts" << endl;
425 }
426
427 void GraphBase::ComputingNode::UpdateMacroPorts( GraphBase::Graph * aGraph ) {
428   cdebug_in << "GraphBase::ComputingNode::UpdateMacroPorts fill ports of MacroNode from "
429             << aGraph->Name() << " InPorts(" << aGraph->GetNodeInPortsSize() << ") OutPorts("
430             << aGraph->GetNodeInPortsSize() << ") to MacroNode " << Name() << " InPorts(" << GetNodeInPortsSize()
431             << ") OutPorts(" << GetNodeInPortsSize() << ")" << endl;
432   cdebug << Name() << " : " << *GetService() << endl ;
433   cdebug << aGraph->Name() << " : " << *aGraph->GetService() << endl ;
434   int i ;
435 // Loop over InPorts of MacroNode ; if it does not exist in the MacroGraph ===> DelInPort in the MacroNode
436   for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
437     GraphBase::InPort * anInPort = aGraph->GetChangeInPort( GetNodeInPort( i )->PortName() ) ;
438     if ( anInPort && !anInPort->IsGate() && !GetNodeInPort( i )->IsGate() ) {
439       if ( strcmp( GetNodeInPort( i )->PortType() , anInPort->PortType() ) ) {
440         cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
441                << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
442         cdebug << "  <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
443                << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
444         GetChangeNodeInPort( i )->PortType( (char * ) anInPort->PortType() ) ;
445       }
446       if ( GetNodeInPort( i )->Kind() != anInPort->Kind() ) {
447         cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
448                << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
449         cdebug << "  <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
450                << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
451         GetChangeNodeInPort( i )->Kind( anInPort->Kind() ) ;
452       }
453       if ( GetNodeInPort( i )->Dependency() != anInPort->Dependency() ) {
454         cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
455                << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
456         cdebug << "  <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
457                << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
458         GetChangeNodeInPort( i )->Dependency( anInPort->Dependency() ) ;
459       }
460     }
461     else if ( !GetNodeInPort( i )->IsGate() ) {
462       cdebug << "UpdateMacroPorts DelInPort In" << i << " " << GetNodeInPort( i )->PortName() << " "
463              << GetNodeInPort( i )->PortType() << " " << GetNodeInPort( i )->Kind() << endl ;
464       DelInPort( GetNodeInPort( i )->PortName() ) ;
465     }
466   }
467   int index ;
468 // Loop over InPorts of the MacroGraph : if it does not exist in the MacroNode ==> AddInPort in the MacroNode
469   for ( index = 0 ; index < aGraph->GetNodeInPortsSize() ; index++ ) {
470     GraphBase::InPort * anInPort = aGraph->GetChangeNodeInPort( index ) ;
471     GraphBase::InPort * aMacroInPort = GetChangeInPort( anInPort->PortName() ) ;
472     if ( !anInPort->IsGate() &&
473          strcmp( GetChangeNodeInPort( index )->PortName() , anInPort->PortName() ) ) {
474       cdebug << "UpdateMacroPorts Add/MoveInPort In" << index << " " << anInPort->PortName() << " "
475              << anInPort->PortType() << " " << anInPort->Kind() << endl ;
476       if ( aMacroInPort ) {
477         MoveInPort( anInPort->PortName() , index ) ;
478       }
479       else {
480         AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() , index ) ;
481       }
482     }
483   }
484 // Loop over OutPorts of MacroNode ; if it does not exist in the MacroGraph ===> DelOutPort in the MacroNode
485   for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
486     GraphBase::OutPort * anOutPort = aGraph->GetChangeOutPort( GetNodeOutPort( i )->PortName() ) ;
487     if ( anOutPort && !anOutPort->IsGate() && !GetNodeOutPort( i )->IsGate() ) {
488       if ( strcmp( GetNodeOutPort( i )->PortType() , anOutPort->PortType() ) ) {
489         cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
490                << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
491         cdebug << "  <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
492                << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
493         GetChangeNodeOutPort( i )->PortType( (char * ) anOutPort->PortType() ) ;
494       }
495       if ( GetNodeOutPort( i )->Kind() != anOutPort->Kind() ) {
496         cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
497                << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
498         cdebug << "  <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
499                << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
500         GetChangeNodeOutPort( i )->Kind( anOutPort->Kind() ) ;
501       }
502       if ( GetNodeOutPort( i )->Dependency() != anOutPort->Dependency() ) {
503         cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
504                << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
505         cdebug << "  <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
506                << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
507         GetChangeNodeOutPort( i )->Dependency( anOutPort->Dependency() ) ;
508       }
509     }
510     else if ( !GetNodeOutPort( i )->IsGate() ) {
511       cdebug << "UpdateMacroPorts DelOutPort Out" << i << " " << GetNodeOutPort( i )->PortName() << " "
512              << GetNodeOutPort( i )->PortType() << " " << GetNodeOutPort( i )->Kind() << endl ;
513       DelOutPort( GetNodeOutPort( i )->PortName() ) ;
514     }
515   }
516 // Loop over OutPorts of the MacroGraph : if it does not exist in the MacroNode ==> AddOutPort in the MacroNode
517   for ( index = 0 ; index < aGraph->GetNodeOutPortsSize() ; index++ ) {
518     GraphBase::OutPort * anOutPort = aGraph->GetChangeNodeOutPort( index ) ;
519     GraphBase::OutPort * aMacroOutPort = GetChangeOutPort( anOutPort->PortName() ) ;
520     if ( !anOutPort->IsGate() && strcmp( GetNodeOutPort( index )->PortName() , anOutPort->PortName() ) ) {
521       cdebug << "UpdateMacroPorts Add/MoveOutPort Out" << index << " " << anOutPort->PortName() << " "
522              << anOutPort->PortType() << " " << anOutPort->Kind() << endl ;
523       if ( aMacroOutPort ) {
524         MoveOutPort( anOutPort->PortName() , index ) ;
525       }
526       else {
527         AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() , index ) ;
528       }
529     }
530   }
531   bool ErrPort = false ;
532   if ( aGraph->GetNodeInPortsSize() != GetNodeInPortsSize() ||
533        aGraph->GetNodeOutPortsSize() != GetNodeOutPortsSize() ) {
534     ErrPort = true ;
535   }
536   for ( i = 0 ; i < aGraph->GetNodeInPortsSize() && i < GetNodeInPortsSize() ; i++ ) {
537     if ( !strcmp( aGraph->GetNodeInPort( i )->PortName() , GetNodeInPort( i )->PortName() ) ) {
538       ErrPort = true ;
539     }
540   }
541   for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() && i < GetNodeOutPortsSize() ; i++ ) {
542     if ( !strcmp( aGraph->GetNodeOutPort( i )->PortName() , GetNodeOutPort( i )->PortName() ) ) {
543       ErrPort = true ;
544     }
545   }
546   if ( ErrPort ) {
547     for ( i = 0 ; i < aGraph->GetNodeInPortsSize() || i < GetNodeInPortsSize() ; i++ ) {
548       if ( i < aGraph->GetNodeInPortsSize() && i < GetNodeInPortsSize() ) {
549         cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << aGraph->GetNodeInPort( i )->PortName()
550                << "  " << GetNodeInPort( i )->PortName() << endl ;
551       }
552       else if ( i >= GetNodeInPortsSize() ) {
553         cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << aGraph->GetNodeInPort( i )->PortName()
554                << endl ;
555       }
556       else {
557         cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << GetNodeInPort( i )->PortName()
558                << endl ;
559       }
560     }
561     for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() || i < GetNodeOutPortsSize() ; i++ ) {
562       if ( i < aGraph->GetNodeOutPortsSize() && i < GetNodeOutPortsSize() ) {
563         cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << aGraph->GetNodeOutPort( i )->PortName()
564                << " != " << GetNodeOutPort( i )->PortName() << endl ;
565       }
566       else if ( i >= GetNodeOutPortsSize() ) {
567         cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << aGraph->GetNodeOutPort( i )->PortName()
568                << endl ;
569       }
570       else {
571         cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << GetNodeOutPort( i )->PortName()
572                << endl ;
573       }
574     }
575   }
576   cdebug_out << "GraphBase::ComputingNode::UpdateMacroPorts"
577              << aGraph->Name() << " InPorts(" << aGraph->GetNodeInPortsSize() << ") OutPorts("
578              << aGraph->GetNodeOutPortsSize() << ") to MacroNode " << Name() << " InPorts("
579              << GetNodeInPortsSize() << ") OutPorts(" << GetNodeOutPortsSize() << ")" << endl;
580 }
581
582 void GraphBase::ComputingNode::SetMacroDatas( GraphBase::Graph * aGraph ,
583                                               GraphBase::Graph * aGraphOfMacroGraph ) {
584   cdebug_in << "GraphBase::ComputingNode::SetMacroDatas fill inputs of MacroNode" << endl;
585   int i ;
586   for ( i = 0 ; i < aGraph->GetNodeInPortsSize() ; i++ ) {
587     const GraphBase::InPort * anInPort = aGraph->GetNodeInPort( i ) ;
588     GraphBase::OutPort * anOutPort = aGraph->GetChangeNodeInDataNodePort(i) ;
589     cdebug << "                 " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
590            << " " << anOutPort->Kind() << " " << anOutPort->PortStatus() << endl ;
591     if ( anOutPort->IsDataConnected() ) {
592 //JR 30.03.2005      aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , *(anOutPort->Value()) ) ;
593       aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , anOutPort->Value() ) ;
594       anOutPort->PortStatus( ExternConnected ) ;
595     }
596   }
597   cdebug_out << "GraphBase::ComputingNode::SetMacroDatas" << endl;
598 }
599
600 void GraphBase::ComputingNode::DelInPort( const char * InputParameterName ) {
601   GraphBase::PortsOfNode::DelInPort( InputParameterName ) ;
602 }
603 void GraphBase::ComputingNode::DelOutPort( const char * OutputParameterName ) {
604   GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ;
605 }
606
607 GraphBase::InPort * GraphBase::ComputingNode::AddInPort( const char * InputParameterName ,
608                                                          const char * InputParameterType ,
609                                                          const SUPERV::KindOfPort aKindOfPort ,
610                                                          int index ) {
611   cdebug << "AddInPort " << Name() << " ConnectedInPortsNumber " << ConnectedInPortsNumber() << endl ;
612 // JR 12.01.2005 : InitLoop and DoLoop are reserved parameter names in LoopNodes :
613   if ( IsLoopNode() && ( strcmp( InputParameterName , "InitLoop" ) == 0 ||
614                          strcmp( InputParameterName , "DoLoop" ) == 0 ) ) {
615     return NULL ;
616   }
617   return GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
618                                             Kind() ,
619                                             InputParameterName ,
620                                             InputParameterType ,
621                                             aKindOfPort ,
622                                             index ,
623                                             _Graph_prof_debug , _Graph_fdebug ) ;
624 }
625 GraphBase::OutPort * GraphBase::ComputingNode::AddOutPort( const char * OutputParameterName ,
626                                                            const char * OutputParameterType ,
627                                                            const SUPERV::KindOfPort aKindOfPort ,
628                                                            int index ) {
629   cdebug << "AddOutPort " << Name() << " ConnectedInPortsNumber " << ConnectedInPortsNumber() << endl ;
630   return GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() ,
631                                              Kind() ,
632                                              OutputParameterName ,
633                                              OutputParameterType ,
634                                              aKindOfPort ,
635                                              index ,
636                                              _Graph_prof_debug , _Graph_fdebug ) ;
637 }
638
639 void GraphBase::ComputingNode::DelInDataStreamPort( const char * InputParameterName ) {
640   GraphBase::PortsOfNode::DelInPort( InputParameterName ) ;
641 }
642 void GraphBase::ComputingNode::DelOutDataStreamPort( const char * OutputParameterName ) {
643   GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ;
644 }
645
646 GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( const char * InputParameterName ,
647                                                                              const SALOME_ModuleCatalog::DataStreamType InputParameterType ,
648                                                                              const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
649                                                                              const SUPERV::KindOfPort aKindOfPort ,
650                                                                              int index ) {
651 //  IncrDataStreamInPorts() ;
652   GraphBase::InDataStreamPort * aDataStreamPort ;
653   aDataStreamPort = (GraphBase::InDataStreamPort * ) GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
654                                                                                         Kind() ,
655                                                                                         InputParameterName ,
656                                                                                         DataStreamTypeToString( InputParameterType ).c_str() ,
657                                                                                         aKindOfPort ,
658                                                                                         index ,
659                                                                                         _Graph_prof_debug ,
660                                                                                         _Graph_fdebug ) ;
661   aDataStreamPort->Dependency( aDependency ) ;
662   if ( aDependency == SALOME_ModuleCatalog::DATASTREAM_TEMPORAL ) {
663     aDataStreamPort->SetParams( SUPERV::TI , SUPERV::L1 , SUPERV::EXTRANULL ) ;
664   }
665   return aDataStreamPort ;
666 }
667 GraphBase::OutDataStreamPort * GraphBase::ComputingNode::AddOutDataStreamPort( const char * OutputParameterName ,
668                                                                                const SALOME_ModuleCatalog::DataStreamType OutputParameterType ,
669                                                                                const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
670                                                                                const SUPERV::KindOfPort aKindOfPort ,
671                                                                                int index ) {
672 //  IncrDataStreamOutPorts() ;
673   GraphBase::OutDataStreamPort * aDataStreamPort ;
674   aDataStreamPort = (GraphBase::OutDataStreamPort * ) GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() ,
675                                                                                           Kind() ,
676                                                                                           OutputParameterName ,
677                                                                                           DataStreamTypeToString( OutputParameterType ).c_str() ,
678                                                                                           aKindOfPort ,
679                                                                                           index ,
680                                                                                           _Graph_prof_debug ,
681                                                                                           _Graph_fdebug ) ;
682   aDataStreamPort->Dependency( aDependency ) ;
683   return aDataStreamPort ;
684 }
685
686
687 bool GraphBase::ComputingNode::CheckLoop(GraphBase::LoopNode * aLoopNode ,
688                                          GraphBase::EndOfLoopNode * anEndLoopNode ) const {
689   cdebug_in << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , "
690             << anEndLoopNode->Name() << ") LinkedNodesSize "
691             << LinkedNodesSize() << endl;
692
693   int i ;
694   if ( LinkedNodesSize() == 0 && !IsDataFlowNode() && !IsDataStreamNode() ) {
695     cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name()
696                << " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
697                << LinkedNodesSize() << " WARNING false" << endl;
698     return false ;
699   }
700 // We check that all nodes linked to that node go to the end of LoopNode :
701   for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
702     GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
703     cdebug << i << ". " << Name() << " Linked to " << aNode->Name() << endl ;
704     if ( !aNode->IsEndLoopNode() || aNode != anEndLoopNode ) {
705       if ( !aNode->CheckLoop( aLoopNode , anEndLoopNode ) ) {
706         cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name()
707                    << " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
708                    << LinkedNodesSize() << " WARNING false" << endl;
709         return false ;
710       }
711     }
712   }
713   cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , "
714              << anEndLoopNode->Name() << ") LinkedNodesSize "
715              << LinkedNodesSize() << " true" << endl;
716   return true ;
717 }
718
719 bool GraphBase::ComputingNode::CheckEndLoop(GraphBase::LoopNode * aLoopNode ,
720                                             GraphBase::EndOfLoopNode * anEndLoopNode ) const {
721   cdebug_in << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , "
722             << anEndLoopNode->Name() << ") LinkedFromNodesSize "
723             << LinkedFromNodesSize() << endl;
724
725   int i ;
726   if ( LinkedFromNodesSize() == 0 ) {
727     cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name()
728                << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
729                << LinkedFromNodesSize() << " WARNING false" << endl;
730     return false ;
731   }
732 // We have to check that all nodes linked from that node go to the beginning of LoopNode : 
733   for ( i = 0 ; i < LinkedFromNodesSize() ; i++ ) {
734     GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedFromNodes( i ) ;
735     cdebug << i << ". " << Name() << " Linked from " << aNode->Name() << endl ;
736     if ( !aNode->IsLoopNode() || aNode != aLoopNode ) {
737       if ( !aNode->CheckEndLoop( aLoopNode , anEndLoopNode ) ) {
738         cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name()
739                    << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
740                    << LinkedFromNodesSize() << " WARNING false" << endl;
741         return false ;
742       }
743     }
744   }
745   cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , "
746              << anEndLoopNode->Name() << ") LinkedFromNodesSize "
747              << LinkedFromNodesSize() << " true" << endl;
748   return true ;
749 }
750
751 bool GraphBase::ComputingNode::InitBranchOfSwitchDone(bool AllInit ,
752                                                       GraphBase::EndOfSwitchNode * anEndSwitchNode ) {
753   bool sts = BranchOfSwitchDone( false ) ;
754   if ( !sts && !AllInit && anEndSwitchNode != this ) {
755 // Common Node in branchs :
756     cdebug << Name() << "->ComputingNode::InitBranchOfSwitchDone WARNING false"
757            << endl ;
758     return false ;
759   }
760   int i ;
761   if ( !IsGOTONode() && anEndSwitchNode != this ) {
762     for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
763       GraphBase::ComputingNode * aNode ;
764       aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
765       if ( !aNode->InitBranchOfSwitchDone( AllInit , anEndSwitchNode ) ) {
766         return false ;
767       }
768     }
769   }
770   return true ;
771 }
772
773 bool GraphBase::ComputingNode::CheckSwitch(GraphBase::EndOfSwitchNode * anEndSwitchNode ) {
774   cdebug_in << Name() << "->ComputingNode::CheckSwitch( "
775             << anEndSwitchNode->Name() << " ) " << Kind() << endl;
776   if ( anEndSwitchNode == this ) {
777   }
778 // if it is a SwitchNode, continue the check at the corresponding EndSwitchNode
779   else if ( IsSwitchNode() ) {
780     GraphBase::EndOfSwitchNode * anOtherEndSwitchNode ;
781     anOtherEndSwitchNode = (GraphBase::EndOfSwitchNode * ) ((GraphBase::SwitchNode * ) this)->CoupledNode() ;
782     cdebug << Name() << "->ComputingNode::CheckSwitch will Check "
783            << anOtherEndSwitchNode->Name() << endl ;
784     if ( !anOtherEndSwitchNode->CheckSwitch( anEndSwitchNode ) ) {
785       cdebug_out << Name() << "->ComputingNode::CheckSwitch "
786                  << anOtherEndSwitchNode->Name() << " WARNING false" << endl;
787       return false ;
788     }
789   }
790   else {
791     int i ;
792     for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
793       GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ;
794       if ( !anOutPort->IsDataStream() ) {
795         int j ;
796         for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
797           GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ;
798           if ( !anInPort->IsDataStream() ) {
799             GraphBase::ComputingNode * aNode ;
800             aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
801             GraphBase::LoopNode * aLoopNode = NULL ;
802             GraphBase::EndOfLoopNode * aEndLoopNode = NULL ;
803             if ( IsLoopNode() ) {
804               aEndLoopNode = (GraphBase::EndOfLoopNode * ) ((GraphBase::LoopNode * ) this)->CoupledNode() ;
805               cdebug << Name() << "->ComputingNode::CheckSwitch LoopNode " << Name() << " coupled to "
806                      << aEndLoopNode << " " << aEndLoopNode->Name() << " aNode " << aNode << endl ;
807             }
808             else if ( IsEndLoopNode() ) {
809               aLoopNode = (GraphBase::LoopNode * ) ((GraphBase::EndOfLoopNode * ) this)->CoupledNode() ;
810               cdebug << Name() << "->ComputingNode::CheckSwitch EndLoopNode " << Name()
811                      << " coupled to "
812                      << aLoopNode << " " << aLoopNode->Name() << " aNode " << aNode << endl ;
813             }
814             if ( aNode == NULL ) {
815               cdebug << Name() << "->ComputingNode::CheckSwitch ignore "
816                      << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
817             }
818             else if ( aNode == anEndSwitchNode ) {
819               ((GraphBase::EndOfSwitchNode * ) aNode)->DecrEndSwitchInPortLinked( anInPort ) ;
820             }
821             else if ( aNode->BranchOfSwitchDone() ) {
822               cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
823                      << anInPort->NodeName() << "( " << anInPort->PortName() << " ) : already checked"
824                      << endl ;
825             }
826             else if ( IsLoopNode() && aNode == aEndLoopNode ) {
827               cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
828                      << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
829             }
830             else if ( IsEndLoopNode() && aNode == aLoopNode ) {
831               cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
832                      << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
833             }
834             else if ( aNode->IsGOTONode() ) {
835               cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
836                      << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
837               anEndSwitchNode->SetSwitchWithGOTO() ;
838             }
839             else {
840               cdebug << Name() << "->ComputingNode::CheckSwitch will Check "
841                      << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
842               if ( !aNode->CheckSwitch( anEndSwitchNode ) ) {
843                 cdebug_out << Name() << "->ComputingNode::CheckSwitch "
844                          << anEndSwitchNode->Name() << " WARNING false" << endl;
845                 return false ;
846               }
847 //            aNode->BranchOfSwitchDone( true ) ;
848             }
849           }
850         }
851       }
852     }
853   }
854   BranchOfSwitchDone( true ) ;
855   cdebug_out << Name() << "->ComputingNode::CheckSwitch BranchOfSwitchDone == true "
856              << anEndSwitchNode->Name() << " true" << endl;
857   return true ;
858 }
859
860 #include <sys/time.h>
861 #include <sys/resource.h>
862 #include <unistd.h>
863
864 const long GraphBase::ComputingNode::CpuUsed() {
865   struct rusage usage ;
866   if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) {
867     perror("GraphBase::CpuUsed") ;
868     return 0 ;
869   }
870 //  return usage.ru_utime.__time_t tv_sec ;
871   cdebug << "CpuUsed " << usage.ru_utime.tv_sec << " " << usage.ru_utime.tv_usec << " "
872          << usage.ru_stime.tv_sec << " " << usage.ru_stime.tv_usec << endl ;
873   return usage.ru_utime.tv_sec ;
874 }
875
876 #if 0
877 const GraphBase::ListOfParameters * GraphBase::ComputingNode::GetListOfParameters() const {
878   GraphBase::ListOfParameters * aListOfParameters = new GraphBase::ListOfParameters ;
879   if ( IsInLineNode() || IsGOTONode() ) {
880     unsigned int i;
881     for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
882       const InPort * anInPort = GetNodeInPort( i ) ;
883       if ( anInPort->IsBus() ) {
884         int size = aListOfParameters->size() ;
885         aListOfParameters->resize( size + 1 ) ;
886         (*aListOfParameters)[size].theInParameter.Parametername = anInPort->PortName() ;
887         (*aListOfParameters)[size].theInParameter.Parametertype = anInPort->PortType() ;
888         const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
889         (*aListOfParameters)[size].theOutParameter.Parametername = anOutPort->PortName() ;
890         (*aListOfParameters)[size].theOutParameter.Parametertype = anOutPort->PortType() ;
891       }
892     }
893   }
894   return aListOfParameters ;
895 }
896 #endif
897
898 bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
899                                         const char * ComponentName ,
900                                         const char * InterfaceName ,
901                                         const char * Computer ,
902                                         const char * CoupledNode ,
903                                         const ListOfFuncName FuncNames ,
904                                         const ListOfPythonFunctions PythonFunctions ,
905                                         int XCoordinate , int YCoordinate ) const {
906   cdebug_in << "SaveXML Node " << Name() << endl ;
907   QDomElement node = Graph.createElement( "node" ) ;
908   info.appendChild( node ) ;
909   QDomElement componentname = Graph.createElement( "component-name" ) ;
910   QDomText aField ;
911   if ( strlen( ComponentName ) ) {
912 //    f << Tabs << "<component-name>" << ComponentName << "</component-name>"
913 //      << endl ;
914 //    componentname.setNodeValue( ComponentName ) ;
915     aField = Graph.createTextNode( ComponentName ) ;
916   }
917   else {
918 //    f << Tabs << "<component-name>?</component-name>" << endl ;
919 //    componentname.setNodeValue( "?" ) ;
920     aField = Graph.createTextNode( "?" ) ;
921   }
922   node.appendChild( componentname ) ;
923   componentname.appendChild( aField ) ;
924
925   QDomElement interfacename = Graph.createElement("interface-name") ;
926   if ( strlen( InterfaceName ) ) {
927 //    f << Tabs << "<interface-name>" << InterfaceName << "</interface-name>"
928 //      << endl ;
929 //    interfacename.setAttribute("name" , InterfaceName ) ;
930     aField = Graph.createTextNode( InterfaceName ) ;
931   }
932   else {
933 //    f << Tabs << "<interface-name>?</interface-name>" << endl ;
934 //    interfacename.setAttribute("name" , "?" ) ;
935     aField = Graph.createTextNode( "?" ) ;
936   }
937   node.appendChild(interfacename) ;
938   interfacename.appendChild( aField ) ;
939
940 //  f << Tabs << "<node-name>" << Name() << "</node-name>" << endl ;
941   QDomElement nodename = Graph.createElement("node-name") ;
942   aField = Graph.createTextNode( Name() ) ;
943   node.appendChild( nodename ) ;
944   nodename.appendChild( aField ) ;
945
946 //  f << Tabs << "<kind>" << (int ) Kind() << "</kind>" << endl ;
947   QDomElement kind = Graph.createElement( "kind" ) ;
948   QString aKind ;
949
950   // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph
951 // JR : the bug was at line 566 : && HasDataStream() != 0 was missing
952   if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) {
953     aKind = aKind.setNum( SUPERV::DataFlowGraph ) ;
954   }
955   else {
956     aKind = aKind.setNum( Kind() ) ;
957   }
958   aField = Graph.createTextNode( aKind ) ;
959   node.appendChild( kind ) ;
960   kind.appendChild( aField ) ;
961
962   if ( IsDataStreamNode() && HasDataStream() != 0 ) {
963     long Timeout ;
964     SUPERV::KindOfDataStreamTrace DataStreamTrace ;
965     double DeltaTime ;
966     ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
967
968     QDomElement timeout = Graph.createElement("streamgraph-timeout") ;
969     QString aTimeout ;
970     aTimeout = aTimeout.setNum( Timeout ) ;
971     aField = Graph.createTextNode( aTimeout ) ;
972     node.appendChild( timeout ) ;
973     timeout.appendChild( aField ) ;
974
975     QDomElement datastreamtrace = Graph.createElement("streamgraph-datastreamtrace") ;
976     QString aDataStreamTrace ;
977     aDataStreamTrace = aDataStreamTrace.setNum( DataStreamTrace ) ;
978     aField = Graph.createTextNode( aDataStreamTrace ) ;
979     node.appendChild( datastreamtrace ) ;
980     datastreamtrace.appendChild( aField ) ;
981
982     QDomElement deltatime = Graph.createElement("streamgraph-deltatime") ;
983     QString aDeltaTime ;
984     aDeltaTime = aDeltaTime.setNum( DeltaTime ) ;
985     aField = Graph.createTextNode( aDeltaTime ) ;
986     node.appendChild( deltatime ) ;
987     deltatime.appendChild( aField ) ;
988   }
989
990   QDomElement couplednode = Graph.createElement("coupled-node") ;
991   if ( IsGOTONode() || IsLoopNode() || IsEndLoopNode() ||
992        IsSwitchNode() || IsEndSwitchNode() || IsMacroNode() ) {
993 //    f << Tabs << "<coupled-node>" << CoupledNode << "</coupled-node>"
994 //      << endl ;
995     aField = Graph.createTextNode( CoupledNode ) ;
996   }
997   else {
998 //    f << Tabs << "<coupled-node>?</coupled-node>" << endl ;
999     aField = Graph.createTextNode( "?" ) ;
1000   }
1001   node.appendChild(couplednode) ;
1002   couplednode.appendChild( aField ) ;
1003
1004 //  f << Tabs << "<service>" << endl ;
1005   QDomElement service = Graph.createElement("service") ;
1006   node.appendChild(service) ;
1007   QDomElement servicename = Graph.createElement("service-name") ;
1008   if ( strlen( ServiceName() ) ) {
1009 //    f << Tabs << "    <service-name>" << ServiceName() << "</service-name>" << endl ;
1010     aField = Graph.createTextNode( ServiceName() ) ;
1011   }
1012   else {
1013 //    f << Tabs << "    <service-name>?</service-name>" << endl ;
1014     aField = Graph.createTextNode( "?" ) ;
1015   }
1016   service.appendChild(servicename) ;
1017   servicename.appendChild( aField ) ;
1018
1019   cdebug << "SaveXML " << Name() << " In(" << ServiceInParameter().length()
1020          << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
1021   QDomElement inParameterlist = Graph.createElement("inParameter-list") ;
1022   service.appendChild(inParameterlist) ;
1023   unsigned int i;
1024   GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) this ;
1025   for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
1026     const GraphBase::InPort * anInPort ;
1027     anInPort = aNode->GetInPort( ServiceInParameter()[i].Parametername ) ;
1028     if ( !anInPort->IsDataStream() ) {
1029       cdebug << "SaveXML " << i << ". " << ServiceInParameter()[i].Parametername
1030              << " InParameterPort " << anInPort->Kind() << endl ;
1031       QDomElement inParameter = Graph.createElement("inParameter") ;
1032       inParameterlist.appendChild(inParameter) ;
1033       QDomElement inParametertype = Graph.createElement("inParameter-type") ;
1034       if ( strlen( ServiceInParameter()[i].Parametertype ) ) {
1035         aField = Graph.createTextNode( strdup( ServiceInParameter()[i].Parametertype ) ) ;
1036       }
1037       else {
1038         aField = Graph.createTextNode( "?" ) ;
1039       }
1040       inParameter.appendChild(inParametertype) ;
1041       inParametertype.appendChild( aField ) ;
1042       QDomElement inParametername = Graph.createElement("inParameter-name") ;
1043       if ( strlen( ServiceInParameter()[i].Parametername ) ) {
1044         aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
1045       }
1046       else {
1047         aField = Graph.createTextNode( "?" ) ;
1048       }
1049       inParameter.appendChild(inParametername) ;
1050       inParametername.appendChild( aField ) ;
1051     }
1052   }
1053   QDomElement outParameterlist = Graph.createElement("outParameter-list") ;
1054   service.appendChild(outParameterlist) ;
1055   for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) {
1056     const GraphBase::OutPort * anOutPort ;
1057     anOutPort = aNode->GetOutPort( ServiceOutParameter()[i].Parametername ) ;
1058     if ( !anOutPort->IsDataStream() ) {
1059       cdebug << "SaveXML " << i << ". " << ServiceOutParameter()[i].Parametername
1060              << " OutParameterPort " << anOutPort->Kind() << endl ;
1061       QDomElement outParameter = Graph.createElement("outParameter") ;
1062       outParameterlist.appendChild(outParameter) ;
1063       QDomElement outParametertype = Graph.createElement("outParameter-type") ;
1064       if ( strlen( ServiceOutParameter()[i].Parametertype ) ) {
1065         aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
1066       }
1067       else {
1068         aField = Graph.createTextNode( "?" ) ;
1069       }
1070       outParameter.appendChild(outParametertype) ;
1071       outParametertype.appendChild( aField ) ;
1072       QDomElement outParametername = Graph.createElement("outParameter-name") ;
1073       if ( strlen( ServiceOutParameter()[i].Parametername ) ) {
1074         aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
1075       }
1076       else {
1077         aField = Graph.createTextNode( "?" ) ;
1078       }
1079       outParameter.appendChild(outParametername) ;
1080       outParametername.appendChild( aField ) ;
1081     }
1082   }
1083
1084   QDomElement DataStreamlist = Graph.createElement("DataStream-list") ;
1085   node.appendChild( DataStreamlist ) ;
1086   for ( i = 0 ; i < (unsigned int ) GetNodeInPortsSize() ; i++ ) {
1087     const GraphBase::InPort * anInPort ;
1088     anInPort = aNode->GetNodeInPort( i ) ;
1089     if ( anInPort->IsDataStream() ) {
1090       cdebug << "SaveXML " << i << " " << Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
1091              << " InDataStreamPort " << anInPort->Kind() << endl ;
1092       QDomElement inParameter = Graph.createElement("inParameter") ;
1093       DataStreamlist.appendChild(inParameter) ;
1094       QDomElement inParametertype = Graph.createElement("inParameter-type") ;
1095       QString aType ;
1096       aType = aType.setNum( StringToDataStreamType( anInPort->PortType() ) ) ;
1097       cdebug << "SaveXML " << anInPort->PortType() << " --> " << StringToDataStreamType( anInPort->PortType() )
1098              << " " << aType << endl ;
1099       aField = Graph.createTextNode( aType ) ;
1100       inParameter.appendChild(inParametertype) ;
1101       inParametertype.appendChild( aField ) ;
1102       QDomElement inParametername = Graph.createElement("inParameter-name") ;
1103       if ( strlen( anInPort->PortName() ) ) {
1104         aField = Graph.createTextNode( strdup(anInPort->PortName()) ) ;
1105       }
1106       else {
1107         aField = Graph.createTextNode( "?" ) ;
1108       }
1109       inParameter.appendChild(inParametername) ;
1110       inParametername.appendChild( aField ) ;
1111       cdebug << "SaveXML " << anInPort->PortName() << endl ;
1112       QDomElement inParameterdependency = Graph.createElement("inParameter-dependency") ;
1113       QString aDependency ;
1114       aDependency = aDependency.setNum( anInPort->Dependency() ) ;
1115       aField = Graph.createTextNode( aDependency ) ;
1116       inParameter.appendChild(inParameterdependency) ;
1117       inParameterdependency.appendChild( aField ) ;
1118       cdebug << "SaveXML Dependency " << anInPort->Dependency() << endl ;
1119       SUPERV::KindOfSchema        aKindOfSchema ;
1120       SUPERV::KindOfInterpolation aKindOfInterpolation ;
1121       SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1122       ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1123       QDomElement inParameterKindOfSchema = Graph.createElement("inParameter-schema") ;
1124       QString aSchema ;
1125       aSchema = aSchema.setNum( aKindOfSchema ) ;
1126       aField = Graph.createTextNode( aSchema ) ;
1127       inParameter.appendChild(inParameterKindOfSchema) ;
1128       inParameterKindOfSchema.appendChild( aField ) ;
1129       cdebug << "SaveXML aKindOfSchema " << aKindOfSchema << endl ;
1130       QDomElement inParameterKindOfInterpolation = Graph.createElement("inParameter-interpolation") ;
1131       QString anInterpolation ;
1132       anInterpolation = anInterpolation.setNum( aKindOfInterpolation ) ;
1133       aField = Graph.createTextNode( anInterpolation ) ;
1134       inParameter.appendChild(inParameterKindOfInterpolation) ;
1135       inParameterKindOfInterpolation.appendChild( aField ) ;
1136       cdebug << "SaveXML aKindOfInterpolation " << aKindOfInterpolation << endl ;
1137       QDomElement inParameterKindOfExtrapolation = Graph.createElement("inParameter-extrapolation") ;
1138       QString anExtrapolation ;
1139       anExtrapolation = anExtrapolation.setNum( aKindOfExtrapolation ) ;
1140       aField = Graph.createTextNode( anExtrapolation ) ;
1141       inParameter.appendChild(inParameterKindOfExtrapolation) ;
1142       inParameterKindOfExtrapolation.appendChild( aField ) ;
1143       cdebug << "SaveXML aKindOfExtrapolation " << aKindOfExtrapolation << endl ;
1144     }
1145   }
1146   for ( i = 0 ; i < (unsigned int ) GetNodeOutPortsSize() ; i++ ) {
1147     const GraphBase::OutPort * anOutPort ;
1148     anOutPort = aNode->GetNodeOutPort( i ) ;
1149     if ( anOutPort->IsDataStream() ) {
1150       cdebug << "SaveXML " << i << " " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
1151              << " OutDataStreamPort " << anOutPort->Kind() << endl ;
1152       QDomElement outParameter = Graph.createElement("outParameter") ;
1153       DataStreamlist.appendChild(outParameter) ;
1154       QDomElement outParametertype = Graph.createElement("outParameter-type") ;
1155       QString aType ;
1156       aType = aType.setNum( StringToDataStreamType( anOutPort->PortType() ) ) ;
1157       cdebug << "SaveXML " << anOutPort->PortType() << " --> " << StringToDataStreamType( anOutPort->PortType() )
1158              << " " << aType << endl ;
1159       aField = Graph.createTextNode( aType ) ;
1160       outParameter.appendChild(outParametertype) ;
1161       outParametertype.appendChild( aField ) ;
1162       QDomElement outParametername = Graph.createElement("outParameter-name") ;
1163       if ( strlen( anOutPort->PortName() ) ) {
1164         aField = Graph.createTextNode( strdup(anOutPort->PortName() ) ) ;
1165       }
1166       else {
1167         aField = Graph.createTextNode( "?" ) ;
1168       }
1169       outParameter.appendChild(outParametername) ;
1170       outParametername.appendChild( aField ) ;
1171       cdebug << "SaveXML " << anOutPort->PortName() << endl ;
1172       QDomElement outParameterdependency = Graph.createElement("outParameter-dependency") ;
1173       QString aDependency ;
1174       aDependency = aDependency.setNum( anOutPort->Dependency() )  ;
1175       aField = Graph.createTextNode( aDependency ) ;
1176       outParameter.appendChild(outParameterdependency) ;
1177       outParameterdependency.appendChild( aField ) ;
1178       cdebug << "SaveXML Dependency " << anOutPort->Dependency() << endl ;
1179       long aNumberOfValues ;
1180       aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1181       QDomElement outParameterNumberOfValues = Graph.createElement("outParameter-values") ;
1182       QString aValues ;
1183       aValues = aValues.setNum( aNumberOfValues ) ;
1184       aField = Graph.createTextNode( aValues ) ;
1185       outParameter.appendChild(outParameterNumberOfValues) ;
1186       outParameterNumberOfValues.appendChild( aField ) ;
1187       cdebug << "SaveXML NumberOfValues " << ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() << endl ;
1188     }
1189   }
1190 //  f << Tabs << "</Parameter-list>" << endl ;    
1191
1192 //  f << Tabs << "<PyFunction-list>" << endl ;
1193   QDomElement PyFunctionlist = Graph.createElement("PyFunction-list") ;
1194   node.appendChild( PyFunctionlist ) ;
1195   for ( i = 0 ; i < PythonFunctions.size() ; i++ ) {
1196 //    f << Tabs << "    <PyFunction>" << endl ;
1197     QDomElement PyFunction = Graph.createElement("PyFunction") ;
1198     PyFunctionlist.appendChild( PyFunction ) ;
1199     int j ;
1200     QDomElement FuncName = Graph.createElement("FuncName") ;
1201     if ( strlen( FuncNames[i].c_str() ) ) {
1202       aField = Graph.createTextNode( FuncNames[i].c_str() ) ;
1203     }
1204     else {
1205       aField = Graph.createTextNode( "?" ) ;
1206     }
1207     PyFunction.appendChild( FuncName ) ;
1208     FuncName.appendChild( aField ) ;
1209     if ( (*PythonFunctions[i]).length() ) {
1210       for ( j = 0 ; j < (int ) (*PythonFunctions[i]).length() ; j++ ) {
1211         QDomElement PyFunc = Graph.createElement("PyFunc") ;
1212         QDomCDATASection aCDATA ;
1213       // mpv: Linux 8.0 compiler compatibility
1214         char * aCDATAChar = strdup ((*PythonFunctions[i])[j]) ;
1215         int i ;
1216         for ( i = 0 ; i < (int ) strlen( aCDATAChar ) ; i++ ) {
1217           if ( aCDATAChar[ i ] != ' ' ) {
1218             break ;
1219           }
1220         }
1221         if ( i == (int ) strlen( aCDATAChar ) ) {
1222           aCDATA = Graph.createCDATASection( "?" ) ;
1223         }
1224         else {
1225           aCDATA = Graph.createCDATASection( aCDATAChar ) ;
1226         }
1227         PyFunction.appendChild( PyFunc ) ;
1228         PyFunc.appendChild( aCDATA ) ;
1229       }
1230     }
1231     else {
1232       QDomElement PyFunc = Graph.createElement("PyFunc") ;
1233       QDomCDATASection aCDATA = Graph.createCDATASection( "?" ) ;
1234       PyFunction.appendChild( PyFunc ) ;
1235       PyFunc.appendChild( aCDATA ) ;
1236     }
1237   }
1238
1239 //  f << Tabs << "<creation-date>" << FirstCreation() << "</creation-date>"
1240 //    << endl ;
1241   QDomElement creationdate = Graph.createElement("creation-date") ;
1242   char fdate[30] ;
1243   sprintf( fdate , "%d/%d/%d - %d:%d:%d" ,  FirstCreation().Day , FirstCreation().Month , FirstCreation().Year , FirstCreation().Hour , FirstCreation().Minute , FirstCreation().Second ) ;
1244   aField = Graph.createTextNode( fdate ) ;
1245   node.appendChild( creationdate ) ;
1246   creationdate.appendChild( aField ) ;
1247 //  f << Tabs << "<lastmodification-date>" << LastModification()
1248 //    << "</lastmodification-date>" << endl ;
1249   QDomElement lastmodificationdate = Graph.createElement("lastmodification-date") ;
1250   char ldate[30] ;
1251   sprintf( ldate , "%d/%d/%d - %d:%d:%d" , LastModification().Day , LastModification().Month , LastModification().Year , LastModification().Hour , LastModification().Minute , LastModification().Second ) ;
1252   aField = Graph.createTextNode( ldate ) ;
1253   node.appendChild( lastmodificationdate ) ;
1254   lastmodificationdate.appendChild( aField ) ;
1255 //  f << Tabs << "<editor-release>" << EditorRelease() << "</editor-release>"
1256 //    << endl ;
1257   QDomElement editorrelease = Graph.createElement("editor-release") ;
1258   aField = Graph.createTextNode( EditorRelease() ) ;
1259   node.appendChild( editorrelease ) ;
1260   editorrelease.appendChild( aField ) ;
1261   QDomElement author = Graph.createElement("author") ;
1262   if ( strlen( Author() ) ) {
1263 //    f << Tabs << "<author>" << Author() << "</author>" << endl ;
1264     aField = Graph.createTextNode( Author() ) ;
1265   }
1266   else {
1267 //    f << Tabs << "<author>?</author>" << endl ;
1268     aField = Graph.createTextNode( "?" ) ;
1269   }
1270   node.appendChild( author ) ;
1271   author.appendChild( aField ) ;
1272   QDomElement container = Graph.createElement("container") ;
1273   if ( IsFactoryNode() && strlen( Computer) ) {
1274 //    f << Tabs << "<container>" << Computer << "</container>" << endl ;
1275     aField = Graph.createTextNode( Computer ) ;
1276   }
1277   else {
1278 //    f << Tabs << "<container>?</container>" << endl ;
1279     aField = Graph.createTextNode( "?" ) ;
1280   }
1281   node.appendChild( container ) ;
1282   container.appendChild( aField ) ;
1283   QDomElement comment = Graph.createElement("comment") ;
1284   if ( strlen( Comment() ) ) {
1285 //    f << Tabs << "<comment>" << Comment() << "</comment>" << endl ;
1286     aField = Graph.createTextNode( Comment() ) ;
1287   }
1288   else {
1289 //    f << Tabs << "<comment>?</comment>" << endl ;
1290     aField = Graph.createTextNode( "?" ) ;
1291   }
1292   node.appendChild( comment ) ;
1293   comment.appendChild( aField ) ;
1294 //  f << Tabs << "<x-position>" << XCoordinate << "</x-position>" << endl ;
1295   QDomElement xposition = Graph.createElement("x-position") ;
1296   QString aXCoordinate ;
1297   aXCoordinate = aKind.setNum( XCoordinate ) ;
1298   aField = Graph.createTextNode( aXCoordinate ) ;
1299   node.appendChild( xposition ) ;
1300   xposition.appendChild( aField ) ;
1301 //  f << Tabs << "<y-position>" << YCoordinate << "</y-position>" << endl ;
1302   QDomElement yposition = Graph.createElement("y-position") ;
1303   QString aYCoordinate ;
1304   aYCoordinate = aKind.setNum( YCoordinate ) ;
1305   aField = Graph.createTextNode( aYCoordinate ) ;
1306   node.appendChild( yposition ) ;
1307   yposition.appendChild( aField ) ;
1308   cdebug_out << "SaveXML Node " << Name() << endl ;
1309   return true ;
1310 }
1311
1312 bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
1313                                        const char * ComponentName ,
1314                                        const char * InterfaceName ,
1315                                        const char * Computer ,
1316                                        const GraphBase::InLineNode * aCoupledNode ,
1317                                        const ListOfFuncName FuncNames ,
1318                                        const ListOfPythonFunctions PythonFunctions ,
1319                                        int XCoordinate , int YCoordinate ) const {
1320   cdebug_in << "ComputingNode::SavePY " << Name() << endl ;
1321   // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph
1322 // JR : the bug was at line 927 : && HasDataStream() != 0 was missing
1323   if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) {
1324     f << "    " << Name() << " = Graph( '" << Name() << "' )" << endl ;
1325      if ( GraphMacroLevel() ) {
1326       f << "    " << Name() << ".SetCoupled( '"
1327         << ((GraphBase::GOTONode * ) this)->CoupledNodeName() << "' )" << endl ;
1328     }
1329   }
1330   else if ( IsDataStreamNode() && HasDataStream() != 0 ) {
1331     f << "    " << Name() << " = StreamGraph( '" << Name() << "' )" << endl ;
1332     long Timeout ;
1333     SUPERV::KindOfDataStreamTrace DataStreamTrace ;
1334     double DeltaTime ;
1335     ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
1336     f << "    " << aGraphName << ".SetStreamParams( " << Timeout << " , SUPERV." << DataStreamTrace
1337       << " , " << DeltaTime << " )" << endl ;
1338   }
1339   else if ( IsComputingNode() ) {
1340     int i ;
1341     f << "    " << Name() << "_ServiceinParameter = []" << endl ;
1342     for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
1343       f << "    " << Name() << "_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
1344         << ServiceInParameter()[i].Parametertype << "' , '"
1345         << ServiceInParameter()[i].Parametername << "' ) )" << endl ;
1346     }
1347     f << "    " << Name() << "_ServiceoutParameter = []" << endl ;
1348     for ( i = 0 ; i < (int ) ServiceOutParameter().length() ; i++ ) {
1349       f << "    " << Name() << "_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
1350         << ServiceOutParameter()[i].Parametertype << "' , '"
1351         << ServiceOutParameter()[i].Parametername << "' ) )" << endl ;
1352     }
1353     f << "    " << Name() << "_ServiceinStreamParameter = []" << endl ;
1354     for ( i = 0 ; i < (int ) ServiceInStreamParameter().length() ; i++ ) {
1355       f << "    " << Name() << "_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog."
1356         << ServiceInStreamParameter()[i].Parametertype << " , '"
1357         << ServiceInStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog."
1358         << ServiceInStreamParameter()[i].Parameterdependency << " ) )" << endl ;
1359     }
1360     f << "    " << Name() << "_ServiceoutStreamParameter = []" << endl ;
1361     for ( i = 0 ; i < (int ) ServiceOutStreamParameter().length() ; i++ ) {
1362       f << "    " << Name() << "_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog."
1363         << ServiceOutStreamParameter()[i].Parametertype << " , '"
1364         << ServiceOutStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog."
1365         << ServiceOutStreamParameter()[i].Parameterdependency << " ) )" << endl ;
1366     }
1367     f << "    " << Name() << "_Service = SALOME_ModuleCatalog.Service( '" << ServiceName()
1368       << "' , " << Name() << "_ServiceinParameter"
1369       << " , " << Name() << "_ServiceoutParameter"
1370       << " , " << Name() << "_ServiceinStreamParameter"
1371       << " , " << Name() << "_ServiceoutStreamParameter"
1372       << " , 0 , 0 )" << endl ;
1373     f << "    " << Name() << " = " << aGraphName << ".CNode( " << Name() << "_Service" << " )"
1374       << endl ;
1375   }
1376   else if ( IsFactoryNode() ) {
1377     f << "    " << Name() << " = " << aGraphName << ".FNode( '" << ComponentName
1378       << "' , '" << InterfaceName << "' , '" << ServiceName() << "' )"
1379       << endl ;
1380   }
1381   else if ( IsEndLoopNode() || IsEndSwitchNode() ) {
1382 // It is done with LoopNode or SwitchNode with CoupledNode()
1383   }
1384   else {
1385     if ( !IsMacroNode() ) {
1386       f << "    " << "Py" << Name() << " = []" << endl ;
1387     }
1388     int i ;
1389     SUPERV::ListOfStrings aPyFunc ;
1390     if ( PythonFunctions.size() ) {
1391       aPyFunc = *PythonFunctions[0] ;
1392       for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
1393         f << "    " << "Py" << Name() << ".append( '" << aPyFunc[i] << "' )" << endl ;
1394       }
1395     }
1396     if ( IsInLineNode() ) {
1397       f << "    " << Name() << " = " << aGraphName << ".INode( '" << FuncNames[0].c_str() << "' , Py"
1398         << Name() << " )" << endl ;
1399     }
1400     else if ( IsGOTONode() ) {
1401       if ( aCoupledNode ) {
1402         f << "    " << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
1403           << Name() << " , '" << aCoupledNode->Name() << "' )" << endl ;
1404       }
1405       else {
1406         f << "    " << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
1407           << Name() << " , '' )" << endl ;
1408       }
1409     }
1410     else if ( IsMacroNode() ) {
1411       if ( aCoupledNode ) {
1412         f << "    " << aCoupledNode->Name() << " = Def" << aCoupledNode->Name() << "()" << endl ;
1413         f << "    " << Name() << " = " << aGraphName << ".GraphMNode( " << aCoupledNode->Name() << " )" << endl ;
1414       }
1415       else {
1416         f << "    " << Name() << " = " << aGraphName << ".GraphMNode( ? )" << endl ;
1417       }
1418       f << "    " << Name() << ".SetCoupled( '" << aCoupledNode->Name() << "' )" << endl ;
1419     }
1420     else {
1421 //      char * EndName = NULL ;
1422 //      EndName = new char[ 3 + strlen( Name() ) + 1 ] ;
1423 //      strcpy( EndName , "End" ) ;
1424 //      strcat( EndName , Name() ) ;
1425       char * EndName = aCoupledNode->Name() ;
1426       cdebug << "ComputingNode::SavePY Node " << Name() << " EndName " << EndName
1427              << endl ;
1428       if ( IsLoopNode() ) {
1429         int i ;
1430         SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ;
1431         SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ;
1432         f << "    " << "PyMore" << Name() << " = []" << endl ;
1433         for ( i = 0 ; i < (int ) aPyMore.length() ; i++ ) {
1434           f << "    " << "PyMore" << Name() << ".append( '" << aPyMore[i] << "' )" << endl ;
1435         }
1436         f << "    " << "PyNext" << Name() << " = []" << endl ;
1437         for ( i = 0 ; i < (int ) aPyNext.length() ; i++ ) {
1438           f << "    " << "PyNext" << Name() << ".append( '" << aPyNext[i] << "' )" << endl ;
1439         }
1440         f << "    " << Name() << "," << EndName << " = " << aGraphName << ".LNode( '"
1441           << FuncNames[0].c_str() << "' , Py" << Name() << " , '"
1442           << FuncNames[1].c_str() << "' , PyMore" << Name()
1443           << " , '" << FuncNames[2].c_str() << "' , PyNext"
1444           << Name() << " )" << endl ;
1445         f << "    " << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
1446         f << "    " << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
1447         f << "    " << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
1448         f << "    " << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
1449           << aCoupledNode->YCoordinate() << " )" << endl ;
1450         SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
1451         f << "    " << "Py" << aCoupledNode->Name() << " = []" << endl ;
1452         for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
1453           f << "    " << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
1454             << endl ;
1455         }
1456         f << "    " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
1457         for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1458           const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1459           cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
1460                  << " " << anInPort->Kind() << endl ;
1461           if ( anInPort->IsLoop() ) {
1462             f << "    " << "I" << Name() << anInPort->PortName() << " = "
1463               << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1464           }
1465           else if ( anInPort->IsInLine() ) {
1466             f << "    " << "I" << Name() << anInPort->PortName() << " = "
1467               << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
1468               << anInPort->PortType() << "' )" << endl ;
1469           }
1470           else if ( anInPort->IsDataStream() ) {
1471             f << "    " << "I" << Name() << anInPort->PortName() << " = " << Name()
1472               << ".InStreamPort( '" << anInPort->PortName()
1473               << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
1474               << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
1475             SUPERV::KindOfSchema        aKindOfSchema ;
1476             SUPERV::KindOfInterpolation aKindOfInterpolation ;
1477             SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1478             ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1479             f << "    " << "I" << Name() << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1480               << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1481           }
1482           else if ( anInPort->IsGate() ) {
1483             f << "    " << "I" << Name() << anInPort->PortName() << " = "
1484               << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1485           }
1486         }
1487         for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1488           const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1489           cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
1490                  << " " << anOutPort->Kind() << endl ;
1491           if ( anOutPort->IsInLine() || anOutPort->IsLoop() ) {
1492             f << "    " << "O" << Name() << anOutPort->PortName() << " = "
1493               << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1494           }
1495           else if ( anOutPort->IsDataStream() ) {
1496             f << "    " << "O" << Name() << anOutPort->PortName() << " = " << Name()
1497               << ".OutStreamPort( '" << anOutPort->PortName()
1498               << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
1499               << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
1500             long aNumberOfValues ;
1501             aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1502             f << "    " << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
1503               << endl ;
1504           }
1505         }
1506         for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
1507           const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
1508           cdebug << "Node " << aCoupledNode->Name() << " InPort " << anInPort->PortName()
1509                  << " " << anInPort->Kind() << endl ;
1510           if ( anInPort->IsInLine() || anInPort->IsLoop() || anInPort->IsGate() ) {
1511             f << "    " << "I" << EndName << anInPort->PortName() << " = " << EndName
1512               << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1513           }
1514           else if ( anInPort->IsDataStream() ) {
1515             f << "    " << "I" << EndName << anInPort->PortName() << " = " << EndName
1516               << ".InStreamPort( '" << anInPort->PortName()
1517               << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
1518               << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
1519             SUPERV::KindOfSchema        aKindOfSchema ;
1520             SUPERV::KindOfInterpolation aKindOfInterpolation ;
1521             SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1522             ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1523             f << "    " << "I" << EndName << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1524               << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1525           }
1526         }
1527         for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) {
1528           const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ;
1529           cdebug << "Node " << aCoupledNode->Name() << " OutPort " << anOutPort->PortName()
1530                  << " " << anOutPort->Kind() << endl ;
1531           if ( anOutPort->IsInLine() || anOutPort->IsLoop() || anOutPort->IsGate() ) {
1532             f << "    " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1533               << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1534           }
1535           else if ( anOutPort->IsDataStream() ) {
1536             f << "    " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1537               << ".OutStreamPort( '" << anOutPort->PortName()
1538               << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
1539               << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
1540             long aNumberOfValues ;
1541             aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1542             f << "    " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
1543               << endl ;
1544           }
1545         }
1546       }
1547       else if ( IsSwitchNode() ) {
1548         f << "    " << Name() << "," << EndName << " = " << aGraphName << ".SNode( '"
1549           << FuncNames[0].c_str() << "' , Py" << Name() << " )" << endl ;
1550         f << "    " << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
1551         f << "    " << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
1552         f << "    " << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
1553         f << "    " << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
1554           << aCoupledNode->YCoordinate() << " )" << endl ;
1555         SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
1556         f << "    " << "Py" << aCoupledNode->Name() << " = []" << endl ;
1557         for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
1558           f << "    " << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
1559             << endl ;
1560         }
1561         f << "    " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
1562         for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
1563           const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
1564           cdebug << "Node " << aCoupledNode->Name() << " InPort " << anInPort->PortName()
1565                  << " " << anInPort->Kind() << endl ;
1566 //          if ( anInPort->IsGate() || anInPort->IsEndSwitch() ) {
1567           if ( anInPort->IsGate() ) {
1568             f << "    " << "I" << EndName << anInPort->PortName() << " = " << EndName
1569               << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1570           }
1571           else if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
1572             f << "    " << "I" << EndName << anInPort->PortName() << " = " << EndName
1573               << ".InPort( '" << anInPort->PortName()
1574               << "' , '" << anInPort->PortType() << "' )" << endl ;
1575           }
1576           else if ( anInPort->IsDataStream() ) {
1577             f << "    " << "I" << EndName << anInPort->PortName() << " = " << EndName
1578               << ".InStreamPort( '" << anInPort->PortName()
1579               << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
1580               << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
1581             SUPERV::KindOfSchema        aKindOfSchema ;
1582             SUPERV::KindOfInterpolation aKindOfInterpolation ;
1583             SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1584             ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1585             f << "    " << "I" << EndName << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1586               << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1587           }
1588         }
1589         for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) {
1590           const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ;
1591           cdebug << "Node " << aCoupledNode->Name() << " OutPort " << anOutPort->PortName()
1592                  << " " << anOutPort->Kind() << endl ;
1593 //          if ( anOutPort->IsGate() || anOutPort->IsEndSwitch() ) {
1594           if ( anOutPort->IsGate() ) {
1595             f << "    " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1596               << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1597           }
1598           else if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
1599             f << "    " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1600               << ".OutPort( '" << anOutPort->PortName()
1601               << "' , '" << anOutPort->PortType() << "' )" << endl ;
1602           }
1603           else if ( anOutPort->IsDataStream() ) {
1604             f << "    " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1605               << ".OutStreamPort( '" << anOutPort->PortName()
1606               << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
1607               << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
1608             long aNumberOfValues ;
1609             aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1610             f << "    " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
1611               << endl ;
1612           }
1613         }
1614       }
1615       cdebug << "ComputingNode::SavePY Node " << Name() << " EndName " << EndName
1616              << endl ;
1617 // PAL8507
1618 //JR 24.02.2005 Debug !!!... : I should not delete myself : what a stupid thing !
1619 //      delete [] EndName ;
1620     }
1621   }
1622
1623   if ( IsEndLoopNode() || IsEndSwitchNode() ) {
1624 // It is done with LoopNode or SwitchNode with CoupledNode()
1625   }
1626   else {
1627     f << "    " << Name() << ".SetName( '" << Name() << "' )" << endl ;
1628     f << "    " << Name() << ".SetAuthor( '" << Author() << "' )" << endl ;
1629     if ( IsFactoryNode() ) {
1630       f << "    " << Name() << ".SetContainer( '" << Computer << "' )" << endl ;
1631     }
1632     f << "    " << Name() << ".SetComment( '" << Comment() << "' )" << endl ;
1633     f << "    " << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ;
1634
1635     if ( IsComputingNode() || IsFactoryNode() ) {
1636       int i ;
1637       for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1638         const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1639         if ( !anInPort->IsDataStream() ) {
1640           cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
1641                  << " " << anInPort->Kind() << endl ;
1642           f << "    " << "I" << Name() << anInPort->PortName() << " = "
1643             << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1644         }
1645       }
1646       for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1647         const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1648         if ( !anOutPort->IsDataStream() ) {
1649           cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
1650                  << " " << anOutPort->Kind() << endl ;
1651           f << "    " << "O" << Name() << anOutPort->PortName() << " = "
1652             << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1653         }
1654       }
1655     }
1656     else if ( IsOneOfInLineNodes() && !IsLoopNode() ) {
1657       int i ;
1658       for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1659         const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1660         cdebug << "ComputingNode::SavePY Node " << Name() << " InPort " << anInPort->PortName()
1661                << " " << anInPort->Kind() << endl ;
1662 //        if ( anInPort->IsGate() || ( anInPort->IsInLine() && IsMacroNode() ) ) {
1663         if ( anInPort->IsGate() || IsMacroNode() ) {
1664           f << "    " << "I" << Name() << anInPort->PortName() << " = "
1665             << Name() << ".GetInPort( '" << anInPort->PortName()  << "' )" << endl ;
1666         }
1667         else if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
1668           f << "    " << "I" << Name() << anInPort->PortName() << " = "
1669             << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
1670             << anInPort->PortType() << "' )" << endl ;
1671         }
1672         else {
1673           cdebug << "Ignored " << Name() << " " << anInPort->PortName() << " " << anInPort->PortStatus() << endl ;
1674 //          f << "    " << "I" << Name() << anInPort->PortName() << " = "
1675 //            << Name() << ".GetInPort( '" << anInPort->PortName()  << "' )" << endl ;
1676         }
1677       }
1678       for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1679         const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1680         cdebug << "ComputingNode::SavePY Node " << Name() << " OutPort " << anOutPort->PortName()
1681                << " " << anOutPort->Kind() << endl ;
1682 //        if ( anOutPort->IsGate() || ( anOutPort->IsInLine() && IsMacroNode() ) ) {
1683         if ( anOutPort->IsGate() || IsMacroNode() ) {
1684           f << "    " << "O" << Name() << anOutPort->PortName() << " = "
1685             << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1686         }
1687         else if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
1688           f << "    " << "O" << Name() << anOutPort->PortName() << " = "
1689             << Name() << ".OutPort( '" << anOutPort->PortName()
1690             << "' , '" << anOutPort->PortType() << "' )" << endl ;
1691         }
1692         else {
1693           cdebug << "Ignored " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortStatus() << endl ;
1694 //          f << "    " << "O" << Name() << anOutPort->PortName() << " = "
1695 //            << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1696         }
1697       }
1698     }
1699     if ( !IsDataFlowNode() && !IsDataStreamNode() ) {
1700       int i ;
1701       for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1702         const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1703         cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
1704                << " " << anInPort->Kind() << endl ;
1705         if ( anInPort->IsDataStream() ) {
1706           if ( IsOneOfInLineNodes() ) {
1707             f << "    " << "I" << Name() << anInPort->PortName() << " = "
1708               << Name() << ".InStreamPort( '" << anInPort->PortName() << "' , SALOME_ModuleCatalog."
1709               << StringToDataStreamType( anInPort->PortType() ) << " , SALOME_ModuleCatalog."
1710               << anInPort->Dependency() << " )" << endl ;
1711           }
1712           else {
1713             f << "    " << "I" << Name() << anInPort->PortName() << " = "
1714               << Name() << ".GetInStreamPort( '" << anInPort->PortName() << "' )" << endl ;
1715           }
1716           SUPERV::KindOfSchema        aKindOfSchema ;
1717           SUPERV::KindOfInterpolation aKindOfInterpolation ;
1718           SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1719           ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1720           f << "    " << "I" << Name() << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1721             << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1722         }
1723       }
1724       for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1725         const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1726         cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
1727                << " " << anOutPort->Kind() << endl ;
1728         if ( anOutPort->IsDataStream() ) {
1729           if ( IsOneOfInLineNodes() ) {
1730             f << "    " << "O" << Name() << anOutPort->PortName() << " = "
1731               << Name() << ".OutStreamPort( '" << anOutPort->PortName() << "' , SALOME_ModuleCatalog."
1732               << StringToDataStreamType( anOutPort->PortType() ) << " , SALOME_ModuleCatalog."
1733               << anOutPort->Dependency() << " )" << endl ;
1734           }
1735           else {
1736             f << "    " << "O" << Name() << anOutPort->PortName() << " = "
1737               << Name() << ".GetOutStreamPort( '" << anOutPort->PortName() << "' )" << endl ;
1738           }
1739           long aNumberOfValues ;
1740           aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1741           f << "    " << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" << endl ;
1742         }
1743       }
1744     }
1745   }
1746
1747   cdebug_out << "ComputingNode::SavePY " ;
1748   NodeInfo( *_fdebug ) ;
1749   cdebug << endl ;
1750   return true ;
1751 }
1752
1753 void GraphBase::ComputingNode::NodeInfo(ostream & s) const {
1754   s << *this ;
1755   ListPorts( s , true ) ;
1756   s << ends ;
1757 }
1758
1759 ostream & operator<< (ostream & f,const GraphBase::ComputingNode & G) {
1760 //  f << "ComponentName    " << G.ComponentName() << endl ;
1761   if ( G.IsComputingNode() ) {
1762     f << "NodeName         " << G.Name() << endl ;
1763   }
1764   else {
1765     f << "DataFlowName     " << G.Name() << endl ;
1766   }
1767   f << "Kind             " << G.Kind() << endl ;
1768   f << "Service          " << *G.GetService() ;
1769   f << "FirstCreation    " << G.FirstCreation () << endl ;
1770   f << "LastModification " << G.LastModification() << endl ;
1771   f << "EditorRelease    " << G.EditorRelease() << endl ;
1772   f << "Author           " << G.Author() << endl ;
1773 //  f << "Computer         " << G.Computer() << endl ;
1774   f << "Comment          " << G.Comment() << endl ;
1775   f << endl ;
1776   
1777   return f;
1778 }
1779
1780 void GraphBase::ComputingNode::ListLinks(ostream &f ) const {
1781   int i ;
1782   for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1783     const GraphBase::OutPort* fromPort = GetNodeOutPort( i ) ;
1784     if ( fromPort->IsPortConnected() ) {
1785       int j ;
1786       for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) {
1787         if ( j == 0 ) {
1788           f << "FromNode " << Name() << endl ;
1789         }
1790         f << "         FromServiceParameterName "
1791           << fromPort->GetServicesParameter().Parametername ;
1792         const GraphBase::InPort* toPort = fromPort->InPorts( j ) ;
1793         f << " ToNode " << toPort->NodeName() ;
1794         f << " ToServiceParameterName "
1795           << toPort->GetServicesParameter().Parametername;
1796         f << " Value " ;
1797         fromPort->StringValue( f ) ;
1798         f << endl ;
1799       }
1800     }
1801   }
1802 }
1803
1804 ostream & operator<< (ostream &fOut,const SUPERV::SDate &D) {
1805 //  cdebug_in << "operator<< GraphEditor::Date" << endl;
1806
1807   fOut  << D.Day << "/" 
1808         << D.Month << "/" 
1809         << D.Year << " - " 
1810         << D.Hour << ":" 
1811         << D.Minute <<  ":"  
1812         << D.Second;
1813
1814 //  cdebug_out << "operator<< GraphEditor::Date" << endl;
1815   return fOut;
1816 }
1817