]> SALOME platform Git repositories - modules/superv.git/blob - src/GraphBase/DataFlowBase_ComputingNode.cxx
Salome HOME
NRI : Merge from 1.2c.
[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     RetVal = thePort->IsDataConnected() ;
361   }
362   else {
363     const GraphBase::OutPort * thePort = GetOutPort( ToServiceParameterName ) ;
364     if ( thePort ) {
365       RetVal = thePort->IsDataConnected() ;
366     }
367   }
368   return RetVal ;
369 }
370
371 GraphBase::SNode * GraphBase::ComputingNode::GetInfo() {
372   cdebug_in << "GraphBase::ComputingNode::GetInfo" << endl;
373   GraphBase::SNode * Info = new GraphBase::SNode ;
374 //  Info->theComponentName = ComponentName() ;
375 //  Info->theInterfaceName = InterfaceName() ;
376   Info->theName = Name() ;
377   Info->theKind = Kind() ;
378   Info->theService = *GetService() ;
379 //  Info->theListOfParameters = *GetListOfParameters() ;
380   Info->theFirstCreation = FirstCreation() ;
381   Info->theLastModification = LastModification() ;
382   Info->theEditorRelease = EditorRelease() ;
383   Info->theAuthor = Author() ;
384 //  Info->theContainer = Computer() ;
385   Info->theComment = Comment() ;
386   Info->theCoords.theX = GraphBase::ComputingNode::XCoordinate() ;
387   Info->theCoords.theY = GraphBase::ComputingNode::YCoordinate() ;
388   cdebug_out << "GraphBase::ComputingNode::GetInfo" << endl;
389   return Info ;
390 }
391
392 GraphBase::InPort * GraphBase::ComputingNode::AddInPort( const char * InputParameterName ,
393                                                 const char * InputParameterType ) {
394   return GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
395                                             Kind() ,
396                                             InputParameterName ,
397                                             InputParameterType ,
398                                             _Graph_prof_debug , _Graph_fdebug ) ;
399 }
400 GraphBase::OutPort * GraphBase::ComputingNode::AddOutPort( const char * OutputParameterName ,
401                                                   const char * OutputParameterType ) {
402   return GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() ,
403                                              Kind() ,
404                                              OutputParameterName ,
405                                              OutputParameterType ,
406                                              _Graph_prof_debug , _Graph_fdebug ) ;
407 }
408
409 void GraphBase::ComputingNode::AddLink( GraphBase::ComputingNode * ToNode ) {
410   int index = GetLinkedNodeIndex( ToNode->Name() ) ;
411   if ( index < 0 ) {
412     cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name()
413            << " ) new LinkedNode " << endl ;
414     _LinkedNodes.resize( _LinkedNodesSize+1 ) ;
415     _LinkedInPortsNumber.resize( _LinkedNodesSize+1 ) ;
416     _LinkedNodes[ _LinkedNodesSize ] = ToNode ;
417     _LinkedInPortsNumber[ _LinkedNodesSize ] = 1 ;
418     SetLinkedNodeIndex( ToNode->Name() , _LinkedNodesSize ) ;
419     index = _LinkedNodesSize ;
420     _LinkedNodesSize++ ;
421   }
422   else {
423     cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name()
424            << " ) old LinkedNode " << _LinkedNodes[index ]->Name() << endl ;
425     _LinkedInPortsNumber[ index ] += 1 ;
426   }
427   cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name()
428          << " ) LinkedNodesSize " << _LinkedNodesSize << " [ " << index
429          << " ] _LinkedInPortsNumber " << _LinkedInPortsNumber[ index ]
430          << " ConnectedInPortsNumber " << ToNode->ConnectedInPortsNumber()
431          << " + 1 Service " << ServiceName() << endl ;
432   ToNode->IncrConnectedInPortsNumber() ;
433 }
434
435 void GraphBase::ComputingNode::RemoveLink( GraphBase::ComputingNode * ToNode ) {
436   int index = GetLinkedNodeIndex( ToNode->Name() ) ;
437   if ( index >= 0 ) {
438     cdebug << "GraphBase::ComputingNode::RemoveLink( to " << ToNode->Name() << " from "
439            << Name() << " index : " << index << " ConnectedInPortsNumber "
440            << ToNode->ConnectedInPortsNumber() - 1 << " LinkedInPortsNumber "
441            << _LinkedInPortsNumber[ index ] << " - 1" << endl ;
442     ToNode->DecrConnectedInPortsNumber() ;
443     _LinkedInPortsNumber[ index ] -= 1 ;
444     if ( _LinkedInPortsNumber[ index ] == 0 ) {
445       _LinkedNodesSize-- ;
446       cdebug << "GraphBase::ComputingNode::RemoveLink new LinkedNodesSize "
447              << _LinkedNodesSize << " " << ToNode->Name() << " removed from "
448              << " linkednodes of " << Name() << endl ;
449       int i ;
450       for ( i = index ; i < _LinkedNodesSize ; i++ ) {
451         _LinkedNodes[ i ] = _LinkedNodes[ i+1 ] ;
452         _LinkedInPortsNumber[ i ] =  _LinkedInPortsNumber[ i+1 ] ;
453         SetLinkedNodeIndex( _LinkedNodes[ i ]->Name() , i ) ;
454       }
455       DelLinkedNodeIndex( ToNode->Name() ) ;
456       _LinkedNodes.resize( _LinkedNodesSize+1 ) ;
457       _LinkedInPortsNumber.resize( _LinkedNodesSize+1 ) ;
458     }
459   }
460   else {
461     cdebug << " Error index " << index << endl ;
462   }
463 }
464
465 void GraphBase::ComputingNode::ReNameLink( const char* OldNodeName ,
466                                   const char* NewNodeName ) {
467   cdebug_in << "GraphBase::ComputingNode::ReNameLink (" << OldNodeName << " , "
468             << NewNodeName << ")" << endl;
469   int index = GetLinkedNodeIndex( OldNodeName ) ;
470   if ( index >= 0 ) {
471     _MapOfLinkedNodes.erase( OldNodeName ) ;
472     SetLinkedNodeIndex( NewNodeName , index ) ;
473   }
474   cdebug_out << "GraphBase::ComputingNode::ReNameLink" << endl ;
475 }
476
477 #include <sys/time.h>
478 #include <sys/resource.h>
479 #include <unistd.h>
480
481 const long GraphBase::ComputingNode::CpuUsed() {
482   struct rusage usage ;
483   if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) {
484     perror("GraphBase::CpuUsed") ;
485     return 0 ;
486   }
487 //  return usage.ru_utime.__time_t tv_sec ;
488   cdebug << "CpuUsed " << usage.ru_utime.tv_sec << " " << usage.ru_utime.tv_usec << " "
489          << usage.ru_stime.tv_sec << " " << usage.ru_stime.tv_usec << endl ;
490   return usage.ru_utime.tv_sec ;
491 }
492
493 #if 0
494 const GraphBase::ListOfParameters * GraphBase::ComputingNode::GetListOfParameters() const {
495   GraphBase::ListOfParameters * aListOfParameters = new GraphBase::ListOfParameters ;
496   if ( IsInLineNode() || IsGOTONode() ) {
497     unsigned int i;
498     for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
499       const InPort * anInPort = GetNodeInPort( i ) ;
500       if ( anInPort->IsBus() ) {
501         int size = aListOfParameters->size() ;
502         aListOfParameters->resize( size + 1 ) ;
503         (*aListOfParameters)[size].theInParameter.Parametername = anInPort->PortName() ;
504         (*aListOfParameters)[size].theInParameter.Parametertype = anInPort->PortType() ;
505         const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
506         (*aListOfParameters)[size].theOutParameter.Parametername = anOutPort->PortName() ;
507         (*aListOfParameters)[size].theOutParameter.Parametertype = anOutPort->PortType() ;
508       }
509     }
510   }
511   return aListOfParameters ;
512 }
513 #endif
514
515 bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
516                                         const char * ComponentName ,
517                                         const char * InterfaceName ,
518                                         const char * Computer ,
519                                         const char * CoupledNode ,
520                                         const ListOfFuncName FuncNames ,
521                                         const ListOfPythonFunctions PythonFunctions ,
522                                         int XCoordinate , int YCoordinate ) const {
523   QDomElement node = Graph.createElement( "node" ) ;
524   info.appendChild( node ) ;
525   QDomElement componentname = Graph.createElement( "component-name" ) ;
526   QDomText aField ;
527   if ( strlen( ComponentName ) ) {
528 //    f << Tabs << "<component-name>" << ComponentName << "</component-name>"
529 //      << endl ;
530 //    componentname.setNodeValue( ComponentName ) ;
531     aField = Graph.createTextNode( ComponentName ) ;
532   }
533   else {
534 //    f << Tabs << "<component-name>?</component-name>" << endl ;
535 //    componentname.setNodeValue( "?" ) ;
536     aField = Graph.createTextNode( "?" ) ;
537   }
538   node.appendChild( componentname ) ;
539   componentname.appendChild( aField ) ;
540
541   QDomElement interfacename = Graph.createElement("interface-name") ;
542   if ( strlen( InterfaceName ) ) {
543 //    f << Tabs << "<interface-name>" << InterfaceName << "</interface-name>"
544 //      << endl ;
545 //    interfacename.setAttribute("name" , InterfaceName ) ;
546     aField = Graph.createTextNode( InterfaceName ) ;
547   }
548   else {
549 //    f << Tabs << "<interface-name>?</interface-name>" << endl ;
550 //    interfacename.setAttribute("name" , "?" ) ;
551     aField = Graph.createTextNode( "?" ) ;
552   }
553   node.appendChild(interfacename) ;
554   interfacename.appendChild( aField ) ;
555
556 //  f << Tabs << "<node-name>" << Name() << "</node-name>" << endl ;
557   QDomElement nodename = Graph.createElement("node-name") ;
558   aField = Graph.createTextNode( Name() ) ;
559   node.appendChild( nodename ) ;
560   nodename.appendChild( aField ) ;
561
562 //  f << Tabs << "<kind>" << (int ) Kind() << "</kind>" << endl ;
563   QDomElement kind = Graph.createElement( "kind" ) ;
564   QString aKind ;
565   aKind = aKind.setNum( Kind() ) ;
566   aField = Graph.createTextNode( aKind ) ;
567   node.appendChild( kind ) ;
568   kind.appendChild( aField ) ;
569
570   QDomElement couplednode = Graph.createElement("coupled-node") ;
571   if ( IsGOTONode() || IsLoopNode() || IsEndLoopNode() ||
572        IsSwitchNode() || IsEndSwitchNode() ) {
573 //    f << Tabs << "<coupled-node>" << CoupledNode << "</coupled-node>"
574 //      << endl ;
575     aField = Graph.createTextNode( CoupledNode ) ;
576   }
577   else {
578 //    f << Tabs << "<coupled-node>?</coupled-node>" << endl ;
579     aField = Graph.createTextNode( "?" ) ;
580   }
581   node.appendChild(couplednode) ;
582   couplednode.appendChild( aField ) ;
583
584 //  f << Tabs << "<service>" << endl ;
585   QDomElement service = Graph.createElement("service") ;
586   node.appendChild(service) ;
587   QDomElement servicename = Graph.createElement("service-name") ;
588   if ( strlen( ServiceName() ) ) {
589 //    f << Tabs << "    <service-name>" << ServiceName() << "</service-name>" << endl ;
590     aField = Graph.createTextNode( ServiceName() ) ;
591   }
592   else {
593 //    f << Tabs << "    <service-name>?</service-name>" << endl ;
594     aField = Graph.createTextNode( "?" ) ;
595   }
596   service.appendChild(servicename) ;
597   servicename.appendChild( aField ) ;
598
599 //  f << Tabs << "      <inParameter-list>" << endl ;
600   QDomElement inParameterlist = Graph.createElement("inParameter-list") ;
601   service.appendChild(inParameterlist) ;
602   unsigned int i;
603   for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
604 //    f << Tabs << "            <inParameter>" << endl ;
605     QDomElement inParameter = Graph.createElement("inParameter") ;
606     inParameterlist.appendChild(inParameter) ;
607 //    f << Tabs << "                    <inParameter-type>"
608 //      << ServiceInParameter()[i].Parametertype << "</inParameter-type>"
609 //      << endl ;
610     QDomElement inParametertype = Graph.createElement("inParameter-type") ;
611     // mpv: Linux 8.0 compiler compatibility
612 //    aField = Graph.createTextNode( (char *)ServiceInParameter()[i].Parametertype ) ;
613     if ( strlen( ServiceInParameter()[i].Parametertype ) ) {
614       aField = Graph.createTextNode( strdup( ServiceInParameter()[i].Parametertype ) ) ;
615     }
616     else {
617       aField = Graph.createTextNode( "?" ) ;
618     }
619     inParameter.appendChild(inParametertype) ;
620     inParametertype.appendChild( aField ) ;
621 //    f << Tabs << "                    <inParameter-name>"
622 //      << ServiceInParameter()[i].Parametername << "</inParameter-name>"
623 //      << endl ;
624     QDomElement inParametername = Graph.createElement("inParameter-name") ;
625     // mpv: Linux 8.0 compiler compatibility
626 //    aField = Graph.createTextNode( (char *) ServiceInParameter()[i].Parametername ) ;
627     if ( strlen( ServiceInParameter()[i].Parametername ) ) {
628       aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
629     }
630     else {
631       aField = Graph.createTextNode( "?" ) ;
632     }
633     inParameter.appendChild(inParametername) ;
634     inParametername.appendChild( aField ) ;
635 //    f << Tabs << "            </inParameter>" << endl ;
636   }
637 //  f << Tabs << "      </inParameter-list>" << endl ;
638 //  f << Tabs << "      <outParameter-list>" << endl ;
639   QDomElement outParameterlist = Graph.createElement("outParameter-list") ;
640   service.appendChild(outParameterlist) ;
641   for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) {
642 //    f << Tabs << "            <outParameter>" << endl ;
643     QDomElement outParameter = Graph.createElement("outParameter") ;
644     outParameterlist.appendChild(outParameter) ;
645 //    f << Tabs << "                    <outParameter-type>"
646 //      << ServiceOutParameter()[i].Parametertype << "</outParameter-type>"
647 //      << endl ;
648     QDomElement outParametertype = Graph.createElement("outParameter-type") ;
649     // mpv: Linux 8.0 compiler compatibility
650 //    aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametertype ) ;
651     if ( strlen( ServiceOutParameter()[i].Parametertype ) ) {
652       aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
653     }
654     else {
655       aField = Graph.createTextNode( "?" ) ;
656     }
657     outParameter.appendChild(outParametertype) ;
658     outParametertype.appendChild( aField ) ;
659 //    f << Tabs << "                    <outParameter-name>"
660 //      << ServiceOutParameter()[i].Parametername << "</outParameter-name>"
661 //      << endl ;
662     QDomElement outParametername = Graph.createElement("outParameter-name") ;
663     // mpv: Linux 8.0 compiler compatibility
664 //    aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametername ) ;
665     if ( strlen( ServiceOutParameter()[i].Parametername ) ) {
666       aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
667     }
668     else {
669       aField = Graph.createTextNode( "?" ) ;
670     }
671     outParameter.appendChild(outParametername) ;
672     outParametername.appendChild( aField ) ;
673 //    f << Tabs << "            </outParameter>" << endl ;
674   }
675 //  f << Tabs << "      </outParameter-list>" << endl ;
676 //  f << Tabs << "</service>" << endl ;
677
678 //  f << Tabs << "<Parameter-list>" << endl ;
679   QDomElement Parameterlist = Graph.createElement("Parameter-list") ;
680   node.appendChild( Parameterlist ) ;
681 #if 0
682   if ( IsInLineNode() || IsGOTONode() ||
683        IsLoopNode() || IsEndLoopNode() ||
684        IsSwitchNode() || IsEndSwitchNode() ) {
685     unsigned int i;
686     for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
687       const InPort * anInPort = GetNodeInPort( i ) ;
688       if ( anInPort->IsBus() ) {
689         f << Tabs << "  <inParameter>" << endl ;
690         f << Tabs << "          <inParameter-type>"
691           << anInPort->PortType() << "</inParameter-type>"
692           << endl ;
693         f << Tabs << "          <inParameter-name>"
694           << anInPort->PortName() << "</inParameter-name>"
695           << endl ;
696         f << Tabs << "  </inParameter>" << endl ;
697         const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
698         f << Tabs << "  <outParameter>" << endl ;
699         f << Tabs << "          <outParameter-type>"
700           << anOutPort->PortType() << "</outParameter-type>"
701           << endl ;
702         f << Tabs << "          <outParameter-name>"
703           << anOutPort->PortName() << "</outParameter-name>"
704           << endl ;
705         f << Tabs << "  </outParameter>" << endl ;
706       }
707     }
708   }
709 #endif
710 //  f << Tabs << "</Parameter-list>" << endl ;    
711
712 //  f << Tabs << "<PyFunction-list>" << endl ;
713   QDomElement PyFunctionlist = Graph.createElement("PyFunction-list") ;
714   node.appendChild( PyFunctionlist ) ;
715   for ( i = 0 ; i < PythonFunctions.size() ; i++ ) {
716 //    f << Tabs << "    <PyFunction>" << endl ;
717     QDomElement PyFunction = Graph.createElement("PyFunction") ;
718     PyFunctionlist.appendChild( PyFunction ) ;
719     int j ;
720     for ( j = 0 ; j < (int ) (*PythonFunctions[i]).length() ; j++ ) {
721       if ( j == 0 ) {
722 //        if ( i == 0 ) {
723 //          f << Tabs << "              <FuncName>" << FuncNames[i].c_str()
724 //            << "</FuncName>" << endl ;
725           QDomElement FuncName = Graph.createElement("FuncName") ;
726           if ( strlen( FuncNames[i].c_str() ) ) {
727             aField = Graph.createTextNode( FuncNames[i].c_str() ) ;
728           }
729           else {
730             aField = Graph.createTextNode( "?" ) ;
731           }
732           PyFunction.appendChild( FuncName ) ;
733           FuncName.appendChild( aField ) ;
734 //      }
735 //        else if ( i == 1 ) {
736 //          f << Tabs << "              <FuncName>" << FuncNames[i].c_str()
737 //            << "</FuncName>" << endl ;
738 //      }
739 //        else if ( i == 2 ) {
740 //          f << Tabs << "              <FuncName>" << FuncNames[i].c_str()
741 //            << "</FuncName>" << endl ;
742 //      }
743       }
744 //      f << Tabs << "          <PyFunc>" << (*PythonFunctions[i])[j]
745 //        << "</PyFunc>" << endl ;
746       QDomElement PyFunc = Graph.createElement("PyFunc") ;
747       QDomCDATASection aCDATA ;
748       // mpv: Linux 8.0 compiler compatibility
749 //       char * aCDATAChar = (char *) (*PythonFunctions[i])[j] ;
750       char * aCDATAChar = strdup ((*PythonFunctions[i])[j]) ;
751       int i ;
752       for ( i = 0 ; i < (int ) strlen( aCDATAChar ) ; i++ ) {
753         if ( aCDATAChar[ i ] != ' ' ) {
754           break ;
755         }
756       }
757       if ( i == (int ) strlen( aCDATAChar ) ) {
758         aCDATA = Graph.createCDATASection( "?" ) ;
759       }
760       else {
761         aCDATA = Graph.createCDATASection( aCDATAChar ) ;
762       }
763       PyFunction.appendChild( PyFunc ) ;
764       PyFunc.appendChild( aCDATA ) ;
765     }
766 //    f << Tabs << "    </PyFunction>" << endl ;
767   }
768 //  f << Tabs << "</PyFunction-list>" << endl ;
769
770 //  f << Tabs << "<creation-date>" << FirstCreation() << "</creation-date>"
771 //    << endl ;
772   QDomElement creationdate = Graph.createElement("creation-date") ;
773   char fdate[30] ;
774   sprintf( fdate , "%d/%d/%d - %d:%d:%d" ,  FirstCreation().Day , FirstCreation().Month , FirstCreation().Year , FirstCreation().Hour , FirstCreation().Minute , FirstCreation().Second ) ;
775   aField = Graph.createTextNode( fdate ) ;
776   node.appendChild( creationdate ) ;
777   creationdate.appendChild( aField ) ;
778 //  f << Tabs << "<lastmodification-date>" << LastModification()
779 //    << "</lastmodification-date>" << endl ;
780   QDomElement lastmodificationdate = Graph.createElement("lastmodification-date") ;
781   char ldate[30] ;
782   sprintf( ldate , "%d/%d/%d - %d:%d:%d" , LastModification().Day , LastModification().Month , LastModification().Year , LastModification().Hour , LastModification().Minute , LastModification().Second ) ;
783   aField = Graph.createTextNode( ldate ) ;
784   node.appendChild( lastmodificationdate ) ;
785   lastmodificationdate.appendChild( aField ) ;
786 //  f << Tabs << "<editor-release>" << EditorRelease() << "</editor-release>"
787 //    << endl ;
788   QDomElement editorrelease = Graph.createElement("editor-release") ;
789   aField = Graph.createTextNode( EditorRelease() ) ;
790   node.appendChild( editorrelease ) ;
791   editorrelease.appendChild( aField ) ;
792   QDomElement author = Graph.createElement("author") ;
793   if ( strlen( Author() ) ) {
794 //    f << Tabs << "<author>" << Author() << "</author>" << endl ;
795     aField = Graph.createTextNode( Author() ) ;
796   }
797   else {
798 //    f << Tabs << "<author>?</author>" << endl ;
799     aField = Graph.createTextNode( "?" ) ;
800   }
801   node.appendChild( author ) ;
802   author.appendChild( aField ) ;
803   QDomElement container = Graph.createElement("container") ;
804   if ( IsFactoryNode() && strlen( Computer) ) {
805 //    f << Tabs << "<container>" << Computer << "</container>" << endl ;
806     aField = Graph.createTextNode( Computer ) ;
807   }
808   else {
809 //    f << Tabs << "<container>?</container>" << endl ;
810     aField = Graph.createTextNode( "?" ) ;
811   }
812   node.appendChild( container ) ;
813   container.appendChild( aField ) ;
814   QDomElement comment = Graph.createElement("comment") ;
815   if ( strlen( Comment() ) ) {
816 //    f << Tabs << "<comment>" << Comment() << "</comment>" << endl ;
817     aField = Graph.createTextNode( Comment() ) ;
818   }
819   else {
820 //    f << Tabs << "<comment>?</comment>" << endl ;
821     aField = Graph.createTextNode( "?" ) ;
822   }
823   node.appendChild( comment ) ;
824   comment.appendChild( aField ) ;
825 //  f << Tabs << "<x-position>" << XCoordinate << "</x-position>" << endl ;
826   QDomElement xposition = Graph.createElement("x-position") ;
827   QString aXCoordinate ;
828   aXCoordinate = aKind.setNum( XCoordinate ) ;
829   aField = Graph.createTextNode( aXCoordinate ) ;
830   node.appendChild( xposition ) ;
831   xposition.appendChild( aField ) ;
832 //  f << Tabs << "<y-position>" << YCoordinate << "</y-position>" << endl ;
833   QDomElement yposition = Graph.createElement("y-position") ;
834   QString aYCoordinate ;
835   aYCoordinate = aKind.setNum( YCoordinate ) ;
836   aField = Graph.createTextNode( aYCoordinate ) ;
837   node.appendChild( yposition ) ;
838   yposition.appendChild( aField ) ;
839   return true ;
840 }
841
842 bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
843                                        const char * ComponentName ,
844                                        const char * InterfaceName ,
845                                        const char * Computer ,
846                                        const GraphBase::InLineNode * aCoupledNode ,
847                                        const ListOfFuncName FuncNames ,
848                                        const ListOfPythonFunctions PythonFunctions ,
849                                        int XCoordinate , int YCoordinate ) const {
850   if ( IsDataFlowNode() ) {
851     f << Name() << " = Graph( '" << Name() << "' )" << endl ;
852   }
853   else if ( IsComputingNode() ) {
854     int i ;
855     f << Name() << "_ServiceinParameter = []" << endl ;
856     for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
857       f << Name() << "_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
858         << ServiceInParameter()[i].Parametertype << "' , '"
859         << ServiceInParameter()[i].Parametername << "' ) )" << endl ;
860     }
861     f << Name() << "_ServiceoutParameter = []" << endl ;
862     for ( i = 0 ; i < (int ) ServiceOutParameter().length() ; i++ ) {
863       f << Name() << "_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
864         << ServiceOutParameter()[i].Parametertype << "' , '"
865         << ServiceOutParameter()[i].Parametername << "' ) )" << endl ;
866     }
867     f << Name() << "_Service = SALOME_ModuleCatalog.Service( '" << ServiceName()
868       << "' , " << Name() << "_ServiceinParameter" << " , "
869       << Name() << "_ServiceoutParameter" << " , 0 )" << endl ;
870     f << Name() << " = " << aGraphName << ".CNode( " << Name() << "_Service" << " )"
871       << endl ;
872   }
873   else if ( IsFactoryNode() ) {
874     f << Name() << " = " << aGraphName << ".FNode( '" << ComponentName
875       << "' , '" << InterfaceName << "' , '" << ServiceName() << "' )"
876       << endl ;
877   }
878   else {
879     f << "Py" << Name() << " = []" << endl ;
880     int i ;
881     SUPERV::ListOfStrings aPyFunc ;
882     if ( PythonFunctions.size() ) {
883       aPyFunc = *PythonFunctions[0] ;
884       for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
885         f << "Py" << Name() << ".append( '" << aPyFunc[i] << "' )" << endl ;
886       }
887     }
888     if ( IsInLineNode() ) {
889       f << Name() << " = " << aGraphName << ".INode( '" << FuncNames[0].c_str() << "' , Py"
890         << Name() << " )" << endl ;
891     }
892     else if ( IsGOTONode() ) {
893       if ( aCoupledNode ) {
894         f << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
895           << Name() << " , '" << aCoupledNode->Name() << "' )" << endl ;
896       }
897       else {
898         f << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
899           << Name() << " , '' )" << endl ;
900       }
901     }
902     else {
903 //      char * EndName = NULL ;
904 //      EndName = new char[ 3 + strlen( Name() ) + 1 ] ;
905 //      strcpy( EndName , "End" ) ;
906 //      strcat( EndName , Name() ) ;
907       char * EndName = aCoupledNode->Name() ;
908       if ( IsLoopNode() ) {
909         SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ;
910         SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ;
911         f << "PyMore" << Name() << " = []" << endl ;
912         for ( i = 0 ; i < (int ) aPyMore.length() ; i++ ) {
913           f << "PyMore" << Name() << ".append( '" << aPyMore[i] << "' )" << endl ;
914         }
915         f << "PyNext" << Name() << " = []" << endl ;
916         for ( i = 0 ; i < (int ) aPyNext.length() ; i++ ) {
917           f << "PyNext" << Name() << ".append( '" << aPyNext[i] << "' )" << endl ;
918         }
919         f << Name() << "," << EndName << " = " << aGraphName << ".LNode( '"
920           << FuncNames[0].c_str() << "' , Py" << Name() << " , '"
921           << FuncNames[1].c_str() << "' , PyMore" << Name()
922           << " , '" << FuncNames[2].c_str() << "' , PyNext"
923           << Name() << " )" << endl ;
924         f << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
925         f << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
926         f << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
927         f << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
928           << aCoupledNode->YCoordinate() << " )" << endl ;
929       }
930       else if ( IsSwitchNode() ) {
931         f << Name() << "," << EndName << " = " << aGraphName << ".SNode( '"
932           << FuncNames[0].c_str() << "' , Py" << Name() << " )" << endl ;
933         f << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
934         f << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
935         f << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
936         f << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
937           << aCoupledNode->YCoordinate() << " )" << endl ;
938         SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
939         f << "Py" << aCoupledNode->Name() << " = []" << endl ;
940         for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
941           f << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
942             << endl ;
943         }
944         f << EndName << ".SetPyFunction( 'End" << FuncNames[0].c_str() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
945         for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
946           const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
947           if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
948             f << EndName << ".InPort( '" << anInPort->PortName()
949               << "' , '" << anInPort->PortType() << "' )" << endl ;
950           }
951         }
952         for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) {
953           const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ;
954           if ( anOutPort->IsInLine() ) {
955             f << EndName << ".OutPort( '" << anOutPort->PortName()
956               << "' , '" << anOutPort->PortType() << "' )" << endl ;
957           }
958         }
959       }
960       delete [] EndName ;
961     }
962   }
963
964   f << Name() << ".SetName( '" << Name() << "' )" << endl ;
965   f << Name() << ".SetAuthor( '" << Author() << "' )" << endl ;
966   if ( IsFactoryNode() ) {
967     f << Name() << ".SetContainer( '" << Computer << "' )" << endl ;
968   }
969   f << Name() << ".SetComment( '" << Comment() << "' )" << endl ;
970   f << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ;
971
972   if ( IsOneOfInLineNodes() ) {
973     int i ;
974     for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
975       const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
976       if ( anInPort->IsInLine() ) {
977         f << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
978           << anInPort->PortType() << "' )" << endl ;
979       }
980     }
981     for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
982       const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
983       if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
984         f << Name() << ".OutPort( '" << anOutPort->PortName()
985           << "' , '" << anOutPort->PortType() << "' )" << endl ;
986       }
987     }
988   }
989
990 #if 0
991   if ( IsLoopNode() || IsSwitchNode() ) {
992     f << EndName << ".SetName( '" << CoupledNode
993       << "' )" << endl ;
994     f << EndName << ".SetAuthor( '" << CoupledNode->Author()
995       << "' )" << endl ;
996     f << EndName << ".SetComment( '" << CoupledNode->Comment()
997       << "' )" << endl ;
998     f << EndName << ".Coords( " << CoupledNode->XCoordinate() << " , "
999       << CoupledNode->YCoordinate() << " )" << endl ;
1000     unsigned int i;
1001     for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1002       const InPort * anInPort = GetNodeInPort( i ) ;
1003       if ( anInPort->IsBus() ) {
1004         const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
1005         f << Name() << ".BusPorts( '" << anInPort->PortName() << "' , '"
1006           << anInPort->PortType() << "' , '" << anOutPort->PortName()
1007           << "' , '" << anOutPort->PortType() << "' )" << endl ;
1008       }
1009     }
1010   }
1011 #endif
1012   return true ;
1013 }
1014
1015 void GraphBase::ComputingNode::NodeInfo(ostream & s) const {
1016   s << *this ;
1017   ListPorts( s , true ) ;
1018   s << ends ;
1019 }
1020
1021 ostream & operator<< (ostream & f,const GraphBase::ComputingNode & G) {
1022 //  f << "ComponentName    " << G.ComponentName() << endl ;
1023   if ( G.IsComputingNode() )
1024     f << "NodeName         " << G.Name() << endl ;
1025   else
1026     f << "DataFlowName     " << G.Name() << endl ;
1027   f << "Kind             " << G.Kind() << endl ;
1028   f << "Service          " << *G.GetService() ;
1029   f << "FirstCreation    " << G.FirstCreation () << endl ;
1030   f << "LastModification " << G.LastModification() << endl ;
1031   f << "EditorRelease    " << G.EditorRelease() << endl ;
1032   f << "Author           " << G.Author() << endl ;
1033 //  f << "Computer         " << G.Computer() << endl ;
1034   f << "Comment          " << G.Comment() << endl ;
1035   f << endl ;
1036   
1037   return f;
1038 }
1039
1040 void GraphBase::ComputingNode::ListLinks(ostream &f ) const {
1041   int i ;
1042   for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1043     const GraphBase::OutPort* fromPort = GetNodeOutPort( i ) ;
1044     if ( fromPort->IsPortConnected() ) {
1045       int j ;
1046       for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) {
1047         if ( j == 0 )
1048           f << "FromNode " << Name() << endl ;
1049         f << "         FromServiceParameterName "
1050           << fromPort->GetServicesParameter().Parametername ;
1051         const GraphBase::InPort* toPort = fromPort->InPorts( j ) ;
1052         f << " ToNode " << toPort->NodeName() ;
1053         f << " ToServiceParameterName "
1054           << toPort->GetServicesParameter().Parametername;
1055         f << " Value " ;
1056         fromPort->StringValue( f ) ;
1057         f << endl ;
1058       }
1059     }
1060   }
1061 }
1062
1063 ostream & operator<< (ostream &fOut,const SUPERV::SDate &D) {
1064 //  cdebug_in << "operator<< GraphEditor::Date" << endl;
1065
1066   fOut  << D.Day << "/" 
1067         << D.Month << "/" 
1068         << D.Year << " - " 
1069         << D.Hour << ":" 
1070         << D.Minute <<  ":"  
1071         << D.Second;
1072
1073 //  cdebug_out << "operator<< GraphEditor::Date" << endl;
1074   return fOut;
1075 }
1076