1 // SUPERV GraphEditor : contains classes that permit edition of graphs
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : DataFlowEditor_OutNode.cxx
30 #include "DataFlowEditor_DataFlow.hxx"
31 #include "DataFlowEditor_OutNode.hxx"
32 #include "DataFlowBase_EndOfLoopNode.hxx"
33 #include "DataFlowBase_EndOfSwitchNode.hxx"
35 #include "DataFlowExecutor_DataFlow.hxx"
36 extern GraphExecutor::FiniteStateMachine * theAutomaton ;
38 // Implementation de la classe GraphEditor::Graph
40 GraphEditor::OutNode::OutNode() {
42 cdebug_in << "GraphEditor::OutNode::OutNode()" << endl;
49 cdebug_out << "GraphEditor::OutNode::OutNode()" << endl;
52 GraphEditor::OutNode::OutNode( CORBA::ORB_ptr ORB ,
53 SALOME_NamingService * ptrNamingService ,
54 const char * DataFlowName ,
55 const char * DebugFileName ,
56 const SUPERV::KindOfNode aKindOfNode ) {
57 // Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) {
59 Set_prof_debug( ORB , DebugFileName ) ;
60 cdebug_in << "GraphEditor::OutNode::OutNode(" ;
62 cdebug << DataFlowName ;
64 cdebug << ")" << endl;
66 if ( aKindOfNode == SUPERV::DataFlowGraph ) {
68 // _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ;
69 _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , aKindOfNode ,
70 _prof_debug , _fdebug ) ;
72 else if ( aKindOfNode == SUPERV::DataStreamGraph ) {
73 // _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ;;
74 _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , aKindOfNode ,
75 _prof_debug , _fdebug ) ;
76 _Graph = _StreamGraph ;
78 // if ( aKindOfNode == SUPERV::DataFlowGraph || aKindOfNode == SUPERV::DataStreamGraph ) {
79 // theAutomaton->MapGraph( _Graph , _Graph->Name() ) ;
81 _Orb = CORBA::ORB::_duplicate( ORB ) ;
86 cdebug_out << "GraphEditor::OutNode::OutNode" << endl;
89 GraphEditor::OutNode::OutNode(
91 SALOME_NamingService * ptrNamingService ,
92 const SALOME_ModuleCatalog::Service& DataFlowService ,
93 const char * DataFlowComponentName ,
94 const char * DataFlowInterfaceName ,
95 const char * DataFlowName ,
96 const SUPERV::KindOfNode DataFlowkind ,
97 const SUPERV::SDate DataFlowFirstCreation ,
98 const SUPERV::SDate DataFlowLastModification ,
99 const char * DataFlowEditorRelease ,
100 const char * DataFlowAuthor ,
101 const char * DataFlowComputer ,
102 const char * DataFlowComment ,
103 const char * DebugFileName ) {
104 // Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName ,
105 // DataFlowInterfaceName , DataFlowName , DataFlowkind ,
106 // DataFlowFirstCreation , DataFlowLastModification ,
107 // DataFlowEditorRelease , DataFlowAuthor ,
108 // DataFlowComputer , DataFlowComment , DebugFileName ) {
110 Set_prof_debug( ORB , DebugFileName ) ;
112 if ( DataFlowkind == SUPERV::DataFlowGraph ) {
113 _StreamGraph = NULL ;
114 _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName ,
115 DataFlowInterfaceName , DataFlowName , DataFlowkind ,
116 DataFlowFirstCreation , DataFlowLastModification ,
117 DataFlowEditorRelease , DataFlowAuthor ,
118 DataFlowComputer , DataFlowComment ,
119 _prof_debug , _fdebug ) ;
120 // DataFlowComputer , DataFlowComment , DebugFileName ) ;
122 else if ( DataFlowkind == SUPERV::DataStreamGraph ) {
123 _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName ,
124 DataFlowInterfaceName , DataFlowName , DataFlowkind ,
125 DataFlowFirstCreation , DataFlowLastModification ,
126 DataFlowEditorRelease , DataFlowAuthor ,
127 DataFlowComputer , DataFlowComment ,
128 _prof_debug , _fdebug ) ;
129 // DataFlowComputer , DataFlowComment , DebugFileName ) ;
130 _Graph = _StreamGraph ;
132 // if ( DataFlowkind == SUPERV::DataFlowGraph || DataFlowkind == SUPERV::DataStreamGraph ) {
133 // theAutomaton->MapGraph( _Graph , _Graph->Name() ) ;
135 _Orb = CORBA::ORB::_duplicate( ORB ) ;
138 _Executable = false ;
142 GraphEditor::OutNode::~OutNode() {
143 // theAutomaton->EraseGraph( Graph->Name() ) ;
144 // delete _DataFlowNode ;
145 // delete _DataFlowDatas ;
149 bool GraphEditor::OutNode::Name( const char * aName ) {
150 bool RetVal = false ;
151 if ( !theAutomaton->GraphName( aName ) ) {
152 char * aGraphName = Graph()->Name() ;
153 RetVal = Graph()->Name( aName ) ;
155 theAutomaton->EraseGraph( aGraphName ) ;
156 theAutomaton->MapGraph( Graph() , aName ) ;
162 void GraphEditor::OutNode::Set_prof_debug( CORBA::ORB_ptr ORB ,
163 const char * DebugFileName ) {
164 _Graph_prof_debug = 0 ;
166 if ( DebugFileName ) {
167 _fdebug = new ofstream( DebugFileName );
168 SetDebug( ORB , &_Graph_prof_debug , _fdebug ) ;
169 MESSAGE( endl << "Trace redirected to file " << DebugFileName << endl)
173 bool GraphEditor::OutNode::LoadDataFlow( const GraphBase::SGraph * aDataFlow ) {
174 bool RetVal = false ;
175 cdebug_in << "GraphEditor::OutNode::LoadDataFlow() " << (*aDataFlow).Info.theName.c_str()
176 << " GraphNodesSize " << Graph()->GraphNodesSize() << endl;
178 RetVal = LoadInfo( (*aDataFlow).Info ) ;
181 else if ( Graph()->IsDataStreamNode() || (*aDataFlow).Info.theKind == SUPERV::DataFlowGraph ) {
184 cdebug << "GraphEditor::OutNode::LoadDataFlow() _Imported " << _Imported << " RetVal " << RetVal << endl;
186 map< string , int > aMapOfNodes ;
188 cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadNodes GraphNodesSize " << Graph()->GraphNodesSize() << endl;
189 RetVal = LoadNodes( aMapOfNodes , (*aDataFlow).Nodes ) ;
192 cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadLinks GraphNodesSize " << Graph()->GraphNodesSize() << endl;
193 RetVal = LoadLinks( aMapOfNodes , (*aDataFlow).Links ) ;
197 cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadDatas GraphNodesSize " << Graph()->GraphNodesSize() << endl;
198 RetVal = LoadDatas( aMapOfNodes , (*aDataFlow).Datas ) ;
200 cdebug_out << "GraphEditor::OutNode::LoadDataFlow done GraphNodesSize " << Graph()->GraphNodesSize() << endl;
204 bool GraphEditor::OutNode::LoadXml( const char* myFileName , GraphBase::ListOfSGraphs & aListOfDataFlows ) {
205 bool RetVal = false ;
206 // GraphBase::ListOfSGraphs aListOfDataFlows ;
207 if ( myFileName == NULL ) {
208 cdebug << "GraphEditor::OutNode::LoadXml() No file" << endl;
210 char * aDataFlowName = Graph()->Name() ;
211 Name( theAutomaton->GraphInstanceName( Graph()->Name() ).c_str() ) ;
212 theAutomaton->MapGraph( Graph() , Graph()->Name() ) ;
213 cdebug << "GraphEditor::OutNode::LoadXml() " << aDataFlowName << " --> " << Graph()->Name() << endl;
217 cdebug_in << "GraphEditor::OutNode::LoadXml() " << myFileName << endl;
218 RetVal = Graph()->LoadXml( _Orb , myFileName , aListOfDataFlows ) ;
219 // RetVal = LoadDataFlows( &aListOfDataFlows ) ;
220 cdebug_out << "GraphEditor::OutNode::LoadXml " << RetVal << " " << aListOfDataFlows.size()
221 << " Graphs" << endl;
227 bool GraphEditor::OutNode::LoadXml( const char* myFileName ) {
228 bool RetVal = false ;
229 GraphBase::ListOfSGraphs aListOfDataFlows ;
230 if ( myFileName == NULL ) {
231 cdebug << "GraphEditor::OutNode::LoadXml() No file" << endl;
235 else if ( Graph()->LoadXml( _Orb , myFileName , aListOfDataFlows ) ) {
236 cdebug_in << "GraphEditor::OutNode::LoadXml() " << myFileName << endl;
237 RetVal = LoadDataFlows( &aListOfDataFlows ) ;
238 cdebug_out << "GraphEditor::OutNode::LoadXml " << RetVal << endl;
244 bool GraphEditor::OutNode::LoadInfo(const GraphBase::SNode &aDataFlowInfo ) {
245 bool RetVal = false ;
246 cdebug_in << "GraphEditor::OutNode::LoadInfo " << aDataFlowInfo.theName.c_str()
248 // MESSAGE( "GraphEditor::OutNode::LoadInfo" );
249 // ComponentName( aDataFlowInfo.theComponentName.c_str() ) ;
250 // InterfaceName( aDataFlowInfo.theInterfaceName.c_str() ) ;
251 if ( Graph()->IsDataStreamNode() || aDataFlowInfo.theKind == SUPERV::DataFlowGraph ) {
252 char * aDataFlowName = Graph()->Name() ;
253 Graph()->Name( theAutomaton->GraphInstanceName( aDataFlowInfo.theName.c_str() ).c_str() ) ;
254 theAutomaton->MapGraph( Graph() , Graph()->Name() ) ;
255 cdebug << "GraphEditor::OutNode::LoadInfo " << aDataFlowName << " --> " << Graph()->Name()
256 << " aDataFlowInfo.Kind " << aDataFlowInfo.theKind << " Kind() " << Graph()->Kind() << endl ;
257 if ( Graph()->IsDataStreamNode() ) {
258 Graph()->Kind( SUPERV::DataStreamGraph ) ;
259 StreamGraph()->SetStreamParams( aDataFlowInfo.theTimeout , aDataFlowInfo.theDataStreamTrace , aDataFlowInfo.theDeltaTime ) ;
262 Graph()->Kind( SUPERV::DataFlowGraph ) ;
264 Graph()->SetService( aDataFlowInfo.theService ) ;
265 Graph()->FirstCreation( aDataFlowInfo.theFirstCreation ) ;
266 Graph()->LastModification( aDataFlowInfo.theLastModification ) ;
267 Graph()->EditorRelease( aDataFlowInfo.theEditorRelease.c_str() ) ;
268 Graph()->Author( aDataFlowInfo.theAuthor.c_str() ) ;
269 // Graph()->Computer( aDataFlowInfo.theContainer.c_str() ) ;
270 Graph()->Comment( aDataFlowInfo.theComment.c_str() ) ;
271 // Not in OutNode/DataFlow but in InNode/DataFlow_in_an_other_DataFlow
272 // Graph()->Coordinates( aDataFlowInfo.theX , aDataFlowInfo.theY ) ;
276 Graph()->Kind( aDataFlowInfo.theKind ) ;
277 cdebug << "GraphEditor::OutNode::LoadInfo aDataFlowInfo.Kind " << aDataFlowInfo.theKind
278 << " != IsDataStreamNode() " << Graph()->IsDataStreamNode() << endl ;
280 cdebug_out << "GraphEditor::OutNode::LoadInfo " << RetVal << endl ;
284 bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes ,
285 const GraphBase::ListOfSNodes &aListOfNodes ) {
286 GraphEditor::InNode * anInNode ;
287 cdebug_in << "GraphEditor::OutNode::LoadNodes " << endl ;
289 for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) {
290 GraphBase::SNode aNode = aListOfNodes[ i ] ;
291 const char * aNodeName = aNode.theName.c_str() ;
292 // cout << "GraphEditor::OutNode::LoadNodes " << aNodeName << " "
293 // << aNode.theService.ServiceinParameter.length() << " InParameters "
294 // << aNode.theService.ServiceoutParameter.length() << " OutParameters "
295 // << aNode.theListOfInDataStreams.size() << " InDataStreams "
296 // << aNode.theListOfOutDataStreams.size() << " OutDataStreams "
297 // << " _prof_debug " << _prof_debug << endl ;
298 cdebug << "GraphEditor::OutNode::LoadNodes " << aNodeName << " "
299 << aNode.theService.ServiceinParameter.length() << " InParameters "
300 << aNode.theService.ServiceoutParameter.length() << " OutParameters "
301 << aNode.theListOfInDataStreams.size() << " InDataStreams "
302 << aNode.theListOfOutDataStreams.size() << " OutDataStreams "
304 if ( aNode.theListOfFuncName.size() == 0 ) {
305 aNode.theListOfFuncName.resize( 1 ) ;
306 aNode.theListOfFuncName[ 0 ] = "" ;
307 aNode.theListOfPythonFunctions.resize( 1 ) ;
308 aNode.theListOfPythonFunctions[ 0 ] = new SUPERV::ListOfStrings() ;
310 if ( Graph()->GetGraphNode( aNode.theName.c_str() ) ) {
311 aNodeName = NULLSTRING ;
314 aNode.theService.ServiceinDataStreamParameter.length( aNode.theListOfInDataStreams.size() ) ;
315 aNode.theService.ServiceoutDataStreamParameter.length( aNode.theListOfOutDataStreams.size() ) ;
317 for ( j = 0 ; j < aNode.theListOfInDataStreams.size() ; j++ ) {
318 aNode.theService.ServiceinDataStreamParameter[ j ].Parametername = aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametername ,
319 aNode.theService.ServiceinDataStreamParameter[ j ].Parametertype = aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametertype ,
320 aNode.theService.ServiceinDataStreamParameter[ j ].Parameterdependency = aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parameterdependency ;
322 for ( j = 0 ; j < aNode.theListOfOutDataStreams.size() ; j++ ) {
323 aNode.theService.ServiceoutDataStreamParameter[ j ].Parametername = aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametername ,
324 aNode.theService.ServiceoutDataStreamParameter[ j ].Parametertype = aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametertype ,
325 aNode.theService.ServiceoutDataStreamParameter[ j ].Parameterdependency = aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parameterdependency ;
328 anInNode = AddNode( aNode.theService ,
329 aNode.theListOfFuncName ,
330 aNode.theListOfPythonFunctions ,
331 aNode.theComponentName.c_str() ,
332 aNode.theInterfaceName.c_str() , aNodeName ,
334 aNode.theFirstCreation , aNode.theLastModification ,
335 aNode.theEditorRelease.c_str() ,
336 aNode.theAuthor.c_str() , aNode.theContainer.c_str() ,
337 aNode.theComment.c_str() ,
338 aNode.theCoords.theX , aNode.theCoords.theY ) ;
339 string * aNodetheName = new string( aNode.theName ) ;
340 aMapOfNodes[ *aNodetheName ] = Graph()->GetGraphNodeIndex( anInNode->Name() ) ;
341 if ( anInNode->IsOneOfInLineNodes() || anInNode->IsMacroNode() ) {
342 anInNode->GraphEditor::InNode::InLineNode()->DefPortsOfNode(
343 _Orb , aNode.theService , anInNode->NamePtr() ,
345 _prof_debug , _fdebug ) ;
346 GraphBase::InLineNode * aINode = anInNode->InLineNode() ;
347 GraphBase::LoopNode * aLNode = NULL ;
348 if ( aINode->IsLoopNode() ) {
349 aLNode = anInNode->LoopNode() ;
350 aLNode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
351 *aNode.theListOfPythonFunctions[ 0 ] ) ;
352 aLNode->SetMorePythonFunction( aNode.theListOfFuncName[ 1 ].c_str() ,
353 *aNode.theListOfPythonFunctions[ 1 ] ) ;
354 aLNode->SetNextPythonFunction( aNode.theListOfFuncName[ 2 ].c_str() ,
355 *aNode.theListOfPythonFunctions[ 2 ] ) ;
357 else if ( aINode->IsMacroNode() || aINode->IsInLineNode() || aINode->IsGOTONode() ||
358 aINode->IsSwitchNode() || aINode->IsEndSwitchNode() ) {
359 aINode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
360 *aNode.theListOfPythonFunctions[ 0 ] ) ;
364 for ( j = 0 ; j < aNode.theListOfInDataStreams.size() ; j++ ) {
365 GraphBase::InPort * anInPort ;
366 if ( anInNode->IsOneOfInLineNodes() ) {
367 anInPort = anInNode->ComputingNode()->AddInDataStreamPort( aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametername ,
368 aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametertype ,
369 aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parameterdependency ,
370 SUPERV::DataStreamParameter ) ;
373 anInPort = anInNode->ComputingNode()->GetChangeInPort( aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametername ) ;
375 ((GraphBase::InDataStreamPort * ) anInPort)->SetParams( aNode.theListOfInDataStreams[ j ].theKindOfSchema ,
376 aNode.theListOfInDataStreams[ j ].theKindOfInterpolation ,
377 aNode.theListOfInDataStreams[ j ].theKindOfExtrapolation ) ;
379 for ( j = 0 ; j < aNode.theListOfOutDataStreams.size() ; j++ ) {
380 GraphBase::OutPort * anOutPort ;
381 if ( anInNode->IsOneOfInLineNodes() ) {
382 anOutPort = anInNode->ComputingNode()->AddOutDataStreamPort( aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametername ,
383 aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametertype ,
384 aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parameterdependency ,
385 SUPERV::DataStreamParameter ) ;
388 anOutPort = anInNode->ComputingNode()->GetChangeOutPort( aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametername ) ;
390 ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues( aNode.theListOfOutDataStreams[ j ].theNumberOfValues ) ;
392 delete aNodetheName ;
397 for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) {
398 GraphBase::SNode aNode = aListOfNodes[ i ] ;
399 cdebug << "GraphEditor::OutNode::LoadNodes " << aNode.theName.c_str() << " Coupled to "
400 << aNode.theCoupledNode.c_str() << endl ;
401 anInNode = (GraphEditor::InNode * ) Graph()->GetChangeGraphNode( aNode.theName.c_str() )->GetInNode() ;
402 if ( anInNode->IsOneOfGOTONodes() && strlen( aNode.theCoupledNode.c_str() ) ) {
403 GraphBase::GOTONode * aCoupledNode ;
404 aCoupledNode = (GraphBase::GOTONode * ) Graph()->GetGraphNode( aNode.theName.c_str() ) ;
405 GraphBase::GOTONode * aCoupledCoupledNode ;
406 aCoupledCoupledNode = (GraphBase::GOTONode * ) Graph()->GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ;
407 if ( aCoupledCoupledNode != NULL ) {
408 aCoupledNode->CoupledNode( aCoupledCoupledNode ) ;
411 aCoupledNode->CoupledNodeName( aNode.theCoupledNode.c_str() ) ;
415 cdebug_out << "GraphEditor::OutNode::LoadNodes" << endl ;
419 bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes ,
420 const GraphBase::ListOfSLinks &aListOfLinks ) {
422 cdebug_in << "GraphEditor::OutNode::LoadLinks" << endl ;
423 // MESSAGE( "GraphEditor::OutNode::LoadLinks" );
425 for ( i = 0 ; i < (int ) aListOfLinks.size() ; i++ ) {
426 GraphBase::SLink aLink = aListOfLinks[ i ] ;
427 string * aLinkFromNodeName = new string( aLink.FromNodeName.c_str() ) ;
428 string * aLinkToNodeName = new string( aLink.ToNodeName.c_str() ) ;
429 cdebug << "LoadLinks " << aLinkFromNodeName->c_str() << "( "
430 << aLink.FromServiceParameterName.c_str() << " ) --> "
431 << aLinkToNodeName->c_str() << "( "
432 << aLink.ToServiceParameterName.c_str() << " )" << endl ;
433 if ( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) &&
434 Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] ) ) {
435 // GraphBase::ComputingNode * aFromNode = (GraphBase::ComputingNode * ) Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) ;
436 // const GraphBase::OutPort * anOutPort = aFromNode->GetOutPort( aLink.FromServiceParameterName.c_str() ) ;
437 RetVal = AddLink( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
438 aLink.FromServiceParameterName.c_str() ,
439 Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
440 aLink.ToServiceParameterName.c_str() ) ;
441 // , *anOutPort->Value() ) ;
446 // aLink.aLinkValue ) ;
450 for ( j = 0 ; j < (int ) aLink.aListOfCoords.size() ; j++ ) {
451 RetVal = AddLinkCoord( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
452 aLink.FromServiceParameterName.c_str() ,
453 Graph()->GetGraphNode( aMapOfNodes[ aLink.ToNodeName.c_str() ] )->Name() ,
454 aLink.ToServiceParameterName.c_str() ,
456 aLink.aListOfCoords[j].theX ,
457 aLink.aListOfCoords[j].theY ) ;
462 delete aLinkFromNodeName ;
463 delete aLinkToNodeName ;
465 cdebug_out << "GraphEditor::OutNode::LoadLinks" << endl ;
469 bool GraphEditor::OutNode::LoadDatas(map< string , int > & aMapOfNodes ,
470 const GraphBase::ListOfSLinks &aListOfDatas ) {
472 cdebug_in << "GraphEditor::OutNode::LoadDatas" << endl ;
473 // MESSAGE( "GraphEditor::OutNode::LoadDatas" );
475 for ( i = 0 ; i < (int ) aListOfDatas.size() ; i++ ) {
476 GraphBase::SLink aLink = aListOfDatas[ i ] ;
477 cdebug << "OutNode::LoadDatas " << i << aLink.FromNodeName.c_str() << "(" << aLink.FromServiceParameterName
478 << ") --> " << aLink.ToNodeName.c_str() << "(" << aLink.ToServiceParameterName << ") CORBA::tk_xxx "
479 << aLink.aLinkValue.type()->kind() << endl ;
480 string * aLinkFromNodeName = new string( aLink.FromNodeName.c_str() ) ;
481 string * aLinkToNodeName = new string( aLink.ToNodeName.c_str() ) ;
482 // cout << "LoadDatas " << aLink.FromNodeName.c_str() << " "
483 // << aMapOfNodes[ aLinkFromNodeName->c_str() ] << endl ;
484 // cout << " " << aLink.ToNodeName.c_str() << " "
485 // << aMapOfNodes[ aLinkToNodeName->c_str() ] << endl ;
486 RetVal = Graph()->AddInputData( Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
487 aLink.ToServiceParameterName.c_str() ,
489 delete aLinkFromNodeName ;
490 delete aLinkToNodeName ;
494 cdebug_out << "GraphEditor::OutNode::LoadDatas" << endl ;
498 bool GraphEditor::OutNode::SaveXml(const char* filename) {
500 cdebug_in << "GraphEditor::OutNode::SaveXml(" << filename << ")" << endl;
501 ofstream f(filename);
503 QDomDocument DomGraph ;
504 QDomElement Domsupergraph ;
505 cdebug << "OutNode::SaveXML("<< filename << ") ---> OutNode::SaveXML( ostream & f , QDomDocument & , true "
506 << " , QDomElement & ) " << Graph()->Name() << endl ;
507 test = SaveXML( f , DomGraph , true , Domsupergraph );
508 QString xml = DomGraph.toString() ;
511 cdebug << "OutNode::SaveXML("<< filename << ") done" << endl ;
513 // QString xml = Graph.toString() ;
514 // cout << "GraphEditor::OutNode::SaveXML " << xml << endl ;
515 // f << xml << endl ;
517 cdebug_out << "GraphEditor::OutNode::SaveXml" << endl;
522 bool GraphEditor::OutNode::SavePy( const char* filename ) {
524 cdebug_in << "GraphEditor::OutNode::SavePy(" << filename << ")" << endl;
525 ofstream f( filename ) ;
527 test = SavePY( f , true );
528 f << endl << Graph()->Name() << " = Def" << Graph()->Name() << "()" << endl ;
529 cdebug_out << "GraphEditor::OutNode::SavePy" << endl;
533 GraphBase::ListOfSGraphs * GraphEditor::OutNode::GetDataFlows( GraphBase::ListOfSGraphs * aListOfDataFlows ) {
534 // GraphBase::ListOfSGraphs * aListOfDataFlows = new GraphBase::ListOfSGraphs;
535 int index = aListOfDataFlows->size() ;
536 aListOfDataFlows->resize( index + 1 ) ;
537 if ( Graph()->IsDataFlowNode() ) {
538 (*aListOfDataFlows)[ index ].Info = *Graph()->GetInfo() ;
539 (*aListOfDataFlows)[ index ].Nodes = *Graph()->GetNodes() ;
540 (*aListOfDataFlows)[ index ].Links = *Graph()->GetLinks( true ) ;
541 (*aListOfDataFlows)[ index ].Datas = *Graph()->GetDatas() ;
544 (*aListOfDataFlows)[ index ].Info = *StreamGraph()->GetInfo() ;
545 (*aListOfDataFlows)[ index ].Nodes = *StreamGraph()->GetNodes() ;
546 (*aListOfDataFlows)[ index ].Links = *StreamGraph()->GetLinks( true ) ;
547 (*aListOfDataFlows)[ index ].Datas = *StreamGraph()->GetDatas() ;
550 for ( i = 0 ; i < (int ) (*aListOfDataFlows)[ index ].Nodes.size() ; i++ ) {
551 if ( Graph()->GetGraphNode( (*aListOfDataFlows)[ index ].Nodes[i].theName.c_str() )->IsMacroNode() ) {
552 string aCoupledNode = (*aListOfDataFlows)[ index ].Nodes[i].theCoupledNode ;
553 GraphBase::Graph * aGraph = theAutomaton->MapGraph( aCoupledNode.c_str() ) ;
554 aGraph->GraphEditor()->GraphEditor::OutNode::GetDataFlows( aListOfDataFlows ) ;
557 return aListOfDataFlows ;
560 void GraphEditor::OutNode::DateModification() {
561 time_t T = time(NULL);
562 struct tm * Tm = localtime(&T);
563 SUPERV::SDate aLastModificationDate ;
565 aLastModificationDate.Second = Tm->tm_sec;
566 aLastModificationDate.Minute = Tm->tm_min;
567 aLastModificationDate.Hour = Tm->tm_hour;
568 aLastModificationDate.Day = Tm->tm_mday;
569 aLastModificationDate.Month = Tm->tm_mon + 1;
570 aLastModificationDate.Year = Tm->tm_year + 1900;
571 Graph()->LastModification( aLastModificationDate ) ;
574 void GraphEditor::OutNode::Coordinates( const char* NodeName ,
577 ((GraphEditor::InNode * ) Graph()->GetChangeGraphNode( NodeName ))->Coordinates( X , Y ) ;
580 const int GraphEditor::OutNode::XCoordinate( const char* NodeName ) {
581 return ((GraphEditor::InNode * ) Graph()->GetChangeGraphNode( NodeName ))->XCoordinate() ;
584 const int GraphEditor::OutNode::YCoordinate( const char* NodeName ) {
585 return ((GraphEditor::InNode * ) Graph()->GetChangeGraphNode( NodeName ))->YCoordinate() ;
588 GraphEditor::InNode * GraphEditor::OutNode::AddNode(
589 const SALOME_ModuleCatalog::Service& NodeService ,
590 GraphBase::ListOfFuncName aFuncName ,
591 GraphBase::ListOfPythonFunctions aPythonFunction ,
592 const char * NodeComponentName ,
593 const char * NodeInterfaceName ,
594 const char * theNodeName ,
595 const SUPERV::KindOfNode NodeKindOfNode ,
596 const SUPERV::SDate NodeFirstCreation ,
597 const SUPERV::SDate NodeLastModification ,
598 const char * NodeEditorRelease ,
599 const char * NodeAuthor ,
600 const char * NodeComputer ,
601 const char * NodeComment ,
604 cdebug_in << "GraphEditor::OutNode::AddNode( " ;
605 if ( NodeComponentName != NULLSTRING && strlen( NodeComponentName ) ) {
606 cdebug << "Component('" << NodeComponentName << "') , Node('" ;
609 cdebug << "NodeComponentName[NULL] )" << endl;
611 if ( theNodeName == NULL ) {
612 theNodeName = NULLSTRING ;
614 if ( theNodeName != NULLSTRING && strlen( theNodeName ) ) {
615 cdebug << theNodeName << "' )" ;
618 cdebug << "NodeName[NULLSTRING]' )" ;
620 cdebug << " " << NodeKindOfNode << endl ;
621 char * RetVal = NULLSTRING ;
622 GraphEditor::InNode *Nd = NULL ;
623 char * aNodeName = NULLSTRING ;
624 bool GeneratedName = false ;
625 if ( NodeKindOfNode == SUPERV::InLineNode ||
626 NodeKindOfNode == SUPERV::LoopNode ||
627 NodeKindOfNode == SUPERV::EndLoopNode ||
628 NodeKindOfNode == SUPERV::SwitchNode ||
629 NodeKindOfNode == SUPERV::EndSwitchNode ||
630 NodeKindOfNode == SUPERV::GOTONode ) {
631 if ( theNodeName == NULLSTRING || strlen( theNodeName ) == 0 ) {
632 if ( NodeKindOfNode == SUPERV::InLineNode ) {
633 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "InLine" ) ;
635 else if ( NodeKindOfNode == SUPERV::LoopNode ) {
636 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "Loop" ) ;
638 else if ( NodeKindOfNode == SUPERV::EndLoopNode ) {
639 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "EndLoop" ) ;
641 else if ( NodeKindOfNode == SUPERV::SwitchNode ) {
642 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "Switch" ) ;
644 else if ( NodeKindOfNode == SUPERV::EndSwitchNode ) {
645 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "EndSwitch" ) ;
647 else if ( NodeKindOfNode == SUPERV::GOTONode ) {
648 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "GOTO" ) ;
652 ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = CORBA::string_dup( theNodeName ) ;
654 theNodeName = NULLSTRING ;
656 if ( theNodeName == NULLSTRING || strlen( theNodeName ) == 0 || Graph()->GetGraphNode( theNodeName ) ) {
657 aNodeName = new char[ strlen( NodeService.ServiceName )+1 ] ;
658 strcpy( aNodeName , NodeService.ServiceName ) ;
659 if ( Graph()->GetGraphNode( NodeService.ServiceName ) ) {
660 GeneratedName = true ;
661 while ( Graph()->GetGraphNode( aNodeName ) ) {
663 delete [] aNodeName ;
665 int num = Graph()->GetServiceNameNumber( NodeService ) ;
667 astr << num << ends ;
668 const char * n_instance = astr.str().c_str() ;
669 int lname = strlen( NodeService.ServiceName ) + 1 +
670 strlen( n_instance ) + 1 ;
671 aNodeName = new char[lname] ;
672 strcpy( aNodeName , NodeService.ServiceName ) ;
673 strcat( aNodeName , "_" ) ;
674 strcat( aNodeName , n_instance ) ;
679 if ( Graph()->GetGraphNode( theNodeName ) == NULL ) {
680 aNodeName = new char[ strlen( theNodeName )+1 ] ;
681 strcpy( aNodeName , theNodeName ) ;
684 aNodeName = NULLSTRING ;
687 if ( aNodeName != NULLSTRING ) {
688 Nd = new GraphEditor::InNode( _Orb , Graph()->NamingService() ,
689 aFuncName , aPythonFunction , NodeService ,
690 NodeComponentName , NodeInterfaceName ,
691 aNodeName , NodeKindOfNode ,
692 NodeFirstCreation , NodeLastModification ,
693 NodeEditorRelease , NodeAuthor ,
694 NodeComputer , NodeComment , GeneratedName ,
696 _prof_debug , _fdebug ) ;
697 // MESSAGE( "GraphEditor::OutNode::AddNode " << hex << (void *) Nd << dec );
698 // if ( GraphBase::Graph::AddNode( Nd ) ) {
700 if ( Graph()->IsDataStreamNode() && ( Nd->IsComputingNode() || Nd->IsFactoryNode() ) ) {
702 for ( i = 0 ; i < NodeService.ServiceinDataStreamParameter.length() ; i++ ) {
703 GraphBase::InDataStreamPort * aDataStreamPort ;
704 aDataStreamPort = Nd->ComputingNode()->AddInDataStreamPort(
705 my_strdup( NodeService.ServiceinDataStreamParameter[i].Parametername ) ,
706 NodeService.ServiceinDataStreamParameter[i].Parametertype ,
707 NodeService.ServiceinDataStreamParameter[i].Parameterdependency ,
708 SUPERV::DataStreamParameter ) ;
710 for ( i = 0 ; i < NodeService.ServiceoutDataStreamParameter.length() ; i++ ) {
711 GraphBase::OutDataStreamPort * aDataStreamPort ;
712 aDataStreamPort = Nd->ComputingNode()->AddOutDataStreamPort(
713 my_strdup( NodeService.ServiceoutDataStreamParameter[i].Parametername ) ,
714 NodeService.ServiceoutDataStreamParameter[i].Parametertype ,
715 NodeService.ServiceoutDataStreamParameter[i].Parameterdependency ,
716 SUPERV::DataStreamParameter ) ;
720 if ( Graph()->AddNode( Nd->ComputingNode() ) ) {
722 RetVal = Nd->Name() ;
725 cdebug << "NodeName already exists." << endl ;
729 cdebug << "ERROR NodeName is NULL or already exists." << endl ;
731 // delete [] aNodeName ;
732 cdebug_out << "GraphEditor::OutNode::AddNode" << endl;
737 bool GraphEditor::OutNode::AddLinkCoord( const char* FromNodeName ,
738 const char* FromServiceParameterName ,
739 const char* ToNodeName ,
740 const char* ToServiceParameterName ,
744 GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName ,
745 ToServiceParameterName ) ;
746 // cdebug << "GraphEditor::OutNode::AddLinkCoord " << ToNodeName << "( " << ToServiceParameterName
747 // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
749 if ( anInPort->IsEndSwitch() ) {
750 // cdebug << "GraphEditor::OutNode::AddLinkCoord " << FromNodeName << "( " << FromServiceParameterName
752 return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( nXY , X , Y ) ;
755 return anInPort->AddCoord( nXY , X , Y ) ;
761 bool GraphEditor::OutNode::AddLinkCoord( const char* FromNodeName ,
762 const char* FromServiceParameterName ,
763 const char* ToNodeName ,
764 const char* ToServiceParameterName ,
768 GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName ,
769 ToServiceParameterName ) ;
770 // cdebug << "GraphEditor::OutNode::AddLinkCoord " << ToNodeName << "( " << ToServiceParameterName
771 // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
773 if ( anInPort->IsEndSwitch() ) {
774 // cdebug << "GraphEditor::OutNode::AddLinkCoord " << FromNodeName << "( " << FromServiceParameterName
776 return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( index , X , Y ) ;
779 return anInPort->AddCoord( index , X , Y ) ;
785 bool GraphEditor::OutNode::ChangeLinkCoord( const char* FromNodeName ,
786 const char* FromServiceParameterName ,
787 const char* ToNodeName ,
788 const char* ToServiceParameterName ,
792 GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName ,
793 ToServiceParameterName ) ;
794 // cdebug << "GraphEditor::OutNode::ChangeLinkCoord " << ToNodeName << "( " << ToServiceParameterName
795 // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
797 if ( anInPort->IsEndSwitch() ) {
798 // cdebug << "GraphEditor::OutNode::ChangeLinkCoord " << FromNodeName << "( " << FromServiceParameterName
800 return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->ChangeCoord( index , X , Y ) ;
803 return anInPort->ChangeCoord( index , X , Y ) ;
809 bool GraphEditor::OutNode::RemoveLinkCoord( const char* FromNodeName ,
810 const char* FromServiceParameterName ,
811 const char* ToNodeName ,
812 const char* ToServiceParameterName ,
814 GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName ,
815 ToServiceParameterName ) ;
816 // cdebug << "GraphEditor::OutNode::RemoveLinkCoord " << ToNodeName << "( " << ToServiceParameterName
817 // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
819 if ( anInPort->IsEndSwitch() ) {
820 // cdebug << "GraphEditor::OutNode::RemoveLinkCoord " << FromNodeName << "( " << FromServiceParameterName
822 return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->RemoveCoord( index ) ;
825 return anInPort->RemoveCoord( index ) ;
831 int GraphEditor::OutNode::GetLinkCoordSize( const char* FromNodeName ,
832 const char* FromServiceParameterName ,
833 const char* ToNodeName ,
834 const char* ToServiceParameterName ) {
835 const GraphBase::InPort * anInPort = Graph()->GetInPort( ToNodeName , ToServiceParameterName ) ;
836 // cdebug << "GraphEditor::OutNode::GetLinkCoordSize " << ToNodeName << "( " << ToServiceParameterName
837 // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
839 if ( anInPort->IsEndSwitch() ) {
840 // cdebug << "GraphEditor::OutNode::GetLinkCoordSize " << FromNodeName << "( " << FromServiceParameterName
842 return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord() ;
845 return anInPort->GetCoord() ;
851 bool GraphEditor::OutNode::GetLinkCoord( const char* FromNodeName ,
852 const char* FromServiceParameterName ,
853 const char* ToNodeName ,
854 const char* ToServiceParameterName ,
856 const GraphBase::InPort * anInPort = Graph()->GetInPort( ToNodeName , ToServiceParameterName ) ;
857 // cdebug << "GraphEditor::OutNode::GetLinkCoord " << ToNodeName << "( " << ToServiceParameterName
858 // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
860 if ( anInPort->IsEndSwitch() ) {
861 // cdebug << "GraphEditor::OutNode::GetLinkCoord " << FromNodeName << "( " << FromServiceParameterName
863 return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( X , Y ) ;
866 return anInPort->GetCoord( X , Y ) ;
872 bool GraphEditor::OutNode::GetLinkCoord( const char* FromNodeName ,
873 const char* FromServiceParameterName ,
874 const char* ToNodeName ,
875 const char* ToServiceParameterName ,
876 const int index , long &X , long &Y ) {
877 GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName ,
878 ToServiceParameterName ) ;
879 // cdebug << "GraphEditor::OutNode::GetLinkCoord " << ToNodeName << "( " << ToServiceParameterName
880 // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
882 if ( anInPort->IsEndSwitch() ) {
883 // cdebug << "GraphEditor::OutNode::GetLinkCoord " << FromNodeName << "( " << FromServiceParameterName
885 return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( index , X , Y ) ;
888 return anInPort->GetCoord( index , X , Y ) ;
894 bool GraphEditor::OutNode::UnValid() {
895 bool RetVal = _Valid ;
897 if ( Graph()->GraphMacroLevel() != 0 ) {
898 cdebug << "GraphEditor::OutNode::UnValid() GraphMacroLevel " << Graph()->GraphMacroLevel() << endl ;
904 bool GraphEditor::OutNode::Valid() {
908 cdebug_in << "GraphEditor::OutNode::Valid" << endl;
909 _Executable = false ;
911 if ( !Graph()->CreateService() ) {
912 cdebug_out << "GraphEditor::OutNode::Valid " << _Valid << endl;
916 if ( Graph()->GraphMacroLevel() != 0 ) {
917 cdebug << "CoupledNode " << Graph()->CoupledNode() << endl ;
918 cdebug << "GraphEditor " << Graph()->CoupledNode()->GraphEditor() << endl ;
919 cdebug << "Graph " << Graph()->CoupledNode()->GraphEditor()->Graph() << endl ;
920 cdebug << "Name " << Graph()->CoupledNode()->GraphEditor()->Graph()->Name() << endl ;
921 cdebug << "Valid --> UpdateMacroPorts of " << Graph()->CoupledNodeName() << " of "
922 << Graph()->CoupledNode()->GraphEditor()->Graph()->Name() << endl ;
923 cdebug << Graph()->CoupledNode() << endl ;
924 Graph()->CoupledNode()->UpdateMacroPorts( Graph() ) ;
925 cdebug << Graph()->CoupledNode()->Name() << " Valid --> UnValid of graph "
926 << Graph()->CoupledNode()->GraphEditor()->Graph()->Name()
927 << " GraphMacroLevel " << Graph()->CoupledNode()->GraphEditor()->Graph()->GraphMacroLevel() << endl ;
928 Graph()->CoupledNode()->GraphEditor()->UnValid() ;
931 int SubStreamGraphsNumber = 0 ;
932 if ( !Graph()->Sort( SubStreamGraphsNumber ) ) {
933 cdebug_out << "This DataFlow is not valid." << endl ;
936 if ( Graph()->IsDataStreamNode() ) {
937 StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ;
942 Graph()->InLineServices() ;
944 Graph()->ComputingNodes() ;
948 cdebug_out << "GraphEditor::OutNode::Valid " << _Valid << endl;
952 bool GraphEditor::OutNode::Executable() {
953 cdebug_in << "GraphEditor::OutNode::Executable" << endl;
955 if ( Graph()->LinkLoopNodes( NewLink ) ) {
961 cdebug << "This DataFlow is not executable." << endl ;
962 _Executable = false ;
970 if ( Graph()->DataServerNodes() )
973 cdebug << "This DataFlow is not executable." << endl ;
974 _Executable = false ;
977 if ( _Executable && Graph()->IsDataStreamNode() ) {
978 StreamGraph()->CreateStreamTopology( "/tmp/" ) ;
981 cdebug_out << "GraphEditor::OutNode::Executable" << endl;
985 const CORBA::Any *GraphEditor::OutNode::GetInData(
986 const char * ToNodeName ,
987 const char * ToParameterName ) {
988 // cdebug_in << "GraphEditor::OutNode::GetInData " << ToNodeName
989 // << " " << ToParameterName << endl ;
990 const CORBA::Any * retdata = Graph()->PortInData( ToNodeName , ToParameterName ) ;
991 // cdebug_out << "GraphEditor::OutNode::GetInData" << endl ;
995 const CORBA::Any *GraphEditor::OutNode::GetOutData(
996 const char * FromNodeName ,
997 const char * FromParameterName ) {
998 // cdebug_in << "GraphEditor::OutNode::GetOutData " << FromNodeName
999 // << " " << FromParameterName << endl ;
1000 const CORBA::Any * retdata = Graph()->PortOutData( FromNodeName , FromParameterName ) ;
1001 // cdebug_out << "GraphEditor::OutNode::GetOutData" << endl ;
1005 //bool GraphEditor::OutNode::LinkSaveXML( ostream &f , char *Tabs ,
1006 bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & link ,
1007 GraphBase::SLink aLink ,
1008 bool wdata ) const {
1009 cdebug_in << "GraphEditor::OutNode::LinkSaveXML " << aLink.FromNodeName
1010 << "(" << aLink.FromServiceParameterName << ") --> "
1011 << aLink.ToNodeName << "(" << aLink.ToServiceParameterName << ")" << endl ;
1012 QDomElement fromnodename = Graph.createElement( "fromnode-name" ) ;
1014 if ( strlen( aLink.FromNodeName.c_str() ) ) {
1015 // f << Tabs << "<fromnode-name>" << aLink.FromNodeName.c_str()
1016 // << "</fromnode-name>" << endl ;
1017 aField = Graph.createTextNode( aLink.FromNodeName.c_str() ) ;
1020 // f << Tabs << "<fromnode-name>?</fromnode-name>" << endl ;
1021 aField = Graph.createTextNode( "?" ) ;
1023 link.appendChild( fromnodename ) ;
1024 fromnodename.appendChild( aField ) ;
1026 // f << Tabs << "<fromserviceparameter-name>"
1027 // << aLink.FromServiceParameterName.c_str() << "</fromserviceparameter-name>"
1029 QDomElement fromserviceparametername = Graph.createElement( "fromserviceparameter-name" ) ;
1030 aField = Graph.createTextNode( aLink.FromServiceParameterName.c_str() ) ;
1031 link.appendChild( fromserviceparametername ) ;
1032 fromserviceparametername.appendChild( aField ) ;
1034 QDomElement tonodename = Graph.createElement( "tonode-name" ) ;
1035 if ( strlen( aLink.ToNodeName.c_str() ) ) {
1036 // f << Tabs << "<tonode-name>" << aLink.ToNodeName.c_str()
1037 // << "</tonode-name>" << endl ;
1038 aField = Graph.createTextNode( aLink.ToNodeName.c_str() ) ;
1041 // f << Tabs << "<tonode-name>?</tonode-name>" << endl ;
1042 aField = Graph.createTextNode( "?" ) ;
1044 link.appendChild( tonodename ) ;
1045 tonodename.appendChild( aField ) ;
1047 // f << Tabs << "<toserviceparameter-name>"
1048 // << aLink.ToServiceParameterName.c_str() << "</toserviceparameter-name>"
1050 QDomElement toserviceparametername = Graph.createElement( "toserviceparameter-name" ) ;
1051 aField = Graph.createTextNode( aLink.ToServiceParameterName.c_str() ) ;
1052 link.appendChild( toserviceparametername ) ;
1053 toserviceparametername.appendChild( aField ) ;
1056 // f << Tabs << "<data-value>" << endl ;
1057 QDomElement datavalue = Graph.createElement( "data-value" ) ;
1058 link.appendChild( datavalue ) ;
1059 // f << Tabs << " <value-type>" << aLink.aLinkValue.type()->kind()
1060 // << "</value-type>" << endl ;
1061 QDomElement valuetype = Graph.createElement( "value-type" ) ;
1063 aKind = aKind.setNum( aLink.aLinkValue.type()->kind() ) ;
1064 aField = Graph.createTextNode( aKind ) ;
1065 datavalue.appendChild( valuetype ) ;
1066 valuetype.appendChild( aField ) ;
1067 switch (aLink.aLinkValue.type()->kind()) {
1068 case CORBA::tk_string: {
1070 aLink.aLinkValue >>= retstr;
1071 // f << Tabs << " <value>" << retstr << "</value>" << endl ;
1072 QDomElement value = Graph.createElement( "value" ) ;
1073 aField = Graph.createTextNode( retstr ) ;
1074 datavalue.appendChild( value ) ;
1075 value.appendChild( aField ) ;
1076 // MESSAGE( "ToString( string ) " << retstr );
1079 case CORBA::tk_double: {
1081 aLink.aLinkValue >>= d;
1082 // f << Tabs << " <value>" << d << "</value>" << endl ;
1083 QDomElement value = Graph.createElement( "value" ) ;
1085 aKind = aKind.setNum( d ) ;
1086 aField = Graph.createTextNode( aKind ) ;
1087 datavalue.appendChild( value ) ;
1088 value.appendChild( aField ) ;
1089 // MESSAGE( "ToString( double ) " << d );
1092 case CORBA::tk_long: {
1094 aLink.aLinkValue >>= l;
1095 // f << Tabs << " <value>" << l << "</value>" << endl ;
1096 QDomElement value = Graph.createElement( "value" ) ;
1098 aKind = aKind.setNum( l ) ;
1099 aField = Graph.createTextNode( aKind ) ;
1100 datavalue.appendChild( value ) ;
1101 value.appendChild( aField ) ;
1102 // MESSAGE( "ToString( long ) " << l );
1105 case CORBA::tk_objref: {
1107 CORBA::Object_ptr obj ;
1108 aLink.aLinkValue >>= obj ;
1109 retstr = _Orb->object_to_string(obj );
1110 // f << Tabs << " <value>" << retstr << "</value>" << endl ;
1111 QDomElement value = Graph.createElement( "value" ) ;
1112 aField = Graph.createTextNode( retstr ) ;
1113 datavalue.appendChild( value ) ;
1114 value.appendChild( aField ) ;
1115 // MESSAGE( "ToString( object ) " << retstr );
1119 // f << Tabs << " <value>?</value>" << endl ;
1120 QDomElement value = Graph.createElement( "value" ) ;
1121 aField = Graph.createTextNode( "?" ) ;
1122 datavalue.appendChild( value ) ;
1123 value.appendChild( aField ) ;
1124 // MESSAGE( "Unknown CORBA::Any Type" );
1128 // f << Tabs << "</data-value>" << endl ;
1130 // f << Tabs << "<coord-list>" << endl ;
1131 QDomElement coordlist = Graph.createElement( "coord-list" ) ;
1132 link.appendChild( coordlist ) ;
1135 for ( i = 0 ; i < (int ) aLink.aListOfCoords.size() ; i++ ) {
1136 // f << Tabs << " <coord>" << endl ;
1137 QDomElement coord = Graph.createElement( "coord" ) ;
1138 coordlist.appendChild( coord ) ;
1139 // f << Tabs << " <x>" << aLink.aListOfCoords[ i ].theX << "</x>" << endl ;
1140 QDomElement x = Graph.createElement( "x" ) ;
1142 ax = ax.setNum( aLink.aListOfCoords[ i ].theX ) ;
1143 aField = Graph.createTextNode( ax ) ;
1144 coord.appendChild( x ) ;
1145 x.appendChild( aField ) ;
1146 // f << Tabs << " <y>" << aLink.aListOfCoords[ i ].theY << "</y>" << endl ;
1147 QDomElement y = Graph.createElement( "y" ) ;
1149 ay = ay.setNum( aLink.aListOfCoords[ i ].theY ) ;
1150 aField = Graph.createTextNode( ay ) ;
1151 coord.appendChild( y ) ;
1152 y.appendChild( aField ) ;
1153 // f << Tabs << " </coord>" << endl ;
1155 // f << Tabs << "</coord-list>" << endl ;
1156 cdebug_out << "GraphEditor::OutNode::LinkSaveXML " << aLink.FromNodeName
1157 << "(" << aLink.FromServiceParameterName << ") --> "
1158 << aLink.ToNodeName << "(" << aLink.ToServiceParameterName << ")"
1163 bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName ,
1164 GraphBase::SLink aLink ,
1165 bool fromparam , bool toparam ,
1166 bool wdata ) const {
1168 // if ( intervar ) {
1169 // f << "O" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str()
1171 // << aLink.FromNodeName.c_str() << ".GetOutPort( '"
1172 // << aLink.FromServiceParameterName.c_str()
1173 // << "' )" << endl ;
1175 f << " " << "L" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str()
1176 << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() ;
1177 if ( ((GraphBase::Graph *) Graph())->GetChangeGraphNode( aLink.FromNodeName.c_str() )->GetChangeOutPort( aLink.FromServiceParameterName.c_str() )->IsDataStream() ) {
1178 f << " = " << aGraphName << ".StreamLink( " ;
1181 f << " = " << aGraphName << ".Link( " ;
1183 // if ( !fromparam ) {
1186 f << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() << " , " ;
1187 // if ( !toparam ) {
1190 f << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() << " )" << endl ;
1193 f << " " << "I"<< aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str()
1194 // << " = " << aLink.ToNodeName.c_str() << ".Input( '"
1195 // << aLink.ToServiceParameterName.c_str() << "' , " ;
1197 switch (aLink.aLinkValue.type()->kind()) {
1198 case CORBA::tk_string: {
1200 aLink.aLinkValue >>= retstr;
1201 f << "'" << retstr << "'" ;
1204 case CORBA::tk_double: {
1206 aLink.aLinkValue >>= d;
1210 case CORBA::tk_long: {
1212 aLink.aLinkValue >>= l;
1216 case CORBA::tk_objref: {
1218 CORBA::Object_ptr obj ;
1219 aLink.aLinkValue >>= obj ;
1220 retstr = _Orb->object_to_string(obj );
1221 f << "'" << retstr << "'" ;
1226 // MESSAGE( "Unknown CORBA::Any Type" );
1233 for ( i = 0 ; i < (int ) aLink.aListOfCoords.size() ; i++ ) {
1234 f << " " << "L" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str()
1235 << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() << ".AddCoord( " << i+1 << " , "
1236 << aLink.aListOfCoords[ i ].theX << " , "
1237 << aLink.aListOfCoords[ i ].theY << " )" << endl ;
1242 //bool GraphEditor::OutNode::SaveXML(ostream & f ) {
1243 bool GraphEditor::OutNode::SaveXML( ostream & f , QDomDocument & GraphQDom ,
1244 bool aSuperGraph , QDomElement & supergraph ) {
1245 cdebug_in << "OutNode::SaveXML( ostream & f , QDomDocument & , " << aSuperGraph << " , QDomElement & ) "
1246 << Graph()->Name() << endl ;
1249 QDomElement dataflow ;
1250 if ( aSuperGraph ) {
1251 QString SuperGraph("SuperGraph") ;
1252 GraphQDom = QDomDocument(SuperGraph) ;
1254 supergraph = GraphQDom.createElement( "supergraph" ) ;
1255 GraphQDom.appendChild( supergraph ) ;
1257 dataflow = GraphQDom.createElement( "dataflow" ) ;
1258 supergraph.appendChild( dataflow ) ;
1261 // QString Dataflow("Dataflow") ;
1262 // GraphQDom = QDomDocument(Dataflow) ;
1264 dataflow = GraphQDom.createElement( "dataflow" ) ;
1265 supergraph.appendChild( dataflow ) ;
1268 QDomElement info = GraphQDom.createElement( "info-list" ) ;
1269 dataflow.appendChild( info ) ;
1271 Graph()->SaveXML( GraphQDom , info , 0 , 0 ) ;
1273 QDomElement nodelist = GraphQDom.createElement( "node-list" ) ;
1274 dataflow.appendChild( nodelist ) ;
1275 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1276 // f << " <node>" << endl ;
1277 if ( Graph()->GraphNodes( i )->IsComputingNode() ) {
1278 // ((GraphBase::ComputingNode *)GraphNodes( i ))->SaveXML( f ,
1280 ((GraphBase::ComputingNode *) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
1281 Graph()->GraphNodes( i )->XCoordinate() ,
1282 Graph()->GraphNodes( i )->YCoordinate() ) ;
1284 else if ( Graph()->GraphNodes( i )->IsFactoryNode() ) {
1285 // ((GraphBase::FactoryNode * ) GraphNodes( i ))->SaveXML( f ,
1287 ((GraphBase::FactoryNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
1288 Graph()->GraphNodes( i )->XCoordinate() ,
1289 Graph()->GraphNodes( i )->YCoordinate() ) ;
1291 else if ( Graph()->GraphNodes( i )->IsInLineNode() ) {
1292 // ((GraphBase::InLineNode * ) GraphNodes( i ))->SaveXML( f ,
1294 ((GraphBase::InLineNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
1295 Graph()->GraphNodes( i )->XCoordinate() ,
1296 Graph()->GraphNodes( i )->YCoordinate() ) ;
1298 else if ( Graph()->GraphNodes( i )->IsMacroNode() ) {
1299 // ((GraphBase::InLineNode * ) GraphNodes( i ))->SaveXML( f ,
1301 ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
1302 Graph()->GraphNodes( i )->XCoordinate() ,
1303 Graph()->GraphNodes( i )->YCoordinate() ) ;
1305 else if ( Graph()->GraphNodes( i )->IsGOTONode() ) {
1306 // ((GraphBase::GOTONode * ) GraphNodes( i ))->SaveXML( f ,
1308 ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
1309 Graph()->GraphNodes( i )->XCoordinate() ,
1310 Graph()->GraphNodes( i )->YCoordinate() ) ;
1312 else if ( Graph()->GraphNodes( i )->IsLoopNode() ) {
1313 // ((GraphBase::LoopNode * ) GraphNodes( i ))->SaveXML( f ,
1315 ((GraphBase::LoopNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
1316 Graph()->GraphNodes( i )->XCoordinate() ,
1317 Graph()->GraphNodes( i )->YCoordinate() ) ;
1319 else if ( Graph()->GraphNodes( i )->IsEndLoopNode() ) {
1320 // ((GraphBase::EndOfLoopNode * ) GraphNodes( i ))->SaveXML( f ,
1322 ((GraphBase::EndOfLoopNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
1323 Graph()->GraphNodes( i )->XCoordinate() ,
1324 Graph()->GraphNodes( i )->YCoordinate() ) ;
1326 else if ( Graph()->GraphNodes( i )->IsSwitchNode() ) {
1327 // ((GraphBase::SwitchNode * ) GraphNodes( i ))->SaveXML( f ,
1329 ((GraphBase::SwitchNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
1330 Graph()->GraphNodes( i )->XCoordinate() ,
1331 Graph()->GraphNodes( i )->YCoordinate() ) ;
1333 else if ( Graph()->GraphNodes( i )->IsEndSwitchNode() ) {
1334 // ((GraphBase::EndOfSwitchNode * ) GraphNodes( i ))->SaveXML( f ,
1336 ((GraphBase::EndOfSwitchNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
1337 Graph()->GraphNodes( i )->XCoordinate() ,
1338 Graph()->GraphNodes( i )->YCoordinate() ) ;
1340 // f << " </node>" << endl ;
1343 // f << " </node-list>" << endl << endl ;
1345 // f << " <link-list>" << endl ;
1346 QDomElement linklist = GraphQDom.createElement( "link-list" ) ;
1347 dataflow.appendChild( linklist ) ;
1348 const GraphBase::ListOfSLinks * Links = Graph()->GetLinks( true ) ;
1349 for ( i = 0 ; i < (int ) Links->size() ; i++ ) {
1350 // f << " <link>" << endl ;
1351 QDomElement link = GraphQDom.createElement( "link" ) ;
1352 linklist.appendChild( link ) ;
1353 // LinkSaveXML( f , " " , (*Links)[ i ] , false ) ;
1354 LinkSaveXML( GraphQDom , link , (*Links)[ i ] , false ) ;
1355 // f << " </link>" << endl ;
1357 // f << " </link-list>" << endl << endl ;
1359 // f << " <data-list>" << endl ;
1360 QDomElement datalist = GraphQDom.createElement( "data-list" ) ;
1361 dataflow.appendChild( datalist ) ;
1362 if ( Graph()->GraphMacroLevel() == 0 ) {
1363 const GraphBase::ListOfSLinks * Datas = Graph()->GetDatas() ;
1364 for ( i = 0 ; i < (int ) Datas->size() ; i++ ) {
1365 // f << " <data>" << endl ;
1366 QDomElement data = GraphQDom.createElement( "data" ) ;
1367 datalist.appendChild( data ) ;
1368 // LinkSaveXML( f , " " , (*Datas)[ i ] , true ) ;
1369 LinkSaveXML( GraphQDom , data , (*Datas)[ i ] , true ) ;
1370 // f << " </data>" << endl ;
1374 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1375 if ( Graph()->GraphNodes( i )->IsMacroNode() ) {
1376 GraphBase::GOTONode * aMacroNode = (GraphBase::GOTONode * ) Graph()->GraphNodes( i ) ;
1377 GraphBase::Graph * aMacroGraph = (GraphBase::Graph * ) aMacroNode->CoupledNode() ;
1378 cdebug << "OutNode::SaveXML ---> OutNode::SaveXML( ostream & f , QDomDocument & , false "
1379 << " , QDomElement & ) MacroGraph " << aMacroGraph->Name() << endl ;
1380 if ( !aMacroGraph->GraphEditor()->SaveXML( f , GraphQDom , false , supergraph ) ) {
1382 cdebug << "OutNode::SaveXML MacroGraph "<< aMacroGraph->Name() << " done" << endl ;
1387 cdebug_out << "OutNode::SaveXML( ostream & f , QDomDocument & , " << aSuperGraph << " , QDomElement & ) "
1388 << Graph()->Name() << endl ;
1393 bool GraphEditor::OutNode::SavePY( ostream & f , bool importSuperV ) {
1396 if ( importSuperV ) {
1397 f << endl << "# Generated python file of Graph " << Graph()->Name() << endl << endl ;
1399 f << "from SuperV import *" << endl << endl ;
1402 f << "# Graph creation of " << Graph()->Name() << endl ;
1403 f << "def Def" << Graph()->Name() << "() :" << endl ;
1404 Graph()->SavePY( f , Graph()->Name() , 0 , 0 ) ;
1406 f << " " << endl << " " << "# Creation of Factory Nodes" << endl ;
1407 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1408 if ( Graph()->GraphNodes( i )->IsFactoryNode() ) {
1410 ((GraphBase::FactoryNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
1411 Graph()->GraphNodes( i )->XCoordinate() ,
1412 Graph()->GraphNodes( i )->YCoordinate() ) ;
1417 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1418 if ( Graph()->GraphNodes( i )->IsComputingNode() ) {
1420 f << " " << endl << " " << "# Creation of Computing Nodes" << endl ;
1426 ((GraphBase::ComputingNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
1427 Graph()->GraphNodes( i )->XCoordinate() ,
1428 Graph()->GraphNodes( i )->YCoordinate() ) ;
1433 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1434 if ( Graph()->GraphNodes( i )->IsInLineNode() ) {
1436 f << " " << endl << " " << "# Creation of InLine Nodes" << endl ;
1442 ((GraphBase::InLineNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
1443 Graph()->GraphNodes( i )->XCoordinate() ,
1444 Graph()->GraphNodes( i )->YCoordinate() ) ;
1449 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1450 if ( Graph()->GraphNodes( i )->IsLoopNode() ) {
1452 f << " " << endl << " " << "# Creation of Loop Nodes" << endl ;
1458 ((GraphBase::LoopNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
1459 Graph()->GraphNodes( i )->XCoordinate() ,
1460 Graph()->GraphNodes( i )->YCoordinate() ) ;
1465 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1466 if ( Graph()->GraphNodes( i )->IsSwitchNode() ) {
1468 f << " " << endl << " " << "# Creation of Switch Nodes" << endl ;
1474 ((GraphBase::SwitchNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
1475 Graph()->GraphNodes( i )->XCoordinate() ,
1476 Graph()->GraphNodes( i )->YCoordinate() ) ;
1481 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1482 if ( Graph()->GraphNodes( i )->IsGOTONode() ) {
1484 f << " " << endl << " " << "# Creation of GOTO Nodes" << endl ;
1490 ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
1491 Graph()->GraphNodes( i )->XCoordinate() ,
1492 Graph()->GraphNodes( i )->YCoordinate() ) ;
1497 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1498 if ( Graph()->GraphNodes( i )->IsMacroNode() ) {
1500 f << " " << endl << " " << "# Creation of Macro Nodes" << endl ;
1506 ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
1507 Graph()->GraphNodes( i )->XCoordinate() ,
1508 Graph()->GraphNodes( i )->YCoordinate() ) ;
1512 const GraphBase::ListOfSLinks * Links = Graph()->GetLinks() ;
1514 // map< string , int > aMapOfOutPorts ;
1516 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1517 for ( j = 0 ; j < (int ) Links->size() ; j++ ) {
1518 if ( !strcmp( Graph()->GraphNodes( i )->Name() , (*Links)[ j ].FromNodeName.c_str() ) ) {
1521 << " " << "# Creation of Links"
1528 // char * NodePort = new char [ strlen( (*Links)[ j ].FromNodeName.c_str() ) +
1529 // strlen( (*Links)[ j ].FromServiceParameterName.c_str() ) + 1 ] ;
1530 // strcpy( NodePort , (*Links)[ j ].FromNodeName.c_str() ) ;
1531 // strcat( NodePort , (*Links)[ j ].FromServiceParameterName.c_str() ) ;
1532 // if ( aMapOfOutPorts[ NodePort ] == 0 ) {
1533 // aMapOfOutPorts[ NodePort ] = j + 1 ;
1534 // intervar = true ;
1537 // intervar = false ;
1539 bool fromparam = false ;
1540 if ( Graph()->GraphNodes( i )->GetOutPort( (*Links)[ j ].FromServiceParameterName.c_str() )->IsParam() ) {
1543 bool toparam = false ;
1544 if ( Graph()->GetChangeGraphNode( (*Links)[ j ].ToNodeName.c_str() )->GetInPort( (*Links)[ j ].ToServiceParameterName.c_str() )->IsParam() ) {
1547 LinkSavePY( f , Graph()->Name() , (*Links)[ j ] , fromparam , toparam , false ) ;
1548 // delete [] NodePort ;
1553 if ( Graph()->GraphMacroLevel() == 0 ) {
1554 const GraphBase::ListOfSLinks * Datas = Graph()->GetDatas() ;
1556 for ( i = 0 ; i < (int ) Datas->size() ; i++ ) {
1558 f << " " << endl << " " << "# Input datas" << endl ;
1561 bool fromparam = true ;
1562 bool toparam = true ;
1563 LinkSavePY( f , Graph()->Name() , (*Datas)[ i ] , fromparam , toparam , true ) ;
1568 const SALOME_ModuleCatalog::ListOfServicesParameter ListOfInParam = Graph()->ServiceInParameter() ;
1569 for ( i = 0 ; i < (int ) ListOfInParam.length() ; i++ ) {
1570 string _aParam = CORBA::string_dup(ListOfInParam[ i ].Parametername) ;
1571 const char * aParam = _aParam.c_str() ;
1575 for ( j = 0 ; j < (int ) strlen( aParam ) ; j++ ) {
1576 // if ( aParam[ j ] == '\\' ) {
1577 if ( aParam[ j ] == '_' && aParam[ j+1 ] == '_' ) {
1578 aNodeName = new char[ j+1 ] ;
1579 strncpy( aNodeName , aParam , j ) ;
1580 aNodeName[ j ] = '\0' ;
1581 aPortName = new char[ strlen( aParam ) - j-1 ] ;
1582 strncpy( aPortName , &aParam[ j+2 ] , strlen( aParam ) - j-1 ) ;
1586 const GraphBase::InPort * anInPort = Graph()->GetChangeGraphNode( aNodeName )->GetInPort( aPortName ) ;
1587 if ( !anInPort->IsDataConnected() ) {
1589 f << " " << endl << " " << "# Input Ports of the graph" << endl ;
1592 f << " " << "#I" << aNodeName << aPortName << " = " << aNodeName << ".GetInPort( '"
1593 << aPortName << "' )" << endl ;
1595 delete [] aNodeName ;
1596 delete [] aPortName ;
1599 f << " " << endl << " # Output Ports of the graph" << endl ;
1600 const SALOME_ModuleCatalog::ListOfServicesParameter ListOfOutParam = Graph()->ServiceOutParameter() ;
1601 for ( i = 0 ; i < (int ) ListOfOutParam.length() ; i++ ) {
1602 string _aParam = CORBA::string_dup(ListOfOutParam[ i ].Parametername) ;
1603 const char * aParam = _aParam.c_str() ;
1607 for ( j = 0 ; j < (int ) strlen( aParam ) ; j++ ) {
1608 // if ( aParam[ j ] == '\\' ) {
1609 if ( aParam[ j ] == '_' && aParam[ j+1 ] == '_' ) {
1610 aNodeName = new char[ j+1 ] ;
1611 strncpy( aNodeName , aParam , j ) ;
1612 aNodeName[ j ] = '\0' ;
1613 aPortName = new char[ strlen( aParam ) - j-1 ] ;
1614 strncpy( aPortName , &aParam[ j+2 ] , strlen( aParam ) - j-1 ) ;
1618 f << " " << "#O" << aNodeName << aPortName << " = " << aNodeName << ".GetOutPort( '"
1619 << aPortName << "' )" << endl ;
1620 delete [] aNodeName ;
1621 delete [] aPortName ;
1624 f << " " << "return " << Graph()->Name() << endl << endl ;
1626 // RECURSIVE CREATION OF GRAPHS OF MACRONODES
1627 for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
1628 if ( Graph()->GraphNodes( i )->IsMacroNode() ) {
1629 GraphBase::GOTONode * aMacroNode = (GraphBase::GOTONode * ) Graph()->GraphNodes( i ) ;
1630 GraphBase::Graph * aMacroGraph = (GraphBase::Graph * ) aMacroNode->CoupledNode() ;
1631 cdebug << "OutNode::SavePY ---> OutNode::SavePY( ostream & f ) MacroGraph " << aMacroGraph->Name() << endl ;
1632 GraphEditor::DataFlow * aDataFlow = aMacroGraph->GraphEditor() ;
1633 cdebug << "SavePY of the Graph " << aDataFlow->Graph() << " of the MacroNode "
1634 << aMacroGraph->Name() << endl ;
1635 if ( !aDataFlow->SavePY( f , false ) ) {
1641 // f << Graph()->Name() << " = " << Graph()->Name() << "()" << endl ;
1648 ostream & operator<< (ostream & f,const GraphEditor::OutNode & G) {
1649 f << (GraphBase::ComputingNode ) *(G.Graph()) ;
1652 f << " Nodes : " << (G.Graph())->GraphNodesSize() << " node"
1653 << ((G.Graph())->GraphNodesSize() > 1 ? "s" : "") << endl;
1656 for ( i = 0 ; i < (G.Graph())->GraphNodesSize() ; i++ ) {
1658 // << hex << (void *) G.Graph().GraphNodes( i ) << dec << " "
1659 << (G.Graph())->GraphNodes( i ) << endl;
1662 f << " Links : " << endl ;
1663 for ( i = 0 ; i < (G.Graph())->GraphNodesSize() ; i++ ) {
1664 (G.Graph())->GraphNodes( i )->ListLinks( f ) ;
1667 f << " Datas : " << endl ;
1668 (G.Graph())->ListDatas( f ) ;
1670 f << "DataFlow " << (G.Graph())->Name() << " is " ;
1671 if ( G.IsNotValid() )
1673 f << "valid and is " ;
1674 if ( G.IsNotExecutable() )
1676 f << "executable." << endl ;
1683 ostream & operator<< (ostream &fOut,const SUPERV::SDate &D)
1685 // cdebug_in << "operator<< GraphEditor::Date" << endl;
1687 fOut << D.Day << "/"
1694 // cdebug_out << "operator<< GraphEditor::Date" << endl;