1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : DataFlowBase_ComputingNode.cxx
24 // Author : Jean Rahuel, CEA
31 #include "DataFlowBase_StreamGraph.hxx"
32 //#include "DataFlowBase_LoopNode.hxx"
34 // Screen single quotes
35 static string protectQuotes (const string theText)
37 string aRes (theText);
41 for (pos = 0; pos < aRes.size(); pos++) {
42 pos = aRes.find("\\", pos);
43 if (pos < 0 || pos > aRes.size()) break;
45 aRes.insert(pos, "\\");
48 // screen symbol after back slash (except single quote, which will be processed below)
49 if (pos + 1 < aRes.size() && aRes[pos + 1] != '\'') {
50 aRes.insert(pos + 1, "\\");
55 // screen single quote
56 for (pos = 0; pos < aRes.size(); pos++) {
57 pos = aRes.find("'", pos);
58 if (pos < 0 || pos > aRes.size()) break;
60 aRes.insert(pos, "\\");
67 static void InitFields( //SUPERV::KindOfNode &_Kind ,
68 SUPERV::SDate &_FirstCreation ,
69 SUPERV::SDate &_LastModification ,
70 char * &_EditorRelease ,
74 bool &_GeneratedName ,
75 //int &_DataStreamInPortsNumber ,
76 //int &_DataStreamOutPortsNumber ,
77 int &_ConnectedInPortsNumber ,
78 int &_DecrConnectedInPortsNumber ) {
79 //int &_LinkedNodesSize ,
80 //int &_SubGraphNumber ) {
81 time_t T = time(NULL);
82 struct tm * Tm = localtime(&T);
84 // _Kind = SUPERV::DataFlowGraph ;
86 _FirstCreation.Second = _LastModification.Second = Tm->tm_sec;
87 _FirstCreation.Minute = _LastModification.Minute = Tm->tm_min;
88 _FirstCreation.Hour = _LastModification.Hour = Tm->tm_hour;
89 _FirstCreation.Day = _LastModification.Day = Tm->tm_mday;
90 _FirstCreation.Month = _LastModification.Month = Tm->tm_mon + 1;
91 _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900;
93 _EditorRelease = new char[ strlen( SuperVision_Version ) + 1 ] ;
94 strcpy( _EditorRelease , SuperVision_Version ) ;
95 _Author = NULLSTRING ;
96 // _Computer = new char[ strlen( FACTORYSERVER ) + 1 ] ;
97 // strcpy( _Computer , FACTORYSERVER ) ;
98 _Comment = NULLSTRING ;
100 // _SubGraphNumber = 0 ;
101 // _HeadNode = false ;
102 _GeneratedName = false ;
104 // _DataStreamInPortsNumber = 0 ;
105 // _DataStreamOutPortsNumber = 0 ;
107 _ConnectedInPortsNumber = 0 ;
108 _DecrConnectedInPortsNumber = 0 ;
109 // _LinkedNodesSize = 0 ;
110 // _SubGraphNumber = 0 ;
113 GraphBase::ComputingNode::ComputingNode() :
114 // GraphBase::PortsOfNode::PortsOfNode() {
115 GraphBase::StreamNode::StreamNode() {
117 InitFields( //_Kind ,
125 //_DataStreamInPortsNumber ,
126 //_DataStreamOutPortsNumber ,
127 _ConnectedInPortsNumber ,
128 _DecrConnectedInPortsNumber ) ;
130 //_SubGraphNumber ) ;
131 Kind( SUPERV::DataFlowGraph ) ;
132 _NamingService = NULL ;
133 _Node_var = SUPERV::CNode::_nil() ;
136 _ThreadNo = pthread_self() ;
137 cdebug << "GraphBase::Node::Node " << this << " " << endl ;
141 GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
142 SALOME_NamingService* ptrNamingService ,
143 const char * aDataFlowName ,
144 const SUPERV::KindOfNode DataFlowkind ,
145 int * Graph_prof_debug ,
146 ofstream * Graph_fdebug ) :
147 // GraphBase::PortsOfNode::PortsOfNode( aDataFlowName ) {
148 GraphBase::StreamNode::StreamNode( aDataFlowName , DataFlowkind ,
149 Graph_prof_debug , Graph_fdebug ) {
151 // MESSAGE( "GraphBase::ComputingNode::ComputingNode " << aDataFlowName << " Graph_prof_debug " << Graph_prof_debug ) ;
152 InitFields( //_Kind ,
160 //_DataStreamInPortsNumber ,
161 //_DataStreamOutPortsNumber ,
162 _ConnectedInPortsNumber ,
163 _DecrConnectedInPortsNumber ) ;
165 //_SubGraphNumber ) ;
167 // Kind( SUPERV::DataFlowGraph ) ;
168 Kind( DataFlowkind ) ;
169 _ORB = CORBA::ORB::_duplicate( ORB ) ;
170 _NamingService = ptrNamingService ;
171 _Node_var = SUPERV::CNode::_nil() ;
174 _ThreadNo = pthread_self() ;
176 if ( Graph_prof_debug ) {
177 // MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug" ) ;
178 // cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug" << endl ;
179 _Graph_prof_debug = Graph_prof_debug ;
180 _Graph_fdebug = Graph_fdebug ;
181 SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
184 // cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ;
186 DefPortsOfNode( ORB , SALOME_ModuleCatalog::Service() , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
187 cdebug << "GraphBase::ComputingNode::ComputingNode " << this
188 << " Name '" << Name() << "' " << _FirstCreation
189 << " " << _LastModification << endl ;
192 GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
193 SALOME_NamingService* ptrNamingService ,
194 const SALOME_ModuleCatalog::Service& aService ,
195 const char *NodeName ,
196 const SUPERV::KindOfNode akind ,
197 const SUPERV::SDate NodeFirstCreation ,
198 const SUPERV::SDate NodeLastModification ,
199 const char * NodeEditorRelease ,
200 const char * NodeAuthor ,
201 const char * NodeComment ,
202 const bool GeneratedName ,
205 int * Graph_prof_debug ,
206 ofstream * Graph_fdebug ) :
207 // GraphBase::PortsOfNode::PortsOfNode() {
208 GraphBase::StreamNode::StreamNode( NodeName , akind , Graph_prof_debug , Graph_fdebug ) {
210 _ORB = CORBA::ORB::_duplicate( ORB ) ;
211 _NamingService = ptrNamingService ;
212 _Node_var = SUPERV::CNode::_nil() ;
215 _ThreadNo = pthread_self() ;
220 time_t T = time(NULL);
221 struct tm * Tm = localtime(&T);
223 _FirstCreation.Second = _LastModification.Second = Tm->tm_sec;
224 _FirstCreation.Minute = _LastModification.Minute = Tm->tm_min;
225 _FirstCreation.Hour = _LastModification.Hour = Tm->tm_hour;
226 _FirstCreation.Day = _LastModification.Day = Tm->tm_mday;
227 _FirstCreation.Month = _LastModification.Month = Tm->tm_mon + 1;
228 _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900;
230 if ( NodeEditorRelease != NULLSTRING ) {
231 _EditorRelease = new char[ strlen( NodeEditorRelease ) + 1 ] ;
232 strcpy( _EditorRelease , NodeEditorRelease ) ;
235 _EditorRelease = new char[ strlen( SuperVision_Version ) + 1 ] ;
236 strcpy( _EditorRelease , SuperVision_Version ) ;
239 if ( NodeAuthor != NULLSTRING ) {
240 _Author = new char[ strlen( NodeAuthor ) + 1 ] ;
241 strcpy( _Author , NodeAuthor ) ;
244 _Author = NULLSTRING ;
247 if ( NodeComment != NULLSTRING ) {
248 _Comment = new char[ strlen( NodeComment ) + 1 ] ;
249 strcpy( _Comment , NodeComment ) ;
252 _Comment = NULLSTRING ;
255 // _SubGraphNumber = 0 ;
256 // _HeadNode = false ;
257 _GeneratedName = GeneratedName ;
259 // const char *aNodeName = NodeName ;
260 // _Name = new char[strlen(aNodeName)+1];
261 // strcpy(_Name , aNodeName);
263 // _DataStreamInPortsNumber = 0 ;
264 // _DataStreamOutPortsNumber = 0 ;
266 _ConnectedInPortsNumber = 0 ;
267 _DecrConnectedInPortsNumber = 0 ;
268 // _LinkedNodesSize = 0 ;
273 _Graph_prof_debug = Graph_prof_debug ;
274 _Graph_fdebug = Graph_fdebug ;
275 // MESSAGE( "GraphBase::ComputingNode::ComputingNode " << NodeName
276 // << " _Graph_prof_debug " << _Graph_prof_debug ) ;
277 SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
278 cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << NodeName << ","
279 << akind << ")" << endl;
282 DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
283 cdebug << "GraphBase::ComputingNode::ComputingNode " << this
284 << " Name '" << Name()
285 << "' KindOfNode " << Kind()
286 << " ServiceName '" << ServiceName() << "' In(" << ServiceInParameter().length()
287 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
289 cdebug_out << "GraphBase::ComputingNode::ComputingNode" << endl;
292 GraphBase::ComputingNode::~ComputingNode() {
293 cdebug << "GraphBase::ComputingNode::~ComputingNode " << this
294 << " Name() "<< Name() << " _Comment "
295 << (void *) _Comment << " " << _Comment << " " << endl ;
298 //->StreamNode bool GraphBase::ComputingNode::Name( const char * aName) {
299 //->StreamNode cdebug_in << "GraphBase::ComputingNode::Name " << _Name << endl;
300 //->StreamNode if ( _Name ) {
301 //->StreamNode cdebug << "GraphBase::ComputingNode::ReName " << _Name << " --> " << aName << endl ;
302 //->StreamNode delete [] _Name ;
304 //->StreamNode _Name = new char[strlen(aName)+1] ;
305 //->StreamNode strcpy( _Name , aName ) ;
306 //->StreamNode cdebug_out << "GraphBase::ComputingNode::Name " << _Name << endl;
307 //->StreamNode return true ;
310 SUPERV::SDate GraphBase::ComputingNode::FirstCreation () const {
311 // cdebug << "GraphBase::ComputingNode::FirstCreation "
312 // << " Name '" << Name() << "' " << _FirstCreation << " "
313 // << _LastModification << endl ;
314 return _FirstCreation;
317 SUPERV::SDate GraphBase::ComputingNode::LastModification () const {
318 return _LastModification ;
321 void GraphBase::ComputingNode::FirstCreation(const SUPERV::SDate aDate ) {
322 _FirstCreation = aDate ;
325 void GraphBase::ComputingNode::LastModification(const SUPERV::SDate aDate ) {
326 _LastModification = aDate ;
329 bool GraphBase::ComputingNode::EditorRelease(const char * c){
330 if ( _EditorRelease && _EditorRelease != NULLSTRING )
331 delete [] _EditorRelease;
332 _EditorRelease = my_strdup(c);
336 bool GraphBase::ComputingNode::Author(const char * a) {
337 cdebug_in << "GraphBase::ComputingNode::Author " << _Author << endl;
338 if ( _Author && _Author != NULLSTRING )
340 _Author = my_strdup(a);
341 cdebug_out << "GraphBase::ComputingNode::Author " << _Author << endl;
345 bool GraphBase::ComputingNode::Comment(const char *c) {
346 cdebug_in << "GraphBase::ComputingNode::Comment " << _Comment << endl;
347 if ( _Comment != NULLSTRING )
349 _Comment = my_strdup(c);
350 cdebug_out << "GraphBase::ComputingNode::Comment " << _Comment << endl;
354 void GraphBase::ComputingNode::NodePort( const char * NodeName ,
355 const char * ServiceParameterName ,
356 char ** aNode , char ** aPort ) {
357 if ( strcmp( NodeName , Name() ) ) {
358 *aNode = my_strdup( NodeName ) ;
359 *aPort = my_strdup( ServiceParameterName ) ;
362 // char * BPort = strchr( ServiceParameterName , '\\' ) ;
363 char * BPort = (char * ) ServiceParameterName ;
364 while ( ( BPort = strchr( BPort , '_' ) ) ) {
365 if ( BPort[1] == '_' ) {
366 int len = BPort - ServiceParameterName ;
367 *aNode = new char [ len + 1 ] ;
368 strncpy( *aNode , ServiceParameterName , len ) ;
369 (*aNode)[ len ] = '\0' ;
370 *aPort = my_strdup( &BPort[ 2 ] ) ;
377 if ( BPort == NULL ) {
378 *aNode = my_strdup( NULLSTRING ) ;
379 *aPort = my_strdup( NULLSTRING ) ;
384 bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName, bool isInput ) {
385 bool RetVal = false ;
386 if ( isInput ) { // mkr : PAL8060
387 // we have to know the type of the port, because of input and output ports
388 // belong to one node may have the same names
389 const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ;
391 RetVal = thePort->IsPortConnected() ;
395 const GraphBase::OutPort * thePort = GetOutPort( ToServiceParameterName ) ;
397 RetVal = thePort->IsPortConnected() ;
403 bool GraphBase::ComputingNode::HasInput(const char * ToServiceParameterName ) {
404 bool RetVal = false ;
405 const GraphBase::InPort * theInPort = GetInPort( ToServiceParameterName ) ;
407 RetVal = theInPort->IsDataConnected() ;
410 const GraphBase::OutPort * theOutPort = GetOutPort( ToServiceParameterName ) ;
412 RetVal = theOutPort->IsDataConnected() ;
418 GraphBase::SNode * GraphBase::ComputingNode::GetInfo() {
419 cdebug_in << "GraphBase::ComputingNode::GetInfo" << endl;
420 GraphBase::SNode * Info = new GraphBase::SNode ;
421 // Info->theComponentName = ComponentName() ;
422 // Info->theInterfaceName = InterfaceName() ;
423 Info->theName = Name() ;
424 Info->theKind = Kind() ;
425 if ( IsDataStreamNode() ) {
426 CORBA::Long Timeout ;
427 SUPERV::KindOfDataStreamTrace DataStreamTrace ;
428 CORBA::Double DeltaTime ;
429 ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
430 Info->theTimeout = Timeout ;
431 Info->theDataStreamTrace = DataStreamTrace ;
432 Info->theDeltaTime = DeltaTime ;
434 Info->theService = *GetService() ;
435 // Info->theListOfParameters = *GetListOfParameters() ;
436 Info->theFirstCreation = FirstCreation() ;
437 Info->theLastModification = LastModification() ;
438 Info->theEditorRelease = EditorRelease() ;
439 Info->theAuthor = Author() ;
440 // Info->theContainer = Computer() ;
441 Info->theComment = Comment() ;
442 Info->theCoords.theX = GraphBase::ComputingNode::XCoordinate() ;
443 Info->theCoords.theY = GraphBase::ComputingNode::YCoordinate() ;
444 cdebug_out << "GraphBase::ComputingNode::GetInfo" << endl;
448 void GraphBase::ComputingNode::SetMacroPorts( GraphBase::Graph * aGraph ) {
449 cdebug_in << "GraphBase::ComputingNode::SetMacroPorts fill ports of MacroNode" << endl;
451 for ( i = 0 ; i < aGraph->GetNodeInPortsSize() ; i++ ) {
452 const GraphBase::InPort * anInPort = aGraph->GetNodeInPort( i ) ;
453 cdebug << "SetMacroPorts In" << i << " " << anInPort->PortName() << " " << anInPort->PortType()
454 << " " << anInPort->Kind() << endl ;
455 GraphBase::InPort * aNewInPort ;
456 if ( anInPort->IsDataStream() ) {
457 aNewInPort = AddInDataStreamPort( anInPort->PortName(), anInPort->PortType(),
458 anInPort->Dependency(), anInPort->Kind() ) ;
460 else if ( anInPort->IsParam() || anInPort->IsInLine() ) {
461 aNewInPort = AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() ) ;
464 for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() ; i++ ) {
465 const GraphBase::OutPort * anOutPort = aGraph->GetNodeOutPort( i ) ;
466 cdebug << "SetMacroPorts Out" << i << " " << anOutPort->PortName() << " " << anOutPort->PortType()
467 << " " << anOutPort->Kind() << endl ;
468 if ( anOutPort->IsDataStream() ) {
469 AddOutDataStreamPort( anOutPort->PortName(), anOutPort->PortType(),
470 anOutPort->Dependency(), anOutPort->Kind() ) ;
472 else if ( anOutPort->IsParam() || anOutPort->IsInLine() ) {
473 AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() ) ;
476 cdebug_out << "GraphBase::ComputingNode::SetMacroPorts" << endl;
479 void GraphBase::ComputingNode::UpdateMacroPorts( GraphBase::Graph * aGraph ) {
480 cdebug_in << "GraphBase::ComputingNode::UpdateMacroPorts fill ports of MacroNode from "
481 << aGraph->Name() << " InPorts(" << aGraph->GetNodeInPortsSize() << ") OutPorts("
482 << aGraph->GetNodeInPortsSize() << ") to MacroNode " << Name() << " InPorts(" << GetNodeInPortsSize()
483 << ") OutPorts(" << GetNodeInPortsSize() << ")" << endl;
484 cdebug << Name() << " : " << *GetService() << endl ;
485 cdebug << aGraph->Name() << " : " << *aGraph->GetService() << endl ;
487 // Loop over InPorts of MacroNode ; if it does not exist in the MacroGraph ===> DelInPort in the MacroNode
488 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
489 GraphBase::InPort * anInPort = aGraph->GetChangeInPort( GetNodeInPort( i )->PortName() ) ;
490 if ( anInPort && !anInPort->IsGate() && !GetNodeInPort( i )->IsGate() ) {
491 if ( strcmp( GetNodeInPort( i )->PortType() , anInPort->PortType() ) ) {
492 cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
493 << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
494 cdebug << " <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
495 << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
496 GetChangeNodeInPort( i )->PortType( (char * ) anInPort->PortType() ) ;
498 if ( GetNodeInPort( i )->Kind() != anInPort->Kind() ) {
499 cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
500 << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
501 cdebug << " <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
502 << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
503 GetChangeNodeInPort( i )->Kind( anInPort->Kind() ) ;
505 if ( GetNodeInPort( i )->Dependency() != anInPort->Dependency() ) {
506 cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
507 << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
508 cdebug << " <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
509 << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
510 GetChangeNodeInPort( i )->Dependency( anInPort->Dependency() ) ;
513 else if ( !GetNodeInPort( i )->IsGate() ) {
514 cdebug << "UpdateMacroPorts DelInPort In" << i << " " << GetNodeInPort( i )->PortName() << " "
515 << GetNodeInPort( i )->PortType() << " " << GetNodeInPort( i )->Kind() << endl ;
516 DelInPort( GetNodeInPort( i )->PortName() ) ;
517 i--; // mkr : fix for bug PAL8004
521 // Loop over InPorts of the MacroGraph : if it does not exist in the MacroNode ==> AddInPort in the MacroNode
522 for ( index = 0 ; index < aGraph->GetNodeInPortsSize() ; index++ ) {
523 GraphBase::InPort * anInPort = aGraph->GetChangeNodeInPort( index ) ;
524 GraphBase::InPort * aMacroInPort = GetChangeInPort( anInPort->PortName() ) ;
525 if ( !anInPort->IsGate() &&
526 strcmp( GetChangeNodeInPort( index )->PortName() , anInPort->PortName() ) ) {
527 cdebug << "UpdateMacroPorts Add/MoveInPort In" << index << " " << anInPort->PortName() << " "
528 << anInPort->PortType() << " " << anInPort->Kind() << endl ;
529 if ( aMacroInPort ) {
530 MoveInPort( anInPort->PortName() , index ) ;
533 AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() , index ) ;
537 // Loop over OutPorts of MacroNode ; if it does not exist in the MacroGraph ===> DelOutPort in the MacroNode
538 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
539 GraphBase::OutPort * anOutPort = aGraph->GetChangeOutPort( GetNodeOutPort( i )->PortName() ) ;
540 if ( anOutPort && !anOutPort->IsGate() && !GetNodeOutPort( i )->IsGate() ) {
541 if ( strcmp( GetNodeOutPort( i )->PortType() , anOutPort->PortType() ) ) {
542 cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
543 << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
544 cdebug << " <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
545 << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
546 GetChangeNodeOutPort( i )->PortType( (char * ) anOutPort->PortType() ) ;
548 if ( GetNodeOutPort( i )->Kind() != anOutPort->Kind() ) {
549 cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
550 << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
551 cdebug << " <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
552 << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
553 GetChangeNodeOutPort( i )->Kind( anOutPort->Kind() ) ;
555 if ( GetNodeOutPort( i )->Dependency() != anOutPort->Dependency() ) {
556 cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
557 << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
558 cdebug << " <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
559 << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
560 GetChangeNodeOutPort( i )->Dependency( anOutPort->Dependency() ) ;
563 else if ( !GetNodeOutPort( i )->IsGate() ) {
564 cdebug << "UpdateMacroPorts DelOutPort Out" << i << " " << GetNodeOutPort( i )->PortName() << " "
565 << GetNodeOutPort( i )->PortType() << " " << GetNodeOutPort( i )->Kind() << endl ;
566 DelOutPort( GetNodeOutPort( i )->PortName() ) ;
569 // Loop over OutPorts of the MacroGraph : if it does not exist in the MacroNode ==> AddOutPort in the MacroNode
570 for ( index = 0 ; index < aGraph->GetNodeOutPortsSize() ; index++ ) {
571 GraphBase::OutPort * anOutPort = aGraph->GetChangeNodeOutPort( index ) ;
572 GraphBase::OutPort * aMacroOutPort = GetChangeOutPort( anOutPort->PortName() ) ;
573 if ( !anOutPort->IsGate() && strcmp( GetNodeOutPort( index )->PortName() , anOutPort->PortName() ) ) {
574 cdebug << "UpdateMacroPorts Add/MoveOutPort Out" << index << " " << anOutPort->PortName() << " "
575 << anOutPort->PortType() << " " << anOutPort->Kind() << endl ;
576 if ( aMacroOutPort ) {
577 MoveOutPort( anOutPort->PortName() , index ) ;
580 AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() , index ) ;
584 bool ErrPort = false ;
585 if ( aGraph->GetNodeInPortsSize() != GetNodeInPortsSize() ||
586 aGraph->GetNodeOutPortsSize() != GetNodeOutPortsSize() ) {
589 for ( i = 0 ; i < aGraph->GetNodeInPortsSize() && i < GetNodeInPortsSize() ; i++ ) {
590 if ( !strcmp( aGraph->GetNodeInPort( i )->PortName() , GetNodeInPort( i )->PortName() ) ) {
594 for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() && i < GetNodeOutPortsSize() ; i++ ) {
595 if ( !strcmp( aGraph->GetNodeOutPort( i )->PortName() , GetNodeOutPort( i )->PortName() ) ) {
600 for ( i = 0 ; i < aGraph->GetNodeInPortsSize() || i < GetNodeInPortsSize() ; i++ ) {
601 if ( i < aGraph->GetNodeInPortsSize() && i < GetNodeInPortsSize() ) {
602 cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << aGraph->GetNodeInPort( i )->PortName()
603 << " " << GetNodeInPort( i )->PortName() << endl ;
605 else if ( i >= GetNodeInPortsSize() ) {
606 cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << aGraph->GetNodeInPort( i )->PortName()
610 cdebug << "ComputingNode::UpdateMacroPorts In" << i << " " << GetNodeInPort( i )->PortName()
614 for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() || i < GetNodeOutPortsSize() ; i++ ) {
615 if ( i < aGraph->GetNodeOutPortsSize() && i < GetNodeOutPortsSize() ) {
616 cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << aGraph->GetNodeOutPort( i )->PortName()
617 << " != " << GetNodeOutPort( i )->PortName() << endl ;
619 else if ( i >= GetNodeOutPortsSize() ) {
620 cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << aGraph->GetNodeOutPort( i )->PortName()
624 cdebug << "ComputingNode::UpdateMacroPorts Out" << i << " " << GetNodeOutPort( i )->PortName()
629 cdebug_out << "GraphBase::ComputingNode::UpdateMacroPorts"
630 << aGraph->Name() << " InPorts(" << aGraph->GetNodeInPortsSize() << ") OutPorts("
631 << aGraph->GetNodeOutPortsSize() << ") to MacroNode " << Name() << " InPorts("
632 << GetNodeInPortsSize() << ") OutPorts(" << GetNodeOutPortsSize() << ")" << endl;
635 void GraphBase::ComputingNode::SetMacroDatas( GraphBase::Graph * aGraph ,
636 GraphBase::Graph * aGraphOfMacroGraph ) {
637 cdebug_in << "GraphBase::ComputingNode::SetMacroDatas fill inputs of MacroNode" << endl;
639 for ( i = 0 ; i < aGraph->GetNodeInPortsSize() ; i++ ) {
640 const GraphBase::InPort * anInPort = aGraph->GetNodeInPort( i ) ;
641 GraphBase::OutPort * anOutPort = aGraph->GetChangeNodeInDataNodePort(i) ;
642 cdebug << " " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
643 << " " << anOutPort->Kind() << " " << anOutPort->PortStatus() << endl ;
644 if ( anOutPort->IsDataConnected() ) {
645 //JR 30.03.2005 aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , *(anOutPort->Value()) ) ;
646 aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , anOutPort->Value() ) ;
647 anOutPort->PortStatus( ExternConnected ) ;
650 cdebug_out << "GraphBase::ComputingNode::SetMacroDatas" << endl;
653 void GraphBase::ComputingNode::DelInPort( const char * InputParameterName ) {
655 //JR 07.06.2005 Debug : LinkedNodes and LinkedFromNode must be updated
656 // LinkedInPortsNumber and LinkedFromInPortsNumber must be updated
657 cdebug_in << "ComputingNode::DelInPort " << Name() << "( " << InputParameterName << " )"
660 if ( !IsEndSwitchNode() ) {
661 GraphBase::InPort * anInPort = GetChangeInPort( InputParameterName ) ;
662 cdebug << "ComputingNode::DelInPort InPort " << Name() << "( "
663 << anInPort->PortName() << " ) " << anInPort->PortStatus() << " <-- " ;
664 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
665 if ( anOutPort && !( IsEndLoopNode() && anInPort->IsLoop() ) ) {
666 cdebug << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") "
667 << anOutPort->PortStatus() ;
670 if ( !anInPort->IsNotConnected() ) {
671 GraphBase::ComputingNode * FromNode = NULL ;
673 if ( anOutPort->IsDataConnected() || anOutPort->IsExternConnected() ) {
674 cdebug << " Data/Extern ignored" << endl ;
677 FromNode = GraphOfNode()->GetChangeGraphNode( anOutPort->NodeName() ) ;
680 cdebug << "FromNode " << FromNode->Name() << " LinkedNodesSize "
681 << FromNode->LinkedNodesSize() << " and " << Name()
682 << " LinkedFromNodesSize " << LinkedFromNodesSize() << endl ;
683 if ( !FromNode->IsGOTONode() &&
684 !( FromNode->IsEndLoopNode() && anInPort->IsLoop() ) ) {
685 if ( anInPort->IsDataStream() ) {
686 RetVal = FromNode->RemoveStreamLinkedNode( this ) ;
689 RetVal = FromNode->RemoveLinkedNode( this ) ;
692 cdebug << "ComputingNode::DelInPort anOutPort->RemoveLinkedNode Error RetVal "
699 //We have an EndSwitchNode :
702 for ( i = LinkedFromNodesSize() - 1 ; i >= 0 ; i-- ) {
703 GraphBase::ComputingNode * aLinkedFromNode = (GraphBase::ComputingNode * ) LinkedFromNodes( i ) ;
704 cdebug << aLinkedFromNode->Name() << " linked to " << Name() << endl ;
706 for ( j = aLinkedFromNode->GetNodeOutPortsSize() - 1 ; j >= 0 ; j-- ) {
707 GraphBase::OutPort * anOutPort = aLinkedFromNode->GetChangeNodeOutPort( j ) ;
708 cdebug << "ComputingNode::DelInPort OutPort" << j << ". Remove " << anOutPort->InPortsSize()
709 << " InPortsof OutPort : " << anOutPort->NodeName() << "( "
710 << anOutPort->PortName() << ") "
711 << anOutPort->PortStatus() << " :" << endl ;
713 //Process concerned OutPorts of LinkedFromNodes of that EndSwitchNode
714 for ( k = anOutPort->InPortsSize() - 1 ; k >= 0 ; k-- ) {
715 GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ;
716 if ( !strcmp( anInPort->NodeName() , Name() ) &&
717 !strcmp( anInPort->PortName() , InputParameterName ) ) {
718 // InPort of the EndSwitchNode
719 cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( "
720 << anInPort->PortName() << ") "
721 << anInPort->PortStatus() << endl ;
722 anInPort->RemoveOutPort() ;
723 if ( anOutPort->IsDataStream() ) {
724 aLinkedFromNode->RemoveStreamLinkedNode( this ) ;
727 // false ==> No error for aNode->LinkedFromNode()
728 RetVal = aLinkedFromNode->RemoveLinkedNode( this , false ) ;
730 cdebug << "ComputingNode::DelInPort aLinkedFromNode->RemoveLinkedNode Error RetVal "
735 // Remove the InPort of the EndSwitchNode from that OutPort
736 RetVal = anOutPort->RemoveInPort( anInPort ) ;
738 cdebug << "ComputingNode::DelInPort anOutPort->RemoveInPort( anInPort ) Error RetVal "
748 GraphBase::PortsOfNode::DelInPort( InputParameterName ) ;
749 cdebug_out << "ComputingNode::DelInPort " << Name() << "( " << InputParameterName << " )"
752 void GraphBase::ComputingNode::DelOutPort( const char * OutputParameterName ) {
754 //JR 07.06.2005 Debug : LinkedNodes and LinkedFromNode must be updated
755 // LinkedInPortsNumber and LinkedFromInPortsNumber must be updated
756 cdebug_in << "ComputingNode::DelOutPort " << Name() << "( " << OutputParameterName << " )"
759 GraphBase::OutPort * anOutPort = GetChangeOutPort( OutputParameterName ) ;
760 cdebug << "ComputingNode::DelOutPort OutPort " << " InPortof OutPort : "
761 << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") "
762 << anOutPort->PortStatus() << " :" << endl ;
764 for ( j = anOutPort->InPortsSize() - 1 ; j >= 0 ; j-- ) {
765 GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ;
766 GraphBase::ComputingNode * ToNode = NULL ;
767 cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( "
768 << anInPort->PortName() << ") " << anInPort->PortStatus() ;
769 if ( anInPort->IsExternConnected() ) {
770 cdebug << " ExternConnected ignored" << endl ;
774 ToNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
777 RetVal = anInPort->RemoveOutPort() ;
778 // JR 04.02.2005 : Bug if it is a link to an EndSwitchNode. The InPort may be multiple linked !!!
781 cdebug << "ComputingNode::DelOutPort anOutPort->RemoveOutPort Error RetVal " << RetVal
785 if ( ( IsGOTONode() && ToNode->IsOneOfInLineNodes() ) ||
786 ( IsEndLoopNode() && ToNode->IsLoopNode( ) ) ) {
788 else if ( anOutPort->IsDataStream() ) {
789 RetVal = RemoveStreamLinkedNode( ToNode ) ;
792 RetVal = RemoveLinkedNode( ToNode ) ;
795 cdebug << "ComputingNode::DelOutPort anOutPort->RemoveLinkedNode Error RetVal " << RetVal
799 if ( ToNode->IsEndSwitchNode() ) {
802 for ( i = 0 ; i < ToNode->LinkedFromNodesSize() ; i++ ) {
803 GraphBase::StreamNode * fromNode = ToNode->LinkedFromNodes( i ) ;
804 // Not the node that we are deleting ... :
805 if ( strcmp( fromNode->Name() , Name() ) ) {
807 for ( j = 0 ; j < fromNode->GetNodeOutPortsSize() ; j++ ) {
808 GraphBase::OutPort * fromOutPort = fromNode->GetChangeNodeOutPort( j ) ;
810 for ( k = 0 ; k < fromOutPort->InPortsSize() ; k++ ) {
811 if ( strcmp( ToNode->Name() , fromOutPort->InPorts( k )->NodeName() ) == 0 ) {
812 if ( strcmp( anInPort->PortName() , fromOutPort->InPorts( k )->PortName() ) == 0 ) {
813 // Restore an OutPort in the InPort
814 anInPort->ChangeOutPort( fromOutPort ) ;
815 cdebug << "ComputingNode::DelOutPort reestablish " << fromOutPort->NodeName() << "( "
816 << fromOutPort->PortName() << " ) in the InPort of EndSwitch : "
817 << ToNode->Name() << "( " << anInPort->PortName() << " )"
818 << anInPort->Kind() << " " << anInPort->PortStatus() << endl;
837 cdebug << "Error RetVal " << RetVal << endl ;
840 GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ;
841 cdebug_out << "ComputingNode::DelOutPort " << Name() << "( " << OutputParameterName << " )"
845 GraphBase::InPort * GraphBase::ComputingNode::AddInPort( const char * InputParameterName ,
846 const char * InputParameterType ,
847 const SUPERV::KindOfPort aKindOfPort ,
849 cdebug << "AddInPort " << Name() << " ConnectedInPortsNumber " << ConnectedInPortsNumber() << endl ;
850 // JR 12.01.2005 : InitLoop and DoLoop are reserved parameter names in LoopNodes :
851 if ( IsLoopNode() && ( strcmp( InputParameterName , "InitLoop" ) == 0 ||
852 strcmp( InputParameterName , "DoLoop" ) == 0 ) ) {
855 return GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
861 _Graph_prof_debug , _Graph_fdebug ) ;
863 GraphBase::OutPort * GraphBase::ComputingNode::AddOutPort( const char * OutputParameterName ,
864 const char * OutputParameterType ,
865 const SUPERV::KindOfPort aKindOfPort ,
867 cdebug << "AddOutPort " << Name() << " ConnectedInPortsNumber " << ConnectedInPortsNumber() << endl ;
868 return GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() ,
870 OutputParameterName ,
871 OutputParameterType ,
874 _Graph_prof_debug , _Graph_fdebug ) ;
877 void GraphBase::ComputingNode::DelInDataStreamPort( const char * InputParameterName ) {
878 GraphBase::PortsOfNode::DelInPort( InputParameterName ) ;
880 void GraphBase::ComputingNode::DelOutDataStreamPort( const char * OutputParameterName ) {
881 GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ;
884 GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( const char * InputParameterName,
885 const char * InputParameterType,
886 const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
887 const SUPERV::KindOfPort aKindOfPort ,
889 // IncrDataStreamInPorts() ;
890 GraphBase::InDataStreamPort * aDataStreamPort ;
891 aDataStreamPort = (GraphBase::InDataStreamPort * ) GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
899 aDataStreamPort->Dependency( aDependency ) ;
900 if ( aDependency == SALOME_ModuleCatalog::DATASTREAM_TEMPORAL ) {
901 aDataStreamPort->SetParams( SUPERV::TI , SUPERV::L1 , SUPERV::EXTRANULL ) ;
903 return aDataStreamPort ;
905 GraphBase::OutDataStreamPort * GraphBase::ComputingNode::AddOutDataStreamPort( const char * OutputParameterName,
906 const char * OutputParameterType,
907 const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
908 const SUPERV::KindOfPort aKindOfPort ,
910 // IncrDataStreamOutPorts() ;
911 GraphBase::OutDataStreamPort * aDataStreamPort ;
912 aDataStreamPort = (GraphBase::OutDataStreamPort * ) GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr(),
920 aDataStreamPort->Dependency( aDependency ) ;
921 return aDataStreamPort ;
925 bool GraphBase::ComputingNode::CheckLoop( GraphBase::LoopNode * aLoopNode ,
926 GraphBase::EndOfLoopNode * anEndLoopNode ,
927 string & anErrorMessage ) const {
928 cdebug_in << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , "
929 << anEndLoopNode->Name() << ") LinkedNodesSize "
930 << LinkedNodesSize() << endl;
933 if ( LinkedNodesSize() == 0 && !IsDataFlowNode() && !IsDataStreamNode() ) {
934 anErrorMessage = anErrorMessage + string( "The node " ) + string( Name() ) +
935 string( " has no linked Nodes. Loop not valid\n" ) ;
936 cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name()
937 << " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
938 << LinkedNodesSize() << " ERROR false" << endl;
941 // We check that all nodes linked to that node go to the end of LoopNode :
942 for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
943 GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
944 cdebug << i << ". " << Name() << " Linked to " << aNode->Name() << endl ;
945 if ( !aNode->IsEndLoopNode() || aNode != anEndLoopNode ) {
946 if ( !aNode->CheckLoop( aLoopNode , anEndLoopNode , anErrorMessage) ) {
947 cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name()
948 << " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
949 << LinkedNodesSize() << " ERROR false" << endl;
954 cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , "
955 << anEndLoopNode->Name() << ") LinkedNodesSize "
956 << LinkedNodesSize() << " true" << endl;
960 bool GraphBase::ComputingNode::CheckEndLoop(GraphBase::LoopNode * aLoopNode ,
961 GraphBase::EndOfLoopNode * anEndLoopNode ,
962 string & anErrorMessage ) const {
963 cdebug_in << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , "
964 << anEndLoopNode->Name() << ") LinkedFromNodesSize "
965 << LinkedFromNodesSize() << endl;
968 if ( LinkedFromNodesSize() == 0 ) {
969 anErrorMessage = anErrorMessage + string( "The node " ) + string( Name() ) +
970 string( " has no reversed linked Nodes. Loop not valid\n" ) ;
971 cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name()
972 << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
973 << LinkedFromNodesSize() << " ERROR false" << endl;
976 // We have to check that all nodes linked from that node go to the beginning of LoopNode :
977 for ( i = 0 ; i < LinkedFromNodesSize() ; i++ ) {
978 GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedFromNodes( i ) ;
979 cdebug << i << ". " << Name() << " Linked from " << aNode->Name() << endl ;
980 if ( !aNode->IsLoopNode() || aNode != aLoopNode ) {
981 if ( !aNode->CheckEndLoop( aLoopNode , anEndLoopNode , anErrorMessage ) ) {
982 cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name()
983 << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
984 << LinkedFromNodesSize() << " ERROR false" << endl;
989 cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , "
990 << anEndLoopNode->Name() << ") LinkedFromNodesSize "
991 << LinkedFromNodesSize() << " true" << endl;
995 bool GraphBase::ComputingNode::InitBranchOfSwitchDone( bool AllInit ,
996 GraphBase::EndOfSwitchNode * anEndSwitchNode ,
997 string & anErrorMessage ) {
999 bool sts = BranchOfSwitchDone( false ) ;
1000 if ( !sts && !AllInit && anEndSwitchNode != this ) {
1001 // Common Node in branchs :
1002 anErrorMessage = anErrorMessage + string( "Common Node between some SwitchBranches : " ) +
1003 string( Name() ) + string("\n" ) ;
1004 cdebug << Name() << "->ComputingNode::InitBranchOfSwitchDone ERROR false"
1009 if ( !IsGOTONode() && anEndSwitchNode != this ) {
1010 for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
1011 GraphBase::ComputingNode * aNode ;
1012 aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
1013 if ( !aNode->InitBranchOfSwitchDone( AllInit , anEndSwitchNode , anErrorMessage ) ) {
1021 bool GraphBase::ComputingNode::CheckSwitch( GraphBase::EndOfSwitchNode * anEndSwitchNode ,
1022 string & anErrorMessage ) {
1023 bool RetVal = true ;
1024 cdebug_in << Name() << "->ComputingNode::CheckSwitch( "
1025 << anEndSwitchNode->Name() << " ) " << Kind() << endl;
1026 if ( anEndSwitchNode == this ) {
1028 // if it is a SwitchNode, continue the check at the corresponding EndSwitchNode
1029 else if ( IsSwitchNode() ) {
1030 GraphBase::EndOfSwitchNode * anOtherEndSwitchNode ;
1031 anOtherEndSwitchNode = (GraphBase::EndOfSwitchNode * ) ((GraphBase::SwitchNode * ) this)->CoupledNode() ;
1032 cdebug << Name() << "->ComputingNode::CheckSwitch will Check "
1033 << anOtherEndSwitchNode->Name() << endl ;
1034 if ( !anOtherEndSwitchNode->CheckSwitch( anEndSwitchNode , anErrorMessage ) ) {
1035 cdebug_out << Name() << "->ComputingNode::CheckSwitch "
1036 << anOtherEndSwitchNode->Name() << " ERROR false" << endl;
1042 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1043 GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ;
1044 if ( !anOutPort->IsDataStream() ) {
1046 for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
1047 GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ;
1048 if ( !anInPort->IsDataStream() ) {
1049 GraphBase::ComputingNode * aNode ;
1050 aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
1051 GraphBase::LoopNode * aLoopNode = NULL ;
1052 GraphBase::EndOfLoopNode * aEndLoopNode = NULL ;
1053 if ( IsLoopNode() ) {
1054 aEndLoopNode = (GraphBase::EndOfLoopNode * ) ((GraphBase::LoopNode * ) this)->CoupledNode() ;
1055 cdebug << Name() << "->ComputingNode::CheckSwitch LoopNode " << Name() << " coupled to "
1056 << aEndLoopNode << " " << aEndLoopNode->Name() << " aNode " << aNode << endl ;
1058 else if ( IsEndLoopNode() ) {
1059 aLoopNode = (GraphBase::LoopNode * ) ((GraphBase::EndOfLoopNode * ) this)->CoupledNode() ;
1060 cdebug << Name() << "->ComputingNode::CheckSwitch EndLoopNode " << Name()
1062 << aLoopNode << " " << aLoopNode->Name() << " aNode " << aNode << endl ;
1064 if ( aNode == NULL ) {
1065 cdebug << Name() << "->ComputingNode::CheckSwitch ignore "
1066 << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
1068 else if ( aNode == anEndSwitchNode ) {
1069 if ( !((GraphBase::EndOfSwitchNode * ) aNode)->DecrEndSwitchInPortLinked( anInPort ,
1070 anErrorMessage ) ) {
1074 else if ( aNode->BranchOfSwitchDone() ) {
1075 cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
1076 << anInPort->NodeName() << "( " << anInPort->PortName() << " ) : already checked"
1079 else if ( IsLoopNode() && aNode == aEndLoopNode ) {
1080 cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
1081 << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
1083 else if ( IsEndLoopNode() && aNode == aLoopNode ) {
1084 cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
1085 << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
1087 else if ( aNode->IsGOTONode() ) {
1088 cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
1089 << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
1090 anEndSwitchNode->SetSwitchWithGOTO() ;
1093 cdebug << Name() << "->ComputingNode::CheckSwitch will Check "
1094 << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
1095 if ( !aNode->CheckSwitch( anEndSwitchNode , anErrorMessage ) ) {
1096 cdebug_out << Name() << "->ComputingNode::CheckSwitch "
1097 << anEndSwitchNode->Name() << " ERROR false" << endl;
1100 // aNode->BranchOfSwitchDone( true ) ;
1108 BranchOfSwitchDone( true ) ;
1110 cdebug_out << Name() << "->ComputingNode::CheckSwitch "
1111 << anEndSwitchNode->Name() << " RetVal " << RetVal << endl;
1115 #include <sys/time.h>
1116 #include <sys/resource.h>
1119 const long GraphBase::ComputingNode::CpuUsed() {
1120 struct rusage usage ;
1121 if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) {
1122 perror("GraphBase::CpuUsed") ;
1125 // return usage.ru_utime.__time_t tv_sec ;
1126 cdebug << "CpuUsed " << usage.ru_utime.tv_sec << " " << usage.ru_utime.tv_usec << " "
1127 << usage.ru_stime.tv_sec << " " << usage.ru_stime.tv_usec << endl ;
1128 return usage.ru_utime.tv_sec ;
1132 const GraphBase::ListOfParameters * GraphBase::ComputingNode::GetListOfParameters() const {
1133 GraphBase::ListOfParameters * aListOfParameters = new GraphBase::ListOfParameters ;
1134 if ( IsInLineNode() || IsGOTONode() ) {
1136 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1137 const InPort * anInPort = GetNodeInPort( i ) ;
1138 if ( anInPort->IsBus() ) {
1139 int size = aListOfParameters->size() ;
1140 aListOfParameters->resize( size + 1 ) ;
1141 (*aListOfParameters)[size].theInParameter.Parametername = anInPort->PortName() ;
1142 (*aListOfParameters)[size].theInParameter.Parametertype = anInPort->PortType() ;
1143 const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
1144 (*aListOfParameters)[size].theOutParameter.Parametername = anOutPort->PortName() ;
1145 (*aListOfParameters)[size].theOutParameter.Parametertype = anOutPort->PortType() ;
1149 return aListOfParameters ;
1153 bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
1154 const char * ComponentName ,
1155 const char * InterfaceName ,
1156 const char * Computer ,
1157 const char * CoupledNode ,
1158 const ListOfFuncName FuncNames ,
1159 const ListOfPythonFunctions PythonFunctions ,
1160 int XCoordinate , int YCoordinate ) const {
1161 cdebug_in << "SaveXML Node " << Name() << endl ;
1162 QDomElement node = Graph.createElement( "node" ) ;
1163 info.appendChild( node ) ;
1164 QDomElement componentname = Graph.createElement( "component-name" ) ;
1166 if ( strlen( ComponentName ) ) {
1167 // f << Tabs << "<component-name>" << ComponentName << "</component-name>"
1169 // componentname.setNodeValue( ComponentName ) ;
1170 aField = Graph.createTextNode( ComponentName ) ;
1173 // f << Tabs << "<component-name>?</component-name>" << endl ;
1174 // componentname.setNodeValue( "?" ) ;
1175 aField = Graph.createTextNode( "?" ) ;
1177 node.appendChild( componentname ) ;
1178 componentname.appendChild( aField ) ;
1180 QDomElement interfacename = Graph.createElement("interface-name") ;
1181 if ( strlen( InterfaceName ) ) {
1182 // f << Tabs << "<interface-name>" << InterfaceName << "</interface-name>"
1184 // interfacename.setAttribute("name" , InterfaceName ) ;
1185 aField = Graph.createTextNode( InterfaceName ) ;
1188 // f << Tabs << "<interface-name>?</interface-name>" << endl ;
1189 // interfacename.setAttribute("name" , "?" ) ;
1190 aField = Graph.createTextNode( "?" ) ;
1192 node.appendChild(interfacename) ;
1193 interfacename.appendChild( aField ) ;
1195 // f << Tabs << "<node-name>" << Name() << "</node-name>" << endl ;
1196 QDomElement nodename = Graph.createElement("node-name") ;
1197 aField = Graph.createTextNode( Name() ) ;
1198 node.appendChild( nodename ) ;
1199 nodename.appendChild( aField ) ;
1201 // f << Tabs << "<kind>" << (int ) Kind() << "</kind>" << endl ;
1202 QDomElement kind = Graph.createElement( "kind" ) ;
1205 // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph
1206 // JR : the bug was at line 566 : && HasDataStream() != 0 was missing
1207 if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) {
1208 aKind = aKind.setNum( SUPERV::DataFlowGraph ) ;
1211 aKind = aKind.setNum( Kind() ) ;
1213 aField = Graph.createTextNode( aKind ) ;
1214 node.appendChild( kind ) ;
1215 kind.appendChild( aField ) ;
1217 if ( IsDataStreamNode() && HasDataStream() != 0 ) {
1218 CORBA::Long Timeout ;
1219 SUPERV::KindOfDataStreamTrace DataStreamTrace ;
1220 CORBA::Double DeltaTime ;
1221 ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
1223 QDomElement timeout = Graph.createElement("streamgraph-timeout") ;
1225 aTimeout = aTimeout.setNum( Timeout ) ;
1226 aField = Graph.createTextNode( aTimeout ) ;
1227 node.appendChild( timeout ) ;
1228 timeout.appendChild( aField ) ;
1230 QDomElement datastreamtrace = Graph.createElement("streamgraph-datastreamtrace") ;
1231 QString aDataStreamTrace ;
1232 aDataStreamTrace = aDataStreamTrace.setNum( DataStreamTrace ) ;
1233 aField = Graph.createTextNode( aDataStreamTrace ) ;
1234 node.appendChild( datastreamtrace ) ;
1235 datastreamtrace.appendChild( aField ) ;
1237 QDomElement deltatime = Graph.createElement("streamgraph-deltatime") ;
1238 QString aDeltaTime ;
1239 aDeltaTime = aDeltaTime.setNum( DeltaTime ) ;
1240 aField = Graph.createTextNode( aDeltaTime ) ;
1241 node.appendChild( deltatime ) ;
1242 deltatime.appendChild( aField ) ;
1245 QDomElement couplednode = Graph.createElement("coupled-node") ;
1246 if ( IsGOTONode() || IsLoopNode() || IsEndLoopNode() ||
1247 IsSwitchNode() || IsEndSwitchNode() || IsMacroNode() ) {
1248 // f << Tabs << "<coupled-node>" << CoupledNode << "</coupled-node>"
1250 aField = Graph.createTextNode( CoupledNode ) ;
1253 // f << Tabs << "<coupled-node>?</coupled-node>" << endl ;
1254 aField = Graph.createTextNode( "?" ) ;
1256 node.appendChild(couplednode) ;
1257 couplednode.appendChild( aField ) ;
1259 // f << Tabs << "<service>" << endl ;
1260 QDomElement service = Graph.createElement("service") ;
1261 node.appendChild(service) ;
1262 QDomElement servicename = Graph.createElement("service-name") ;
1263 if ( strlen( ServiceName() ) ) {
1264 // f << Tabs << " <service-name>" << ServiceName() << "</service-name>" << endl ;
1265 aField = Graph.createTextNode( ServiceName() ) ;
1268 // f << Tabs << " <service-name>?</service-name>" << endl ;
1269 aField = Graph.createTextNode( "?" ) ;
1271 service.appendChild(servicename) ;
1272 servicename.appendChild( aField ) ;
1274 cdebug << "SaveXML " << Name() << " In(" << ServiceInParameter().length()
1275 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
1276 QDomElement inParameterlist = Graph.createElement("inParameter-list") ;
1277 service.appendChild(inParameterlist) ;
1279 GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) this ;
1280 for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
1281 const GraphBase::InPort * anInPort ;
1282 anInPort = aNode->GetInPort( ServiceInParameter()[i].Parametername ) ;
1283 if ( !anInPort->IsDataStream() ) {
1284 cdebug << "SaveXML " << i << ". " << ServiceInParameter()[i].Parametername
1285 << " InParameterPort " << anInPort->Kind() << endl ;
1286 QDomElement inParameter = Graph.createElement("inParameter") ;
1287 inParameterlist.appendChild(inParameter) ;
1288 QDomElement inParametertype = Graph.createElement("inParameter-type") ;
1289 if ( strlen( ServiceInParameter()[i].Parametertype ) ) {
1290 aField = Graph.createTextNode( strdup( ServiceInParameter()[i].Parametertype ) ) ;
1293 aField = Graph.createTextNode( "?" ) ;
1295 inParameter.appendChild(inParametertype) ;
1296 inParametertype.appendChild( aField ) ;
1297 QDomElement inParametername = Graph.createElement("inParameter-name") ;
1298 if ( strlen( ServiceInParameter()[i].Parametername ) ) {
1299 aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
1302 aField = Graph.createTextNode( "?" ) ;
1304 inParameter.appendChild(inParametername) ;
1305 inParametername.appendChild( aField ) ;
1308 QDomElement outParameterlist = Graph.createElement("outParameter-list") ;
1309 service.appendChild(outParameterlist) ;
1310 for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) {
1311 const GraphBase::OutPort * anOutPort ;
1312 anOutPort = aNode->GetOutPort( ServiceOutParameter()[i].Parametername ) ;
1313 if ( !anOutPort->IsDataStream() ) {
1314 cdebug << "SaveXML " << i << ". " << ServiceOutParameter()[i].Parametername
1315 << " OutParameterPort " << anOutPort->Kind() << endl ;
1316 QDomElement outParameter = Graph.createElement("outParameter") ;
1317 outParameterlist.appendChild(outParameter) ;
1318 QDomElement outParametertype = Graph.createElement("outParameter-type") ;
1319 if ( strlen( ServiceOutParameter()[i].Parametertype ) ) {
1320 aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
1323 aField = Graph.createTextNode( "?" ) ;
1325 outParameter.appendChild(outParametertype) ;
1326 outParametertype.appendChild( aField ) ;
1327 QDomElement outParametername = Graph.createElement("outParameter-name") ;
1328 if ( strlen( ServiceOutParameter()[i].Parametername ) ) {
1329 aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
1332 aField = Graph.createTextNode( "?" ) ;
1334 outParameter.appendChild(outParametername) ;
1335 outParametername.appendChild( aField ) ;
1339 QDomElement DataStreamlist = Graph.createElement("DataStream-list") ;
1340 node.appendChild( DataStreamlist ) ;
1341 for ( i = 0 ; i < (unsigned int ) GetNodeInPortsSize() ; i++ ) {
1342 const GraphBase::InPort * anInPort ;
1343 anInPort = aNode->GetNodeInPort( i ) ;
1344 if ( anInPort->IsDataStream() ) {
1345 cdebug << "SaveXML " << i << " " << Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
1346 << " InDataStreamPort " << anInPort->Kind() << endl ;
1347 QDomElement inParameter = Graph.createElement("inParameter") ;
1348 DataStreamlist.appendChild(inParameter) ;
1349 QDomElement inParametertype = Graph.createElement("inParameter-type") ;
1351 aType = aType.setNum( StringToDataStreamType(anInPort->PortType()) ) ;
1352 cdebug << "SaveXML " << anInPort->PortType() << " --> " << anInPort->PortType()
1353 << " " << aType << endl ;
1354 aField = Graph.createTextNode( aType ) ;
1355 inParameter.appendChild(inParametertype) ;
1356 inParametertype.appendChild( aField ) ;
1357 QDomElement inParametername = Graph.createElement("inParameter-name") ;
1358 if ( strlen( anInPort->PortName() ) ) {
1359 aField = Graph.createTextNode( strdup(anInPort->PortName()) ) ;
1362 aField = Graph.createTextNode( "?" ) ;
1364 inParameter.appendChild(inParametername) ;
1365 inParametername.appendChild( aField ) ;
1366 cdebug << "SaveXML " << anInPort->PortName() << endl ;
1367 QDomElement inParameterdependency = Graph.createElement("inParameter-dependency") ;
1368 QString aDependency ;
1369 aDependency = aDependency.setNum( anInPort->Dependency() ) ;
1370 aField = Graph.createTextNode( aDependency ) ;
1371 inParameter.appendChild(inParameterdependency) ;
1372 inParameterdependency.appendChild( aField ) ;
1373 cdebug << "SaveXML Dependency " << anInPort->Dependency() << endl ;
1374 SUPERV::KindOfSchema aKindOfSchema ;
1375 SUPERV::KindOfInterpolation aKindOfInterpolation ;
1376 SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1377 ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1378 QDomElement inParameterKindOfSchema = Graph.createElement("inParameter-schema") ;
1380 aSchema = aSchema.setNum( aKindOfSchema ) ;
1381 aField = Graph.createTextNode( aSchema ) ;
1382 inParameter.appendChild(inParameterKindOfSchema) ;
1383 inParameterKindOfSchema.appendChild( aField ) ;
1384 cdebug << "SaveXML aKindOfSchema " << aKindOfSchema << endl ;
1385 QDomElement inParameterKindOfInterpolation = Graph.createElement("inParameter-interpolation") ;
1386 QString anInterpolation ;
1387 anInterpolation = anInterpolation.setNum( aKindOfInterpolation ) ;
1388 aField = Graph.createTextNode( anInterpolation ) ;
1389 inParameter.appendChild(inParameterKindOfInterpolation) ;
1390 inParameterKindOfInterpolation.appendChild( aField ) ;
1391 cdebug << "SaveXML aKindOfInterpolation " << aKindOfInterpolation << endl ;
1392 QDomElement inParameterKindOfExtrapolation = Graph.createElement("inParameter-extrapolation") ;
1393 QString anExtrapolation ;
1394 anExtrapolation = anExtrapolation.setNum( aKindOfExtrapolation ) ;
1395 aField = Graph.createTextNode( anExtrapolation ) ;
1396 inParameter.appendChild(inParameterKindOfExtrapolation) ;
1397 inParameterKindOfExtrapolation.appendChild( aField ) ;
1398 cdebug << "SaveXML aKindOfExtrapolation " << aKindOfExtrapolation << endl ;
1401 for ( i = 0 ; i < (unsigned int ) GetNodeOutPortsSize() ; i++ ) {
1402 const GraphBase::OutPort * anOutPort ;
1403 anOutPort = aNode->GetNodeOutPort( i ) ;
1404 if ( anOutPort->IsDataStream() ) {
1405 cdebug << "SaveXML " << i << " " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
1406 << " OutDataStreamPort " << anOutPort->Kind() << endl ;
1407 QDomElement outParameter = Graph.createElement("outParameter") ;
1408 DataStreamlist.appendChild(outParameter) ;
1409 QDomElement outParametertype = Graph.createElement("outParameter-type") ;
1411 aType = aType.setNum( StringToDataStreamType(anOutPort->PortType()) ) ;
1412 cdebug << "SaveXML " << anOutPort->PortType() << " --> " << anOutPort->PortType()
1413 << " " << aType << endl ;
1414 aField = Graph.createTextNode( aType ) ;
1415 outParameter.appendChild(outParametertype) ;
1416 outParametertype.appendChild( aField ) ;
1417 QDomElement outParametername = Graph.createElement("outParameter-name") ;
1418 if ( strlen( anOutPort->PortName() ) ) {
1419 aField = Graph.createTextNode( strdup(anOutPort->PortName() ) ) ;
1422 aField = Graph.createTextNode( "?" ) ;
1424 outParameter.appendChild(outParametername) ;
1425 outParametername.appendChild( aField ) ;
1426 cdebug << "SaveXML " << anOutPort->PortName() << endl ;
1427 QDomElement outParameterdependency = Graph.createElement("outParameter-dependency") ;
1428 QString aDependency ;
1429 aDependency = aDependency.setNum( anOutPort->Dependency() ) ;
1430 aField = Graph.createTextNode( aDependency ) ;
1431 outParameter.appendChild(outParameterdependency) ;
1432 outParameterdependency.appendChild( aField ) ;
1433 cdebug << "SaveXML Dependency " << anOutPort->Dependency() << endl ;
1434 long aNumberOfValues ;
1435 aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1436 QDomElement outParameterNumberOfValues = Graph.createElement("outParameter-values") ;
1438 aValues = aValues.setNum( aNumberOfValues ) ;
1439 aField = Graph.createTextNode( aValues ) ;
1440 outParameter.appendChild(outParameterNumberOfValues) ;
1441 outParameterNumberOfValues.appendChild( aField ) ;
1442 cdebug << "SaveXML NumberOfValues " << ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() << endl ;
1445 // f << Tabs << "</Parameter-list>" << endl ;
1447 // f << Tabs << "<PyFunction-list>" << endl ;
1448 QDomElement PyFunctionlist = Graph.createElement("PyFunction-list") ;
1449 node.appendChild( PyFunctionlist ) ;
1450 for ( i = 0 ; i < PythonFunctions.size() ; i++ ) {
1451 // f << Tabs << " <PyFunction>" << endl ;
1452 QDomElement PyFunction = Graph.createElement("PyFunction") ;
1453 PyFunctionlist.appendChild( PyFunction ) ;
1455 QDomElement FuncName = Graph.createElement("FuncName") ;
1456 if ( strlen( FuncNames[i].c_str() ) ) {
1457 aField = Graph.createTextNode( FuncNames[i].c_str() ) ;
1460 aField = Graph.createTextNode( "?" ) ;
1462 PyFunction.appendChild( FuncName ) ;
1463 FuncName.appendChild( aField ) ;
1464 if ( (*PythonFunctions[i]).length() ) {
1465 for ( j = 0 ; j < (int ) (*PythonFunctions[i]).length() ; j++ ) {
1466 QDomElement PyFunc = Graph.createElement("PyFunc") ;
1467 QDomCDATASection aCDATA ;
1468 // mpv: Linux 8.0 compiler compatibility
1469 char * aCDATAChar = strdup ((*PythonFunctions[i])[j]) ;
1471 for ( i = 0 ; i < (int ) strlen( aCDATAChar ) ; i++ ) {
1472 if ( aCDATAChar[ i ] != ' ' ) {
1476 if ( i == (int ) strlen( aCDATAChar ) ) {
1477 aCDATA = Graph.createCDATASection( "?" ) ;
1480 aCDATA = Graph.createCDATASection( aCDATAChar ) ;
1482 PyFunction.appendChild( PyFunc ) ;
1483 PyFunc.appendChild( aCDATA ) ;
1487 QDomElement PyFunc = Graph.createElement("PyFunc") ;
1488 QDomCDATASection aCDATA = Graph.createCDATASection( "?" ) ;
1489 PyFunction.appendChild( PyFunc ) ;
1490 PyFunc.appendChild( aCDATA ) ;
1494 // f << Tabs << "<creation-date>" << FirstCreation() << "</creation-date>"
1496 QDomElement creationdate = Graph.createElement("creation-date") ;
1498 sprintf( fdate , "%d/%d/%d - %d:%d:%d" , FirstCreation().Day , FirstCreation().Month , FirstCreation().Year , FirstCreation().Hour , FirstCreation().Minute , FirstCreation().Second ) ;
1499 aField = Graph.createTextNode( fdate ) ;
1500 node.appendChild( creationdate ) ;
1501 creationdate.appendChild( aField ) ;
1502 // f << Tabs << "<lastmodification-date>" << LastModification()
1503 // << "</lastmodification-date>" << endl ;
1504 QDomElement lastmodificationdate = Graph.createElement("lastmodification-date") ;
1506 sprintf( ldate , "%d/%d/%d - %d:%d:%d" , LastModification().Day , LastModification().Month , LastModification().Year , LastModification().Hour , LastModification().Minute , LastModification().Second ) ;
1507 aField = Graph.createTextNode( ldate ) ;
1508 node.appendChild( lastmodificationdate ) ;
1509 lastmodificationdate.appendChild( aField ) ;
1510 // f << Tabs << "<editor-release>" << EditorRelease() << "</editor-release>"
1512 QDomElement editorrelease = Graph.createElement("editor-release") ;
1513 aField = Graph.createTextNode( EditorRelease() ) ;
1514 node.appendChild( editorrelease ) ;
1515 editorrelease.appendChild( aField ) ;
1516 QDomElement author = Graph.createElement("author") ;
1517 if ( strlen( Author() ) ) {
1518 // f << Tabs << "<author>" << Author() << "</author>" << endl ;
1519 aField = Graph.createTextNode( Author() ) ;
1522 // f << Tabs << "<author>?</author>" << endl ;
1523 aField = Graph.createTextNode( "?" ) ;
1525 node.appendChild( author ) ;
1526 author.appendChild( aField ) ;
1527 QDomElement container = Graph.createElement("container") ;
1528 if ( IsFactoryNode() && strlen( Computer) ) {
1529 // f << Tabs << "<container>" << Computer << "</container>" << endl ;
1530 aField = Graph.createTextNode( Computer ) ;
1533 // f << Tabs << "<container>?</container>" << endl ;
1534 aField = Graph.createTextNode( "?" ) ;
1536 node.appendChild( container ) ;
1537 container.appendChild( aField ) ;
1538 QDomElement comment = Graph.createElement("comment") ;
1539 if ( strlen( Comment() ) ) {
1540 // f << Tabs << "<comment>" << Comment() << "</comment>" << endl ;
1541 aField = Graph.createTextNode( Comment() ) ;
1544 // f << Tabs << "<comment>?</comment>" << endl ;
1545 aField = Graph.createTextNode( "?" ) ;
1547 node.appendChild( comment ) ;
1548 comment.appendChild( aField ) ;
1549 // f << Tabs << "<x-position>" << XCoordinate << "</x-position>" << endl ;
1550 QDomElement xposition = Graph.createElement("x-position") ;
1551 QString aXCoordinate ;
1552 aXCoordinate = aKind.setNum( XCoordinate ) ;
1553 aField = Graph.createTextNode( aXCoordinate ) ;
1554 node.appendChild( xposition ) ;
1555 xposition.appendChild( aField ) ;
1556 // f << Tabs << "<y-position>" << YCoordinate << "</y-position>" << endl ;
1557 QDomElement yposition = Graph.createElement("y-position") ;
1558 QString aYCoordinate ;
1559 aYCoordinate = aKind.setNum( YCoordinate ) ;
1560 aField = Graph.createTextNode( aYCoordinate ) ;
1561 node.appendChild( yposition ) ;
1562 yposition.appendChild( aField ) ;
1563 cdebug_out << "SaveXML Node " << Name() << endl ;
1567 bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
1568 const char * ComponentName ,
1569 const char * InterfaceName ,
1570 const char * Computer ,
1571 const GraphBase::InLineNode * aCoupledNode ,
1572 const ListOfFuncName FuncNames ,
1573 const ListOfPythonFunctions PythonFunctions ,
1574 int XCoordinate , int YCoordinate ) const {
1575 cdebug_in << "ComputingNode::SavePY " << Name() << endl ;
1576 // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph
1577 // JR : the bug was at line 927 : && HasDataStream() != 0 was missing
1578 if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) {
1579 f << " " << Name() << " = Graph( '" << Name() << "' )" << endl ;
1580 if ( GraphMacroLevel() ) {
1581 f << " " << Name() << ".SetCoupled( '"
1582 << ((GraphBase::GOTONode * ) this)->CoupledNodeName() << "' )" << endl ;
1585 else if ( IsDataStreamNode() && HasDataStream() != 0 ) {
1586 f << " " << Name() << " = StreamGraph( '" << Name() << "' )" << endl ;
1587 CORBA::Long Timeout ;
1588 SUPERV::KindOfDataStreamTrace DataStreamTrace ;
1589 CORBA::Double DeltaTime ;
1590 ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
1591 f << " " << aGraphName << ".SetStreamParams( " << Timeout << " , SUPERV." << DataStreamTrace
1592 << " , " << DeltaTime << " )" << endl ;
1594 else if ( IsComputingNode() ) {
1596 f << " " << Name() << "_ServiceinParameter = []" << endl ;
1597 for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
1598 f << " " << Name() << "_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
1599 << ServiceInParameter()[i].Parametertype << "' , '"
1600 << ServiceInParameter()[i].Parametername << "' ) )" << endl ;
1602 f << " " << Name() << "_ServiceoutParameter = []" << endl ;
1603 for ( i = 0 ; i < (int ) ServiceOutParameter().length() ; i++ ) {
1604 f << " " << Name() << "_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
1605 << ServiceOutParameter()[i].Parametertype << "' , '"
1606 << ServiceOutParameter()[i].Parametername << "' ) )" << endl ;
1608 f << " " << Name() << "_ServiceinStreamParameter = []" << endl ;
1609 for ( i = 0 ; i < (int ) ServiceInStreamParameter().length() ; i++ ) {
1610 f << " " << Name() << "_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( '"
1611 << ServiceInStreamParameter()[i].Parametertype << "' , '"
1612 << ServiceInStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog."
1613 << ServiceInStreamParameter()[i].Parameterdependency << " ) )" << endl ;
1615 f << " " << Name() << "_ServiceoutStreamParameter = []" << endl ;
1616 for ( i = 0 ; i < (int ) ServiceOutStreamParameter().length() ; i++ ) {
1617 f << " " << Name() << "_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( '"
1618 << ServiceOutStreamParameter()[i].Parametertype << "' , '"
1619 << ServiceOutStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog."
1620 << ServiceOutStreamParameter()[i].Parameterdependency << " ) )" << endl ;
1622 f << " " << Name() << "_Service = SALOME_ModuleCatalog.Service( '" << ServiceName()
1623 << "' , " << Name() << "_ServiceinParameter"
1624 << " , " << Name() << "_ServiceoutParameter"
1625 << " , " << Name() << "_ServiceinStreamParameter"
1626 << " , " << Name() << "_ServiceoutStreamParameter"
1627 << " , 0 , 0 )" << endl ;
1628 f << " " << Name() << " = " << aGraphName << ".CNode( " << Name() << "_Service" << " )"
1631 else if ( IsFactoryNode() ) {
1632 f << " " << Name() << " = " << aGraphName << ".FNode( '" << ComponentName
1633 << "' , '" << InterfaceName << "' , '" << ServiceName() << "' )"
1636 else if ( IsEndLoopNode() || IsEndSwitchNode() ) {
1637 // It is done with LoopNode or SwitchNode with CoupledNode()
1640 if ( !IsMacroNode() ) {
1641 f << " " << "Py" << Name() << " = []" << endl ;
1644 SUPERV::ListOfStrings aPyFunc ;
1645 if ( PythonFunctions.size() ) {
1646 aPyFunc = *PythonFunctions[0] ;
1647 for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
1648 f << " " << "Py" << Name() << ".append( '" << protectQuotes(aPyFunc[i].in()) << "' )" << endl;
1651 if ( IsInLineNode() ) {
1652 f << " " << Name() << " = " << aGraphName << ".INode( '" << FuncNames[0].c_str() << "' , Py"
1653 << Name() << " )" << endl ;
1655 else if ( IsGOTONode() ) {
1656 if ( aCoupledNode ) {
1657 f << " " << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
1658 << Name() << " , '" << aCoupledNode->Name() << "' )" << endl ;
1661 f << " " << Name() << " = " << aGraphName << ".GNode( '" << FuncNames[0].c_str() << "' , Py"
1662 << Name() << " , '' )" << endl ;
1665 else if ( IsMacroNode() ) {
1666 if ( aCoupledNode ) {
1667 f << " " << aCoupledNode->Name() << " = Def" << aCoupledNode->Name() << "()" << endl ;
1668 f << " " << Name() << " = " << aGraphName << ".GraphMNode( " << aCoupledNode->Name() << " )" << endl ;
1671 f << " " << Name() << " = " << aGraphName << ".GraphMNode( ? )" << endl ;
1673 f << " " << Name() << ".SetCoupled( '" << aCoupledNode->Name() << "' )" << endl ;
1676 // char * EndName = NULL ;
1677 // EndName = new char[ 3 + strlen( Name() ) + 1 ] ;
1678 // strcpy( EndName , "End" ) ;
1679 // strcat( EndName , Name() ) ;
1680 char * EndName = aCoupledNode->Name() ;
1681 cdebug << "ComputingNode::SavePY Node " << Name() << " EndName " << EndName
1683 if ( IsLoopNode() ) {
1685 SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ;
1686 SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ;
1687 f << " " << "PyMore" << Name() << " = []" << endl ;
1689 for ( i = 0 ; i < (int ) aPyMore.length() ; i++ ) {
1690 f << " " << "PyMore" << Name() << ".append( '"
1691 << protectQuotes(aPyMore[i].in()) << "' )" << endl;
1693 f << " " << "PyNext" << Name() << " = []" << endl ;
1694 for ( i = 0 ; i < (int ) aPyNext.length() ; i++ ) {
1695 f << " " << "PyNext" << Name() << ".append( '"
1696 << protectQuotes(aPyNext[i].in()) << "' )" << endl ;
1698 f << " " << Name() << "," << EndName << " = " << aGraphName << ".LNode( '"
1699 << FuncNames[0].c_str() << "' , Py" << Name() << " , '"
1700 << FuncNames[1].c_str() << "' , PyMore" << Name()
1701 << " , '" << FuncNames[2].c_str() << "' , PyNext"
1702 << Name() << " )" << endl ;
1703 f << " " << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
1704 f << " " << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
1705 f << " " << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
1706 f << " " << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
1707 << aCoupledNode->YCoordinate() << " )" << endl ;
1708 SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
1709 f << " " << "Py" << aCoupledNode->Name() << " = []" << endl ;
1710 for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
1711 f << " " << "Py" << aCoupledNode->Name() << ".append( '"
1712 << protectQuotes(aPyFunc[i].in()) << "' )" << endl;
1714 f << " " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
1715 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1716 const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1717 cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
1718 << " " << anInPort->Kind() << endl ;
1719 if ( anInPort->IsLoop() ) {
1720 f << " " << "I" << Name() << anInPort->PortName() << " = "
1721 << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1723 else if ( anInPort->IsInLine() ) {
1724 f << " " << "I" << Name() << anInPort->PortName() << " = "
1725 << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
1726 << anInPort->PortType() << "' )" << endl ;
1728 else if ( anInPort->IsDataStream() ) {
1729 f << " " << "I" << Name() << anInPort->PortName() << " = " << Name()
1730 << ".InStreamPort( '" << anInPort->PortName() << "' , '" << anInPort->PortType()
1731 << "' , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
1732 SUPERV::KindOfSchema aKindOfSchema ;
1733 SUPERV::KindOfInterpolation aKindOfInterpolation ;
1734 SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1735 ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1736 f << " " << "I" << Name() << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1737 << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1739 else if ( anInPort->IsGate() ) {
1740 f << " " << "I" << Name() << anInPort->PortName() << " = "
1741 << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1744 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1745 const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1746 cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
1747 << " " << anOutPort->Kind() << endl ;
1748 if ( anOutPort->IsInLine() || anOutPort->IsLoop() ) {
1749 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1750 << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1752 else if ( anOutPort->IsDataStream() ) {
1753 f << " " << "O" << Name() << anOutPort->PortName() << " = " << Name()
1754 << ".OutStreamPort( '" << anOutPort->PortName()
1755 << "' , '" << anOutPort->PortType()
1756 << "' , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
1757 long aNumberOfValues ;
1758 aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1759 f << " " << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
1762 //JR 02.09.2005 : GetOutPort for Gates was missing
1763 else if ( anOutPort->IsGate() ) {
1764 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1765 << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1768 for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
1769 const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
1770 cdebug << "Node " << aCoupledNode->Name() << " InPort " << anInPort->PortName()
1771 << " " << anInPort->Kind() << endl ;
1772 if ( anInPort->IsInLine() || anInPort->IsLoop() || anInPort->IsGate() ) {
1773 f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
1774 << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1776 else if ( anInPort->IsDataStream() ) {
1777 f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
1778 << ".InStreamPort( '" << anInPort->PortName()
1779 << "' , '" << anInPort->PortType()
1780 << "' , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
1781 SUPERV::KindOfSchema aKindOfSchema ;
1782 SUPERV::KindOfInterpolation aKindOfInterpolation ;
1783 SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1784 ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1785 f << " " << "I" << EndName << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1786 << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1789 for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) {
1790 const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ;
1791 cdebug << "Node " << aCoupledNode->Name() << " OutPort " << anOutPort->PortName()
1792 << " " << anOutPort->Kind() << endl ;
1793 if ( anOutPort->IsInLine() || anOutPort->IsLoop() || anOutPort->IsGate() ) {
1794 f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1795 << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1797 else if ( anOutPort->IsDataStream() ) {
1798 f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1799 << ".OutStreamPort( '" << anOutPort->PortName()
1800 << "' , '" << anOutPort->PortType()
1801 << "' , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
1802 long aNumberOfValues ;
1803 aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1804 f << " " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
1809 else if ( IsSwitchNode() ) {
1810 f << " " << Name() << "," << EndName << " = " << aGraphName << ".SNode( '"
1811 << FuncNames[0].c_str() << "' , Py" << Name() << " )" << endl ;
1812 f << " " << EndName << ".SetName( '" << aCoupledNode->Name() << "' )" << endl ;
1813 f << " " << EndName << ".SetAuthor( '" << aCoupledNode->Author() << "' )" << endl ;
1814 f << " " << EndName << ".SetComment( '" << aCoupledNode->Comment() << "' )" << endl ;
1815 f << " " << EndName << ".Coords( " << aCoupledNode->XCoordinate() << " , "
1816 << aCoupledNode->YCoordinate() << " )" << endl ;
1817 SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
1818 f << " " << "Py" << aCoupledNode->Name() << " = []" << endl ;
1819 for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
1820 f << " " << "Py" << aCoupledNode->Name() << ".append( '"
1821 << protectQuotes(aPyFunc[i].in()) << "' )" << endl;
1823 f << " " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
1824 for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
1825 const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
1826 cdebug << "Node " << aCoupledNode->Name() << " InPort " << anInPort->PortName()
1827 << " " << anInPort->Kind() << endl ;
1828 // if ( anInPort->IsGate() || anInPort->IsEndSwitch() ) {
1829 if ( anInPort->IsGate() ) {
1830 f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
1831 << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1833 else if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
1834 f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
1835 << ".InPort( '" << anInPort->PortName()
1836 << "' , '" << anInPort->PortType() << "' )" << endl ;
1838 else if ( anInPort->IsDataStream() ) {
1839 f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
1840 << ".InStreamPort( '" << anInPort->PortName()
1841 << "' , '" << anInPort->PortType()
1842 << "' , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
1843 SUPERV::KindOfSchema aKindOfSchema ;
1844 SUPERV::KindOfInterpolation aKindOfInterpolation ;
1845 SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1846 ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1847 f << " " << "I" << EndName << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1848 << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1851 for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) {
1852 const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ;
1853 cdebug << "Node " << aCoupledNode->Name() << " OutPort " << anOutPort->PortName()
1854 << " " << anOutPort->Kind() << endl ;
1855 // if ( anOutPort->IsGate() || anOutPort->IsEndSwitch() ) {
1856 if ( anOutPort->IsGate() ) {
1857 f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1858 << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1860 else if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
1861 f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1862 << ".OutPort( '" << anOutPort->PortName()
1863 << "' , '" << anOutPort->PortType() << "' )" << endl ;
1865 else if ( anOutPort->IsDataStream() ) {
1866 f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
1867 << ".OutStreamPort( '" << anOutPort->PortName()
1868 << "' , '" << anOutPort->PortType()
1869 << "' , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
1870 long aNumberOfValues ;
1871 aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
1872 f << " " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
1877 cdebug << "ComputingNode::SavePY Node " << Name() << " EndName " << EndName
1880 //JR 24.02.2005 Debug !!!... : I should not delete myself : what a stupid thing !
1881 // delete [] EndName ;
1885 if ( IsEndLoopNode() || IsEndSwitchNode() ) {
1886 // It is done with LoopNode or SwitchNode with CoupledNode()
1889 f << " " << Name() << ".SetName( '" << Name() << "' )" << endl ;
1890 f << " " << Name() << ".SetAuthor( '" << Author() << "' )" << endl ;
1891 if ( IsFactoryNode() ) {
1892 f << " " << Name() << ".SetContainer( '" << Computer << "' )" << endl ;
1894 f << " " << Name() << ".SetComment( '" << Comment() << "' )" << endl ;
1895 f << " " << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ;
1897 if ( IsComputingNode() || IsFactoryNode() ) {
1899 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1900 const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1901 if ( !anInPort->IsDataStream() ) {
1902 cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
1903 << " " << anInPort->Kind() << endl ;
1904 f << " " << "I" << Name() << anInPort->PortName() << " = "
1905 << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1908 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1909 const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1910 if ( !anOutPort->IsDataStream() ) {
1911 cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
1912 << " " << anOutPort->Kind() << endl ;
1913 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1914 << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1918 else if ( IsOneOfInLineNodes() && !IsLoopNode() ) {
1920 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1921 const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1922 cdebug << "ComputingNode::SavePY Node " << Name() << " InPort " << anInPort->PortName()
1923 << " " << anInPort->Kind() << endl ;
1924 // if ( anInPort->IsGate() || ( anInPort->IsInLine() && IsMacroNode() ) ) {
1925 if ( anInPort->IsGate() || IsMacroNode() ) {
1926 f << " " << "I" << Name() << anInPort->PortName() << " = "
1927 << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1929 else if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) {
1930 f << " " << "I" << Name() << anInPort->PortName() << " = "
1931 << Name() << ".InPort( '" << anInPort->PortName() << "' , '"
1932 << anInPort->PortType() << "' )" << endl ;
1935 cdebug << "Ignored " << Name() << " " << anInPort->PortName() << " " << anInPort->PortStatus() << endl ;
1936 // f << " " << "I" << Name() << anInPort->PortName() << " = "
1937 // << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ;
1940 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1941 const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1942 cdebug << "ComputingNode::SavePY Node " << Name() << " OutPort " << anOutPort->PortName()
1943 << " " << anOutPort->Kind() << endl ;
1944 // if ( anOutPort->IsGate() || ( anOutPort->IsInLine() && IsMacroNode() ) ) {
1945 if ( anOutPort->IsGate() || IsMacroNode() ) {
1946 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1947 << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1949 else if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) {
1950 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1951 << Name() << ".OutPort( '" << anOutPort->PortName()
1952 << "' , '" << anOutPort->PortType() << "' )" << endl ;
1955 cdebug << "Ignored " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortStatus() << endl ;
1956 // f << " " << "O" << Name() << anOutPort->PortName() << " = "
1957 // << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
1961 if ( !IsDataFlowNode() && !IsDataStreamNode() ) {
1963 for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
1964 const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
1965 cdebug << "Node " << Name() << " InPort " << anInPort->PortName()
1966 << " " << anInPort->Kind() << endl ;
1967 if ( anInPort->IsDataStream() ) {
1968 if ( IsOneOfInLineNodes() ) {
1969 f << " " << "I" << Name() << anInPort->PortName() << " = "
1970 << Name() << ".InStreamPort( '" << anInPort->PortName() << "' , '"
1971 << anInPort->PortType() << "' , SALOME_ModuleCatalog."
1972 << anInPort->Dependency() << " )" << endl ;
1975 f << " " << "I" << Name() << anInPort->PortName() << " = "
1976 << Name() << ".GetInStreamPort( '" << anInPort->PortName() << "' )" << endl ;
1978 SUPERV::KindOfSchema aKindOfSchema ;
1979 SUPERV::KindOfInterpolation aKindOfInterpolation ;
1980 SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
1981 ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
1982 f << " " << "I" << Name() << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV."
1983 << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ;
1986 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
1987 const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ;
1988 cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName()
1989 << " " << anOutPort->Kind() << endl ;
1990 if ( anOutPort->IsDataStream() ) {
1991 if ( IsOneOfInLineNodes() ) {
1992 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1993 << Name() << ".OutStreamPort( '" << anOutPort->PortName() << "' , '"
1994 << anOutPort->PortType() << "' , SALOME_ModuleCatalog."
1995 << anOutPort->Dependency() << " )" << endl ;
1998 f << " " << "O" << Name() << anOutPort->PortName() << " = "
1999 << Name() << ".GetOutStreamPort( '" << anOutPort->PortName() << "' )" << endl ;
2001 long aNumberOfValues ;
2002 aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
2003 f << " " << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" << endl ;
2009 cdebug_out << "ComputingNode::SavePY " ;
2010 NodeInfo( *_fdebug ) ;
2015 void GraphBase::ComputingNode::NodeInfo(ostream & s) const {
2017 ListPorts( s , true ) ;
2021 ostream & operator<< (ostream & f,const GraphBase::ComputingNode & G) {
2022 // f << "ComponentName " << G.ComponentName() << endl ;
2023 if ( G.IsComputingNode() ) {
2024 f << "NodeName " << G.Name() << endl ;
2027 f << "DataFlowName " << G.Name() << endl ;
2029 f << "Kind " << G.Kind() << endl ;
2030 f << "Service " << *G.GetService() ;
2031 f << "FirstCreation " << G.FirstCreation () << endl ;
2032 f << "LastModification " << G.LastModification() << endl ;
2033 f << "EditorRelease " << G.EditorRelease() << endl ;
2034 f << "Author " << G.Author() << endl ;
2035 // f << "Computer " << G.Computer() << endl ;
2036 f << "Comment " << G.Comment() << endl ;
2042 void GraphBase::ComputingNode::ListLinks(ostream &f ) const {
2044 for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
2045 const GraphBase::OutPort* fromPort = GetNodeOutPort( i ) ;
2046 if ( fromPort->IsPortConnected() ) {
2048 for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) {
2050 f << "FromNode " << Name() << endl ;
2052 f << " FromServiceParameterName "
2053 << fromPort->GetServicesParameter().Parametername ;
2054 const GraphBase::InPort* toPort = fromPort->InPorts( j ) ;
2055 f << " ToNode " << toPort->NodeName() ;
2056 f << " ToServiceParameterName "
2057 << toPort->GetServicesParameter().Parametername;
2059 fromPort->StringValue( f ) ;
2066 ostream & operator<< (ostream &fOut,const SUPERV::SDate &D) {
2067 // cdebug_in << "operator<< GraphEditor::Date" << endl;
2069 fOut << D.Day << "/"
2076 // cdebug_out << "operator<< GraphEditor::Date" << endl;