1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : DataFlowBase_ComputingNode.cxx
8 // Author : Jean Rahuel, CEA
16 #include "DataFlowBase_StreamGraph.hxx"
17 //#include "DataFlowBase_LoopNode.hxx"
19 static void InitFields( //SUPERV::KindOfNode &_Kind ,
20 SUPERV::SDate &_FirstCreation ,
21 SUPERV::SDate &_LastModification ,
22 char * &_EditorRelease ,
26 bool &_GeneratedName ,
27 //int &_DataStreamInPortsNumber ,
28 //int &_DataStreamOutPortsNumber ,
29 int &_ConnectedInPortsNumber ,
30 int &_DecrConnectedInPortsNumber ) {
31 //int &_LinkedNodesSize ,
32 //int &_SubGraphNumber ) {
33 time_t T = time(NULL);
34 struct tm * Tm = localtime(&T);
36 // _Kind = SUPERV::DataFlowGraph ;
38 _FirstCreation.Second = _LastModification.Second = Tm->tm_sec;
39 _FirstCreation.Minute = _LastModification.Minute = Tm->tm_min;
40 _FirstCreation.Hour = _LastModification.Hour = Tm->tm_hour;
41 _FirstCreation.Day = _LastModification.Day = Tm->tm_mday;
42 _FirstCreation.Month = _LastModification.Month = Tm->tm_mon + 1;
43 _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900;
45 _EditorRelease = new char[ strlen( SuperVision_Version ) + 1 ] ;
46 strcpy( _EditorRelease , SuperVision_Version ) ;
47 _Author = NULLSTRING ;
48 // _Computer = new char[ strlen( FACTORYSERVER ) + 1 ] ;
49 // strcpy( _Computer , FACTORYSERVER ) ;
50 _Comment = NULLSTRING ;
52 // _SubGraphNumber = 0 ;
53 // _HeadNode = false ;
54 _GeneratedName = false ;
56 // _DataStreamInPortsNumber = 0 ;
57 // _DataStreamOutPortsNumber = 0 ;
59 _ConnectedInPortsNumber = 0 ;
60 _DecrConnectedInPortsNumber = 0 ;
61 // _LinkedNodesSize = 0 ;
62 // _SubGraphNumber = 0 ;
65 GraphBase::ComputingNode::ComputingNode() :
66 // GraphBase::PortsOfNode::PortsOfNode() {
67 GraphBase::StreamNode::StreamNode() {
77 //_DataStreamInPortsNumber ,
78 //_DataStreamOutPortsNumber ,
79 _ConnectedInPortsNumber ,
80 _DecrConnectedInPortsNumber ) ;
83 Kind( SUPERV::DataFlowGraph ) ;
84 _NamingService = NULL ;
85 _Node_var = SUPERV::CNode::_nil() ;
88 _ThreadNo = pthread_self() ;
89 cdebug << "GraphBase::Node::Node " << this << " " << endl ;
93 GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
94 SALOME_NamingService* ptrNamingService ,
95 const char * aDataFlowName ,
96 const SUPERV::KindOfNode DataFlowkind ,
97 int * Graph_prof_debug ,
98 ofstream * Graph_fdebug ) :
99 // GraphBase::PortsOfNode::PortsOfNode( aDataFlowName ) {
100 GraphBase::StreamNode::StreamNode( aDataFlowName , DataFlowkind ,
101 Graph_prof_debug , Graph_fdebug ) {
103 // MESSAGE( "GraphBase::ComputingNode::ComputingNode " << aDataFlowName << " Graph_prof_debug " << Graph_prof_debug ) ;
104 InitFields( //_Kind ,
112 //_DataStreamInPortsNumber ,
113 //_DataStreamOutPortsNumber ,
114 _ConnectedInPortsNumber ,
115 _DecrConnectedInPortsNumber ) ;
117 //_SubGraphNumber ) ;
119 // Kind( SUPERV::DataFlowGraph ) ;
120 Kind( DataFlowkind ) ;
121 _ORB = CORBA::ORB::_duplicate( ORB ) ;
122 _NamingService = ptrNamingService ;
123 _Node_var = SUPERV::CNode::_nil() ;
126 _ThreadNo = pthread_self() ;
128 if ( Graph_prof_debug ) {
129 // MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug" ) ;
130 // cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug" << endl ;
131 _Graph_prof_debug = Graph_prof_debug ;
132 _Graph_fdebug = Graph_fdebug ;
133 SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
136 // cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ;
138 DefPortsOfNode( ORB , SALOME_ModuleCatalog::Service() , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
139 cdebug << "GraphBase::ComputingNode::ComputingNode " << this
140 << " Name '" << Name() << "' " << _FirstCreation
141 << " " << _LastModification << endl ;
144 GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
145 SALOME_NamingService* ptrNamingService ,
146 const SALOME_ModuleCatalog::Service& aService ,
147 const char *NodeName ,
148 const SUPERV::KindOfNode akind ,
149 const SUPERV::SDate NodeFirstCreation ,
150 const SUPERV::SDate NodeLastModification ,
151 const char * NodeEditorRelease ,
152 const char * NodeAuthor ,
153 const char * NodeComment ,
154 const bool GeneratedName ,
157 int * Graph_prof_debug ,
158 ofstream * Graph_fdebug ) :
159 // GraphBase::PortsOfNode::PortsOfNode() {
160 GraphBase::StreamNode::StreamNode( NodeName , akind , Graph_prof_debug , Graph_fdebug ) {
162 _ORB = CORBA::ORB::_duplicate( ORB ) ;
163 _NamingService = ptrNamingService ;
164 _Node_var = SUPERV::CNode::_nil() ;
167 _ThreadNo = pthread_self() ;
172 time_t T = time(NULL);
173 struct tm * Tm = localtime(&T);
175 _FirstCreation.Second = _LastModification.Second = Tm->tm_sec;
176 _FirstCreation.Minute = _LastModification.Minute = Tm->tm_min;
177 _FirstCreation.Hour = _LastModification.Hour = Tm->tm_hour;
178 _FirstCreation.Day = _LastModification.Day = Tm->tm_mday;
179 _FirstCreation.Month = _LastModification.Month = Tm->tm_mon + 1;
180 _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900;
182 if ( NodeEditorRelease != NULLSTRING ) {
183 _EditorRelease = new char[ strlen( NodeEditorRelease ) + 1 ] ;
184 strcpy( _EditorRelease , NodeEditorRelease ) ;
187 _EditorRelease = new char[ strlen( SuperVision_Version ) + 1 ] ;
188 strcpy( _EditorRelease , SuperVision_Version ) ;
191 if ( NodeAuthor != NULLSTRING ) {
192 _Author = new char[ strlen( NodeAuthor ) + 1 ] ;
193 strcpy( _Author , NodeAuthor ) ;
196 _Author = NULLSTRING ;
199 if ( NodeComment != NULLSTRING ) {
200 _Comment = new char[ strlen( NodeComment ) + 1 ] ;
201 strcpy( _Comment , NodeComment ) ;
204 _Comment = NULLSTRING ;
207 // _SubGraphNumber = 0 ;
208 // _HeadNode = false ;
209 _GeneratedName = GeneratedName ;
211 // const char *aNodeName = NodeName ;
212 // _Name = new char[strlen(aNodeName)+1];
213 // strcpy(_Name , aNodeName);
215 // _DataStreamInPortsNumber = 0 ;
216 // _DataStreamOutPortsNumber = 0 ;
218 _ConnectedInPortsNumber = 0 ;
219 _DecrConnectedInPortsNumber = 0 ;
220 // _LinkedNodesSize = 0 ;
225 _Graph_prof_debug = Graph_prof_debug ;
226 _Graph_fdebug = Graph_fdebug ;
227 // MESSAGE( "GraphBase::ComputingNode::ComputingNode " << NodeName
228 // << " _Graph_prof_debug " << _Graph_prof_debug ) ;
229 SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
230 cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << NodeName << ","
231 << akind << ")" << endl;
234 DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
235 cdebug << "GraphBase::ComputingNode::ComputingNode " << this
236 << " Name '" << Name()
237 << "' KindOfNode " << Kind()
238 << " ServiceName '" << ServiceName() << "' In(" << ServiceInParameter().length()
239 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
241 cdebug_out << "GraphBase::ComputingNode::ComputingNode" << endl;
244 GraphBase::ComputingNode::~ComputingNode() {
245 cdebug << "GraphBase::ComputingNode::~ComputingNode " << this
246 << " Name() "<< Name() << " _Comment "
247 << (void *) _Comment << " " << _Comment << " " << endl ;
250 //->StreamNode bool GraphBase::ComputingNode::Name( const char * aName) {
251 //->StreamNode cdebug_in << "GraphBase::ComputingNode::Name " << _Name << endl;
252 //->StreamNode if ( _Name ) {
253 //->StreamNode cdebug << "GraphBase::ComputingNode::ReName " << _Name << " --> " << aName << endl ;
254 //->StreamNode delete [] _Name ;
256 //->StreamNode _Name = new char[strlen(aName)+1] ;
257 //->StreamNode strcpy( _Name , aName ) ;
258 //->StreamNode cdebug_out << "GraphBase::ComputingNode::Name " << _Name << endl;
259 //->StreamNode return true ;
262 SUPERV::SDate GraphBase::ComputingNode::FirstCreation () const {
263 // cdebug << "GraphBase::ComputingNode::FirstCreation "
264 // << " Name '" << Name() << "' " << _FirstCreation << " "
265 // << _LastModification << endl ;
266 return _FirstCreation;
269 SUPERV::SDate GraphBase::ComputingNode::LastModification () const {
270 return _LastModification ;
273 void GraphBase::ComputingNode::FirstCreation(const SUPERV::SDate aDate ) {
274 _FirstCreation = aDate ;
277 void GraphBase::ComputingNode::LastModification(const SUPERV::SDate aDate ) {
278 _LastModification = aDate ;
281 bool GraphBase::ComputingNode::EditorRelease(const char * c){
282 if ( _EditorRelease && _EditorRelease != NULLSTRING )
283 delete _EditorRelease;
284 _EditorRelease = my_strdup(c);
288 bool GraphBase::ComputingNode::Author(const char * a) {
289 cdebug_in << "GraphBase::ComputingNode::Author " << _Author << endl;
290 if ( _Author && _Author != NULLSTRING )
292 _Author = my_strdup(a);
293 cdebug_out << "GraphBase::ComputingNode::Author " << _Author << endl;
297 bool GraphBase::ComputingNode::Comment(const char *c) {
298 cdebug_in << "GraphBase::ComputingNode::Comment " << _Comment << endl;
299 if ( _Comment != NULLSTRING )
301 _Comment = my_strdup(c);
302 cdebug_out << "GraphBase::ComputingNode::Comment " << _Comment << endl;
306 void GraphBase::ComputingNode::NodePort( const char * NodeName ,
307 const char * ServiceParameterName ,
308 char ** aNode , char ** aPort ) {
309 if ( strcmp( NodeName , Name() ) ) {
310 *aNode = my_strdup( NodeName ) ;
311 *aPort = my_strdup( ServiceParameterName ) ;
314 // char * BPort = strchr( ServiceParameterName , '\\' ) ;
315 char * BPort = (char * ) ServiceParameterName ;
316 while ( ( BPort = strchr( BPort , '_' ) ) ) {
317 if ( BPort[1] == '_' ) {
318 int len = BPort - ServiceParameterName ;
319 *aNode = new char [ len + 1 ] ;
320 strncpy( *aNode , ServiceParameterName , len ) ;
321 (*aNode)[ len ] = '\0' ;
322 *aPort = my_strdup( &BPort[ 2 ] ) ;
329 if ( BPort == NULL ) {
330 *aNode = my_strdup( NULLSTRING ) ;
331 *aPort = my_strdup( NULLSTRING ) ;
336 bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName, bool isInput ) {
337 bool RetVal = false ;
338 if ( isInput ) { // mkr : PAL8060
339 // we have to know the type of the port, because of input and output ports
340 // belong to one node may have the same names
341 const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ;
343 RetVal = thePort->IsPortConnected() ;
347 const GraphBase::OutPort * thePort = GetOutPort( ToServiceParameterName ) ;
349 RetVal = thePort->IsPortConnected() ;
355 bool GraphBase::ComputingNode::HasInput(const char * ToServiceParameterName ) {
356 bool RetVal = false ;
357 const GraphBase::InPort * theInPort = GetInPort( ToServiceParameterName ) ;
359 RetVal = theInPort->IsDataConnected() ;
362 const GraphBase::OutPort * theOutPort = GetOutPort( ToServiceParameterName ) ;
364 RetVal = theOutPort->IsDataConnected() ;
370 GraphBase::SNode * GraphBase::ComputingNode::GetInfo() {
371 cdebug_in << "GraphBase::ComputingNode::GetInfo" << endl;
372 GraphBase::SNode * Info = new GraphBase::SNode ;
373 // Info->theComponentName = ComponentName() ;
374 // Info->theInterfaceName = InterfaceName() ;
375 Info->theName = Name() ;
376 Info->theKind = Kind() ;
377 if ( IsDataStreamNode() ) {
379 SUPERV::KindOfDataStreamTrace DataStreamTrace ;
381 ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
382 Info->theTimeout = Timeout ;
383 Info->theDataStreamTrace = DataStreamTrace ;
384 Info->theDeltaTime = DeltaTime ;
386 Info->theService = *GetService() ;
387 // Info->theListOfParameters = *GetListOfParameters() ;
388 Info->theFirstCreation = FirstCreation() ;
389 Info->theLastModification = LastModification() ;
390 Info->theEditorRelease = EditorRelease() ;
391 Info->theAuthor = Author() ;
392 // Info->theContainer = Computer() ;
393 Info->theComment = Comment() ;
394 Info->theCoords.theX = GraphBase::ComputingNode::XCoordinate() ;
395 Info->theCoords.theY = GraphBase::ComputingNode::YCoordinate() ;
396 cdebug_out << "GraphBase::ComputingNode::GetInfo" << endl;
400 void GraphBase::ComputingNode::SetMacroPorts( GraphBase::Graph * aGraph ) {
401 cdebug_in << "GraphBase::ComputingNode::SetMacroPorts fill ports of MacroNode" << endl;
403 for ( i = 0 ; i < aGraph->GetNodeInPortsSize() ; i++ ) {
404 const GraphBase::InPort * anInPort = aGraph->GetNodeInPort( i ) ;
405 cdebug << "SetMacroPorts In" << i << " " << anInPort->PortName() << " " << anInPort->PortType()
406 << " " << anInPort->Kind() << endl ;
407 GraphBase::InPort * aNewInPort ;
408 if ( anInPort->IsDataStream() ) {
409 aNewInPort = AddInDataStreamPort( anInPort->PortName() , StringToDataStreamType( anInPort->PortType() ) ,
410 anInPort->Dependency() , anInPort->Kind() ) ;
412 else if ( anInPort->IsParam() || anInPort->IsInLine() ) {
413 aNewInPort = AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() ) ;
416 for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() ; i++ ) {
417 const GraphBase::OutPort * anOutPort = aGraph->GetNodeOutPort( i ) ;
418 cdebug << "SetMacroPorts Out" << i << " " << anOutPort->PortName() << " " << anOutPort->PortType()
419 << " " << anOutPort->Kind() << endl ;
420 if ( anOutPort->IsDataStream() ) {
421 AddOutDataStreamPort( anOutPort->PortName() , StringToDataStreamType( anOutPort->PortType() ) ,
422 anOutPort->Dependency() , anOutPort->Kind() ) ;
424 else if ( anOutPort->IsParam() || anOutPort->IsInLine() ) {
425 AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() ) ;
428 cdebug_out << "GraphBase::ComputingNode::SetMacroPorts" << endl;
431 void GraphBase::ComputingNode::UpdateMacroPorts( GraphBase::Graph * aGraph ) {
432 cdebug_in << "GraphBase::ComputingNode::UpdateMacroPorts fill ports of MacroNode from "
433 << aGraph->Name() << " InPorts(" << aGraph->GetNodeInPortsSize() << ") OutPorts("
434 << aGraph->GetNodeInPortsSize() << ") to MacroNode " << Name() << " InPorts(" << GetNodeInPortsSize()
435 << ") OutPorts(" << GetNodeInPortsSize() << ")" << endl;
436 cdebug << Name() << " : " << *GetService() << endl ;
437 cdebug << aGraph->Name() << " : " << *aGraph->GetService() << endl ;
439 // Loop over InPorts of MacroNode ; if it does not exist in the MacroGraph ===> DelInPort in the MacroNode
440 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
441 GraphBase::InPort * anInPort = aGraph->GetChangeInPort( GetNodeInPort( i )->PortName() ) ;
442 if ( anInPort && !anInPort->IsGate() && !GetNodeInPort( i )->IsGate() ) {
443 if ( strcmp( GetNodeInPort( i )->PortType() , anInPort->PortType() ) ) {
444 cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
445 << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
446 cdebug << " <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
447 << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
448 GetChangeNodeInPort( i )->PortType( (char * ) anInPort->PortType() ) ;
450 if ( GetNodeInPort( i )->Kind() != anInPort->Kind() ) {
451 cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
452 << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
453 cdebug << " <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
454 << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
455 GetChangeNodeInPort( i )->Kind( anInPort->Kind() ) ;
457 if ( GetNodeInPort( i )->Dependency() != anInPort->Dependency() ) {
458 cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
459 << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
460 cdebug << " <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
461 << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
462 GetChangeNodeInPort( i )->Dependency( anInPort->Dependency() ) ;
465 else if ( !GetNodeInPort( i )->IsGate() ) {
466 cdebug << "UpdateMacroPorts DelInPort In" << i << " " << GetNodeInPort( i )->PortName() << " "
467 << GetNodeInPort( i )->PortType() << " " << GetNodeInPort( i )->Kind() << endl ;
468 DelInPort( GetNodeInPort( i )->PortName() ) ;
469 i--; // mkr : fix for bug PAL8004
473 // Loop over InPorts of the MacroGraph : if it does not exist in the MacroNode ==> AddInPort in the MacroNode
474 for ( index = 0 ; index < aGraph->GetNodeInPortsSize() ; index++ ) {
475 GraphBase::InPort * anInPort = aGraph->GetChangeNodeInPort( index ) ;
476 GraphBase::InPort * aMacroInPort = GetChangeInPort( anInPort->PortName() ) ;
477 if ( !anInPort->IsGate() &&
478 strcmp( GetChangeNodeInPort( index )->PortName() , anInPort->PortName() ) ) {
479 cdebug << "UpdateMacroPorts Add/MoveInPort In" << index << " " << anInPort->PortName() << " "
480 << anInPort->PortType() << " " << anInPort->Kind() << endl ;
481 if ( aMacroInPort ) {
482 MoveInPort( anInPort->PortName() , index ) ;
485 AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() , index ) ;
489 // Loop over OutPorts of MacroNode ; if it does not exist in the MacroGraph ===> DelOutPort in the MacroNode
490 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
491 GraphBase::OutPort * anOutPort = aGraph->GetChangeOutPort( GetNodeOutPort( i )->PortName() ) ;
492 if ( anOutPort && !anOutPort->IsGate() && !GetNodeOutPort( i )->IsGate() ) {
493 if ( strcmp( GetNodeOutPort( i )->PortType() , anOutPort->PortType() ) ) {
494 cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
495 << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
496 cdebug << " <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
497 << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
498 GetChangeNodeOutPort( i )->PortType( (char * ) anOutPort->PortType() ) ;
500 if ( GetNodeOutPort( i )->Kind() != anOutPort->Kind() ) {
501 cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
502 << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
503 cdebug << " <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
504 << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
505 GetChangeNodeOutPort( i )->Kind( anOutPort->Kind() ) ;
507 if ( GetNodeOutPort( i )->Dependency() != anOutPort->Dependency() ) {
508 cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
509 << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
510 cdebug << " <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
511 << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
512 GetChangeNodeOutPort( i )->Dependency( anOutPort->Dependency() ) ;
515 else if ( !GetNodeOutPort( i )->IsGate() ) {
516 cdebug << "UpdateMacroPorts DelOutPort Out" << i << " " << GetNodeOutPort( i )->PortName() << " "
517 << GetNodeOutPort( i )->PortType() << " " << GetNodeOutPort( i )->Kind() << endl ;
518 DelOutPort( GetNodeOutPort( i )->PortName() ) ;
521 // Loop over OutPorts of the MacroGraph : if it does not exist in the MacroNode ==> AddOutPort in the MacroNode
522 for ( index = 0 ; index < aGraph->GetNodeOutPortsSize() ; index++ ) {
523 GraphBase::OutPort * anOutPort = aGraph->GetChangeNodeOutPort( index ) ;
524 GraphBase::OutPort * aMacroOutPort = GetChangeOutPort( anOutPort->PortName() ) ;
525 if ( !anOutPort->IsGate() && strcmp( GetNodeOutPort( index )->PortName() , anOutPort->PortName() ) ) {
526 cdebug << "UpdateMacroPorts Add/MoveOutPort Out" << index << " " << anOutPort->PortName() << " "
527 << anOutPort->PortType() << " " << anOutPort->Kind() << endl ;
528 if ( aMacroOutPort ) {
529 MoveOutPort( anOutPort->PortName() , index ) ;
532 AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() , index ) ;
536 bool ErrPort = false ;
537 if ( aGraph->GetNodeInPortsSize() != GetNodeInPortsSize() ||
538 aGraph->GetNodeOutPortsSize() != GetNodeOutPortsSize() ) {
541 for ( i = 0 ; i < aGraph->GetNodeInPortsSize() && i < GetNodeInPortsSize() ; i++ ) {
542 if ( !strcmp( aGraph->GetNodeInPort( i )->PortName() , GetNodeInPort( i )->PortName() ) ) {
546 for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() && i < GetNodeOutPortsSize() ; i++ ) {
547 if ( !strcmp( aGraph->GetNodeOutPort( i )->PortName() , GetNodeOutPort( i )->PortName() ) ) {
552 for ( i = 0 ; i < aGraph->GetNodeInPortsSize() || i < GetNodeInPortsSize() ; i++ ) {
553 if ( i < aGraph->GetNodeInPortsSize() && i < GetNodeInPortsSize() ) {
554 cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << aGraph->GetNodeInPort( i )->PortName()
555 << " " << GetNodeInPort( i )->PortName() << endl ;
557 else if ( i >= GetNodeInPortsSize() ) {
558 cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << aGraph->GetNodeInPort( i )->PortName()
562 cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << GetNodeInPort( i )->PortName()
566 for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() || i < GetNodeOutPortsSize() ; i++ ) {
567 if ( i < aGraph->GetNodeOutPortsSize() && i < GetNodeOutPortsSize() ) {
568 cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << aGraph->GetNodeOutPort( i )->PortName()
569 << " != " << GetNodeOutPort( i )->PortName() << endl ;
571 else if ( i >= GetNodeOutPortsSize() ) {
572 cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << aGraph->GetNodeOutPort( i )->PortName()
576 cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << GetNodeOutPort( i )->PortName()
581 cdebug_out << "GraphBase::ComputingNode::UpdateMacroPorts"
582 << aGraph->Name() << " InPorts(" << aGraph->GetNodeInPortsSize() << ") OutPorts("
583 << aGraph->GetNodeOutPortsSize() << ") to MacroNode " << Name() << " InPorts("
584 << GetNodeInPortsSize() << ") OutPorts(" << GetNodeOutPortsSize() << ")" << endl;
587 void GraphBase::ComputingNode::SetMacroDatas( GraphBase::Graph * aGraph ,
588 GraphBase::Graph * aGraphOfMacroGraph ) {
589 cdebug_in << "GraphBase::ComputingNode::SetMacroDatas fill inputs of MacroNode" << endl;
591 for ( i = 0 ; i < aGraph->GetNodeInPortsSize() ; i++ ) {
592 const GraphBase::InPort * anInPort = aGraph->GetNodeInPort( i ) ;
593 GraphBase::OutPort * anOutPort = aGraph->GetChangeNodeInDataNodePort(i) ;
594 cdebug << " " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
595 << " " << anOutPort->Kind() << " " << anOutPort->PortStatus() << endl ;
596 if ( anOutPort->IsDataConnected() ) {
597 //JR 30.03.2005 aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , *(anOutPort->Value()) ) ;
598 aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , anOutPort->Value() ) ;
599 anOutPort->PortStatus( ExternConnected ) ;
602 cdebug_out << "GraphBase::ComputingNode::SetMacroDatas" << endl;
605 void GraphBase::ComputingNode::DelInPort( const char * InputParameterName ) {
607 //JR 07.06.2005 Debug : LinkedNodes and LinkedFromNode must be updated
608 // LinkedInPortsNumber and LinkedFromInPortsNumber must be updated
609 cdebug_in << "ComputingNode::DelInPort " << Name() << "( " << InputParameterName << " )"
612 if ( !IsEndSwitchNode() ) {
613 GraphBase::InPort * anInPort = GetChangeInPort( InputParameterName ) ;
614 cdebug << "ComputingNode::DelInPort InPort " << Name() << "( "
615 << anInPort->PortName() << " ) " << anInPort->PortStatus() << " <-- " ;
616 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
617 if ( anOutPort && !( IsEndLoopNode() && anInPort->IsLoop() ) ) {
618 cdebug << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") "
619 << anOutPort->PortStatus() ;
622 if ( !anInPort->IsNotConnected() ) {
623 GraphBase::ComputingNode * FromNode = NULL ;
625 if ( anOutPort->IsDataConnected() || anOutPort->IsExternConnected() ) {
626 cdebug << " Data/Extern ignored" << endl ;
629 FromNode = GraphOfNode()->GetChangeGraphNode( anOutPort->NodeName() ) ;
632 cdebug << "FromNode " << FromNode->Name() << " LinkedNodesSize "
633 << FromNode->LinkedNodesSize() << " and " << Name()
634 << " LinkedFromNodesSize " << LinkedFromNodesSize() << endl ;
635 if ( !FromNode->IsGOTONode() &&
636 !( FromNode->IsEndLoopNode() && anInPort->IsLoop() ) ) {
637 if ( anInPort->IsDataStream() ) {
638 RetVal = FromNode->RemoveStreamLinkedNode( this ) ;
641 RetVal = FromNode->RemoveLinkedNode( this ) ;
644 cdebug << "ComputingNode::DelInPort anOutPort->RemoveLinkedNode Error RetVal "
651 //We have an EndSwitchNode :
654 for ( i = LinkedFromNodesSize() - 1 ; i >= 0 ; i-- ) {
655 GraphBase::ComputingNode * aLinkedFromNode = (GraphBase::ComputingNode * ) LinkedFromNodes( i ) ;
656 cdebug << aLinkedFromNode->Name() << " linked to " << Name() << endl ;
658 for ( j = aLinkedFromNode->GetNodeOutPortsSize() - 1 ; j >= 0 ; j-- ) {
659 GraphBase::OutPort * anOutPort = aLinkedFromNode->GetChangeNodeOutPort( j ) ;
660 cdebug << "ComputingNode::DelInPort OutPort" << j << ". Remove " << anOutPort->InPortsSize()
661 << " InPortsof OutPort : " << anOutPort->NodeName() << "( "
662 << anOutPort->PortName() << ") "
663 << anOutPort->PortStatus() << " :" << endl ;
665 //Process concerned OutPorts of LinkedFromNodes of that EndSwitchNode
666 for ( k = anOutPort->InPortsSize() - 1 ; k >= 0 ; k-- ) {
667 GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ;
668 if ( !strcmp( anInPort->NodeName() , Name() ) &&
669 !strcmp( anInPort->PortName() , InputParameterName ) ) {
670 // InPort of the EndSwitchNode
671 cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( "
672 << anInPort->PortName() << ") "
673 << anInPort->PortStatus() << endl ;
674 anInPort->RemoveOutPort() ;
675 if ( anOutPort->IsDataStream() ) {
676 aLinkedFromNode->RemoveStreamLinkedNode( this ) ;
679 // false ==> No error for aNode->LinkedFromNode()
680 RetVal = aLinkedFromNode->RemoveLinkedNode( this , false ) ;
682 cdebug << "ComputingNode::DelInPort aLinkedFromNode->RemoveLinkedNode Error RetVal "
687 // Remove the InPort of the EndSwitchNode from that OutPort
688 RetVal = anOutPort->RemoveInPort( anInPort ) ;
690 cdebug << "ComputingNode::DelInPort anOutPort->RemoveInPort( anInPort ) Error RetVal "
700 GraphBase::PortsOfNode::DelInPort( InputParameterName ) ;
701 cdebug_out << "ComputingNode::DelInPort " << Name() << "( " << InputParameterName << " )"
704 void GraphBase::ComputingNode::DelOutPort( const char * OutputParameterName ) {
706 //JR 07.06.2005 Debug : LinkedNodes and LinkedFromNode must be updated
707 // LinkedInPortsNumber and LinkedFromInPortsNumber must be updated
708 cdebug_in << "ComputingNode::DelOutPort " << Name() << "( " << OutputParameterName << " )"
711 GraphBase::OutPort * anOutPort = GetChangeOutPort( OutputParameterName ) ;
712 cdebug << "ComputingNode::DelOutPort OutPort " << " InPortof OutPort : "
713 << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") "
714 << anOutPort->PortStatus() << " :" << endl ;
716 for ( j = anOutPort->InPortsSize() - 1 ; j >= 0 ; j-- ) {
717 GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ;
718 GraphBase::ComputingNode * ToNode = NULL ;
719 cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( "
720 << anInPort->PortName() << ") " << anInPort->PortStatus() ;
721 if ( anInPort->IsExternConnected() ) {
722 cdebug << " ExternConnected ignored" << endl ;
726 ToNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
729 RetVal = anInPort->RemoveOutPort() ;
730 // JR 04.02.2005 : Bug if it is a link to an EndSwitchNode. The InPort may be multiple linked !!!
733 cdebug << "ComputingNode::DelOutPort anOutPort->RemoveOutPort Error RetVal " << RetVal
737 if ( ( IsGOTONode() && ToNode->IsOneOfInLineNodes() ) ||
738 ( IsEndLoopNode() && ToNode->IsLoopNode( ) ) ) {
740 else if ( anOutPort->IsDataStream() ) {
741 RetVal = RemoveStreamLinkedNode( ToNode ) ;
744 RetVal = RemoveLinkedNode( ToNode ) ;
747 cdebug << "ComputingNode::DelOutPort anOutPort->RemoveLinkedNode Error RetVal " << RetVal
751 if ( ToNode->IsEndSwitchNode() ) {
754 for ( i = 0 ; i < ToNode->LinkedFromNodesSize() ; i++ ) {
755 GraphBase::StreamNode * fromNode = ToNode->LinkedFromNodes( i ) ;
756 // Not the node that we are deleting ... :
757 if ( strcmp( fromNode->Name() , Name() ) ) {
759 for ( j = 0 ; j < fromNode->GetNodeOutPortsSize() ; j++ ) {
760 GraphBase::OutPort * fromOutPort = fromNode->GetChangeNodeOutPort( j ) ;
762 for ( k = 0 ; k < fromOutPort->InPortsSize() ; k++ ) {
763 if ( strcmp( ToNode->Name() , fromOutPort->InPorts( k )->NodeName() ) == 0 ) {
764 if ( strcmp( anInPort->PortName() , fromOutPort->InPorts( k )->PortName() ) == 0 ) {
765 // Restore an OutPort in the InPort
766 anInPort->ChangeOutPort( fromOutPort ) ;
767 cdebug << "ComputingNode::DelOutPort reestablish " << fromOutPort->NodeName() << "( "
768 << fromOutPort->PortName() << " ) in the InPort of EndSwitch : "
769 << ToNode->Name() << "( " << anInPort->PortName() << " )"
770 << anInPort->Kind() << " " << anInPort->PortStatus() << endl;
789 cdebug << "Error RetVal " << RetVal << endl ;
792 GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ;
793 cdebug_out << "ComputingNode::DelOutPort " << Name() << "( " << OutputParameterName << " )"
797 GraphBase::InPort * GraphBase::ComputingNode::AddInPort( const char * InputParameterName ,
798 const char * InputParameterType ,
799 const SUPERV::KindOfPort aKindOfPort ,
801 cdebug << "AddInPort " << Name() << " ConnectedInPortsNumber " << ConnectedInPortsNumber() << endl ;
802 // JR 12.01.2005 : InitLoop and DoLoop are reserved parameter names in LoopNodes :
803 if ( IsLoopNode() && ( strcmp( InputParameterName , "InitLoop" ) == 0 ||
804 strcmp( InputParameterName , "DoLoop" ) == 0 ) ) {
807 return GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
813 _Graph_prof_debug , _Graph_fdebug ) ;
815 GraphBase::OutPort * GraphBase::ComputingNode::AddOutPort( const char * OutputParameterName ,
816 const char * OutputParameterType ,
817 const SUPERV::KindOfPort aKindOfPort ,
819 cdebug << "AddOutPort " << Name() << " ConnectedInPortsNumber " << ConnectedInPortsNumber() << endl ;
820 return GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() ,
822 OutputParameterName ,
823 OutputParameterType ,
826 _Graph_prof_debug , _Graph_fdebug ) ;
829 void GraphBase::ComputingNode::DelInDataStreamPort( const char * InputParameterName ) {
830 GraphBase::PortsOfNode::DelInPort( InputParameterName ) ;
832 void GraphBase::ComputingNode::DelOutDataStreamPort( const char * OutputParameterName ) {
833 GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ;
836 GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( const char * InputParameterName ,
837 const SALOME_ModuleCatalog::DataStreamType InputParameterType ,
838 const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
839 const SUPERV::KindOfPort aKindOfPort ,
841 // IncrDataStreamInPorts() ;
842 GraphBase::InDataStreamPort * aDataStreamPort ;
843 aDataStreamPort = (GraphBase::InDataStreamPort * ) GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
846 DataStreamTypeToString( InputParameterType ).c_str() ,
851 aDataStreamPort->Dependency( aDependency ) ;
852 if ( aDependency == SALOME_ModuleCatalog::DATASTREAM_TEMPORAL ) {
853 aDataStreamPort->SetParams( SUPERV::TI , SUPERV::L1 , SUPERV::EXTRANULL ) ;
855 return aDataStreamPort ;
857 GraphBase::OutDataStreamPort * GraphBase::ComputingNode::AddOutDataStreamPort( const char * OutputParameterName ,
858 const SALOME_ModuleCatalog::DataStreamType OutputParameterType ,
859 const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
860 const SUPERV::KindOfPort aKindOfPort ,
862 // IncrDataStreamOutPorts() ;
863 GraphBase::OutDataStreamPort * aDataStreamPort ;
864 aDataStreamPort = (GraphBase::OutDataStreamPort * ) GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() ,
866 OutputParameterName ,
867 DataStreamTypeToString( OutputParameterType ).c_str() ,
872 aDataStreamPort->Dependency( aDependency ) ;
873 return aDataStreamPort ;
877 bool GraphBase::ComputingNode::CheckLoop( GraphBase::LoopNode * aLoopNode ,
878 GraphBase::EndOfLoopNode * anEndLoopNode ,
879 string & anErrorMessage ) const {
880 cdebug_in << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , "
881 << anEndLoopNode->Name() << ") LinkedNodesSize "
882 << LinkedNodesSize() << endl;
885 if ( LinkedNodesSize() == 0 && !IsDataFlowNode() && !IsDataStreamNode() ) {
886 anErrorMessage = anErrorMessage + string( "The node " ) + string( Name() ) +
887 string( " has no linked Nodes. Loop not valid\n" ) ;
888 cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name()
889 << " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
890 << LinkedNodesSize() << " ERROR false" << endl;
893 // We check that all nodes linked to that node go to the end of LoopNode :
894 for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
895 GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
896 cdebug << i << ". " << Name() << " Linked to " << aNode->Name() << endl ;
897 if ( !aNode->IsEndLoopNode() || aNode != anEndLoopNode ) {
898 if ( !aNode->CheckLoop( aLoopNode , anEndLoopNode , anErrorMessage) ) {
899 cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name()
900 << " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
901 << LinkedNodesSize() << " ERROR false" << endl;
906 cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , "
907 << anEndLoopNode->Name() << ") LinkedNodesSize "
908 << LinkedNodesSize() << " true" << endl;
912 bool GraphBase::ComputingNode::CheckEndLoop(GraphBase::LoopNode * aLoopNode ,
913 GraphBase::EndOfLoopNode * anEndLoopNode ,
914 string & anErrorMessage ) const {
915 cdebug_in << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , "
916 << anEndLoopNode->Name() << ") LinkedFromNodesSize "
917 << LinkedFromNodesSize() << endl;
920 if ( LinkedFromNodesSize() == 0 ) {
921 anErrorMessage = anErrorMessage + string( "The node " ) + string( Name() ) +
922 string( " has no reversed linked Nodes. Loop not valid\n" ) ;
923 cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name()
924 << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
925 << LinkedFromNodesSize() << " ERROR false" << endl;
928 // We have to check that all nodes linked from that node go to the beginning of LoopNode :
929 for ( i = 0 ; i < LinkedFromNodesSize() ; i++ ) {
930 GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedFromNodes( i ) ;
931 cdebug << i << ". " << Name() << " Linked from " << aNode->Name() << endl ;
932 if ( !aNode->IsLoopNode() || aNode != aLoopNode ) {
933 if ( !aNode->CheckEndLoop( aLoopNode , anEndLoopNode , anErrorMessage ) ) {
934 cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name()
935 << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
936 << LinkedFromNodesSize() << " ERROR false" << endl;
941 cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , "
942 << anEndLoopNode->Name() << ") LinkedFromNodesSize "
943 << LinkedFromNodesSize() << " true" << endl;
947 bool GraphBase::ComputingNode::InitBranchOfSwitchDone( bool AllInit ,
948 GraphBase::EndOfSwitchNode * anEndSwitchNode ,
949 string & anErrorMessage ) {
951 bool sts = BranchOfSwitchDone( false ) ;
952 if ( !sts && !AllInit && anEndSwitchNode != this ) {
953 // Common Node in branchs :
954 anErrorMessage = anErrorMessage + string( "Common Node between some SwitchBranches : " ) +
955 string( Name() ) + string("\n" ) ;
956 cdebug << Name() << "->ComputingNode::InitBranchOfSwitchDone ERROR false"
961 if ( !IsGOTONode() && anEndSwitchNode != this ) {
962 for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
963 GraphBase::ComputingNode * aNode ;
964 aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
965 if ( !aNode->InitBranchOfSwitchDone( AllInit , anEndSwitchNode , anErrorMessage ) ) {
973 bool GraphBase::ComputingNode::CheckSwitch( GraphBase::EndOfSwitchNode * anEndSwitchNode ,
974 string & anErrorMessage ) {
976 cdebug_in << Name() << "->ComputingNode::CheckSwitch( "
977 << anEndSwitchNode->Name() << " ) " << Kind() << endl;
978 if ( anEndSwitchNode == this ) {
980 // if it is a SwitchNode, continue the check at the corresponding EndSwitchNode
981 else if ( IsSwitchNode() ) {
982 GraphBase::EndOfSwitchNode * anOtherEndSwitchNode ;
983 anOtherEndSwitchNode = (GraphBase::EndOfSwitchNode * ) ((GraphBase::SwitchNode * ) this)->CoupledNode() ;
984 cdebug << Name() << "->ComputingNode::CheckSwitch will Check "
985 << anOtherEndSwitchNode->Name() << endl ;
986 if ( !anOtherEndSwitchNode->CheckSwitch( anEndSwitchNode , anErrorMessage ) ) {
987 cdebug_out << Name() << "->ComputingNode::CheckSwitch "
988 << anOtherEndSwitchNode->Name() << " ERROR false" << endl;
994 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
995 GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ;
996 if ( !anOutPort->IsDataStream() ) {
998 for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
999 GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ;
1000 if ( !anInPort->IsDataStream() ) {
1001 GraphBase::ComputingNode * aNode ;
1002 aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
1003 GraphBase::LoopNode * aLoopNode = NULL ;
1004 GraphBase::EndOfLoopNode * aEndLoopNode = NULL ;
1005 if ( IsLoopNode() ) {
1006 aEndLoopNode = (GraphBase::EndOfLoopNode * ) ((GraphBase::LoopNode * ) this)->CoupledNode() ;
1007 cdebug << Name() << "->ComputingNode::CheckSwitch LoopNode " << Name() << " coupled to "
1008 << aEndLoopNode << " " << aEndLoopNode->Name() << " aNode " << aNode << endl ;
1010 else if ( IsEndLoopNode() ) {
1011 aLoopNode = (GraphBase::LoopNode * ) ((GraphBase::EndOfLoopNode * ) this)->CoupledNode() ;
1012 cdebug << Name() << "->ComputingNode::CheckSwitch EndLoopNode " << Name()
1014 << aLoopNode << " " << aLoopNode->Name() << " aNode " << aNode << endl ;
1016 if ( aNode == NULL ) {
1017 cdebug << Name() << "->ComputingNode::CheckSwitch ignore "
1018 << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
1020 else if ( aNode == anEndSwitchNode ) {
1021 if ( !((GraphBase::EndOfSwitchNode * ) aNode)->DecrEndSwitchInPortLinked( anInPort ,
1022 anErrorMessage ) ) {
1026 else if ( aNode->BranchOfSwitchDone() ) {
1027 cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
1028 << anInPort->NodeName() << "( " << anInPort->PortName() << " ) : already checked"
1031 else if ( IsLoopNode() && aNode == aEndLoopNode ) {
1032 cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
1033 << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
1035 else if ( IsEndLoopNode() && aNode == aLoopNode ) {
1036 cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
1037 << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
1039 else if ( aNode->IsGOTONode() ) {
1040 cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
1041 << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
1042 anEndSwitchNode->SetSwitchWithGOTO() ;
1045 cdebug << Name() << "->ComputingNode::CheckSwitch will Check "
1046 << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
1047 if ( !aNode->CheckSwitch( anEndSwitchNode , anErrorMessage ) ) {
1048 cdebug_out << Name() << "->ComputingNode::CheckSwitch "
1049 << anEndSwitchNode->Name() << " ERROR false" << endl;
1052 // aNode->BranchOfSwitchDone( true ) ;
1060 BranchOfSwitchDone( true ) ;
1062 cdebug_out << Name() << "->ComputingNode::CheckSwitch "
1063 << anEndSwitchNode->Name() << " RetVal " << RetVal << endl;
1067 #include <sys/time.h>
1068 #include <sys/resource.h>
1071 const long GraphBase::ComputingNode::CpuUsed() {
1072 struct rusage usage ;
1073 if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) {
1074 perror("GraphBase::CpuUsed") ;
1077 // return usage.ru_utime.__time_t tv_sec ;
1078 cdebug << "CpuUsed " << usage.ru_utime.tv_sec << " " << usage.ru_utime.tv_usec << " "
1079 << usage.ru_stime.tv_sec << " " << usage.ru_stime.tv_usec << endl ;
1080 return usage.ru_utime.tv_sec ;
1084 const GraphBase::ListOfParameters * GraphBase::ComputingNode::GetListOfParameters() const {
1085 GraphBase::ListOfParameters * aListOfParameters = new GraphBase::ListOfParameters ;
1086 if ( IsInLineNode() || IsGOTONode() ) {
1088 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1089 const InPort * anInPort = GetNodeInPort( i ) ;
1090 if ( anInPort->IsBus() ) {
1091 int size = aListOfParameters->size() ;
1092 aListOfParameters->resize( size + 1 ) ;
1093 (*aListOfParameters)[size].theInParameter.Parametername = anInPort->PortName() ;
1094 (*aListOfParameters)[size].theInParameter.Parametertype = anInPort->PortType() ;
1095 const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
1096 (*aListOfParameters)[size].theOutParameter.Parametername = anOutPort->PortName() ;
1097 (*aListOfParameters)[size].theOutParameter.Parametertype = anOutPort->PortType() ;
1101 return aListOfParameters ;
1105 bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
1106 const char * ComponentName ,
1107 const char * InterfaceName ,
1108 const char * Computer ,
1109 const char * CoupledNode ,
1110 const ListOfFuncName FuncNames ,
1111 const ListOfPythonFunctions PythonFunctions ,
1112 int XCoordinate , int YCoordinate ) const {
1113 cdebug_in << "SaveXML Node " << Name() << endl ;
1114 QDomElement node = Graph.createElement( "node" ) ;
1115 info.appendChild( node ) ;
1116 QDomElement componentname = Graph.createElement( "component-name" ) ;
1118 if ( strlen( ComponentName ) ) {
1119 // f << Tabs << "<component-name>" << ComponentName << "</component-name>"
1121 // componentname.setNodeValue( ComponentName ) ;
1122 aField = Graph.createTextNode( ComponentName ) ;
1125 // f << Tabs << "<component-name>?</component-name>" << endl ;
1126 // componentname.setNodeValue( "?" ) ;
1127 aField = Graph.createTextNode( "?" ) ;
1129 node.appendChild( componentname ) ;
1130 componentname.appendChild( aField ) ;
1132 QDomElement interfacename = Graph.createElement("interface-name") ;
1133 if ( strlen( InterfaceName ) ) {
1134 // f << Tabs << "<interface-name>" << InterfaceName << "</interface-name>"
1136 // interfacename.setAttribute("name" , InterfaceName ) ;
1137 aField = Graph.createTextNode( InterfaceName ) ;
1140 // f << Tabs << "<interface-name>?</interface-name>" << endl ;
1141 // interfacename.setAttribute("name" , "?" ) ;
1142 aField = Graph.createTextNode( "?" ) ;
1144 node.appendChild(interfacename) ;
1145 interfacename.appendChild( aField ) ;
1147 // f << Tabs << "<node-name>" << Name() << "</node-name>" << endl ;
1148 QDomElement nodename = Graph.createElement("node-name") ;
1149 aField = Graph.createTextNode( Name() ) ;
1150 node.appendChild( nodename ) ;
1151 nodename.appendChild( aField ) ;
1153 // f << Tabs << "<kind>" << (int ) Kind() << "</kind>" << endl ;
1154 QDomElement kind = Graph.createElement( "kind" ) ;
1157 // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph
1158 // JR : the bug was at line 566 : && HasDataStream() != 0 was missing
1159 if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) {
1160 aKind = aKind.setNum( SUPERV::DataFlowGraph ) ;
1163 aKind = aKind.setNum( Kind() ) ;
1165 aField = Graph.createTextNode( aKind ) ;
1166 node.appendChild( kind ) ;
1167 kind.appendChild( aField ) ;
1169 if ( IsDataStreamNode() && HasDataStream() != 0 ) {
1171 SUPERV::KindOfDataStreamTrace DataStreamTrace ;
1173 ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
1175 QDomElement timeout = Graph.createElement("streamgraph-timeout") ;
1177 aTimeout = aTimeout.setNum( Timeout ) ;
1178 aField = Graph.createTextNode( aTimeout ) ;
1179 node.appendChild( timeout ) ;
1180 timeout.appendChild( aField ) ;
1182 QDomElement datastreamtrace = Graph.createElement("streamgraph-datastreamtrace") ;
1183 QString aDataStreamTrace ;
1184 aDataStreamTrace = aDataStreamTrace.setNum( DataStreamTrace ) ;
1185 aField = Graph.createTextNode( aDataStreamTrace ) ;
1186 node.appendChild( datastreamtrace ) ;
1187 datastreamtrace.appendChild( aField ) ;
1189 QDomElement deltatime = Graph.createElement("streamgraph-deltatime") ;
1190 QString aDeltaTime ;
1191 aDeltaTime = aDeltaTime.setNum( DeltaTime ) ;
1192 aField = Graph.createTextNode( aDeltaTime ) ;
1193 node.appendChild( deltatime ) ;
1194 deltatime.appendChild( aField ) ;
1197 QDomElement couplednode = Graph.createElement("coupled-node") ;
1198 if ( IsGOTONode() || IsLoopNode() || IsEndLoopNode() ||
1199 IsSwitchNode() || IsEndSwitchNode() || IsMacroNode() ) {
1200 // f << Tabs << "<coupled-node>" << CoupledNode << "</coupled-node>"
1202 aField = Graph.createTextNode( CoupledNode ) ;
1205 // f << Tabs << "<coupled-node>?</coupled-node>" << endl ;
1206 aField = Graph.createTextNode( "?" ) ;
1208 node.appendChild(couplednode) ;
1209 couplednode.appendChild( aField ) ;
1211 // f << Tabs << "<service>" << endl ;
1212 QDomElement service = Graph.createElement("service") ;
1213 node.appendChild(service) ;
1214 QDomElement servicename = Graph.createElement("service-name") ;
1215 if ( strlen( ServiceName() ) ) {
1216 // f << Tabs << " <service-name>" << ServiceName() << "</service-name>" << endl ;
1217 aField = Graph.createTextNode( ServiceName() ) ;
1220 // f << Tabs << " <service-name>?</service-name>" << endl ;
1221 aField = Graph.createTextNode( "?" ) ;
1223 service.appendChild(servicename) ;
1224 servicename.appendChild( aField ) ;
1226 cdebug << "SaveXML " << Name() << " In(" << ServiceInParameter().length()
1227 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
1228 QDomElement inParameterlist = Graph.createElement("inParameter-list") ;
1229 service.appendChild(inParameterlist) ;
1231 GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) this ;
1232 for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
1233 const GraphBase::InPort * anInPort ;
1234 anInPort = aNode->GetInPort( ServiceInParameter()[i].Parametername ) ;
1235 if ( !anInPort->IsDataStream() ) {
1236 cdebug << "SaveXML " << i << ". " << ServiceInParameter()[i].Parametername
1237 << " InParameterPort " << anInPort->Kind() << endl ;
1238 QDomElement inParameter = Graph.createElement("inParameter") ;
1239 inParameterlist.appendChild(inParameter) ;
1240 QDomElement inParametertype = Graph.createElement("inParameter-type") ;
1241 if ( strlen( ServiceInParameter()[i].Parametertype ) ) {
1242 aField = Graph.createTextNode( strdup( ServiceInParameter()[i].Parametertype ) ) ;
1245 aField = Graph.createTextNode( "?" ) ;
1247 inParameter.appendChild(inParametertype) ;
1248 inParametertype.appendChild( aField ) ;
1249 QDomElement inParametername = Graph.createElement("inParameter-name") ;
1250 if ( strlen( ServiceInParameter()[i].Parametername ) ) {
1251 aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
1254 aField = Graph.createTextNode( "?" ) ;
1256 inParameter.appendChild(inParametername) ;
1257 inParametername.appendChild( aField ) ;
1260 QDomElement outParameterlist = Graph.createElement("outParameter-list") ;
1261 service.appendChild(outParameterlist) ;
1262 for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) {
1263 const GraphBase::OutPort * anOutPort ;
1264 anOutPort = aNode->GetOutPort( ServiceOutParameter()[i].Parametername ) ;
1265 if ( !anOutPort->IsDataStream() ) {
1266 cdebug << "SaveXML " << i << ". " << ServiceOutParameter()[i].Parametername
1267 << " OutParameterPort " << anOutPort->Kind() << endl ;
1268 QDomElement outParameter = Graph.createElement("outParameter") ;
1269 outParameterlist.appendChild(outParameter) ;
1270 QDomElement outParametertype = Graph.createElement("outParameter-type") ;
1271 if ( strlen( ServiceOutParameter()[i].Parametertype ) ) {
1272 aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
1275 aField = Graph.createTextNode( "?" ) ;
1277 outParameter.appendChild(outParametertype) ;
1278 outParametertype.appendChild( aField ) ;
1279 QDomElement outParametername = Graph.createElement("outParameter-name") ;
1280 if ( strlen( ServiceOutParameter()[i].Parametername ) ) {
1281 aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
1284 aField = Graph.createTextNode( "?" ) ;
1286 outParameter.appendChild(outParametername) ;
1287 outParametername.appendChild( aField ) ;
1291 QDomElement DataStreamlist = Graph.createElement("DataStream-list") ;
1292 node.appendChild( DataStreamlist ) ;
1293 for ( i = 0 ; i < (unsigned int ) GetNodeInPortsSize() ; i++ ) {
1294 const GraphBase::InPort * anInPort ;
1295 anInPort = aNode->GetNodeInPort( i ) ;
1296 if ( anInPort->IsDataStream() ) {
1297 cdebug << "SaveXML " << i << " " << Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
1298 << " InDataStreamPort " << anInPort->Kind() << endl ;
1299 QDomElement inParameter = Graph.createElement("inParameter") ;
1300 DataStreamlist.appendChild(inParameter) ;
1301 QDomElement inParametertype = Graph.createElement("inParameter-type") ;
1303 aType = aType.setNum( StringToDataStreamType( anInPort->PortType() ) ) ;
1304 cdebug << "SaveXML " << anInPort->PortType() << " --> " << StringToDataStreamType( anInPort->PortType() )
1305 << " " << aType << endl ;
1306 aField = Graph.createTextNode( aType ) ;
1307 inParameter.appendChild(inParametertype) ;
1308 inParametertype.appendChild( aField ) ;
1309 QDomElement inParametername = Graph.createElement("inParameter-name") ;
1310 if ( strlen( anInPort->PortName() ) ) {
1311 aField = Graph.createTextNode( strdup(anInPort->PortName()) ) ;
1314 aField = Graph.createTextNode( "?" ) ;
1316 inParameter.appendChild(inParametername) ;
1317 inParametername.appendChild( aField ) ;
1318 cdebug << "SaveXML " << anInPort->PortName() << endl ;
1319 QDomElement inParameterdependency = Graph.createElement("inParameter-dependency") ;
1320 QString aDependency ;
1321 aDependency = aDependency.setNum( anInPort->Dependency() ) ;
1322 aField = Graph.createTextNode( aDependency ) ;
1323 inParameter.appendChild(inParameterdependency) ;
1324 inParameterdependency.appendChild( aField ) ;
1325 cdebug << "SaveXML Dependency " << anInPort->Dependency() << endl ;
1326 SUPERV::KindOfSchema aKindOfSchema ;
1327 SUPERV::KindOfInterpolation aKindOfInterpolation ;
1328 SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1329 ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1330 QDomElement inParameterKindOfSchema = Graph.createElement("inParameter-schema") ;
1332 aSchema = aSchema.setNum( aKindOfSchema ) ;
1333 aField = Graph.createTextNode( aSchema ) ;
1334 inParameter.appendChild(inParameterKindOfSchema) ;
1335 inParameterKindOfSchema.appendChild( aField ) ;
1336 cdebug << "SaveXML aKindOfSchema " << aKindOfSchema << endl ;
1337 QDomElement inParameterKindOfInterpolation = Graph.createElement("inParameter-interpolation") ;
1338 QString anInterpolation ;
1339 anInterpolation = anInterpolation.setNum( aKindOfInterpolation ) ;
1340 aField = Graph.createTextNode( anInterpolation ) ;
1341 inParameter.appendChild(inParameterKindOfInterpolation) ;
1342 inParameterKindOfInterpolation.appendChild( aField ) ;
1343 cdebug << "SaveXML aKindOfInterpolation " << aKindOfInterpolation << endl ;
1344 QDomElement inParameterKindOfExtrapolation = Graph.createElement("inParameter-extrapolation") ;
1345 QString anExtrapolation ;
1346 anExtrapolation = anExtrapolation.setNum( aKindOfExtrapolation ) ;
1347 aField = Graph.createTextNode( anExtrapolation ) ;
1348 inParameter.appendChild(inParameterKindOfExtrapolation) ;
1349 inParameterKindOfExtrapolation.appendChild( aField ) ;
1350 cdebug << "SaveXML aKindOfExtrapolation " << aKindOfExtrapolation << endl ;
1353 for ( i = 0 ; i < (unsigned int ) GetNodeOutPortsSize() ; i++ ) {
1354 const GraphBase::OutPort * anOutPort ;
1355 anOutPort = aNode->GetNodeOutPort( i ) ;
1356 if ( anOutPort->IsDataStream() ) {
1357 cdebug << "SaveXML " << i << " " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
1358 << " OutDataStreamPort " << anOutPort->Kind() << endl ;
1359 QDomElement outParameter = Graph.createElement("outParameter") ;
1360 DataStreamlist.appendChild(outParameter) ;
1361 QDomElement outParametertype = Graph.createElement("outParameter-type") ;
1363 aType = aType.setNum( StringToDataStreamType( anOutPort->PortType() ) ) ;
1364 cdebug << "SaveXML " << anOutPort->PortType() << " --> " << StringToDataStreamType( anOutPort->PortType() )
1365 << " " << aType << endl ;
1366 aField = Graph.createTextNode( aType ) ;
1367 outParameter.appendChild(outParametertype) ;
1368 outParametertype.appendChild( aField ) ;
1369 QDomElement outParametername = Graph.createElement("outParameter-name") ;
1370 if ( strlen( anOutPort->PortName() ) ) {
1371 aField = Graph.createTextNode( strdup(anOutPort->PortName() ) ) ;
1374 aField = Graph.createTextNode( "?" ) ;
1376 outParameter.appendChild(outParametername) ;
1377 outParametername.appendChild( aField ) ;
1378 cdebug << "SaveXML " << anOutPort->PortName() << endl ;
1379 QDomElement outParameterdependency = Graph.createElement("outParameter-dependency") ;
1380 QString aDependency ;
1381 aDependency = aDependency.setNum( anOutPort->Dependency() ) ;
1382 aField = Graph.createTextNode( aDependency ) ;
1383 outParameter.appendChild(outParameterdependency) ;
1384 outParameterdependency.appendChild( aField ) ;
1385 cdebug << "SaveXML Dependency " << anOutPort->Dependency() << endl ;
1386 long aNumberOfValues ;
1387 aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1388 QDomElement outParameterNumberOfValues = Graph.createElement("outParameter-values") ;
1390 aValues = aValues.setNum( aNumberOfValues ) ;
1391 aField = Graph.createTextNode( aValues ) ;
1392 outParameter.appendChild(outParameterNumberOfValues) ;
1393 outParameterNumberOfValues.appendChild( aField ) ;
1394 cdebug << "SaveXML NumberOfValues " << ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() << endl ;
1397 // f << Tabs << "</Parameter-list>" << endl ;
1399 // f << Tabs << "<PyFunction-list>" << endl ;
1400 QDomElement PyFunctionlist = Graph.createElement("PyFunction-list") ;
1401 node.appendChild( PyFunctionlist ) ;
1402 for ( i = 0 ; i < PythonFunctions.size() ; i++ ) {
1403 // f << Tabs << " <PyFunction>" << endl ;
1404 QDomElement PyFunction = Graph.createElement("PyFunction") ;
1405 PyFunctionlist.appendChild( PyFunction ) ;
1407 QDomElement FuncName = Graph.createElement("FuncName") ;
1408 if ( strlen( FuncNames[i].c_str() ) ) {
1409 aField = Graph.createTextNode( FuncNames[i].c_str() ) ;
1412 aField = Graph.createTextNode( "?" ) ;
1414 PyFunction.appendChild( FuncName ) ;
1415 FuncName.appendChild( aField ) ;
1416 if ( (*PythonFunctions[i]).length() ) {
1417 for ( j = 0 ; j < (int ) (*PythonFunctions[i]).length() ; j++ ) {
1418 QDomElement PyFunc = Graph.createElement("PyFunc") ;
1419 QDomCDATASection aCDATA ;
1420 // mpv: Linux 8.0 compiler compatibility
1421 char * aCDATAChar = strdup ((*PythonFunctions[i])[j]) ;
1423 for ( i = 0 ; i < (int ) strlen( aCDATAChar ) ; i++ ) {
1424 if ( aCDATAChar[ i ] != ' ' ) {
1428 if ( i == (int ) strlen( aCDATAChar ) ) {
1429 aCDATA = Graph.createCDATASection( "?" ) ;
1432 aCDATA = Graph.createCDATASection( aCDATAChar ) ;
1434 PyFunction.appendChild( PyFunc ) ;
1435 PyFunc.appendChild( aCDATA ) ;
1439 QDomElement PyFunc = Graph.createElement("PyFunc") ;
1440 QDomCDATASection aCDATA = Graph.createCDATASection( "?" ) ;
1441 PyFunction.appendChild( PyFunc ) ;
1442 PyFunc.appendChild( aCDATA ) ;
1446 // f << Tabs << "<creation-date>" << FirstCreation() << "</creation-date>"
1448 QDomElement creationdate = Graph.createElement("creation-date") ;
1450 sprintf( fdate , "%d/%d/%d - %d:%d:%d" , FirstCreation().Day , FirstCreation().Month , FirstCreation().Year , FirstCreation().Hour , FirstCreation().Minute , FirstCreation().Second ) ;
1451 aField = Graph.createTextNode( fdate ) ;
1452 node.appendChild( creationdate ) ;
1453 creationdate.appendChild( aField ) ;
1454 // f << Tabs << "<lastmodification-date>" << LastModification()
1455 // << "</lastmodification-date>" << endl ;
1456 QDomElement lastmodificationdate = Graph.createElement("lastmodification-date") ;
1458 sprintf( ldate , "%d/%d/%d - %d:%d:%d" , LastModification().Day , LastModification().Month , LastModification().Year , LastModification().Hour , LastModification().Minute , LastModification().Second ) ;
1459 aField = Graph.createTextNode( ldate ) ;
1460 node.appendChild( lastmodificationdate ) ;
1461 lastmodificationdate.appendChild( aField ) ;
1462 // f << Tabs << "<editor-release>" << EditorRelease() << "</editor-release>"
1464 QDomElement editorrelease = Graph.createElement("editor-release") ;
1465 aField = Graph.createTextNode( EditorRelease() ) ;
1466 node.appendChild( editorrelease ) ;
1467 editorrelease.appendChild( aField ) ;
1468 QDomElement author = Graph.createElement("author") ;
1469 if ( strlen( Author() ) ) {
1470 // f << Tabs << "<author>" << Author() << "</author>" << endl ;
1471 aField = Graph.createTextNode( Author() ) ;
1474 // f << Tabs << "<author>?</author>" << endl ;
1475 aField = Graph.createTextNode( "?" ) ;
1477 node.appendChild( author ) ;
1478 author.appendChild( aField ) ;
1479 QDomElement container = Graph.createElement("container") ;
1480 if ( IsFactoryNode() && strlen( Computer) ) {
1481 // f << Tabs << "<container>" << Computer << "</container>" << endl ;
1482 aField = Graph.createTextNode( Computer ) ;
1485 // f << Tabs << "<container>?</container>" << endl ;
1486 aField = Graph.createTextNode( "?" ) ;
1488 node.appendChild( container ) ;
1489 container.appendChild( aField ) ;
1490 QDomElement comment = Graph.createElement("comment") ;
1491 if ( strlen( Comment() ) ) {
1492 // f << Tabs << "<comment>" << Comment() << "</comment>" << endl ;
1493 aField = Graph.createTextNode( Comment() ) ;
1496 // f << Tabs << "<comment>?</comment>" << endl ;
1497 aField = Graph.createTextNode( "?" ) ;
1499 node.appendChild( comment ) ;
1500 comment.appendChild( aField ) ;
1501 // f << Tabs << "<x-position>" << XCoordinate << "</x-position>" << endl ;
1502 QDomElement xposition = Graph.createElement("x-position") ;
1503 QString aXCoordinate ;
1504 aXCoordinate = aKind.setNum( XCoordinate ) ;
1505 aField = Graph.createTextNode( aXCoordinate ) ;
1506 node.appendChild( xposition ) ;
1507 xposition.appendChild( aField ) ;
1508 // f << Tabs << "<y-position>" << YCoordinate << "</y-position>" << endl ;
1509 QDomElement yposition = Graph.createElement("y-position") ;
1510 QString aYCoordinate ;
1511 aYCoordinate = aKind.setNum( YCoordinate ) ;
1512 aField = Graph.createTextNode( aYCoordinate ) ;
1513 node.appendChild( yposition ) ;
1514 yposition.appendChild( aField ) ;
1515 cdebug_out << "SaveXML Node " << Name() << endl ;
1519 bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
1520 const char * ComponentName ,
1521 const char * InterfaceName ,
1522 const char * Computer ,
1523 const GraphBase::InLineNode * aCoupledNode ,
1524 const ListOfFuncName FuncNames ,
1525 const ListOfPythonFunctions PythonFunctions ,
1526 int XCoordinate , int YCoordinate ) const {
1527 cdebug_in << "ComputingNode::SavePY " << Name() << endl ;
1528 // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph
1529 // JR : the bug was at line 927 : && HasDataStream() != 0 was missing
1530 if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) {
1531 f << " " << Name() << " = Graph( '" << Name() << "' )" << endl ;
1532 if ( GraphMacroLevel() ) {
1533 f << " " << Name() << ".SetCoupled( '"
1534 << ((GraphBase::GOTONode * ) this)->CoupledNodeName() << "' )" << endl ;
1537 else if ( IsDataStreamNode() && HasDataStream() != 0 ) {
1538 f << " " << Name() << " = StreamGraph( '" << Name() << "' )" << endl ;
1540 SUPERV::KindOfDataStreamTrace DataStreamTrace ;
1542 ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
1543 f << " " << aGraphName << ".SetStreamParams( " << Timeout << " , SUPERV." << DataStreamTrace
1544 << " , " << DeltaTime << " )" << endl ;
1546 else if ( IsComputingNode() ) {
1548 f << " " << Name() << "_ServiceinParameter = []" << endl ;
1549 for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
1550 f << " " << Name() << "_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
1551 << ServiceInParameter()[i].Parametertype << "' , '"
1552 << ServiceInParameter()[i].Parametername << "' ) )" << endl ;
1554 f << " " << Name() << "_ServiceoutParameter = []" << endl ;
1555 for ( i = 0 ; i < (int ) ServiceOutParameter().length() ; i++ ) {
1556 f << " " << Name() << "_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
1557 << ServiceOutParameter()[i].Parametertype << "' , '"
1558 << ServiceOutParameter()[i].Parametername << "' ) )" << endl ;
1560 f << " " << Name() << "_ServiceinStreamParameter = []" << endl ;
1561 for ( i = 0 ; i < (int ) ServiceInStreamParameter().length() ; i++ ) {
1562 f << " " << Name() << "_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog."
1563 << ServiceInStreamParameter()[i].Parametertype << " , '"
1564 << ServiceInStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog."
1565 << ServiceInStreamParameter()[i].Parameterdependency << " ) )" << endl ;
1567 f << " " << Name() << "_ServiceoutStreamParameter = []" << endl ;
1568 for ( i = 0 ; i < (int ) ServiceOutStreamParameter().length() ; i++ ) {
1569 f << " " << Name() << "_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog."
1570 << ServiceOutStreamParameter()[i].Parametertype << " , '"
1571 << ServiceOutStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog."
1572 << ServiceOutStreamParameter()[i].Parameterdependency << " ) )" << endl ;
1574 f << " " << Name() << "_Service = SALOME_ModuleCatalog.Service( '" << ServiceName()
1575 << "' , " << Name() << "_ServiceinParameter"
1576 << " , " << Name() << "_ServiceoutParameter"
1577 << " , " << Name() << "_ServiceinStreamParameter"
1578 << " , " << Name() << "_ServiceoutStreamParameter"
1579 << " , 0 , 0 )" << endl ;
1580 f << " " << Name() << " = " << aGraphName << ".CNode( " << Name() << "_Service" << " )"
1583 else if ( IsFactoryNode() ) {
1584 f << " " << Name() << " = " << aGraphName << ".FNode( '" << ComponentName
1585 << "' , '" << InterfaceName << "' , '" << ServiceName() << "' )"
1588 else if ( IsEndLoopNode() || IsEndSwitchNode() ) {
1589 // It is done with LoopNode or SwitchNode with CoupledNode()
1592 if ( !IsMacroNode() ) {
1593 f << " " << "Py" << Name() << " = []" << endl ;
1596 SUPERV::ListOfStrings aPyFunc ;
1597 if ( PythonFunctions.size() ) {
1598 aPyFunc = *PythonFunctions[0] ;
1599 for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
1600 f << " " << "Py" << Name() << ".append( '" << aPyFunc[i] << "' )" << endl ;
1603 if ( IsInLineNode() ) {
1604 f << " " << Name() << " = " << aGraphName << ".INode( '" << FuncNames[0].c_str() << "' , Py"
1605 << Name() << " )" << endl ;
1607 else if ( IsGOTONode() ) {
1608 if ( aCoupledNode ) {
1609 f << " " << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
1610 << Name() << " , '" << aCoupledNode->Name() << "' )" << endl ;
1613 f << " " << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
1614 << Name() << " , '' )" << endl ;
1617 else if ( IsMacroNode() ) {
1618 if ( aCoupledNode ) {
1619 f << " " << aCoupledNode->Name() << " = Def" << aCoupledNode->Name() << "()" << endl ;
1620 f << " " << Name() << " = " << aGraphName << ".GraphMNode( " << aCoupledNode->Name() << " )" << endl ;
1623 f << " " << Name() << " = " << aGraphName << ".GraphMNode( ? )" << endl ;
1625 f << " " << Name() << ".SetCoupled( '" << aCoupledNode->Name() << "' )" << endl ;
1628 // char * EndName = NULL ;
1629 // EndName = new char[ 3 + strlen( Name() ) + 1 ] ;
1630 // strcpy( EndName , "End" ) ;
1631 // strcat( EndName , Name() ) ;
1632 char * EndName = aCoupledNode->Name() ;
1633 cdebug << "ComputingNode::SavePY Node " << Name() << " EndName " << EndName
1635 if ( IsLoopNode() ) {
1637 SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ;
1638 SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ;
1639 f << " " << "PyMore" << Name() << " = []" << endl ;
1640 for ( i = 0 ; i < (int ) aPyMore.length() ; i++ ) {
1641 f << " " << "PyMore" << Name() << ".append( '" << aPyMore[i] << "' )" << endl ;
1643 f << " " << "PyNext" << Name() << " = []" << endl ;
1644 for ( i = 0 ; i < (int ) aPyNext.length() ; i++ ) {
1645 f << " " << "PyNext" << Name() << ".append( '" << aPyNext[i] << "' )" << endl ;
1647 f << " " << Name() << "," << EndName << " = " << aGraphName << ".LNode( '"
1648 << FuncNames[0].c_str() << "' , Py" << Name() << " , '"
1649 << FuncNames[1].c_str() << "' , PyMore" << Name()
1650 << " , '" << FuncNames[2].c_str() << "' , PyNext"
1651 << Name() << " )" << endl ;
1652 f << " " << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
1653 f << " " << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
1654 f << " " << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
1655 f << " " << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
1656 << aCoupledNode->YCoordinate() << " )" << endl ;
1657 SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
1658 f << " " << "Py" << aCoupledNode->Name() << " = []" << endl ;
1659 for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
1660 f << " " << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
1663 f << " " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
1664 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1665 const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1666 cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
1667 << " " << anInPort->Kind() << endl ;
1668 if ( anInPort->IsLoop() ) {
1669 f << " " << "I" << Name() << anInPort->PortName() << " = "
1670 << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1672 else if ( anInPort->IsInLine() ) {
1673 f << " " << "I" << Name() << anInPort->PortName() << " = "
1674 << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
1675 << anInPort->PortType() << "' )" << endl ;
1677 else if ( anInPort->IsDataStream() ) {
1678 f << " " << "I" << Name() << anInPort->PortName() << " = " << Name()
1679 << ".InStreamPort( '" << anInPort->PortName()
1680 << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
1681 << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
1682 SUPERV::KindOfSchema aKindOfSchema ;
1683 SUPERV::KindOfInterpolation aKindOfInterpolation ;
1684 SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1685 ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1686 f << " " << "I" << Name() << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1687 << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1689 else if ( anInPort->IsGate() ) {
1690 f << " " << "I" << Name() << anInPort->PortName() << " = "
1691 << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1694 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1695 const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1696 cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
1697 << " " << anOutPort->Kind() << endl ;
1698 if ( anOutPort->IsInLine() || anOutPort->IsLoop() ) {
1699 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1700 << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1702 else if ( anOutPort->IsDataStream() ) {
1703 f << " " << "O" << Name() << anOutPort->PortName() << " = " << Name()
1704 << ".OutStreamPort( '" << anOutPort->PortName()
1705 << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
1706 << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
1707 long aNumberOfValues ;
1708 aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1709 f << " " << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
1712 //JR 02.09.2005 : GetOutPort for Gates was missing
1713 else if ( anOutPort->IsGate() ) {
1714 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1715 << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1718 for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
1719 const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
1720 cdebug << "Node " << aCoupledNode->Name() << " InPort " << anInPort->PortName()
1721 << " " << anInPort->Kind() << endl ;
1722 if ( anInPort->IsInLine() || anInPort->IsLoop() || anInPort->IsGate() ) {
1723 f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
1724 << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1726 else if ( anInPort->IsDataStream() ) {
1727 f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
1728 << ".InStreamPort( '" << anInPort->PortName()
1729 << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
1730 << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
1731 SUPERV::KindOfSchema aKindOfSchema ;
1732 SUPERV::KindOfInterpolation aKindOfInterpolation ;
1733 SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1734 ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1735 f << " " << "I" << EndName << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1736 << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1739 for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) {
1740 const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ;
1741 cdebug << "Node " << aCoupledNode->Name() << " OutPort " << anOutPort->PortName()
1742 << " " << anOutPort->Kind() << endl ;
1743 if ( anOutPort->IsInLine() || anOutPort->IsLoop() || anOutPort->IsGate() ) {
1744 f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1745 << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1747 else if ( anOutPort->IsDataStream() ) {
1748 f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1749 << ".OutStreamPort( '" << anOutPort->PortName()
1750 << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
1751 << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
1752 long aNumberOfValues ;
1753 aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1754 f << " " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
1759 else if ( IsSwitchNode() ) {
1760 f << " " << Name() << "," << EndName << " = " << aGraphName << ".SNode( '"
1761 << FuncNames[0].c_str() << "' , Py" << Name() << " )" << endl ;
1762 f << " " << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
1763 f << " " << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
1764 f << " " << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
1765 f << " " << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
1766 << aCoupledNode->YCoordinate() << " )" << endl ;
1767 SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
1768 f << " " << "Py" << aCoupledNode->Name() << " = []" << endl ;
1769 for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
1770 f << " " << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
1773 f << " " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
1774 for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
1775 const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
1776 cdebug << "Node " << aCoupledNode->Name() << " InPort " << anInPort->PortName()
1777 << " " << anInPort->Kind() << endl ;
1778 // if ( anInPort->IsGate() || anInPort->IsEndSwitch() ) {
1779 if ( anInPort->IsGate() ) {
1780 f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
1781 << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1783 else if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
1784 f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
1785 << ".InPort( '" << anInPort->PortName()
1786 << "' , '" << anInPort->PortType() << "' )" << endl ;
1788 else if ( anInPort->IsDataStream() ) {
1789 f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
1790 << ".InStreamPort( '" << anInPort->PortName()
1791 << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
1792 << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
1793 SUPERV::KindOfSchema aKindOfSchema ;
1794 SUPERV::KindOfInterpolation aKindOfInterpolation ;
1795 SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1796 ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1797 f << " " << "I" << EndName << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1798 << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1801 for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) {
1802 const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ;
1803 cdebug << "Node " << aCoupledNode->Name() << " OutPort " << anOutPort->PortName()
1804 << " " << anOutPort->Kind() << endl ;
1805 // if ( anOutPort->IsGate() || anOutPort->IsEndSwitch() ) {
1806 if ( anOutPort->IsGate() ) {
1807 f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1808 << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1810 else if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
1811 f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1812 << ".OutPort( '" << anOutPort->PortName()
1813 << "' , '" << anOutPort->PortType() << "' )" << endl ;
1815 else if ( anOutPort->IsDataStream() ) {
1816 f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1817 << ".OutStreamPort( '" << anOutPort->PortName()
1818 << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
1819 << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
1820 long aNumberOfValues ;
1821 aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1822 f << " " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
1827 cdebug << "ComputingNode::SavePY Node " << Name() << " EndName " << EndName
1830 //JR 24.02.2005 Debug !!!... : I should not delete myself : what a stupid thing !
1831 // delete [] EndName ;
1835 if ( IsEndLoopNode() || IsEndSwitchNode() ) {
1836 // It is done with LoopNode or SwitchNode with CoupledNode()
1839 f << " " << Name() << ".SetName( '" << Name() << "' )" << endl ;
1840 f << " " << Name() << ".SetAuthor( '" << Author() << "' )" << endl ;
1841 if ( IsFactoryNode() ) {
1842 f << " " << Name() << ".SetContainer( '" << Computer << "' )" << endl ;
1844 f << " " << Name() << ".SetComment( '" << Comment() << "' )" << endl ;
1845 f << " " << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ;
1847 if ( IsComputingNode() || IsFactoryNode() ) {
1849 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1850 const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1851 if ( !anInPort->IsDataStream() ) {
1852 cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
1853 << " " << anInPort->Kind() << endl ;
1854 f << " " << "I" << Name() << anInPort->PortName() << " = "
1855 << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1858 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1859 const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1860 if ( !anOutPort->IsDataStream() ) {
1861 cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
1862 << " " << anOutPort->Kind() << endl ;
1863 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1864 << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1868 else if ( IsOneOfInLineNodes() && !IsLoopNode() ) {
1870 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1871 const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1872 cdebug << "ComputingNode::SavePY Node " << Name() << " InPort " << anInPort->PortName()
1873 << " " << anInPort->Kind() << endl ;
1874 // if ( anInPort->IsGate() || ( anInPort->IsInLine() && IsMacroNode() ) ) {
1875 if ( anInPort->IsGate() || IsMacroNode() ) {
1876 f << " " << "I" << Name() << anInPort->PortName() << " = "
1877 << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1879 else if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
1880 f << " " << "I" << Name() << anInPort->PortName() << " = "
1881 << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
1882 << anInPort->PortType() << "' )" << endl ;
1885 cdebug << "Ignored " << Name() << " " << anInPort->PortName() << " " << anInPort->PortStatus() << endl ;
1886 // f << " " << "I" << Name() << anInPort->PortName() << " = "
1887 // << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1890 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1891 const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1892 cdebug << "ComputingNode::SavePY Node " << Name() << " OutPort " << anOutPort->PortName()
1893 << " " << anOutPort->Kind() << endl ;
1894 // if ( anOutPort->IsGate() || ( anOutPort->IsInLine() && IsMacroNode() ) ) {
1895 if ( anOutPort->IsGate() || IsMacroNode() ) {
1896 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1897 << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1899 else if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
1900 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1901 << Name() << ".OutPort( '" << anOutPort->PortName()
1902 << "' , '" << anOutPort->PortType() << "' )" << endl ;
1905 cdebug << "Ignored " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortStatus() << endl ;
1906 // f << " " << "O" << Name() << anOutPort->PortName() << " = "
1907 // << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1911 if ( !IsDataFlowNode() && !IsDataStreamNode() ) {
1913 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1914 const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1915 cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
1916 << " " << anInPort->Kind() << endl ;
1917 if ( anInPort->IsDataStream() ) {
1918 if ( IsOneOfInLineNodes() ) {
1919 f << " " << "I" << Name() << anInPort->PortName() << " = "
1920 << Name() << ".InStreamPort( '" << anInPort->PortName() << "' , SALOME_ModuleCatalog."
1921 << StringToDataStreamType( anInPort->PortType() ) << " , SALOME_ModuleCatalog."
1922 << anInPort->Dependency() << " )" << endl ;
1925 f << " " << "I" << Name() << anInPort->PortName() << " = "
1926 << Name() << ".GetInStreamPort( '" << anInPort->PortName() << "' )" << endl ;
1928 SUPERV::KindOfSchema aKindOfSchema ;
1929 SUPERV::KindOfInterpolation aKindOfInterpolation ;
1930 SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1931 ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1932 f << " " << "I" << Name() << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1933 << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1936 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1937 const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1938 cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
1939 << " " << anOutPort->Kind() << endl ;
1940 if ( anOutPort->IsDataStream() ) {
1941 if ( IsOneOfInLineNodes() ) {
1942 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1943 << Name() << ".OutStreamPort( '" << anOutPort->PortName() << "' , SALOME_ModuleCatalog."
1944 << StringToDataStreamType( anOutPort->PortType() ) << " , SALOME_ModuleCatalog."
1945 << anOutPort->Dependency() << " )" << endl ;
1948 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1949 << Name() << ".GetOutStreamPort( '" << anOutPort->PortName() << "' )" << endl ;
1951 long aNumberOfValues ;
1952 aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1953 f << " " << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" << endl ;
1959 cdebug_out << "ComputingNode::SavePY " ;
1960 NodeInfo( *_fdebug ) ;
1965 void GraphBase::ComputingNode::NodeInfo(ostream & s) const {
1967 ListPorts( s , true ) ;
1971 ostream & operator<< (ostream & f,const GraphBase::ComputingNode & G) {
1972 // f << "ComponentName " << G.ComponentName() << endl ;
1973 if ( G.IsComputingNode() ) {
1974 f << "NodeName " << G.Name() << endl ;
1977 f << "DataFlowName " << G.Name() << endl ;
1979 f << "Kind " << G.Kind() << endl ;
1980 f << "Service " << *G.GetService() ;
1981 f << "FirstCreation " << G.FirstCreation () << endl ;
1982 f << "LastModification " << G.LastModification() << endl ;
1983 f << "EditorRelease " << G.EditorRelease() << endl ;
1984 f << "Author " << G.Author() << endl ;
1985 // f << "Computer " << G.Computer() << endl ;
1986 f << "Comment " << G.Comment() << endl ;
1992 void GraphBase::ComputingNode::ListLinks(ostream &f ) const {
1994 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1995 const GraphBase::OutPort* fromPort = GetNodeOutPort( i ) ;
1996 if ( fromPort->IsPortConnected() ) {
1998 for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) {
2000 f << "FromNode " << Name() << endl ;
2002 f << " FromServiceParameterName "
2003 << fromPort->GetServicesParameter().Parametername ;
2004 const GraphBase::InPort* toPort = fromPort->InPorts( j ) ;
2005 f << " ToNode " << toPort->NodeName() ;
2006 f << " ToServiceParameterName "
2007 << toPort->GetServicesParameter().Parametername;
2009 fromPort->StringValue( f ) ;
2016 ostream & operator<< (ostream &fOut,const SUPERV::SDate &D) {
2017 // cdebug_in << "operator<< GraphEditor::Date" << endl;
2019 fOut << D.Day << "/"
2026 // cdebug_out << "operator<< GraphEditor::Date" << endl;