Salome HOME
aab8ceaafb814d38e79b5981f0b480d2cf333c7b
[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_Node.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_InLineNode.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                &_ConnectedInPortsNumber ,
28                         int                &_DecrConnectedInPortsNumber,
29                         int                &_LinkedNodesSize ,
30                         int                &_SubGraphNumber ) {
31   time_t T = time(NULL);
32   struct tm * Tm = localtime(&T);
33
34   _Kind = SUPERV::DataFlowNode ;
35
36   _FirstCreation.Second = _LastModification.Second = Tm->tm_sec;
37   _FirstCreation.Minute = _LastModification.Minute = Tm->tm_min;
38   _FirstCreation.Hour   = _LastModification.Hour   = Tm->tm_hour;
39   _FirstCreation.Day    = _LastModification.Day    = Tm->tm_mday;
40   _FirstCreation.Month  = _LastModification.Month  = Tm->tm_mon + 1;
41   _FirstCreation.Year   = _LastModification.Year   = Tm->tm_year + 1900; 
42
43   _EditorRelease = new char[ strlen( SuperVision_Version ) + 1 ] ;
44   strcpy( _EditorRelease , SuperVision_Version ) ;
45   _Author = NULLSTRING ;
46 //  _Computer = new char[ strlen( FACTORYSERVER ) + 1 ] ;
47 //  strcpy( _Computer  , FACTORYSERVER ) ;
48   _Comment = NULLSTRING ;
49
50   _SubGraphNumber = 0 ;
51   _HeadNode = false ;
52   _GeneratedName = false ;
53
54   _ConnectedInPortsNumber = 0 ;
55   _DecrConnectedInPortsNumber = 0 ;
56   _LinkedNodesSize = 0 ;
57   _SubGraphNumber = 0 ;
58 }
59
60 GraphBase::ComputingNode::ComputingNode() :
61   GraphBase::PortsOfNode::PortsOfNode() {
62
63   InitFields( _Kind ,
64               _FirstCreation ,
65               _LastModification ,
66               _EditorRelease ,
67               _Author ,
68               _Comment ,
69               _HeadNode ,
70               _GeneratedName ,
71               _ConnectedInPortsNumber ,
72               _DecrConnectedInPortsNumber ,
73               _LinkedNodesSize ,
74               _SubGraphNumber ) ;
75   _NamingService = NULL ;
76   _Node = SUPERV::CNode::_nil() ;
77   _InNode = NULL ;
78   _ThreadNo = pthread_self() ;
79   _Name = NULL ;
80   cdebug << "GraphBase::Node::Node "  << this << " "  << endl ;
81
82 }
83
84 GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
85                                          SALOME_NamingService* ptrNamingService ,
86                                          const char * aDataFlowName ,
87                                          int * Graph_prof_debug ,
88                                          ofstream * Graph_fdebug ) :
89   GraphBase::PortsOfNode::PortsOfNode( aDataFlowName ) {
90
91   MESSAGE( "GraphBase::ComputingNode::ComputingNode( " << aDataFlowName << " Graph_fdebug " << Graph_fdebug ) ;
92   InitFields( _Kind ,
93               _FirstCreation ,
94               _LastModification ,
95               _EditorRelease ,
96               _Author ,
97               _Comment ,
98               _HeadNode ,
99               _GeneratedName ,
100               _ConnectedInPortsNumber ,
101               _DecrConnectedInPortsNumber ,
102               _LinkedNodesSize ,
103               _SubGraphNumber ) ;
104
105   _ORB = CORBA::ORB::_duplicate( ORB ) ;
106   _NamingService = ptrNamingService ;
107   _Node = SUPERV::CNode::_nil() ;
108   _InNode = NULL ;
109   _ThreadNo = pthread_self() ;
110
111   if ( aDataFlowName != NULLSTRING && strlen( aDataFlowName ) ) {
112     _Name = new char[ strlen( aDataFlowName )+1 ] ;
113     strcpy( _Name , aDataFlowName ) ;
114   }
115   else {
116     _Name = NULLSTRING ;
117   }
118   if ( Graph_prof_debug ) {
119 //    MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug" ) ;
120 //    cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug" << endl ;
121     _Graph_prof_debug = Graph_prof_debug ;
122     _Graph_fdebug = Graph_fdebug ;
123     SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
124   }
125 //  else {
126 //    cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ;
127 //  }
128   cdebug << "GraphBase::ComputingNode::ComputingNode "  << this 
129          << "' _Name "
130          << (void *) _Name << " '" << _Name << " "  << _FirstCreation
131          << " "  << _LastModification << endl ;
132 }
133
134 GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
135                                          SALOME_NamingService* ptrNamingService ,
136                                          const SALOME_ModuleCatalog::Service& aService ,
137                                          const char *NodeName ,
138                                          const SUPERV::KindOfNode akind ,
139                                          const SUPERV::SDate NodeFirstCreation ,
140                                          const SUPERV::SDate NodeLastModification  ,
141                                          const char * NodeEditorRelease ,
142                                          const char * NodeAuthor ,
143                                          const char * NodeComment ,
144                                          const bool   GeneratedName ,
145                                          const long   X ,
146                                          const long   Y ,
147                                          int * Graph_prof_debug ,
148                                          ofstream * Graph_fdebug ) :
149   GraphBase::PortsOfNode::PortsOfNode() {
150
151   _ORB = CORBA::ORB::_duplicate( ORB ) ;
152   _NamingService = ptrNamingService ;
153   _Node = SUPERV::CNode::_nil() ;
154   _InNode = NULL ;
155   _ThreadNo = pthread_self() ;
156
157   _Kind = akind ;
158
159   time_t T = time(NULL);
160   struct tm * Tm = localtime(&T);
161
162   _FirstCreation.Second = _LastModification.Second = Tm->tm_sec;
163   _FirstCreation.Minute = _LastModification.Minute = Tm->tm_min;
164   _FirstCreation.Hour   = _LastModification.Hour   = Tm->tm_hour;
165   _FirstCreation.Day    = _LastModification.Day    = Tm->tm_mday;
166   _FirstCreation.Month  = _LastModification.Month  = Tm->tm_mon + 1;
167   _FirstCreation.Year   = _LastModification.Year   = Tm->tm_year + 1900; 
168
169   if ( NodeEditorRelease != NULLSTRING ) {
170     _EditorRelease = new char[ strlen( NodeEditorRelease ) + 1 ] ;
171     strcpy( _EditorRelease , NodeEditorRelease ) ;
172   }
173   else {
174     _EditorRelease = new char[ strlen( SuperVision_Version ) + 1 ] ;
175     strcpy( _EditorRelease , SuperVision_Version ) ;
176   }
177
178   if ( NodeAuthor != NULLSTRING ) {
179     _Author = new char[ strlen( NodeAuthor ) + 1 ] ;
180     strcpy( _Author  , NodeAuthor ) ;
181   }
182   else {
183     _Author = NULLSTRING ;
184   }
185
186   if ( NodeComment != NULLSTRING ) {
187     _Comment = new char[ strlen( NodeComment ) + 1 ] ;
188     strcpy( _Comment  , NodeComment ) ;
189   }
190   else {
191     _Comment = NULLSTRING ;
192   }
193
194   _SubGraphNumber = 0 ;
195   _HeadNode = false ;
196   _GeneratedName = GeneratedName ;
197
198   const char *aNodeName = NodeName ;
199   _Name = new char[strlen(aNodeName)+1];
200   strcpy(_Name , aNodeName);
201
202   _ConnectedInPortsNumber = 0 ;
203   _DecrConnectedInPortsNumber = 0 ;
204   _LinkedNodesSize = 0 ;
205
206   _X = X ;
207   _Y = Y ;
208
209 //  MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug " << Graph_prof_debug << " Graph_fdebug "
210 //           << Graph_fdebug ) ;
211 //  cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug " << Graph_prof_debug << " Graph_fdebug "
212 //       << Graph_fdebug << endl ;
213   _Graph_prof_debug = Graph_prof_debug ;
214   _Graph_fdebug = Graph_fdebug ;
215   SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
216 //  MESSAGE( "GraphBase::ComputingNode::ComputingNode SetDebug Done " << Graph_prof_debug << " Graph_fdebug "
217 //           << Graph_fdebug << " aService.ServiceName " << aService.ServiceName ) ;
218 //  cout << "GraphBase::ComputingNode::ComputingNode SetDebug Done " << Graph_prof_debug << " Graph_fdebug "
219 //       << Graph_fdebug << endl ;
220 //  cout << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << aNodeName << ","
221 //       << akind << ")" << endl;
222   cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << aNodeName << ","
223             << akind << ")" << endl;
224   
225
226   DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
227
228   cdebug << "GraphBase::ComputingNode::ComputingNode "  << this 
229          << " _Name " << (void *) _Name << " '" << _Name
230          << " KindOfNode " << _Kind
231          << " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
232          << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
233
234   cdebug_out << "GraphBase::ComputingNode::ComputingNode" << endl;
235 }
236
237 GraphBase::ComputingNode::~ComputingNode() {
238   cdebug << "GraphBase::ComputingNode::~ComputingNode "  << this 
239          << " _Name "
240          << (void *) _Name << " " << _Name << " _Comment "
241          << (void *) _Comment << " "  << _Comment << " "  << endl ;
242 //  if ( _ComponentName != NULLSTRING )
243 //    delete [] _ComponentName ;
244 //  delete [] _Name ;
245 //  delete [] _EditorRelease ;
246 //  if ( _Author != NULLSTRING )
247 //    delete [] _Author ;
248 //  if ( _Computer != FACTORYSERVER )
249 //    delete [] _Computer;
250 //  if ( _Comment != NULLSTRING )
251 //    delete [] _Comment;
252 }
253
254 bool GraphBase::ComputingNode::Name( const char * aName) {
255   cdebug_in << "GraphBase::ComputingNode::Name " << _Name << endl;
256   if ( _Name ) {
257     cdebug << "GraphBase::ComputingNode::ReName "  << _Name << " --> " << aName << endl ;
258     delete [] _Name ;
259   }
260   _Name = new char[strlen(aName)+1] ;
261   strcpy( _Name , aName ) ;
262   cdebug_out << "GraphBase::ComputingNode::Name " << _Name << endl;
263   return true ;
264 }
265
266 SUPERV::SDate GraphBase::ComputingNode::FirstCreation () const {
267 //  cdebug << "GraphBase::ComputingNode::FirstCreation "
268 //         << "' _Name " << _Name << " "  << _FirstCreation << " "  
269 //         << _LastModification << endl ;
270   return _FirstCreation;
271 }
272
273 SUPERV::SDate GraphBase::ComputingNode::LastModification () const {
274   return _LastModification ;
275 }
276
277 bool GraphBase::ComputingNode::Kind(const SUPERV::KindOfNode aKind) {
278   _Kind = aKind ;
279   return true ;
280 }
281
282 void GraphBase::ComputingNode::FirstCreation(const SUPERV::SDate aDate ) {
283   _FirstCreation = aDate ;
284 }
285
286 void GraphBase::ComputingNode::LastModification(const SUPERV::SDate aDate ) {
287   _LastModification = aDate ;
288 }
289
290 bool GraphBase::ComputingNode::EditorRelease(const char * c){
291   if ( _EditorRelease && _EditorRelease != NULLSTRING )
292     delete _EditorRelease;
293   _EditorRelease = my_strdup(c);
294   return true ;
295 }
296
297 bool GraphBase::ComputingNode::Author(const char * a) {
298   cdebug_in << "GraphBase::ComputingNode::Author " << _Author << endl;
299   if ( _Author && _Author != NULLSTRING )
300     delete _Author;
301   _Author = my_strdup(a);
302   cdebug_out << "GraphBase::ComputingNode::Author " << _Author << endl;
303   return true ;
304 }
305
306 bool GraphBase::ComputingNode::Comment(const char *c) {
307   cdebug_in << "GraphBase::ComputingNode::Comment " << _Comment << endl;
308   if ( _Comment != NULLSTRING )
309     delete [] _Comment;
310   _Comment = my_strdup(c);
311   cdebug_out << "GraphBase::ComputingNode::Comment " << _Comment << endl;
312   return true ;
313 }
314
315 void GraphBase::ComputingNode::NodePort( const char * NodeName ,
316                                 const char * ServiceParameterName ,
317                                 char ** aNode , char ** aPort ) {
318   if ( strcmp( NodeName , Name() ) ) {
319     *aNode = my_strdup( NodeName ) ;
320     *aPort = my_strdup( ServiceParameterName ) ;
321   }
322   else {
323     char * BPort = strchr( ServiceParameterName , '\\' ) ;
324     if ( BPort ) {
325       int len = BPort - ServiceParameterName ;
326       *aNode = new char [ len + 1 ] ;
327       strncpy( *aNode , ServiceParameterName , len ) ;
328       (*aNode)[ len ] = '\0' ;
329       *aPort = my_strdup( &BPort[ 1 ] ) ;
330     }
331     else {
332       *aNode = my_strdup( NULLSTRING ) ;
333       *aPort = my_strdup( NULLSTRING ) ;
334     }
335   }
336 }
337
338 bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName ) {
339   bool RetVal = false ;
340   const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ;
341   if ( thePort ) {
342     RetVal = thePort->IsConnected() ;
343   }
344   else {
345     const GraphBase::OutPort * thePort = GetOutPort( ToServiceParameterName ) ;
346     if ( thePort ) {
347       RetVal = thePort->IsConnected() ;
348     }
349   }
350   return RetVal ;
351 }
352
353 bool GraphBase::ComputingNode::HasInput(const char * ToServiceParameterName ) {
354   bool RetVal = false ;
355   const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ;
356   if ( IsDataFlowNode() && thePort ) {
357     RetVal = true ;
358   }
359   else if ( thePort ) {
360 //    cout << "GraphBase::ComputingNode::HasInput theInPort " << thePort << " " << thePort->PortName() << " of "
361 //         << thePort->NodeName() << " IsDataConnected " << thePort->IsDataConnected() << " OutPort "
362 //         << thePort->GetOutPort() << endl ;
363     RetVal = thePort->IsDataConnected() ;
364   }
365   else {
366     const GraphBase::OutPort * thePort = GetOutPort( ToServiceParameterName ) ;
367     if ( thePort ) {
368       RetVal = thePort->IsDataConnected() ;
369     }
370   }
371   return RetVal ;
372 }
373
374 GraphBase::SNode * GraphBase::ComputingNode::GetInfo() {
375   cdebug_in << "GraphBase::ComputingNode::GetInfo" << endl;
376   GraphBase::SNode * Info = new GraphBase::SNode ;
377 //  Info->theComponentName = ComponentName() ;
378 //  Info->theInterfaceName = InterfaceName() ;
379   Info->theName = Name() ;
380   Info->theKind = Kind() ;
381   Info->theService = *GetService() ;
382 //  Info->theListOfParameters = *GetListOfParameters() ;
383   Info->theFirstCreation = FirstCreation() ;
384   Info->theLastModification = LastModification() ;
385   Info->theEditorRelease = EditorRelease() ;
386   Info->theAuthor = Author() ;
387 //  Info->theContainer = Computer() ;
388   Info->theComment = Comment() ;
389   Info->theCoords.theX = GraphBase::ComputingNode::XCoordinate() ;
390   Info->theCoords.theY = GraphBase::ComputingNode::YCoordinate() ;
391   cdebug_out << "GraphBase::ComputingNode::GetInfo" << endl;
392   return Info ;
393 }
394
395 GraphBase::InPort * GraphBase::ComputingNode::AddInPort( const char * InputParameterName ,
396                                                 const char * InputParameterType ) {
397   return GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
398                                             Kind() ,
399                                             InputParameterName ,
400                                             InputParameterType ,
401                                             _Graph_prof_debug , _Graph_fdebug ) ;
402 }
403 GraphBase::OutPort * GraphBase::ComputingNode::AddOutPort( const char * OutputParameterName ,
404                                                   const char * OutputParameterType ) {
405   return GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() ,
406                                              Kind() ,
407                                              OutputParameterName ,
408                                              OutputParameterType ,
409                                              _Graph_prof_debug , _Graph_fdebug ) ;
410 }
411
412 void GraphBase::ComputingNode::AddLink( GraphBase::ComputingNode * ToNode ) {
413   int index = GetLinkedNodeIndex( ToNode->Name() ) ;
414   if ( index < 0 ) {
415     cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name()
416            << " ) new LinkedNode " << endl ;
417     _LinkedNodes.resize( _LinkedNodesSize+1 ) ;
418     _LinkedInPortsNumber.resize( _LinkedNodesSize+1 ) ;
419     _LinkedNodes[ _LinkedNodesSize ] = ToNode ;
420     _LinkedInPortsNumber[ _LinkedNodesSize ] = 1 ;
421     SetLinkedNodeIndex( ToNode->Name() , _LinkedNodesSize ) ;
422     index = _LinkedNodesSize ;
423     _LinkedNodesSize++ ;
424   }
425   else {
426     cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name()
427            << " ) old LinkedNode " << _LinkedNodes[index ]->Name() << endl ;
428     _LinkedInPortsNumber[ index ] += 1 ;
429   }
430   cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name()
431          << " ) LinkedNodesSize " << _LinkedNodesSize << " [ " << index
432          << " ] _LinkedInPortsNumber " << _LinkedInPortsNumber[ index ]
433          << " ConnectedInPortsNumber " << ToNode->ConnectedInPortsNumber()
434          << " + 1 Service " << ServiceName() << endl ;
435   ToNode->IncrConnectedInPortsNumber() ;
436 }
437
438 void GraphBase::ComputingNode::RemoveLink( GraphBase::ComputingNode * ToNode ) {
439   int index = GetLinkedNodeIndex( ToNode->Name() ) ;
440   if ( index >= 0 ) {
441     cdebug << "GraphBase::ComputingNode::RemoveLink( to " << ToNode->Name() << " from "
442            << Name() << " index : " << index << " ConnectedInPortsNumber "
443            << ToNode->ConnectedInPortsNumber() - 1 << " LinkedInPortsNumber "
444            << _LinkedInPortsNumber[ index ] << " - 1" << endl ;
445     ToNode->DecrConnectedInPortsNumber() ;
446     _LinkedInPortsNumber[ index ] -= 1 ;
447     if ( _LinkedInPortsNumber[ index ] == 0 ) {
448       _LinkedNodesSize-- ;
449       cdebug << "GraphBase::ComputingNode::RemoveLink new LinkedNodesSize "
450              << _LinkedNodesSize << " " << ToNode->Name() << " removed from "
451              << " linkednodes of " << Name() << endl ;
452       int i ;
453       for ( i = index ; i < _LinkedNodesSize ; i++ ) {
454         _LinkedNodes[ i ] = _LinkedNodes[ i+1 ] ;
455         _LinkedInPortsNumber[ i ] =  _LinkedInPortsNumber[ i+1 ] ;
456         SetLinkedNodeIndex( _LinkedNodes[ i ]->Name() , i ) ;
457       }
458       DelLinkedNodeIndex( ToNode->Name() ) ;
459       _LinkedNodes.resize( _LinkedNodesSize+1 ) ;
460       _LinkedInPortsNumber.resize( _LinkedNodesSize+1 ) ;
461     }
462   }
463   else {
464     cdebug << " Error index " << index << endl ;
465   }
466 }
467
468 void GraphBase::ComputingNode::ReNameLink( const char* OldNodeName ,
469                                   const char* NewNodeName ) {
470   cdebug_in << "GraphBase::ComputingNode::ReNameLink (" << OldNodeName << " , "
471             << NewNodeName << ")" << endl;
472   int index = GetLinkedNodeIndex( OldNodeName ) ;
473   if ( index >= 0 ) {
474     _MapOfLinkedNodes.erase( OldNodeName ) ;
475     SetLinkedNodeIndex( NewNodeName , index ) ;
476   }
477   cdebug_out << "GraphBase::ComputingNode::ReNameLink" << endl ;
478 }
479
480 #include <sys/time.h>
481 #include <sys/resource.h>
482 #include <unistd.h>
483
484 const long GraphBase::ComputingNode::CpuUsed() {
485   struct rusage usage ;
486   if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) {
487     perror("GraphBase::CpuUsed") ;
488     return 0 ;
489   }
490 //  return usage.ru_utime.__time_t tv_sec ;
491   cdebug << "CpuUsed " << usage.ru_utime.tv_sec << " " << usage.ru_utime.tv_usec << " "
492          << usage.ru_stime.tv_sec << " " << usage.ru_stime.tv_usec << endl ;
493   return usage.ru_utime.tv_sec ;
494 }
495
496 #if 0
497 const GraphBase::ListOfParameters * GraphBase::ComputingNode::GetListOfParameters() const {
498   GraphBase::ListOfParameters * aListOfParameters = new GraphBase::ListOfParameters ;
499   if ( IsInLineNode() || IsGOTONode() ) {
500     unsigned int i;
501     for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
502       const InPort * anInPort = GetNodeInPort( i ) ;
503       if ( anInPort->IsBus() ) {
504         int size = aListOfParameters->size() ;
505         aListOfParameters->resize( size + 1 ) ;
506         (*aListOfParameters)[size].theInParameter.Parametername = anInPort->PortName() ;
507         (*aListOfParameters)[size].theInParameter.Parametertype = anInPort->PortType() ;
508         const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
509         (*aListOfParameters)[size].theOutParameter.Parametername = anOutPort->PortName() ;
510         (*aListOfParameters)[size].theOutParameter.Parametertype = anOutPort->PortType() ;
511       }
512     }
513   }
514   return aListOfParameters ;
515 }
516 #endif
517
518 bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
519                                         const char * ComponentName ,
520                                         const char * InterfaceName ,
521                                         const char * Computer ,
522                                         const char * CoupledNode ,
523                                         const ListOfFuncName FuncNames ,
524                                         const ListOfPythonFunctions PythonFunctions ,
525                                         int XCoordinate , int YCoordinate ) const {
526   QDomElement node = Graph.createElement( "node" ) ;
527   info.appendChild( node ) ;
528   QDomElement componentname = Graph.createElement( "component-name" ) ;
529   QDomText aField ;
530   if ( strlen( ComponentName ) ) {
531 //    f << Tabs << "<component-name>" << ComponentName << "</component-name>"
532 //      << endl ;
533 //    componentname.setNodeValue( ComponentName ) ;
534     aField = Graph.createTextNode( ComponentName ) ;
535   }
536   else {
537 //    f << Tabs << "<component-name>?</component-name>" << endl ;
538 //    componentname.setNodeValue( "?" ) ;
539     aField = Graph.createTextNode( "?" ) ;
540   }
541   node.appendChild( componentname ) ;
542   componentname.appendChild( aField ) ;
543
544   QDomElement interfacename = Graph.createElement("interface-name") ;
545   if ( strlen( InterfaceName ) ) {
546 //    f << Tabs << "<interface-name>" << InterfaceName << "</interface-name>"
547 //      << endl ;
548 //    interfacename.setAttribute("name" , InterfaceName ) ;
549     aField = Graph.createTextNode( InterfaceName ) ;
550   }
551   else {
552 //    f << Tabs << "<interface-name>?</interface-name>" << endl ;
553 //    interfacename.setAttribute("name" , "?" ) ;
554     aField = Graph.createTextNode( "?" ) ;
555   }
556   node.appendChild(interfacename) ;
557   interfacename.appendChild( aField ) ;
558
559 //  f << Tabs << "<node-name>" << Name() << "</node-name>" << endl ;
560   QDomElement nodename = Graph.createElement("node-name") ;
561   aField = Graph.createTextNode( Name() ) ;
562   node.appendChild( nodename ) ;
563   nodename.appendChild( aField ) ;
564
565 //  f << Tabs << "<kind>" << (int ) Kind() << "</kind>" << endl ;
566   QDomElement kind = Graph.createElement( "kind" ) ;
567   QString aKind ;
568   aKind = aKind.setNum( Kind() ) ;
569   aField = Graph.createTextNode( aKind ) ;
570   node.appendChild( kind ) ;
571   kind.appendChild( aField ) ;
572
573   QDomElement couplednode = Graph.createElement("coupled-node") ;
574   if ( IsGOTONode() || IsLoopNode() || IsEndLoopNode() ||
575        IsSwitchNode() || IsEndSwitchNode() ) {
576 //    f << Tabs << "<coupled-node>" << CoupledNode << "</coupled-node>"
577 //      << endl ;
578     aField = Graph.createTextNode( CoupledNode ) ;
579   }
580   else {
581 //    f << Tabs << "<coupled-node>?</coupled-node>" << endl ;
582     aField = Graph.createTextNode( "?" ) ;
583   }
584   node.appendChild(couplednode) ;
585   couplednode.appendChild( aField ) ;
586
587 //  f << Tabs << "<service>" << endl ;
588   QDomElement service = Graph.createElement("service") ;
589   node.appendChild(service) ;
590   QDomElement servicename = Graph.createElement("service-name") ;
591   if ( strlen( ServiceName() ) ) {
592 //    f << Tabs << "    <service-name>" << ServiceName() << "</service-name>" << endl ;
593     aField = Graph.createTextNode( ServiceName() ) ;
594   }
595   else {
596 //    f << Tabs << "    <service-name>?</service-name>" << endl ;
597     aField = Graph.createTextNode( "?" ) ;
598   }
599   service.appendChild(servicename) ;
600   servicename.appendChild( aField ) ;
601
602 //  f << Tabs << "      <inParameter-list>" << endl ;
603   QDomElement inParameterlist = Graph.createElement("inParameter-list") ;
604   service.appendChild(inParameterlist) ;
605   unsigned int i;
606   for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
607 //    f << Tabs << "            <inParameter>" << endl ;
608     QDomElement inParameter = Graph.createElement("inParameter") ;
609     inParameterlist.appendChild(inParameter) ;
610 //    f << Tabs << "                    <inParameter-type>"
611 //      << ServiceInParameter()[i].Parametertype << "</inParameter-type>"
612 //      << endl ;
613     QDomElement inParametertype = Graph.createElement("inParameter-type") ;
614     // mpv: Linux 8.0 compiler compatibility
615 //    aField = Graph.createTextNode( (char *)ServiceInParameter()[i].Parametertype ) ;
616     if ( strlen( ServiceInParameter()[i].Parametertype ) ) {
617       aField = Graph.createTextNode( strdup( ServiceInParameter()[i].Parametertype ) ) ;
618     }
619     else {
620       aField = Graph.createTextNode( "?" ) ;
621     }
622     inParameter.appendChild(inParametertype) ;
623     inParametertype.appendChild( aField ) ;
624 //    f << Tabs << "                    <inParameter-name>"
625 //      << ServiceInParameter()[i].Parametername << "</inParameter-name>"
626 //      << endl ;
627     QDomElement inParametername = Graph.createElement("inParameter-name") ;
628     // mpv: Linux 8.0 compiler compatibility
629 //    aField = Graph.createTextNode( (char *) ServiceInParameter()[i].Parametername ) ;
630     if ( strlen( ServiceInParameter()[i].Parametername ) ) {
631       aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
632     }
633     else {
634       aField = Graph.createTextNode( "?" ) ;
635     }
636     inParameter.appendChild(inParametername) ;
637     inParametername.appendChild( aField ) ;
638 //    f << Tabs << "            </inParameter>" << endl ;
639   }
640 //  f << Tabs << "      </inParameter-list>" << endl ;
641 //  f << Tabs << "      <outParameter-list>" << endl ;
642   QDomElement outParameterlist = Graph.createElement("outParameter-list") ;
643   service.appendChild(outParameterlist) ;
644   for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) {
645 //    f << Tabs << "            <outParameter>" << endl ;
646     QDomElement outParameter = Graph.createElement("outParameter") ;
647     outParameterlist.appendChild(outParameter) ;
648 //    f << Tabs << "                    <outParameter-type>"
649 //      << ServiceOutParameter()[i].Parametertype << "</outParameter-type>"
650 //      << endl ;
651     QDomElement outParametertype = Graph.createElement("outParameter-type") ;
652     // mpv: Linux 8.0 compiler compatibility
653 //    aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametertype ) ;
654     if ( strlen( ServiceOutParameter()[i].Parametertype ) ) {
655       aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
656     }
657     else {
658       aField = Graph.createTextNode( "?" ) ;
659     }
660     outParameter.appendChild(outParametertype) ;
661     outParametertype.appendChild( aField ) ;
662 //    f << Tabs << "                    <outParameter-name>"
663 //      << ServiceOutParameter()[i].Parametername << "</outParameter-name>"
664 //      << endl ;
665     QDomElement outParametername = Graph.createElement("outParameter-name") ;
666     // mpv: Linux 8.0 compiler compatibility
667 //    aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametername ) ;
668     if ( strlen( ServiceOutParameter()[i].Parametername ) ) {
669       aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
670     }
671     else {
672       aField = Graph.createTextNode( "?" ) ;
673     }
674     outParameter.appendChild(outParametername) ;
675     outParametername.appendChild( aField ) ;
676 //    f << Tabs << "            </outParameter>" << endl ;
677   }
678 //  f << Tabs << "      </outParameter-list>" << endl ;
679 //  f << Tabs << "</service>" << endl ;
680
681 //  f << Tabs << "<Parameter-list>" << endl ;
682   QDomElement Parameterlist = Graph.createElement("Parameter-list") ;
683   node.appendChild( Parameterlist ) ;
684 #if 0
685   if ( IsInLineNode() || IsGOTONode() ||
686        IsLoopNode() || IsEndLoopNode() ||
687        IsSwitchNode() || IsEndSwitchNode() ) {
688     unsigned int i;
689     for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
690       const InPort * anInPort = GetNodeInPort( i ) ;
691       if ( anInPort->IsBus() ) {
692         f << Tabs << "  <inParameter>" << endl ;
693         f << Tabs << "          <inParameter-type>"
694           << anInPort->PortType() << "</inParameter-type>"
695           << endl ;
696         f << Tabs << "          <inParameter-name>"
697           << anInPort->PortName() << "</inParameter-name>"
698           << endl ;
699         f << Tabs << "  </inParameter>" << endl ;
700         const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
701         f << Tabs << "  <outParameter>" << endl ;
702         f << Tabs << "          <outParameter-type>"
703           << anOutPort->PortType() << "</outParameter-type>"
704           << endl ;
705         f << Tabs << "          <outParameter-name>"
706           << anOutPort->PortName() << "</outParameter-name>"
707           << endl ;
708         f << Tabs << "  </outParameter>" << endl ;
709       }
710     }
711   }
712 #endif
713 //  f << Tabs << "</Parameter-list>" << endl ;    
714
715 //  f << Tabs << "<PyFunction-list>" << endl ;
716   QDomElement PyFunctionlist = Graph.createElement("PyFunction-list") ;
717   node.appendChild( PyFunctionlist ) ;
718   for ( i = 0 ; i < PythonFunctions.size() ; i++ ) {
719 //    f << Tabs << "    <PyFunction>" << endl ;
720     QDomElement PyFunction = Graph.createElement("PyFunction") ;
721     PyFunctionlist.appendChild( PyFunction ) ;
722     int j ;
723     QDomElement FuncName = Graph.createElement("FuncName") ;
724     if ( strlen( FuncNames[i].c_str() ) ) {
725       aField = Graph.createTextNode( FuncNames[i].c_str() ) ;
726     }
727     else {
728       aField = Graph.createTextNode( "?" ) ;
729     }
730     PyFunction.appendChild( FuncName ) ;
731     FuncName.appendChild( aField ) ;
732     if ( (*PythonFunctions[i]).length() ) {
733       for ( j = 0 ; j < (int ) (*PythonFunctions[i]).length() ; j++ ) {
734         QDomElement PyFunc = Graph.createElement("PyFunc") ;
735         QDomCDATASection aCDATA ;
736       // mpv: Linux 8.0 compiler compatibility
737         char * aCDATAChar = strdup ((*PythonFunctions[i])[j]) ;
738         int i ;
739         for ( i = 0 ; i < (int ) strlen( aCDATAChar ) ; i++ ) {
740           if ( aCDATAChar[ i ] != ' ' ) {
741             break ;
742           }
743         }
744         if ( i == (int ) strlen( aCDATAChar ) ) {
745           aCDATA = Graph.createCDATASection( "?" ) ;
746         }
747         else {
748           aCDATA = Graph.createCDATASection( aCDATAChar ) ;
749         }
750         PyFunction.appendChild( PyFunc ) ;
751         PyFunc.appendChild( aCDATA ) ;
752       }
753     }
754     else {
755       QDomElement PyFunc = Graph.createElement("PyFunc") ;
756       QDomCDATASection aCDATA = Graph.createCDATASection( "?" ) ;
757       PyFunction.appendChild( PyFunc ) ;
758       PyFunc.appendChild( aCDATA ) ;
759     }
760   }
761
762 //  f << Tabs << "<creation-date>" << FirstCreation() << "</creation-date>"
763 //    << endl ;
764   QDomElement creationdate = Graph.createElement("creation-date") ;
765   char fdate[30] ;
766   sprintf( fdate , "%d/%d/%d - %d:%d:%d" ,  FirstCreation().Day , FirstCreation().Month , FirstCreation().Year , FirstCreation().Hour , FirstCreation().Minute , FirstCreation().Second ) ;
767   aField = Graph.createTextNode( fdate ) ;
768   node.appendChild( creationdate ) ;
769   creationdate.appendChild( aField ) ;
770 //  f << Tabs << "<lastmodification-date>" << LastModification()
771 //    << "</lastmodification-date>" << endl ;
772   QDomElement lastmodificationdate = Graph.createElement("lastmodification-date") ;
773   char ldate[30] ;
774   sprintf( ldate , "%d/%d/%d - %d:%d:%d" , LastModification().Day , LastModification().Month , LastModification().Year , LastModification().Hour , LastModification().Minute , LastModification().Second ) ;
775   aField = Graph.createTextNode( ldate ) ;
776   node.appendChild( lastmodificationdate ) ;
777   lastmodificationdate.appendChild( aField ) ;
778 //  f << Tabs << "<editor-release>" << EditorRelease() << "</editor-release>"
779 //    << endl ;
780   QDomElement editorrelease = Graph.createElement("editor-release") ;
781   aField = Graph.createTextNode( EditorRelease() ) ;
782   node.appendChild( editorrelease ) ;
783   editorrelease.appendChild( aField ) ;
784   QDomElement author = Graph.createElement("author") ;
785   if ( strlen( Author() ) ) {
786 //    f << Tabs << "<author>" << Author() << "</author>" << endl ;
787     aField = Graph.createTextNode( Author() ) ;
788   }
789   else {
790 //    f << Tabs << "<author>?</author>" << endl ;
791     aField = Graph.createTextNode( "?" ) ;
792   }
793   node.appendChild( author ) ;
794   author.appendChild( aField ) ;
795   QDomElement container = Graph.createElement("container") ;
796   if ( IsFactoryNode() && strlen( Computer) ) {
797 //    f << Tabs << "<container>" << Computer << "</container>" << endl ;
798     aField = Graph.createTextNode( Computer ) ;
799   }
800   else {
801 //    f << Tabs << "<container>?</container>" << endl ;
802     aField = Graph.createTextNode( "?" ) ;
803   }
804   node.appendChild( container ) ;
805   container.appendChild( aField ) ;
806   QDomElement comment = Graph.createElement("comment") ;
807   if ( strlen( Comment() ) ) {
808 //    f << Tabs << "<comment>" << Comment() << "</comment>" << endl ;
809     aField = Graph.createTextNode( Comment() ) ;
810   }
811   else {
812 //    f << Tabs << "<comment>?</comment>" << endl ;
813     aField = Graph.createTextNode( "?" ) ;
814   }
815   node.appendChild( comment ) ;
816   comment.appendChild( aField ) ;
817 //  f << Tabs << "<x-position>" << XCoordinate << "</x-position>" << endl ;
818   QDomElement xposition = Graph.createElement("x-position") ;
819   QString aXCoordinate ;
820   aXCoordinate = aKind.setNum( XCoordinate ) ;
821   aField = Graph.createTextNode( aXCoordinate ) ;
822   node.appendChild( xposition ) ;
823   xposition.appendChild( aField ) ;
824 //  f << Tabs << "<y-position>" << YCoordinate << "</y-position>" << endl ;
825   QDomElement yposition = Graph.createElement("y-position") ;
826   QString aYCoordinate ;
827   aYCoordinate = aKind.setNum( YCoordinate ) ;
828   aField = Graph.createTextNode( aYCoordinate ) ;
829   node.appendChild( yposition ) ;
830   yposition.appendChild( aField ) ;
831   return true ;
832 }
833
834 bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
835                                        const char * ComponentName ,
836                                        const char * InterfaceName ,
837                                        const char * Computer ,
838                                        const GraphBase::InLineNode * aCoupledNode ,
839                                        const ListOfFuncName FuncNames ,
840                                        const ListOfPythonFunctions PythonFunctions ,
841                                        int XCoordinate , int YCoordinate ) const {
842   if ( IsDataFlowNode() ) {
843     f << Name() << " = Graph( '" << Name() << "' )" << endl ;
844   }
845   else if ( IsComputingNode() ) {
846     int i ;
847     f << Name() << "_ServiceinParameter = []" << endl ;
848     for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
849       f << Name() << "_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
850         << ServiceInParameter()[i].Parametertype << "' , '"
851         << ServiceInParameter()[i].Parametername << "' ) )" << endl ;
852     }
853     f << Name() << "_ServiceoutParameter = []" << endl ;
854     for ( i = 0 ; i < (int ) ServiceOutParameter().length() ; i++ ) {
855       f << Name() << "_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
856         << ServiceOutParameter()[i].Parametertype << "' , '"
857         << ServiceOutParameter()[i].Parametername << "' ) )" << endl ;
858     }
859     f << Name() << "_Service = SALOME_ModuleCatalog.Service( '" << ServiceName()
860       << "' , " << Name() << "_ServiceinParameter" << " , "
861       << Name() << "_ServiceoutParameter" << " , 0 )" << endl ;
862     f << Name() << " = " << aGraphName << ".CNode( " << Name() << "_Service" << " )"
863       << endl ;
864   }
865   else if ( IsFactoryNode() ) {
866     f << Name() << " = " << aGraphName << ".FNode( '" << ComponentName
867       << "' , '" << InterfaceName << "' , '" << ServiceName() << "' )"
868       << endl ;
869   }
870   else {
871     f << "Py" << Name() << " = []" << endl ;
872     int i ;
873     SUPERV::ListOfStrings aPyFunc ;
874     if ( PythonFunctions.size() ) {
875       aPyFunc = *PythonFunctions[0] ;
876       for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
877         f << "Py" << Name() << ".append( '" << aPyFunc[i] << "' )" << endl ;
878       }
879     }
880     if ( IsInLineNode() ) {
881       f << Name() << " = " << aGraphName << ".INode( '" << FuncNames[0].c_str() << "' , Py"
882         << Name() << " )" << endl ;
883     }
884     else if ( IsGOTONode() ) {
885       if ( aCoupledNode ) {
886         f << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
887           << Name() << " , '" << aCoupledNode->Name() << "' )" << endl ;
888       }
889       else {
890         f << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
891           << Name() << " , '' )" << endl ;
892       }
893     }
894     else {
895 //      char * EndName = NULL ;
896 //      EndName = new char[ 3 + strlen( Name() ) + 1 ] ;
897 //      strcpy( EndName , "End" ) ;
898 //      strcat( EndName , Name() ) ;
899       char * EndName = aCoupledNode->Name() ;
900       if ( IsLoopNode() ) {
901         SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ;
902         SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ;
903         f << "PyMore" << Name() << " = []" << endl ;
904         for ( i = 0 ; i < (int ) aPyMore.length() ; i++ ) {
905           f << "PyMore" << Name() << ".append( '" << aPyMore[i] << "' )" << endl ;
906         }
907         f << "PyNext" << Name() << " = []" << endl ;
908         for ( i = 0 ; i < (int ) aPyNext.length() ; i++ ) {
909           f << "PyNext" << Name() << ".append( '" << aPyNext[i] << "' )" << endl ;
910         }
911         f << Name() << "," << EndName << " = " << aGraphName << ".LNode( '"
912           << FuncNames[0].c_str() << "' , Py" << Name() << " , '"
913           << FuncNames[1].c_str() << "' , PyMore" << Name()
914           << " , '" << FuncNames[2].c_str() << "' , PyNext"
915           << Name() << " )" << endl ;
916         f << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
917         f << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
918         f << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
919         f << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
920           << aCoupledNode->YCoordinate() << " )" << endl ;
921         SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
922         f << "Py" << aCoupledNode->Name() << " = []" << endl ;
923         for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
924           f << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
925             << endl ;
926         }
927         f << EndName << ".SetPyFunction( 'End" << FuncNames[0].c_str() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
928       }
929       else if ( IsSwitchNode() ) {
930         f << Name() << "," << EndName << " = " << aGraphName << ".SNode( '"
931           << FuncNames[0].c_str() << "' , Py" << Name() << " )" << endl ;
932         f << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
933         f << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
934         f << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
935         f << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
936           << aCoupledNode->YCoordinate() << " )" << endl ;
937         SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
938         f << "Py" << aCoupledNode->Name() << " = []" << endl ;
939         for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
940           f << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
941             << endl ;
942         }
943         f << EndName << ".SetPyFunction( 'End" << FuncNames[0].c_str() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
944         for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
945           const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
946           if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
947             f << EndName << ".InPort( '" << anInPort->PortName()
948               << "' , '" << anInPort->PortType() << "' )" << endl ;
949           }
950         }
951         for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) {
952           const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ;
953           if ( anOutPort->IsInLine() ) {
954             f << EndName << ".OutPort( '" << anOutPort->PortName()
955               << "' , '" << anOutPort->PortType() << "' )" << endl ;
956           }
957         }
958       }
959       delete [] EndName ;
960     }
961   }
962
963   f << Name() << ".SetName( '" << Name() << "' )" << endl ;
964   f << Name() << ".SetAuthor( '" << Author() << "' )" << endl ;
965   if ( IsFactoryNode() ) {
966     f << Name() << ".SetContainer( '" << Computer << "' )" << endl ;
967   }
968   f << Name() << ".SetComment( '" << Comment() << "' )" << endl ;
969   f << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ;
970
971   if ( IsOneOfInLineNodes() ) {
972     int i ;
973     for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
974       const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
975       if ( anInPort->IsInLine() ) {
976         f << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
977           << anInPort->PortType() << "' )" << endl ;
978       }
979     }
980     for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
981       const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
982       if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
983         f << Name() << ".OutPort( '" << anOutPort->PortName()
984           << "' , '" << anOutPort->PortType() << "' )" << endl ;
985       }
986     }
987   }
988
989 #if 0
990   if ( IsLoopNode() || IsSwitchNode() ) {
991     f << EndName << ".SetName( '" << CoupledNode
992       << "' )" << endl ;
993     f << EndName << ".SetAuthor( '" << CoupledNode->Author()
994       << "' )" << endl ;
995     f << EndName << ".SetComment( '" << CoupledNode->Comment()
996       << "' )" << endl ;
997     f << EndName << ".Coords( " << CoupledNode->XCoordinate() << " , "
998       << CoupledNode->YCoordinate() << " )" << endl ;
999     unsigned int i;
1000     for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1001       const InPort * anInPort = GetNodeInPort( i ) ;
1002       if ( anInPort->IsBus() ) {
1003         const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
1004         f << Name() << ".BusPorts( '" << anInPort->PortName() << "' , '"
1005           << anInPort->PortType() << "' , '" << anOutPort->PortName()
1006           << "' , '" << anOutPort->PortType() << "' )" << endl ;
1007       }
1008     }
1009   }
1010 #endif
1011   return true ;
1012 }
1013
1014 void GraphBase::ComputingNode::NodeInfo(ostream & s) const {
1015   s << *this ;
1016   ListPorts( s , true ) ;
1017   s << ends ;
1018 }
1019
1020 ostream & operator<< (ostream & f,const GraphBase::ComputingNode & G) {
1021 //  f << "ComponentName    " << G.ComponentName() << endl ;
1022   if ( G.IsComputingNode() )
1023     f << "NodeName         " << G.Name() << endl ;
1024   else
1025     f << "DataFlowName     " << G.Name() << endl ;
1026   f << "Kind             " << G.Kind() << endl ;
1027   f << "Service          " << *G.GetService() ;
1028   f << "FirstCreation    " << G.FirstCreation () << endl ;
1029   f << "LastModification " << G.LastModification() << endl ;
1030   f << "EditorRelease    " << G.EditorRelease() << endl ;
1031   f << "Author           " << G.Author() << endl ;
1032 //  f << "Computer         " << G.Computer() << endl ;
1033   f << "Comment          " << G.Comment() << endl ;
1034   f << endl ;
1035   
1036   return f;
1037 }
1038
1039 void GraphBase::ComputingNode::ListLinks(ostream &f ) const {
1040   int i ;
1041   for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1042     const GraphBase::OutPort* fromPort = GetNodeOutPort( i ) ;
1043     if ( fromPort->IsPortConnected() ) {
1044       int j ;
1045       for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) {
1046         if ( j == 0 )
1047           f << "FromNode " << Name() << endl ;
1048         f << "         FromServiceParameterName "
1049           << fromPort->GetServicesParameter().Parametername ;
1050         const GraphBase::InPort* toPort = fromPort->InPorts( j ) ;
1051         f << " ToNode " << toPort->NodeName() ;
1052         f << " ToServiceParameterName "
1053           << toPort->GetServicesParameter().Parametername;
1054         f << " Value " ;
1055         fromPort->StringValue( f ) ;
1056         f << endl ;
1057       }
1058     }
1059   }
1060 }
1061
1062 ostream & operator<< (ostream &fOut,const SUPERV::SDate &D) {
1063 //  cdebug_in << "operator<< GraphEditor::Date" << endl;
1064
1065   fOut  << D.Day << "/" 
1066         << D.Month << "/" 
1067         << D.Year << " - " 
1068         << D.Hour << ":" 
1069         << D.Minute <<  ":"  
1070         << D.Second;
1071
1072 //  cdebug_out << "operator<< GraphEditor::Date" << endl;
1073   return fOut;
1074 }
1075