3 #include "DataFlowEditor_OutNode.hxx"
4 #include "DataFlowBase_EndOfLoopNode.hxx"
5 #include "DataFlowBase_EndOfSwitchNode.hxx"
7 // Implementation de la classe GraphEditor::Graph
9 GraphEditor::OutNode::OutNode() :
11 cdebug_in << "GraphEditor::OutNode::OutNode()" << endl;
17 cdebug_out << "GraphEditor::OutNode::OutNode()" << endl;
20 GraphEditor::OutNode::OutNode( CORBA::ORB_ptr ORB ,
21 SALOME_NamingService* ptrNamingService ,
22 const char *DataFlowName ,
23 const char * DebugFileName ) :
24 Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) {
25 cdebug_in << "GraphEditor::OutNode::OutNode(" ;
27 cdebug << DataFlowName ;
29 cdebug << ")" << endl;
31 _Orb = CORBA::ORB::_duplicate( ORB ) ;
36 cdebug_out << "GraphEditor::OutNode::OutNode" << endl;
39 GraphEditor::OutNode::OutNode(
41 SALOME_NamingService* ptrNamingService ,
42 const SALOME_ModuleCatalog::Service& DataFlowService ,
43 const char *DataFlowComponentName ,
44 const char *DataFlowInterfaceName ,
45 const char *DataFlowName ,
46 const SUPERV::KindOfNode DataFlowkind ,
47 const SUPERV::SDate DataFlowFirstCreation ,
48 const SUPERV::SDate DataFlowLastModification ,
49 const char * DataFlowEditorRelease ,
50 const char * DataFlowAuthor ,
51 const char * DataFlowComputer ,
52 const char * DataFlowComment ,
53 const char * DebugFileName ) :
54 Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName ,
55 DataFlowInterfaceName , DataFlowName , DataFlowkind ,
56 DataFlowFirstCreation , DataFlowLastModification ,
57 DataFlowEditorRelease , DataFlowAuthor ,
58 DataFlowComputer , DataFlowComment , DebugFileName ) {
60 _Orb = CORBA::ORB::_duplicate( ORB ) ;
67 GraphEditor::OutNode::~OutNode() {
68 // delete _DataFlowNode ;
69 // delete _DataFlowDatas ;
73 bool GraphEditor::OutNode::LoadDataFlow(
74 const GraphBase::SGraph *aDataFlow ) {
76 cdebug_in << "GraphEditor::OutNode::LoadDataFlow() " << aDataFlow->Info.theName.c_str()
78 // if ( GraphBase::Service::ServiceName() == NULL ||
79 // !strlen( GraphBase::Service::ServiceName() ) || !aConstructor ) {
81 RetVal = LoadInfo( aDataFlow->Info ) ;
87 map< string , int > aMapOfNodes ;
89 RetVal = LoadNodes( aMapOfNodes , aDataFlow->Nodes ) ;
91 RetVal = LoadLinks( aMapOfNodes , aDataFlow->Links ) ;
94 RetVal = LoadDatas( aMapOfNodes , aDataFlow->Datas ) ;
98 // cdebug << "GraphEditor::OutNode::LoadDataFlow Error. ServiceName : "
99 // << (void *) GraphBase::Service::ServiceName() << " '"
100 // << GraphBase::Service::ServiceName() << "'" << endl ;
102 cdebug_out << "GraphEditor::OutNode::LoadDataFlow" << endl;
106 bool GraphEditor::OutNode::LoadXml( const char* myFileName ) {
107 bool RetVal = false ;
108 GraphBase::SGraph aDataFlow ;
109 cdebug_in << "GraphEditor::OutNode::LoadXml() " << endl;
110 if ( myFileName == NULL ) {
114 else if ( GraphBase::Graph::LoadXml( _Orb , myFileName , aDataFlow ) ) {
115 RetVal = LoadDataFlow( &aDataFlow ) ;
117 // RetVal = Name( aDataFlow.Info.theName.c_str() ) ;
119 cdebug_out << "GraphEditor::OutNode::LoadXml" << endl;
123 bool GraphEditor::OutNode::LoadInfo(const GraphBase::SNode &aDataFlowInfo ) {
124 cdebug_in << "GraphEditor::OutNode::LoadInfo " << aDataFlowInfo.theName.c_str()
126 // MESSAGE( "GraphEditor::OutNode::LoadDataFlow" );
127 // ComponentName( aDataFlowInfo.theComponentName.c_str() ) ;
128 // InterfaceName( aDataFlowInfo.theInterfaceName.c_str() ) ;
129 Name( aDataFlowInfo.theName.c_str() ) ;
130 Kind( aDataFlowInfo.theKind ) ;
131 Service( aDataFlowInfo.theService ) ;
132 FirstCreation( aDataFlowInfo.theFirstCreation ) ;
133 LastModification( aDataFlowInfo.theLastModification ) ;
134 EditorRelease( aDataFlowInfo.theEditorRelease.c_str() ) ;
135 Author( aDataFlowInfo.theAuthor.c_str() ) ;
136 // Computer( aDataFlowInfo.theContainer.c_str() ) ;
137 Comment( aDataFlowInfo.theComment.c_str() ) ;
138 // Not in OutNode/DataFlow but in InNode/DataFlow_in_an_other_DataFlow
139 // Coordinates( aDataFlowInfo.theX , aDataFlowInfo.theY ) ;
140 cdebug_out << "GraphEditor::OutNode::LoadInfo" << endl ;
144 bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes ,
145 const GraphBase::ListOfNodes &aListOfNodes ) {
146 GraphEditor::InNode * anInNode ;
147 cdebug_in << "GraphEditor::OutNode::LoadNodes" << endl ;
149 for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
150 GraphBase::SNode aNode = aListOfNodes[ i ] ;
151 // if ( aConstructor ) {
152 // anInNode = AddNode( aNode.theService , aNode.theComponentName.c_str() ,
153 // aNode.theInterfaceName.c_str() ,
154 // aNode.theName.c_str() ,
156 // aNode.theFirstCreation , aNode.theLastModification ,
157 // aNode.theEditorRelease.c_str() ,
158 // aNode.theAuthor.c_str() , aNode.theContainer.c_str() ,
159 // aNode.theComment.c_str() ,
160 // aNode.theCoords.theX , aNode.theCoords.theY ) ;
163 const char * aNodeName = aNode.theName.c_str() ;
164 if ( aNode.theListOfFuncName.size() == 0 ) {
165 aNode.theListOfFuncName.resize( 1 ) ;
166 aNode.theListOfFuncName[ 0 ] = "" ;
167 aNode.theListOfPythonFunctions.resize( 1 ) ;
168 aNode.theListOfPythonFunctions[ 0 ] = new SUPERV::ListOfStrings() ;
170 if ( GetGraphNode( aNode.theName.c_str() ) )
172 anInNode = AddNode( aNode.theService ,
173 aNode.theListOfFuncName ,
174 aNode.theListOfPythonFunctions ,
175 aNode.theComponentName.c_str() ,
176 aNode.theInterfaceName.c_str() , aNodeName ,
178 aNode.theFirstCreation , aNode.theLastModification ,
179 aNode.theEditorRelease.c_str() ,
180 aNode.theAuthor.c_str() , aNode.theContainer.c_str() ,
181 aNode.theComment.c_str() ,
182 aNode.theCoords.theX , aNode.theCoords.theY ) ;
183 string * aNodetheName = new string( aNode.theName ) ;
184 aMapOfNodes[ *aNodetheName ] = GetGraphNodeIndex( anInNode->Name() ) ;
185 if ( anInNode->IsOneOfInLineNodes() ) {
186 anInNode->GraphEditor::InNode::InLineNode()->DefPortsOfNode(
187 _Orb , aNode.theService , anInNode->NamePtr() ,
188 anInNode->Kind() , false ,
189 anInNode->IsLoopNode() || anInNode->IsEndLoopNode() ,
190 true , true , Graph_prof_debug() , Graph_fdebug() ) ;
191 GraphBase::InLineNode * aINode = anInNode->InLineNode() ;
192 GraphBase::LoopNode * aLNode = NULL ;
193 if ( aINode->IsLoopNode() ) {
194 aLNode = anInNode->LoopNode() ;
195 aLNode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
196 *aNode.theListOfPythonFunctions[ 0 ] ) ;
197 aLNode->SetMorePythonFunction( aNode.theListOfFuncName[ 1 ].c_str() ,
198 *aNode.theListOfPythonFunctions[ 1 ] ) ;
199 aLNode->SetNextPythonFunction( aNode.theListOfFuncName[ 2 ].c_str() ,
200 *aNode.theListOfPythonFunctions[ 2 ] ) ;
202 else if ( aINode->IsInLineNode() || aINode->IsGOTONode() ||
203 aINode->IsSwitchNode() || aINode->IsEndSwitchNode() ) {
204 aINode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
205 *aNode.theListOfPythonFunctions[ 0 ] ) ;
209 if ( aNode.theListOfParameters.size() ) {
211 for ( j = 0 ; j < aNode.theListOfParameters.size() ; j++ ) {
212 if ( IsInLineNode() ) {
213 GraphBase::InPort * InputPort = anInNode->AddInPort(
214 aNode.theListOfParameters[ j ].theInParameter.Parametername ,
215 aNode.theListOfParameters[ j ].theInParameter.Parametertype ) ;
216 GraphBase::OutPort * OutputPort = anInNode->AddOutPort(
217 aNode.theListOfParameters[ j ].theOutParameter.Parametername ,
218 aNode.theListOfParameters[ j ].theOutParameter.Parametertype ) ;
219 anInNode->InOutPort( InputPort , OutputPort ) ;
224 // cout << "LoadNodes " << aNodetheName << " "
225 // << GetGraphNodeIndex( anInNode->Name() ) << endl ;
226 delete aNodetheName ;
231 for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
232 GraphBase::SNode aNode = aListOfNodes[ i ] ;
233 cdebug << "GraphEditor::OutNode::LoadNodes " << aNode.theName.c_str() << " Coupled to "
234 << aNode.theCoupledNode.c_str() << endl ;
235 anInNode = (GraphEditor::InNode * ) GetChangeGraphNode( aNode.theName.c_str() )->GetInNode() ;
236 if ( anInNode->IsOneOfGOTONodes() && strlen( aNode.theCoupledNode.c_str() ) ) {
237 GraphBase::GOTONode * aCoupledNode ;
238 aCoupledNode = (GraphBase::GOTONode * ) GetGraphNode( aNode.theName.c_str() ) ;
239 aCoupledNode->CoupledNode( (GraphBase::GOTONode * ) GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ) ;
242 cdebug_out << "GraphEditor::OutNode::LoadNodes" << endl ;
246 bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes ,
247 const GraphBase::ListOfLinks &aListOfLinks ) {
249 cdebug_in << "GraphEditor::OutNode::LoadLinks" << endl ;
250 // MESSAGE( "GraphEditor::OutNode::LoadLinks" );
252 for ( i = 0 ; i < aListOfLinks.size() ; i++ ) {
253 GraphBase::SLink aLink = aListOfLinks[ i ] ;
254 string * aLinkFromNodeName = new string( aLink.FromNodeName.c_str() ) ;
255 string * aLinkToNodeName = new string( aLink.ToNodeName.c_str() ) ;
256 RetVal = AddLink( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
257 aLink.FromServiceParameterName.c_str() ,
258 GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
259 aLink.ToServiceParameterName.c_str() ,
260 *((GraphBase::ComputingNode *) GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ))->GetOutPort( aLink.FromServiceParameterName.c_str() )->Value() ) ;
261 // aLink.aLinkValue ) ;
265 for ( j = 0 ; j < aLink.aListOfCoords.size() ; j++ ) {
266 RetVal = AddLinkCoord( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
267 aLink.FromServiceParameterName.c_str() ,
268 GetGraphNode( aMapOfNodes[ aLink.ToNodeName.c_str() ] )->Name() ,
269 aLink.ToServiceParameterName.c_str() ,
271 aLink.aListOfCoords[j].theX ,
272 aLink.aListOfCoords[j].theY ) ;
277 delete aLinkFromNodeName ;
278 delete aLinkToNodeName ;
280 cdebug_out << "GraphEditor::OutNode::LoadLinks" << endl ;
284 bool GraphEditor::OutNode::LoadDatas(map< string , int > & aMapOfNodes ,
285 const GraphBase::ListOfLinks &aListOfDatas ) {
287 cdebug_in << "GraphEditor::OutNode::LoadDatas" << endl ;
288 // MESSAGE( "GraphEditor::OutNode::LoadDatas" );
290 for ( i = 0 ; i < aListOfDatas.size() ; i++ ) {
291 GraphBase::SLink aLink = aListOfDatas[ i ] ;
292 if ( !strcmp( aLink.FromNodeName.c_str() , Name() ) ) {
293 cdebug << "GraphEditor::OutNode::LoadDatas Warning "
294 << aLink.FromNodeName.c_str()
295 << " and " << aLink.ToNodeName.c_str() << " differents from " << Name()
298 string * aLinkFromNodeName = new string( aLink.FromNodeName.c_str() ) ;
299 string * aLinkToNodeName = new string( aLink.ToNodeName.c_str() ) ;
300 // cout << "LoadDatas " << aLink.FromNodeName.c_str() << " "
301 // << aMapOfNodes[ aLinkFromNodeName->c_str() ] << endl ;
302 // cout << " " << aLink.ToNodeName.c_str() << " "
303 // << aMapOfNodes[ aLinkToNodeName->c_str() ] << endl ;
304 RetVal = GraphBase::Graph::AddInputData( GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
305 aLink.ToServiceParameterName.c_str() ,
307 delete aLinkFromNodeName ;
308 delete aLinkToNodeName ;
312 cdebug_out << "GraphEditor::OutNode::LoadDatas" << endl ;
316 bool GraphEditor::OutNode::SaveXml(const char* filename) {
318 cdebug_in << "GraphEditor::OutNode::SaveXml(" << filename << ")" << endl;
319 ofstream f(filename);
321 // test = SaveXML( f );
323 test = SaveXML( Graph );
325 QString xml = Graph.toString() ;
326 // cout << "GraphEditor::OutNode::SaveXML " << xml << endl ;
329 cdebug_out << "GraphEditor::OutNode::SaveXml" << endl;
334 bool GraphEditor::OutNode::SavePy( const char* filename ) {
336 cdebug_in << "GraphEditor::OutNode::SavePy(" << filename << ")" << endl;
337 ofstream f( filename ) ;
340 cdebug_out << "GraphEditor::OutNode::SavePy" << endl;
344 GraphBase::SGraph * GraphEditor::OutNode::GetDataFlow() {
345 GraphBase::SGraph * aDataFlow = new GraphBase::SGraph;
346 aDataFlow->Info = *GetInfo() ;
347 aDataFlow->Nodes = *GetNodes() ;
348 aDataFlow->Links = *GetLinks() ;
349 aDataFlow->Datas = *GetDatas() ;
353 void GraphEditor::OutNode::DateModification() {
354 time_t T = time(NULL);
355 struct tm * Tm = localtime(&T);
356 SUPERV::SDate aLastModificationDate ;
358 aLastModificationDate.Second = Tm->tm_sec;
359 aLastModificationDate.Minute = Tm->tm_min;
360 aLastModificationDate.Hour = Tm->tm_hour;
361 aLastModificationDate.Day = Tm->tm_mday;
362 aLastModificationDate.Month = Tm->tm_mon + 1;
363 aLastModificationDate.Year = Tm->tm_year + 1900;
364 LastModification( aLastModificationDate ) ;
367 void GraphEditor::OutNode::Coordinates( const char* NodeName ,
370 ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->Coordinates( X , Y ) ;
373 const int GraphEditor::OutNode::XCoordinate( const char* NodeName ) {
374 return ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->XCoordinate() ;
377 const int GraphEditor::OutNode::YCoordinate( const char* NodeName ) {
378 return ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->YCoordinate() ;
381 GraphEditor::InNode *GraphEditor::OutNode::AddNode(
382 const SALOME_ModuleCatalog::Service& NodeService ,
383 GraphBase::ListOfFuncName aFuncName ,
384 GraphBase::ListOfPythonFunctions aPythonFunction ,
385 const char *NodeComponentName ,
386 const char* NodeInterfaceName ,
387 const char *theNodeName ,
388 const SUPERV::KindOfNode NodeKindOfNode ,
389 const SUPERV::SDate NodeFirstCreation ,
390 const SUPERV::SDate NodeLastModification ,
391 const char * NodeEditorRelease ,
392 const char * NodeAuthor ,
393 const char * NodeComputer ,
394 const char * NodeComment ,
397 cdebug_in << "GraphEditor::OutNode::AddNode(" << NodeComponentName << " , "
398 << theNodeName << ")" << endl;
399 char * RetVal = NULLSTRING ;
400 GraphEditor::InNode *Nd = NULL ;
401 char * aNodeName = NULL ;
402 bool GeneratedName = false ;
403 if ( NodeKindOfNode == SUPERV::InLineNode ||
404 NodeKindOfNode == SUPERV::LoopNode ||
405 NodeKindOfNode == SUPERV::EndLoopNode ||
406 NodeKindOfNode == SUPERV::SwitchNode ||
407 NodeKindOfNode == SUPERV::EndSwitchNode ||
408 NodeKindOfNode == SUPERV::GOTONode ) {
409 if ( theNodeName == NULL || strlen( theNodeName ) == 0 ) {
410 if ( NodeKindOfNode == SUPERV::InLineNode ) {
411 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "InLine" ) ;
413 else if ( NodeKindOfNode == SUPERV::LoopNode ) {
414 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "Loop" ) ;
416 else if ( NodeKindOfNode == SUPERV::EndLoopNode ) {
417 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "EndLoop" ) ;
419 else if ( NodeKindOfNode == SUPERV::SwitchNode ) {
420 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "Switch" ) ;
422 else if ( NodeKindOfNode == SUPERV::EndSwitchNode ) {
423 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "EndSwitch" ) ;
425 else if ( NodeKindOfNode == SUPERV::GOTONode ) {
426 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "GOTO" ) ;
430 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = CORBA::string_dup( theNodeName ) ;
434 if ( theNodeName == NULL ) {
435 aNodeName = new char[ strlen( NodeService.ServiceName )+1 ] ;
436 strcpy( aNodeName , NodeService.ServiceName ) ;
437 if ( GetGraphNode( NodeService.ServiceName ) ) {
438 GeneratedName = true ;
439 while ( GetGraphNode( aNodeName ) ) {
441 delete [] aNodeName ;
442 int num = GetServiceNameNumber( NodeService.ServiceName ) ;
445 const char * n_instance = s.str() ;
446 int lname = strlen( NodeService.ServiceName ) + 1 +
447 strlen( n_instance ) + 1 ;
448 aNodeName = new char[lname] ;
449 strcpy( aNodeName , NodeService.ServiceName ) ;
450 strcat( aNodeName , "_" ) ;
451 strcat( aNodeName , n_instance ) ;
456 if ( GetGraphNode( theNodeName ) == NULL ) {
457 aNodeName = new char[ strlen( theNodeName )+1 ] ;
458 strcpy( aNodeName , theNodeName ) ;
461 if ( aNodeName != NULL ) {
462 Nd = new GraphEditor::InNode( _Orb , NamingService() ,
463 aFuncName , aPythonFunction , NodeService ,
464 NodeComponentName , NodeInterfaceName ,
465 aNodeName , NodeKindOfNode ,
466 NodeFirstCreation , NodeLastModification ,
467 NodeEditorRelease , NodeAuthor ,
468 NodeComputer , NodeComment , GeneratedName ,
470 Graph_prof_debug() , Graph_fdebug() ) ;
471 // MESSAGE( "GraphEditor::OutNode::AddNode " << hex << (void *) Nd << dec );
472 // if ( GraphBase::Graph::AddNode( Nd ) ) {
473 if ( GraphBase::Graph::AddNode( Nd->ComputingNode() ) ) {
475 RetVal = Nd->Name() ;
478 cdebug << "NodeName already exists." << endl ;
482 cdebug << "NodeName is NULL or already exists." << endl ;
484 // delete [] aNodeName ;
485 cdebug_out << "GraphEditor::OutNode::AddNode" << endl;
490 bool GraphEditor::OutNode::AddLinkCoord( const char* FromNodeName ,
491 const char* FromServiceParameterName ,
492 const char* ToNodeName ,
493 const char* ToServiceParameterName ,
497 GraphBase::InPort * aLink = GraphBase::Graph::GetChangeInPort( ToNodeName ,
498 ToServiceParameterName ) ;
500 if ( aLink->IsSwitch() ) {
501 return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( nXY , X , Y ) ;
504 return aLink->AddCoord( nXY , X , Y ) ;
510 bool GraphEditor::OutNode::AddLinkCoord( const char* FromNodeName ,
511 const char* FromServiceParameterName ,
512 const char* ToNodeName ,
513 const char* ToServiceParameterName ,
517 GraphBase::InPort * aLink = GraphBase::Graph::GetChangeInPort( ToNodeName ,
518 ToServiceParameterName ) ;
520 if ( aLink->IsSwitch() ) {
521 return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( index , X , Y ) ;
524 return aLink->AddCoord( index , X , Y ) ;
530 bool GraphEditor::OutNode::ChangeLinkCoord(
531 const char* FromNodeName ,
532 const char* FromServiceParameterName ,
533 const char* ToNodeName ,
534 const char* ToServiceParameterName ,
538 GraphBase::InPort * aLink = GraphBase::Graph::GetChangeInPort( ToNodeName ,
539 ToServiceParameterName ) ;
541 if ( aLink->IsSwitch() ) {
542 return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->ChangeCoord( index , X , Y ) ;
545 return aLink->ChangeCoord( index , X , Y ) ;
551 bool GraphEditor::OutNode::RemoveLinkCoord(
552 const char* FromNodeName ,
553 const char* FromServiceParameterName ,
554 const char* ToNodeName ,
555 const char* ToServiceParameterName ,
557 GraphBase::InPort * aLink = GraphBase::Graph::GetChangeInPort( ToNodeName ,
558 ToServiceParameterName ) ;
560 if ( aLink->IsSwitch() ) {
561 return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->RemoveCoord( index ) ;
564 return aLink->RemoveCoord( index ) ;
570 int GraphEditor::OutNode::GetLinkCoordSize(
571 const char* FromNodeName ,
572 const char* FromServiceParameterName ,
573 const char* ToNodeName ,
574 const char* ToServiceParameterName ) {
575 const GraphBase::InPort * aLink = GraphBase::Graph::GetInPort( ToNodeName , ToServiceParameterName ) ;
577 if ( aLink->IsSwitch() ) {
578 return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord() ;
581 return aLink->GetCoord() ;
587 bool GraphEditor::OutNode::GetLinkCoord( const char* FromNodeName ,
588 const char* FromServiceParameterName ,
589 const char* ToNodeName ,
590 const char* ToServiceParameterName ,
592 const GraphBase::InPort * aLink = GraphBase::Graph::GetInPort( ToNodeName , ToServiceParameterName ) ;
594 if ( aLink->IsSwitch() ) {
595 return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( X , Y ) ;
598 return aLink->GetCoord( X , Y ) ;
604 bool GraphEditor::OutNode::GetLinkCoord(
605 const char* FromNodeName ,
606 const char* FromServiceParameterName ,
607 const char* ToNodeName ,
608 const char* ToServiceParameterName ,
609 const int index , long &X , long &Y ) {
610 GraphBase::InPort * aLink = GraphBase::Graph::GetChangeInPort( ToNodeName ,
611 ToServiceParameterName ) ;
613 if ( aLink->IsSwitch() ) {
614 return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( index , X , Y ) ;
617 return aLink->GetCoord( index , X , Y ) ;
623 bool GraphEditor::OutNode::AddInputData( const char* ToNodeName1 ,
624 const char* ToParameterName1 ,
625 const char* ToNodeName2 ,
626 const char* ToParameterName2 ) {
627 cdebug_in << "GraphEditor::OutNode::AddInputData" << endl;
628 bool RetVal = GraphBase::Graph::AddInputData( ToNodeName1 ,
632 cdebug_out << "GraphEditor::OutNode::AddInputData" << endl;
637 bool GraphEditor::OutNode::Valid() {
641 cdebug_in << "GraphEditor::OutNode::Valid" << endl;
642 _Executable = false ;
647 cdebug << "This DataFlow is not valid." << endl ;
659 cdebug_out << "GraphEditor::OutNode::Valid" << endl;
663 bool GraphEditor::OutNode::Executable() {
665 cdebug_in << "GraphEditor::OutNode::Executable" << endl;
671 // GraphExecutor::GraphControl _GT = new GraphExecutor::GraphControl( this );
673 if ( DataServerNodes() )
676 cdebug << "This DataFlow is not executable." << endl ;
677 _Executable = false ;
680 cdebug_out << "GraphEditor::OutNode::Executable" << endl;
684 const CORBA::Any *GraphEditor::OutNode::GetInData(
685 const char * ToNodeName ,
686 const char * ToParameterName ) {
687 cdebug_in << "GraphEditor::OutNode::GetInData" << endl ;
688 const CORBA::Any * retdata = PortInData( ToNodeName , ToParameterName ) ;
689 cdebug_out << "GraphEditor::OutNode::GetInData " << ToNodeName
690 << " " << ToParameterName << endl ;
694 const CORBA::Any *GraphEditor::OutNode::GetOutData(
695 const char * FromNodeName ,
696 const char * FromParameterName ) {
697 cdebug_in << "GraphEditor::OutNode::GetOutData" << endl ;
698 const CORBA::Any * retdata = PortOutData( FromNodeName , FromParameterName ) ;
699 cdebug_out << "GraphEditor::OutNode::GetOutData " << FromNodeName
700 << " " << FromParameterName << endl ;
704 //bool GraphEditor::OutNode::LinkSaveXML( ostream &f , char *Tabs ,
705 bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & link ,
706 GraphBase::SLink aLink ,
708 QDomElement fromnodename = Graph.createElement( "fromnode-name" ) ;
710 if ( strlen( aLink.FromNodeName.c_str() ) ) {
711 // f << Tabs << "<fromnode-name>" << aLink.FromNodeName.c_str()
712 // << "</fromnode-name>" << endl ;
713 aField = Graph.createTextNode( aLink.FromNodeName.c_str() ) ;
716 // f << Tabs << "<fromnode-name>?</fromnode-name>" << endl ;
717 aField = Graph.createTextNode( "?" ) ;
719 link.appendChild( fromnodename ) ;
720 fromnodename.appendChild( aField ) ;
722 // f << Tabs << "<fromserviceparameter-name>"
723 // << aLink.FromServiceParameterName.c_str() << "</fromserviceparameter-name>"
725 QDomElement fromserviceparametername = Graph.createElement( "fromserviceparameter-name" ) ;
726 aField = Graph.createTextNode( aLink.FromServiceParameterName.c_str() ) ;
727 link.appendChild( fromserviceparametername ) ;
728 fromserviceparametername.appendChild( aField ) ;
730 QDomElement tonodename = Graph.createElement( "tonode-name" ) ;
731 if ( strlen( aLink.ToNodeName.c_str() ) ) {
732 // f << Tabs << "<tonode-name>" << aLink.ToNodeName.c_str()
733 // << "</tonode-name>" << endl ;
734 aField = Graph.createTextNode( aLink.ToNodeName.c_str() ) ;
737 // f << Tabs << "<tonode-name>?</tonode-name>" << endl ;
738 aField = Graph.createTextNode( "?" ) ;
740 link.appendChild( tonodename ) ;
741 tonodename.appendChild( aField ) ;
743 // f << Tabs << "<toserviceparameter-name>"
744 // << aLink.ToServiceParameterName.c_str() << "</toserviceparameter-name>"
746 QDomElement toserviceparametername = Graph.createElement( "toserviceparameter-name" ) ;
747 aField = Graph.createTextNode( aLink.ToServiceParameterName.c_str() ) ;
748 link.appendChild( toserviceparametername ) ;
749 toserviceparametername.appendChild( aField ) ;
752 // f << Tabs << "<data-value>" << endl ;
753 QDomElement datavalue = Graph.createElement( "data-value" ) ;
754 link.appendChild( datavalue ) ;
755 // f << Tabs << " <value-type>" << aLink.aLinkValue.type()->kind()
756 // << "</value-type>" << endl ;
757 QDomElement valuetype = Graph.createElement( "value-type" ) ;
759 aKind = aKind.setNum( aLink.aLinkValue.type()->kind() ) ;
760 aField = Graph.createTextNode( aKind ) ;
761 datavalue.appendChild( valuetype ) ;
762 valuetype.appendChild( aField ) ;
763 switch (aLink.aLinkValue.type()->kind()) {
764 case CORBA::tk_string: {
766 aLink.aLinkValue >>= retstr;
767 // f << Tabs << " <value>" << retstr << "</value>" << endl ;
768 QDomElement value = Graph.createElement( "value" ) ;
769 aField = Graph.createTextNode( retstr ) ;
770 datavalue.appendChild( value ) ;
771 value.appendChild( aField ) ;
772 // MESSAGE( "ToString( string ) " << retstr );
775 case CORBA::tk_double: {
777 aLink.aLinkValue >>= d;
778 // f << Tabs << " <value>" << d << "</value>" << endl ;
779 QDomElement value = Graph.createElement( "value" ) ;
781 aKind = aKind.setNum( d ) ;
782 aField = Graph.createTextNode( aKind ) ;
783 datavalue.appendChild( value ) ;
784 value.appendChild( aField ) ;
785 // MESSAGE( "ToString( double ) " << d );
788 case CORBA::tk_long: {
790 aLink.aLinkValue >>= l;
791 // f << Tabs << " <value>" << l << "</value>" << endl ;
792 QDomElement value = Graph.createElement( "value" ) ;
794 aKind = aKind.setNum( l ) ;
795 aField = Graph.createTextNode( aKind ) ;
796 datavalue.appendChild( value ) ;
797 value.appendChild( aField ) ;
798 // MESSAGE( "ToString( long ) " << l );
801 case CORBA::tk_objref: {
803 CORBA::Object_ptr obj ;
804 aLink.aLinkValue >>= obj ;
805 retstr = _Orb->object_to_string(obj );
806 // f << Tabs << " <value>" << retstr << "</value>" << endl ;
807 QDomElement value = Graph.createElement( "value" ) ;
808 aField = Graph.createTextNode( retstr ) ;
809 datavalue.appendChild( value ) ;
810 value.appendChild( aField ) ;
811 // MESSAGE( "ToString( object ) " << retstr );
815 // f << Tabs << " <value>?</value>" << endl ;
816 QDomElement value = Graph.createElement( "value" ) ;
817 aField = Graph.createTextNode( "?" ) ;
818 datavalue.appendChild( value ) ;
819 value.appendChild( aField ) ;
820 // MESSAGE( "Unknown CORBA::Any Type" );
824 // f << Tabs << "</data-value>" << endl ;
826 // f << Tabs << "<coord-list>" << endl ;
827 QDomElement coordlist = Graph.createElement( "coord-list" ) ;
828 link.appendChild( coordlist ) ;
831 for ( i = 0 ; i < aLink.aListOfCoords.size() ; i++ ) {
832 // f << Tabs << " <coord>" << endl ;
833 QDomElement coord = Graph.createElement( "coord" ) ;
834 coordlist.appendChild( coord ) ;
835 // f << Tabs << " <x>" << aLink.aListOfCoords[ i ].theX << "</x>" << endl ;
836 QDomElement x = Graph.createElement( "x" ) ;
838 ax = ax.setNum( aLink.aListOfCoords[ i ].theX ) ;
839 aField = Graph.createTextNode( ax ) ;
840 coord.appendChild( x ) ;
841 x.appendChild( aField ) ;
842 // f << Tabs << " <y>" << aLink.aListOfCoords[ i ].theY << "</y>" << endl ;
843 QDomElement y = Graph.createElement( "y" ) ;
845 ay = ay.setNum( aLink.aListOfCoords[ i ].theY ) ;
846 aField = Graph.createTextNode( ay ) ;
847 coord.appendChild( y ) ;
848 y.appendChild( aField ) ;
849 // f << Tabs << " </coord>" << endl ;
851 // f << Tabs << "</coord-list>" << endl ;
855 bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName ,
856 GraphBase::SLink aLink ,
857 bool intervar , bool wdata ) const {
860 f << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str()
862 << aLink.FromNodeName.c_str() << ".Port( '"
863 << aLink.FromServiceParameterName.c_str()
866 f << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str()
867 << " = " << aGraphName << ".Link( " << aLink.FromNodeName.c_str()
868 << aLink.FromServiceParameterName.c_str() << " , "
869 << aLink.ToNodeName.c_str() << ".Port( '"
870 << aLink.ToServiceParameterName.c_str() << "' ) )" << endl ;
873 f << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str()
874 << " = " << aLink.ToNodeName.c_str() << ".Input( '"
875 << aLink.ToServiceParameterName.c_str() << "' , " ;
876 switch (aLink.aLinkValue.type()->kind()) {
877 case CORBA::tk_string: {
879 aLink.aLinkValue >>= retstr;
880 f << "'" << retstr << "'" ;
883 case CORBA::tk_double: {
885 aLink.aLinkValue >>= d;
889 case CORBA::tk_long: {
891 aLink.aLinkValue >>= l;
895 case CORBA::tk_objref: {
897 CORBA::Object_ptr obj ;
898 aLink.aLinkValue >>= obj ;
899 retstr = _Orb->object_to_string(obj );
900 f << "'" << retstr << "'" ;
905 // MESSAGE( "Unknown CORBA::Any Type" );
912 for ( i = 0 ; i < aLink.aListOfCoords.size() ; i++ ) {
913 f << aLink.ToNodeName.c_str()
914 << aLink.ToServiceParameterName.c_str() << ".AddCoord( " << i+1 << " , "
915 << aLink.aListOfCoords[ i ].theX << " , "
916 << aLink.aListOfCoords[ i ].theY << " )" << endl ;
921 //bool GraphEditor::OutNode::SaveXML(ostream & f ) {
922 bool GraphEditor::OutNode::SaveXML(QDomDocument & Graph ) {
924 // f << "<?xml version='1.0' encoding='us-ascii' ?>" << endl << endl ;
925 // f << "<!-- XML Dataflow -->" << endl << endl ;
926 // f << "<!-- Dataflow information -->" << endl ;
927 QString Dataflow("Dataflow") ;
928 Graph = QDomDocument(Dataflow) ;
929 // f << "<dataflow>" << endl ;
930 QDomElement dataflow = Graph.createElement( "dataflow" ) ;
931 Graph.appendChild( dataflow ) ;
932 // f << " <info-list>" << endl ;
933 QDomElement info = Graph.createElement( "info-list" ) ;
934 dataflow.appendChild( info ) ;
936 // f << " <node>" << endl ;
938 // GraphBase::DataNode::SaveXML( f , " " , 0 , 0 ) ;
939 GraphBase::DataNode::SaveXML( Graph , info , 0 , 0 ) ;
941 // f << " </node>" << endl ;
943 // f << " </info-list>" << endl << endl ;
945 // f << " <node-list>" << endl ;
946 QDomElement nodelist = Graph.createElement( "node-list" ) ;
947 dataflow.appendChild( nodelist ) ;
948 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
949 // f << " <node>" << endl ;
950 if ( GraphNodes( i )->IsComputingNode() ) {
951 // ((GraphBase::ComputingNode *)GraphNodes( i ))->SaveXML( f ,
953 ((GraphBase::ComputingNode *)GraphNodes( i ))->SaveXML( Graph , nodelist ,
954 GraphNodes( i )->XCoordinate() ,
955 GraphNodes( i )->YCoordinate() ) ;
957 else if ( GraphNodes( i )->IsFactoryNode() ) {
958 // ((GraphBase::FactoryNode * ) GraphNodes( i ))->SaveXML( f ,
960 ((GraphBase::FactoryNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
961 GraphNodes( i )->XCoordinate() ,
962 GraphNodes( i )->YCoordinate() ) ;
964 else if ( GraphNodes( i )->IsInLineNode() ) {
965 // ((GraphBase::InLineNode * ) GraphNodes( i ))->SaveXML( f ,
967 ((GraphBase::InLineNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
968 GraphNodes( i )->XCoordinate() ,
969 GraphNodes( i )->YCoordinate() ) ;
971 else if ( GraphNodes( i )->IsGOTONode() ) {
972 // ((GraphBase::GOTONode * ) GraphNodes( i ))->SaveXML( f ,
974 ((GraphBase::GOTONode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
975 GraphNodes( i )->XCoordinate() ,
976 GraphNodes( i )->YCoordinate() ) ;
978 else if ( GraphNodes( i )->IsLoopNode() ) {
979 // ((GraphBase::LoopNode * ) GraphNodes( i ))->SaveXML( f ,
981 ((GraphBase::LoopNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
982 GraphNodes( i )->XCoordinate() ,
983 GraphNodes( i )->YCoordinate() ) ;
985 else if ( GraphNodes( i )->IsEndLoopNode() ) {
986 // ((GraphBase::EndOfLoopNode * ) GraphNodes( i ))->SaveXML( f ,
988 ((GraphBase::EndOfLoopNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
989 GraphNodes( i )->XCoordinate() ,
990 GraphNodes( i )->YCoordinate() ) ;
992 else if ( GraphNodes( i )->IsSwitchNode() ) {
993 // ((GraphBase::SwitchNode * ) GraphNodes( i ))->SaveXML( f ,
995 ((GraphBase::SwitchNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
996 GraphNodes( i )->XCoordinate() ,
997 GraphNodes( i )->YCoordinate() ) ;
999 else if ( GraphNodes( i )->IsEndSwitchNode() ) {
1000 // ((GraphBase::EndOfSwitchNode * ) GraphNodes( i ))->SaveXML( f ,
1002 ((GraphBase::EndOfSwitchNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
1003 GraphNodes( i )->XCoordinate() ,
1004 GraphNodes( i )->YCoordinate() ) ;
1006 // f << " </node>" << endl ;
1009 // f << " </node-list>" << endl << endl ;
1011 // f << " <link-list>" << endl ;
1012 QDomElement linklist = Graph.createElement( "link-list" ) ;
1013 dataflow.appendChild( linklist ) ;
1014 const GraphBase::ListOfLinks * Links = GetLinks() ;
1015 for ( i = 0 ; i < Links->size() ; i++ ) {
1016 // f << " <link>" << endl ;
1017 QDomElement link = Graph.createElement( "link" ) ;
1018 linklist.appendChild( link ) ;
1019 // LinkSaveXML( f , " " , (*Links)[ i ] , false ) ;
1020 LinkSaveXML( Graph , link , (*Links)[ i ] , false ) ;
1021 // f << " </link>" << endl ;
1023 // f << " </link-list>" << endl << endl ;
1025 // f << " <data-list>" << endl ;
1026 QDomElement datalist = Graph.createElement( "data-list" ) ;
1027 dataflow.appendChild( datalist ) ;
1028 const GraphBase::ListOfLinks * Datas = GetDatas() ;
1029 for ( i = 0 ; i < Datas->size() ; i++ ) {
1030 // f << " <data>" << endl ;
1031 QDomElement data = Graph.createElement( "data" ) ;
1032 datalist.appendChild( data ) ;
1033 // LinkSaveXML( f , " " , (*Datas)[ i ] , true ) ;
1034 LinkSaveXML( Graph , data , (*Datas)[ i ] , true ) ;
1035 // f << " </data>" << endl ;
1038 // const GraphEditor::OutNode * aDataNode = (GraphEditor::OutNode *) this ;
1039 // if ( aDataNode ) {
1041 // for ( i = 0 ; i < aDataNode->GetNodeOutPortsSize() ; i++ ) {
1042 // const GraphBase::InPort *aLink = aDataNode->GetNodeOutPort(i)->GetLink() ;
1044 // f << " <data>" << endl ;
1045 // aLink->SaveXML( f , " " ) ;
1046 // f << " </data>" << endl ;
1049 // for ( i = 0 ; i < aDataNode->GetNodeInPortsSize() ; i++ ) {
1050 // const GraphBase::InPort *aLink = aDataNode->GetNodeInPort(i)->GetLink() ;
1052 // f << " <data>" << endl ;
1053 // aLink->SaveXML( f , " " ) ;
1054 // f << " </data>" << endl ;
1061 f << " </data-list>" << endl << endl ;
1062 f << "</dataflow>" << endl ;
1068 bool GraphEditor::OutNode::SavePY( ostream & f ) {
1070 f << endl << "# Generated python file of Graph " << Name() << endl << endl ;
1072 f << "from SuperV import *" << endl ;
1074 f << "# Graph creation " << endl ;
1075 GraphBase::DataNode::SavePY( f , Name() , 0 , 0 ) ;
1077 f << endl << "# Creation of Factory Nodes" << endl ;
1078 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1079 if ( GraphNodes( i )->IsFactoryNode() ) {
1080 ((GraphBase::FactoryNode * ) GraphNodes( i ))->SavePY( f , Name() ,
1081 GraphNodes( i )->XCoordinate() ,
1082 GraphNodes( i )->YCoordinate() ) ;
1087 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1088 if ( GraphNodes( i )->IsComputingNode() ) {
1090 f << endl << "# Creation of Computing Nodes" << endl ;
1093 ((GraphBase::ComputingNode * ) GraphNodes( i ))->SavePY( f , Name() ,
1094 GraphNodes( i )->XCoordinate() ,
1095 GraphNodes( i )->YCoordinate() ) ;
1100 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1101 if ( GraphNodes( i )->IsInLineNode() ) {
1103 f << endl << "# Creation of InLine Nodes" << endl ;
1106 ((GraphBase::InLineNode * ) GraphNodes( i ))->SavePY( f , Name() ,
1107 GraphNodes( i )->XCoordinate() ,
1108 GraphNodes( i )->YCoordinate() ) ;
1113 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1114 if ( GraphNodes( i )->IsLoopNode() ) {
1116 f << endl << "# Creation of Loop Nodes" << endl ;
1119 ((GraphBase::LoopNode * ) GraphNodes( i ))->SavePY( f , Name() ,
1120 GraphNodes( i )->XCoordinate() ,
1121 GraphNodes( i )->YCoordinate() ) ;
1126 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1127 if ( GraphNodes( i )->IsSwitchNode() ) {
1129 f << endl << "# Creation of Switch Nodes" << endl ;
1132 ((GraphBase::SwitchNode * ) GraphNodes( i ))->SavePY( f , Name() ,
1133 GraphNodes( i )->XCoordinate() ,
1134 GraphNodes( i )->YCoordinate() ) ;
1139 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1140 if ( GraphNodes( i )->IsGOTONode() ) {
1142 f << endl << "# Creation of GOTO Nodes" << endl ;
1145 ((GraphBase::GOTONode * ) GraphNodes( i ))->SavePY( f , Name() ,
1146 GraphNodes( i )->XCoordinate() ,
1147 GraphNodes( i )->YCoordinate() ) ;
1151 const GraphBase::ListOfLinks * Links = GetLinks() ;
1153 map< string , int > aMapOfOutPorts ;
1155 for ( i = 0 ; i < Links->size() ; i++ ) {
1156 if ( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsComputingNode() &&
1157 GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsComputingNode() ) {
1160 << "# Creation of intermediate Output variables and of Computing Links"
1164 char * NodePort = new char [ strlen( (*Links)[ i ].FromNodeName.c_str() ) +
1165 strlen( (*Links)[ i ].FromServiceParameterName.c_str() ) + 1 ] ;
1166 strcpy( NodePort , (*Links)[ i ].FromNodeName.c_str() ) ;
1167 strcat( NodePort , (*Links)[ i ].FromServiceParameterName.c_str() ) ;
1168 if ( aMapOfOutPorts[ NodePort ] == 0 ) {
1169 aMapOfOutPorts[ NodePort ] = i + 1 ;
1175 LinkSavePY( f , Name() , (*Links)[ i ] , intervar , false ) ;
1176 delete [] NodePort ;
1182 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1183 if ( GraphNodes( i )->IsInLineNode() ||
1184 GraphNodes( i )->IsGOTONode() ) {
1186 for ( j = 0 ; j < GraphNodes( i )->GetNodeInPortsSize() ; j++ ) {
1187 if ( GraphNodes( i )->GetNodeInPort( j )->IsBus() ) {
1190 << "# Creation of Output variables and of Bus Ports"
1194 f << GraphNodes( i )->Name() << ".InOutPort( '"
1195 << GraphNodes( i )->GetNodeInPort( j )->PortName() << "' , '"
1196 << GraphNodes( i )->GetNodeInPort( j )->PortType() << "' , '"
1197 << GraphNodes( i )->GetNodeOutPort( GraphNodes( i )->GetNodeInPort( j )->PortIndex() )->PortName()
1199 << GraphNodes( i )->GetNodeOutPort( GraphNodes( i )->GetNodeInPort( j )->PortIndex() )->PortType()
1208 for ( i = 0 ; i < Links->size() ; i++ ) {
1209 if ( !( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsComputingNode() &&
1210 GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsComputingNode() ) &&
1211 !( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsGOTONode() &&
1212 GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsInLineNode() ) ) {
1215 << "# Creation of intermediate Output variables and of Control Links"
1219 char * NodePort = new char [ strlen( (*Links)[ i ].FromNodeName.c_str() ) +
1220 strlen( (*Links)[ i ].FromServiceParameterName.c_str() ) + 1 ] ;
1221 strcpy( NodePort , (*Links)[ i ].FromNodeName.c_str() ) ;
1222 strcat( NodePort , (*Links)[ i ].FromServiceParameterName.c_str() ) ;
1223 if ( aMapOfOutPorts[ NodePort ] == 0 ) {
1224 aMapOfOutPorts[ NodePort ] = i + 1 ;
1230 LinkSavePY( f , Name() , (*Links)[ i ] , intervar , false ) ;
1231 delete [] NodePort ;
1236 for ( i = 0 ; i < Links->size() ; i++ ) {
1237 if ( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsGOTONode() &&
1238 GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsInLineNode() ) {
1241 << "# Creation of intermediate Output variables and of Loop Links"
1245 char * NodePort = new char [ strlen( (*Links)[ i ].FromNodeName.c_str() ) +
1246 strlen( (*Links)[ i ].FromServiceParameterName.c_str() ) + 1 ] ;
1247 strcpy( NodePort , (*Links)[ i ].FromNodeName.c_str() ) ;
1248 strcat( NodePort , (*Links)[ i ].FromServiceParameterName.c_str() ) ;
1249 if ( aMapOfOutPorts[ NodePort ] == 0 ) {
1250 aMapOfOutPorts[ NodePort ] = i + 1 ;
1256 LinkSavePY( f , Name() , (*Links)[ i ] , intervar , false ) ;
1257 delete [] NodePort ;
1261 const GraphBase::ListOfLinks * Datas = GetDatas() ;
1263 for ( i = 0 ; i < Datas->size() ; i++ ) {
1265 f << endl << "# Creation of Input datas" << endl ;
1268 LinkSavePY( f , Name() , (*Datas)[ i ] , false , true ) ;
1272 const SALOME_ModuleCatalog::ListOfServicesParameter ListOfInParam = ServiceInParameter() ;
1273 for ( i = 0 ; i < ListOfInParam.length() ; i++ ) {
1274 string _aParam = CORBA::string_dup(ListOfInParam[ i ].Parametername) ;
1275 const char * aParam = _aParam.c_str() ;
1279 for ( j = 0 ; j < strlen( aParam ) ; j++ ) {
1280 if ( aParam[ j ] == '\\' ) {
1281 aNodeName = new char[ j+1 ] ;
1282 strncpy( aNodeName , aParam , j ) ;
1283 aNodeName[ j ] = '\0' ;
1284 aPortName = new char[ strlen( aParam ) - j ] ;
1285 strncpy( aPortName , &aParam[ j+1 ] , strlen( aParam ) - j ) ;
1289 if ( !GetChangeGraphNode( aNodeName )->GetInPort( aPortName )->IsDataConnected() ) {
1291 f << endl << "# Missing Input datas" << endl ;
1294 f << aNodeName << aPortName << " = " << aNodeName << ".Port( '"
1295 << aPortName << "' )" << endl ;
1297 delete [] aNodeName ;
1298 delete [] aPortName ;
1301 f << endl << "# Creation of Output variables" << endl ;
1302 const SALOME_ModuleCatalog::ListOfServicesParameter ListOfOutParam = ServiceOutParameter() ;
1303 for ( i = 0 ; i < ListOfOutParam.length() ; i++ ) {
1304 string _aParam = CORBA::string_dup(ListOfOutParam[ i ].Parametername) ;
1305 const char * aParam = _aParam.c_str() ;
1309 for ( j = 0 ; j < strlen( aParam ) ; j++ ) {
1310 if ( aParam[ j ] == '\\' ) {
1311 aNodeName = new char[ j+1 ] ;
1312 strncpy( aNodeName , aParam , j ) ;
1313 aNodeName[ j ] = '\0' ;
1314 aPortName = new char[ strlen( aParam ) - j ] ;
1315 strncpy( aPortName , &aParam[ j+1 ] , strlen( aParam ) - j ) ;
1319 f << aNodeName << aPortName << " = " << aNodeName << ".Port( '"
1320 << aPortName << "' )" << endl ;
1321 delete [] aNodeName ;
1322 delete [] aPortName ;
1329 ostrstream & operator<< (ostrstream & f,const GraphEditor::OutNode & G) {
1330 f << (GraphBase::ComputingNode ) G ;
1333 f << " Nodes : " << G.GraphNodesSize() << " node"
1334 << (G.GraphNodesSize() > 1 ? "s" : "") << endl;
1337 for ( i = 0 ; i < G.GraphNodesSize() ; i++ ) {
1339 // << hex << (void *) G.GraphNodes( i ) << dec << " "
1340 << *G.GraphNodes( i ) << endl;
1343 f << " Links : " << endl ;
1344 for ( i = 0 ; i < G.GraphNodesSize() ; i++ ) {
1345 G.GraphNodes( i )->ListLinks( f ) ;
1348 f << " Datas : " << endl ;
1351 f << "DataFlow " << G.Name() << " is " ;
1352 if ( G.IsNotValid() )
1354 f << "valid and is " ;
1355 if ( G.IsNotExecutable() )
1357 f << "executable." << endl ;
1364 ostream & operator<< (ostream &fOut,const SUPERV::SDate &D)
1366 // cdebug_in << "operator<< GraphEditor::Date" << endl;
1368 fOut << D.Day << "/"
1375 // cdebug_out << "operator<< GraphEditor::Date" << endl;