1 // SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
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 : Graph_Impl.cxx
25 // Author : Jean Rahuel
35 //#include "utilities.h"
37 #include "SALOME_Container_i.hxx"
39 #include "StreamGraph_Impl.hxx"
41 #include "DataFlowEditor_DataFlow.hxx"
43 extern GraphExecutor::FiniteStateMachine * theAutomaton ;
45 static void CreateEditor( CORBA::ORB_ptr orb ,
46 const char *instanceName ,
47 const char *aDataFlowName ,
48 const SUPERV::KindOfNode aKindOfNode ,
50 GraphEditor::DataFlow ** aDataFlowEditor ) {
51 bool aXmlFile = false ;
52 int lenname = strlen( aDataFlowName ) ;
53 char * theDataFlowName = new char [ lenname+1 ] ;
54 strcpy( theDataFlowName , aDataFlowName ) ;
55 if ( aDataFlowName ) {
56 if ( lenname > 4 && !strcmp( &aDataFlowName[ lenname - 4 ] , ".xml" ) ) {
57 strncpy( theDataFlowName , &aDataFlowName[ 0 ] , lenname-4 ) ;
58 theDataFlowName[ lenname-4 ] = '\0' ;
61 for ( i = lenname - 5 ; i >= 0 ; i-- ) {
62 if ( aDataFlowName[ i ] == '/' ) {
63 strncpy( theDataFlowName , &aDataFlowName[ i + 1 ] , lenname-5-i ) ;
64 theDataFlowName[ lenname-5-i ] = '\0' ;
70 strcpy( theDataFlowName , &aDataFlowName[ 0 ] ) ;
74 string theDataFlowInstanceName = theDataFlowName ;
76 // asv : 16.11.04 : creation of log file in /tmp/logs/$USER dir.
77 // "/tmp/logs/$USER" was created by runSalome.py -> orbmodule.py.
78 dbgfile = "/tmp/logs/" ;
79 dbgfile += getenv( "USER" ) ;
81 dbgfile += instanceName ;
83 dbgfile += theDataFlowInstanceName ;
84 dbgfile = dbgfile + "_" + theAutomaton->DbgFileNumber() + ".log" ;
85 FILE* f = fopen ( dbgfile.c_str(), "a" );
86 if ( f ) { // check if file can be opened for writing
89 else { // if file can't be opened - use a guaranteed temp file name
90 char* aTempNam = tempnam( NULL, NULL );
95 SALOME_NamingService * NamingService = new SALOME_NamingService( orb ) ;
96 *aDataFlowEditor = new GraphEditor::DataFlow( orb , NamingService ,
97 theDataFlowInstanceName.c_str() , dbgfile.c_str() ,
99 MESSAGE( "CreateEditor " << theDataFlowName << " uniquely named " << theDataFlowInstanceName << " created with "
100 << dbgfile.c_str() ) ;
102 delete [] theDataFlowName ;
105 static void CreateExecutor( CORBA::ORB_ptr orb ,
106 const char *instanceName ,
107 const char *aDataFlowName ,
108 const SUPERV::KindOfNode aKindOfNode ,
110 GraphExecutor::DataFlow ** aDataFlowExecutor ) {
111 int lenname = strlen( aDataFlowName ) ;
112 char * theDataFlowName = new char [ lenname+1 ] ;
113 strcpy( theDataFlowName , aDataFlowName ) ;
114 if ( aDataFlowName ) {
115 strcpy( theDataFlowName , &aDataFlowName[ 0 ] ) ;
118 string theDataFlowInstanceName = theDataFlowName ;
120 // asv : 16.11.04 : creation of log file in /tmp/logs/$USER dir.
121 // "/tmp/logs/$USER" was created by runSalome.py -> orbmodule.py.
122 dbgfile = "/tmp/logs/" ;
123 dbgfile += getenv( "USER" ) ;
125 dbgfile += instanceName ;
127 dbgfile += theDataFlowInstanceName ;
128 dbgfile = dbgfile + "_" + theAutomaton->DbgFileNumber() ;
130 astr << theAutomaton->ExecNumber() ;
131 dbgfile += astr.str() ;
132 dbgfile += string( "_Exec.log" ) ;
133 FILE* f = fopen ( dbgfile.c_str(), "a" );
134 if ( f ) { // check if file can be opened for writing
137 else { // if file can't be opened - use a guaranteed temp file name
138 char* aTempNam = tempnam( NULL, NULL );
143 SALOME_NamingService * NamingService = new SALOME_NamingService( orb ) ;
144 *aDataFlowExecutor = new GraphExecutor::DataFlow( orb , NamingService ,
145 theDataFlowInstanceName.c_str() , dbgfile.c_str() ,
148 MESSAGE( "CreateExecutor " << theDataFlowName << " " << theDataFlowInstanceName << " created with "
149 << dbgfile.c_str() ) ;
151 delete [] theDataFlowName ;
154 Graph_Impl::Graph_Impl( CORBA::ORB_ptr orb ,
155 PortableServer::POA_ptr poa ,
156 PortableServer::ObjectId * contId ,
157 const char *instanceName ,
158 const char *interfaceName ,
159 const char *aDataFlowName ,
160 const SUPERV::KindOfNode aKindOfNode ) :
161 GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowName , aKindOfNode ) {
162 // MESSAGE("Graph_Impl::Graph_Impl activate object instanceName("
163 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
164 // << hex << (void *) this << dec )
165 // beginService( "Graph_Impl::Graph_Impl" );
166 _Orb = CORBA::ORB::_duplicate(orb);
169 _DebugFileName = NULL ;
170 if ( aKindOfNode == SUPERV::DataFlowGraph || aKindOfNode == SUPERV::MacroNode ) {
171 // MESSAGE( "Graph_Impl::Graph_Impl _poa->activate_object" );
173 _id = _poa->activate_object(_thisObj);
176 // MESSAGE( "Graph_Impl::Graph_Impl NO _poa->activate_object " );
179 if ( aKindOfNode == SUPERV::DataFlowGraph || aKindOfNode == SUPERV::DataStreamGraph ) {
181 GraphEditor::DataFlow * aDataFlowEditor ;
182 CreateEditor( orb , instanceName , aDataFlowName , aKindOfNode ,
183 dbgfile , &aDataFlowEditor ) ;
185 if ( _DebugFileName ) {
186 delete [] _DebugFileName ;
188 _DebugFileName = new char[ strlen( dbgfile.c_str() )+1 ] ;
189 strcpy( _DebugFileName , dbgfile.c_str() ) ;
191 _NamingService = new SALOME_NamingService( orb ) ;
192 DataFlowEditor( aDataFlowEditor ) ;
193 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
194 DataFlowEditor()->Graph()->SetObjImpl( this ) ;
196 pthread_mutex_init( &_MutexExecutorWait , NULL ) ;
197 // DataFlowExecutor( NULL ) ;
198 // endService( "Graph_Impl::Graph_Impl" );
201 Graph_Impl::Graph_Impl( CORBA::ORB_ptr orb ,
202 PortableServer::POA_ptr poa ,
203 PortableServer::ObjectId * contId ,
204 const char *instanceName ,
205 const char *interfaceName ,
206 GraphEditor::DataFlow * aDataFlowEditor ,
207 GraphEditor::InNode * aDataFlowNode ) :
208 GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
209 // beginService( "Graph_Impl::Graph_Impl" );
210 // MESSAGE( aDataFlowEditor->Graph()->Name() << " " );
211 if ( aDataFlowEditor->Graph()->IsDataFlowNode() ||
212 ( aDataFlowNode && aDataFlowNode->IsMacroNode() ) ) {
213 // MESSAGE( "Graph_Impl::Graph_Impl _poa->activate_object" );
215 _id = _poa->activate_object(_thisObj);
218 // MESSAGE( "Graph_Impl::Graph_Impl NO _poa->activate_object " );
220 _Orb = CORBA::ORB::_duplicate(orb);
223 _DebugFileName = NULL ;
224 DataFlowEditor( aDataFlowEditor ) ;
225 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
226 DataFlowEditor()->Graph()->SetObjImpl( this ) ;
227 pthread_mutex_init( &_MutexExecutorWait , NULL ) ;
228 // DataFlowExecutor( NULL ) ;
229 // endService( "Graph_Impl::Graph_Impl" );
232 Graph_Impl::Graph_Impl() {
235 Graph_Impl::~Graph_Impl() {
236 beginService( "Graph_Impl::~Graph_Impl" );
237 endService( "Graph_Impl::~Graph_Impl" );
240 void Graph_Impl::destroy() {
241 beginService( "Graph_Impl::destroy" );
242 if ( DataFlowNode() && DataFlowNode()->ComputingNode()->IsMacroNode() ) {
243 SUPERV::Graph_var aGraph = DataFlowNode()->GOTONode()->MacroObject() ;
244 GNode_Impl::Delete() ;
245 if ( !CORBA::is_nil( aGraph ) ) {
250 SUPERV::Graph_var aGraph = DataFlowEditor()->Graph()->MacroObject() ;
251 GNode_Impl::Delete() ;
252 if ( !CORBA::is_nil( aGraph ) ) {
256 _poa->deactivate_object(*_id) ;
257 CORBA::release(_poa) ;
259 _thisObj->_remove_ref();
260 endService( "Graph_Impl::destroy" );
264 char* Graph_Impl::getIOR() {
266 return CORBA::string_dup( NULLSTRING ) ;
268 else if ( CORBA::is_nil( myServant ) ) {
269 PortableServer::ObjectId* id = getId();
270 CORBA::Object_var obj;
271 obj = _poa->id_to_reference(*id);
272 myServant = SUPERV::Graph::_narrow(obj);
274 return(CORBA::string_dup(_Orb->object_to_string(myServant)));
277 SUPERV::Graph_ptr Graph_Impl::Copy() {
278 beginService( "Graph_Impl::Copy" );
279 SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ;
281 Graph_Impl * myGraph ;
282 myGraph = new Graph_Impl( _Orb , _Poa, _ContId,
283 instanceName() , interfaceName() ,
284 DataFlowEditor()->Graph()->Name() , SUPERV::DataFlowGraph ) ;
285 PortableServer::ObjectId * id = myGraph->getId() ;
286 CORBA::Object_var obj = _poa->id_to_reference(*id);
287 iobject = SUPERV::Graph::_narrow(obj) ;
288 GraphBase::ListOfSGraphs * aListOfSGraphs = GetGraphs() ;
289 myGraph->LoadGraphs( aListOfSGraphs ) ;
291 endService( "Graph_Impl::Copy" );
292 return SUPERV::Graph::_duplicate(iobject) ;
295 void Graph_Impl::ReadOnly() {
296 DataFlowEditor()->ReadOnly() ;
299 SUPERV::INode_ptr Graph_Impl::Node() {
300 // beginService( "Graph_Impl::Node" );
301 PortableServer::ObjectId * id = getId() ;
302 CORBA::Object_var obj = _poa->id_to_reference(*id);
303 SUPERV::Graph_var iobject ;
304 iobject = SUPERV::Graph::_narrow(obj) ;
305 // endService( "Graph_Impl::Node" );
306 return SUPERV::Graph::_duplicate(iobject) ;
309 GraphBase::ListOfSGraphs * Graph_Impl::GetGraphs() {
310 return DataFlowEditor()->GetDataFlows() ;
313 bool Graph_Impl::LoadGraphs( GraphBase::ListOfSGraphs * aListOfDataFlows ) {
314 beginService( "Graph_Impl::LoadGraphs" );
315 bool RetVal = false ;
316 if ( DataFlowEditor()->IsEditing() ) {
317 // RetVal = DataFlowEditor()->LoadDataFlows( aListOfDataFlows ) ;
318 if ( CORBA::is_nil( LoadDataFlows( DataFlowEditor() , aListOfDataFlows , 0 ) ) ) {
322 endService( "Graph_Impl::LoadGraphs" );
326 bool Graph_Impl::Import(const char * aXmlFile ) {
327 beginService( "Graph_Impl::Import" );
328 bool RetVal = false ;
329 if ( DataFlowEditor()->IsEditing() && !IsMacro() ) {
330 GraphBase::ListOfSGraphs aListOfDataFlows ;
331 RetVal = DataFlowEditor()->LoadXml( aXmlFile , aListOfDataFlows ) ;
332 if ( RetVal && aXmlFile != NULL ) {
333 // RetVal = DataFlowEditor()->LoadDataFlows( &aListOfDataFlows ) ;
334 if ( CORBA::is_nil( LoadDataFlows( DataFlowEditor() , &aListOfDataFlows , 0 ) ) ) {
339 endService( "Graph_Impl::Import" );
343 bool Graph_Impl::Export(const char * anXmlFile ) {
344 beginService( "Graph_Impl::Export" );
345 bool RetVal = false ;
347 char * aFile = new char [ strlen( anXmlFile ) + 5 ] ;
348 strcpy( aFile , anXmlFile ) ;
349 int len = strlen( aFile ) ;
350 if ( !strcmp( &aFile[ len - 4 ] , ".xml" ) ) {
352 else if ( !strcmp( &aFile[ len - 3 ] , ".py" ) ) {
353 strcpy( &aFile[ len - 3 ] , ".xml" ) ;
354 len = strlen( aFile ) ;
357 strcat( aFile , ".xml" ) ;
358 len = strlen( aFile ) ;
360 RetVal = DataFlowEditor()->SaveXml( aFile ) ;
362 strcpy( &aFile[ len - 4 ] , ".py" ) ;
363 RetVal = DataFlowEditor()->SavePy( aFile ) ;
367 endService( "Graph_Impl::Export" );
371 SUPERV::CNode_ptr Graph_Impl::CNode( const SALOME_ModuleCatalog::Service &NodeService ) {
372 beginService( "Graph_Impl::CNode" );
373 SUPERV::CNode_var iobject = SUPERV::CNode::_nil() ;
374 if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) {
375 CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId ,
376 instanceName() , interfaceName() ,
378 NodeService , NULLSTRING ,
379 SUPERV::ComputingNode , NULLSTRING ) ;
380 if ( myNode->DataFlowNode() ) {
381 PortableServer::ObjectId * id = myNode->getId() ;
382 CORBA::Object_var obj = _poa->id_to_reference(*id);
383 iobject = SUPERV::CNode::_narrow(obj) ;
384 myNode->SetObjRef( SUPERV::CNode::_duplicate( iobject ) ) ;
387 DataFlowEditor()->UnValid() ;
388 endService( "Graph_Impl::CNode" );
389 return SUPERV::CNode::_duplicate( iobject ) ;
392 SUPERV::FNode_ptr Graph_Impl::FNode( const char * NodeComponentName ,
393 const char * NodeInterfaceName ,
394 const SALOME_ModuleCatalog::Service &NodeService ) {
395 beginService( "Graph_Impl::FNode" );
396 SUPERV::FNode_var iobject = SUPERV::FNode::_nil() ;
397 if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) {
398 FNode_Impl * myNode = new FNode_Impl( _Orb , _Poa , _ContId ,
399 instanceName() , interfaceName() ,
403 NodeInterfaceName ) ;
404 if ( myNode->DataFlowNode() ) {
405 PortableServer::ObjectId * id = myNode->getId() ;
406 CORBA::Object_var obj = _poa->id_to_reference(*id);
407 iobject = SUPERV::FNode::_narrow(obj) ;
408 myNode->SetObjRef( SUPERV::FNode::_duplicate( iobject ) ) ;
411 DataFlowEditor()->UnValid() ;
412 endService( "Graph_Impl::FNode" );
413 return SUPERV::FNode::_duplicate( iobject ) ;
416 SUPERV::INode_ptr Graph_Impl::INode( const char * FuncName ,
417 const SUPERV::ListOfStrings & PythonFuntion ) {
418 beginService( "Graph_Impl::INode" );
419 SUPERV::INode_var iobject = SUPERV::INode::_nil() ;
420 if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) {
421 INode_Impl * myNode = new INode_Impl( _Orb , _Poa , _ContId ,
422 instanceName() , interfaceName() ,
424 FuncName , PythonFuntion ,
425 SUPERV::InLineNode ) ;
426 if ( myNode->DataFlowNode() ) {
427 PortableServer::ObjectId * id = myNode->getId() ;
428 CORBA::Object_var obj = _poa->id_to_reference(*id);
429 iobject = SUPERV::INode::_narrow(obj) ;
430 myNode->SetObjRef( SUPERV::INode::_duplicate( iobject ) ) ;
433 endService( "Graph_Impl::INode" );
434 return SUPERV::INode::_duplicate( iobject ) ;
438 SUPERV::GNode_ptr Graph_Impl::GNode( const char * FuncName ,
439 const SUPERV::ListOfStrings & PythonFuntion ,
440 const char * anInLineNode ) {
441 beginService( "Graph_Impl::GNode" );
442 SUPERV::GNode_var iobject = SUPERV::GNode::_nil() ;
443 if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) {
444 GNode_Impl * myNode = new GNode_Impl( _Orb , _Poa , _ContId ,
445 instanceName() , interfaceName() ,
447 FuncName , PythonFuntion ,
449 if ( myNode->DataFlowNode() ) {
450 PortableServer::ObjectId * id = myNode->getId() ;
451 CORBA::Object_var obj = _poa->id_to_reference(*id);
452 iobject = SUPERV::GNode::_narrow(obj) ;
453 myNode->SetObjRef( SUPERV::GNode::_duplicate( iobject ) ) ;
454 if ( strlen( anInLineNode ) ) {
455 GraphBase::InLineNode * CoupledINode = (GraphBase::InLineNode * ) DataFlowEditor()->Graph()->GetGraphNode( anInLineNode ) ;
456 if ( anInLineNode ) {
457 myNode->SetCoupled( anInLineNode ) ;
458 Link( myNode->Port( "OutGate" ) , CoupledINode->ObjRef()->Port( "InGate" ) ) ;
463 DataFlowEditor()->UnValid() ;
464 endService( "Graph_Impl::GNode" );
465 return SUPERV::GNode::_duplicate( iobject ) ;
468 SUPERV::LNode_ptr Graph_Impl::LNode( const char * InitName ,
469 const SUPERV::ListOfStrings & InitFunction ,
470 const char * MoreName ,
471 const SUPERV::ListOfStrings & MoreFunction ,
472 const char * NextName ,
473 const SUPERV::ListOfStrings & NextFunction ,
474 SUPERV::INode_out anEndOfLoop ) {
475 beginService( "Graph_Impl::LNode" );
476 SUPERV::LNode_var iobject = SUPERV::LNode::_nil() ;
477 SUPERV::ELNode_var iendobject = SUPERV::ELNode::_nil() ;
478 if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) {
479 GraphBase::ListOfFuncName FuncNameList ;
480 FuncNameList.resize(3) ;
481 FuncNameList[0] = InitName ;
482 FuncNameList[1] = MoreName ;
483 FuncNameList[2] = NextName ;
484 GraphBase::ListOfPythonFunctions PythonFunctionList ;
485 PythonFunctionList.resize(3) ;
486 PythonFunctionList[0] = &InitFunction ;
487 PythonFunctionList[1] = &MoreFunction ;
488 PythonFunctionList[2] = &NextFunction ;
489 LNode_Impl * myNode = new LNode_Impl( _Orb , _Poa , _ContId ,
490 instanceName() , interfaceName() ,
492 FuncNameList , PythonFunctionList ,
493 // InitName , InitFunction ,
494 // MoreName , MoreFunction ,
495 // NextName , NextFunction ,
497 if ( myNode->DataFlowNode() ) {
498 PortableServer::ObjectId * id = myNode->getId() ;
499 CORBA::Object_var obj = _poa->id_to_reference(*id);
500 iobject = SUPERV::LNode::_narrow(obj) ;
501 myNode->SetObjRef( SUPERV::LNode::_duplicate( iobject ) ) ;
503 SALOME_ModuleCatalog::Service aVoidService = SALOME_ModuleCatalog::Service() ;
505 if ( strlen( InitName ) ) {
506 anEndName = new char( 3 + strlen( InitName ) + 1 ) ;
507 strcpy( anEndName , "End" ) ;
508 strcat( anEndName , InitName ) ;
511 anEndName = new char( 3 + strlen( "Loop" ) + 1 ) ;
512 strcpy( anEndName , "EndLoop" ) ;
514 ELNode_Impl * myEndNode = new ELNode_Impl( _Orb , _Poa , _ContId ,
515 instanceName() , interfaceName() ,
518 SUPERV::EndLoopNode ) ;
519 PortableServer::ObjectId * endid = myEndNode->getId() ;
520 CORBA::Object_var endobj = _poa->id_to_reference(*endid);
521 iendobject = SUPERV::ELNode::_narrow(endobj) ;
522 myEndNode->SetObjRef( SUPERV::ELNode::_duplicate( iendobject ) ) ;
523 myNode->SetCoupled( myEndNode->BaseNode()->Name() ) ;
524 myEndNode->SetCoupled( myNode->BaseNode()->Name() ) ;
525 Link( myNode->Port( "DoLoop" ) , myEndNode->Port( "DoLoop" ) ) ;
526 // Link( myEndNode->Port( "DoLoop" ) , myNode->Port( "InitLoop" ) ) ;
527 Link( myEndNode->Port( "DoLoop" ) , myNode->Port( "DoLoop" ) ) ;
530 anEndOfLoop = SUPERV::ELNode::_duplicate( iendobject ) ;
531 DataFlowEditor()->UnValid() ;
532 endService( "Graph_Impl::LNode" );
533 return SUPERV::LNode::_duplicate( iobject ) ;
536 SUPERV::SNode_ptr Graph_Impl::SNode( const char * FuncName ,
537 const SUPERV::ListOfStrings & PythonFunction ,
538 SUPERV::INode_out anEndOfSwitch ) {
539 beginService( "Graph_Impl::SNode" );
540 SUPERV::SNode_var iobject = SUPERV::SNode::_nil() ;
541 SUPERV::ESNode_var iendobject = SUPERV::ESNode::_nil() ;
542 if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) {
543 SNode_Impl * myNode = new SNode_Impl( _Orb , _Poa , _ContId ,
544 instanceName() , interfaceName() ,
546 FuncName , PythonFunction ,
547 SUPERV::SwitchNode ) ;
548 if ( myNode->DataFlowNode() ) {
549 PortableServer::ObjectId * id = myNode->getId() ;
550 CORBA::Object_var obj = _poa->id_to_reference(*id);
551 iobject = SUPERV::SNode::_narrow(obj) ;
552 myNode->SetObjRef( SUPERV::SNode::_duplicate( iobject ) ) ;
554 string anEndName = "End" ;
555 if ( strlen( FuncName ) ) {
556 anEndName += FuncName ;
559 anEndName += "Switch" ;
561 // cout << "Graph_Impl::SNode anEndName " << (void *) FuncName << " " << FuncName
562 // << " " << strlen(FuncName) << " " << (void *) anEndName.c_str() << " "
563 // << anEndName.c_str() << endl ;
564 ESNode_Impl * myEndNode = new ESNode_Impl( _Orb , _Poa , _ContId ,
565 instanceName() , interfaceName() ,
568 SUPERV::EndSwitchNode ) ;
569 // cout << "Graph_Impl::SNode returned anEndName " << (void *) FuncName << " "
570 // << FuncName << " " << strlen(FuncName) << " " << (void *) anEndName.c_str()
571 // << " " << anEndName.c_str() << endl ;
572 PortableServer::ObjectId * endid = myEndNode->getId() ;
573 CORBA::Object_var endobj = _poa->id_to_reference(*endid);
574 iendobject = SUPERV::ESNode::_narrow(endobj) ;
575 myEndNode->SetObjRef( SUPERV::ESNode::_duplicate( iendobject ) ) ;
576 myNode->SetCoupled( myEndNode->BaseNode()->Name() ) ;
577 myEndNode->SetCoupled( myNode->BaseNode()->Name() ) ;
578 if ( !Link( myNode->Port( "Default" ) , myEndNode->Port( "Default" ) ) ) {
579 iobject = SUPERV::SNode::_nil() ;
580 iendobject = SUPERV::ESNode::_nil() ;
584 anEndOfSwitch = SUPERV::ESNode::_duplicate( iendobject ) ;
585 DataFlowEditor()->UnValid() ;
586 endService( "Graph_Impl::SNode" );
587 return SUPERV::SNode::_duplicate( iobject ) ;
590 // WARNING : THIS IS COMPLICATED :
591 SUPERV::Graph_var Graph_Impl::LoadDataFlows( GraphEditor::DataFlow * aDataFlowEditor ,
592 GraphBase::ListOfSGraphs * aListOfDataFlows ,
594 beginService( "Graph_Impl::EditorLoadDataFlows" ) ;
595 MESSAGE("Graph_Impl::LoadDataFlows index " << index << " " << (*aListOfDataFlows)[index].Info.theName.c_str() ) ;
597 SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ;
598 // That method is recursive :
599 // At first we load the supergraph with index = 0 :
600 // (After we load the graph corresponding to each MacroNode :)
601 if ( !aDataFlowEditor->LoadDataFlow( &(*aListOfDataFlows)[ index ] ) ) {
602 MESSAGE("Graph_Impl::LoadDataFlows failed " << (*aListOfDataFlows)[index].Info.theName.c_str() ) ;
603 return SUPERV::Graph::_duplicate( iobject ) ;
605 // That graph is not a StreamGraph :
606 else if ( !aDataFlowEditor->Graph()->HasDataStream() ) {
607 aDataFlowEditor->Graph()->Kind( SUPERV::DataFlowGraph ) ;
608 // aDataFlowEditor->Graph()->SetGraphEditor( aDataFlowEditor ) ;
609 Graph_Impl * myGraph ;
610 // We create a Graph ObjRef for that graph
611 myGraph = new Graph_Impl( _Orb , _Poa, _ContId,
612 instanceName() , interfaceName() ,
613 aDataFlowEditor , NULL ) ;
614 PortableServer::ObjectId * id = myGraph->getId() ;
615 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
616 iobject = SUPERV::Graph::_narrow( obj ) ;
617 myGraph->SetObjRef( SUPERV::Graph::_duplicate( iobject ) ) ;
618 myGraph->SetObjImpl( (CNode_Impl * ) myGraph ) ;
619 GraphBase::Graph * aGraph = myGraph->DataFlowEditor()->Graph() ;
622 // asv: set Editor for the graph itself and for all its macro nodes
623 aGraph->GraphEditor( aDataFlowEditor );
625 // For the supergraph or each graph of MacroNodes we search MacroNodes recursively :
626 for ( i = 0 ; i < aGraph->GraphNodesSize() ; i++ ) {
627 if ( aGraph->GraphNodes( i )->IsMacroNode() ) {
628 GraphBase::GOTONode * aMacroNode = (GraphBase::GOTONode * ) aGraph->GraphNodes( i ) ;
630 // asv : 05.11.04 : fix of bug - "insert file" into existing graph with MacroNodes worked incorrectly!
631 // aMacroNode is an "old" node, and here we must analize only "new" nodes, that
632 // came from aListOfDataFlows and were loaded by aDataFlowEditor->LoadDataFlow( &(*aListOfDataFlows)[ index ] )
633 // so here we check if the node is "new" or "old"
634 if ( aMacroNode->GraphEditor() && aMacroNode->CoupledNode() )
637 // asv: set Editor for the graph itself and for all its macro nodes
638 aMacroNode->GraphEditor( aDataFlowEditor );
640 // Creation of a GraphMacroNode ObjRef in the current editor
641 SUPERV::Graph_var macroiobject = SUPERV::Graph::_nil() ;
642 Graph_Impl * myMacroNode ;
643 myMacroNode = new Graph_Impl( _Orb , _Poa, _ContId,
644 instanceName() , interfaceName() ,
645 aMacroNode->Name() , SUPERV::MacroNode ) ;
646 id = myMacroNode->getId() ;
647 obj = _poa->id_to_reference(*id);
648 macroiobject = SUPERV::Graph::_narrow( obj ) ;
649 myMacroNode->DataFlowEditor( aDataFlowEditor ) ;
650 GraphEditor::InNode * aDataFlowNode = (GraphEditor::InNode * ) aMacroNode->GetInNode() ;
651 myMacroNode->DataFlowNode( aDataFlowNode ) ;
652 aDataFlowNode->SetObjRef( SUPERV::CNode::_duplicate( SUPERV::CNode::_narrow( obj ) ) ) ;
653 aDataFlowNode->SetObjImpl( myMacroNode ) ;
655 char * aCoupledNodeName = aMacroNode->CoupledNodeName() ;
656 MESSAGE( "LoadDataFlows MacroNode " << aMacroNode->Name() << " --> " << aCoupledNodeName
657 << " to be searched among " << (*aListOfDataFlows).size() << " Graphs" ) ;
660 for ( index = 0 ; index < (int ) (*aListOfDataFlows).size() ; index++ ) {
661 MESSAGE( "LoadDataFlows Graph" << index << " " << (*aListOfDataFlows)[index].Info.theName.c_str() ) ;
662 if ( !strcmp( aCoupledNodeName , (*aListOfDataFlows)[index].Info.theName.c_str() ) ) {
665 // At first create the editor and a StreamGraph
666 GraphEditor::DataFlow * aMacroGraphDataFlowEditor ;
667 CreateEditor( _Orb , instanceName() , aCoupledNodeName , SUPERV::DataStreamGraph ,
668 dbgfile , &aMacroGraphDataFlowEditor ) ;
670 if ( _DebugFileName ) {
671 delete [] _DebugFileName ;
673 _DebugFileName = new char[ strlen( dbgfile.c_str() )+1 ] ;
674 strcpy( _DebugFileName , dbgfile.c_str() ) ;
676 MESSAGE( "RECURSIVE IMPORT OF GRAPHS OF MACRONODES :" << aCoupledNodeName ) ;
677 if ( CORBA::is_nil( LoadDataFlows( aMacroGraphDataFlowEditor , aListOfDataFlows , index ) ) ) {
678 MESSAGE("Graph_Impl::LoadDataFlows failed" ) ;
679 return SUPERV::Graph::_duplicate( iobject ) ;
682 // That graph is not a StreamGraph :
683 else if ( !aMacroGraphDataFlowEditor->Graph()->HasDataStream() ) {
684 Graph_Impl * myMacroGraph ;
685 // The Graph ObjRef for that graph was already created
686 myMacroGraph = (Graph_Impl * ) aMacroGraphDataFlowEditor->Graph()->ObjImpl() ;
688 GraphBase::Graph * aMacroGraph = myMacroGraph->DataFlowEditor()->Graph() ;
690 aMacroGraph->GraphMacroLevel( aGraph->GraphMacroLevel() + 1 ) ;
691 aMacroGraph->CoupledNode( aMacroNode ) ;
692 aMacroGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ;
694 // Set the GraphMacroNode ObjRef in the MacroNode
695 aMacroNode->GraphMacroLevel( aGraph->GraphMacroLevel() + 1 ) ;
696 aMacroNode->CoupledNode( aMacroGraph ) ;
697 aMacroNode->MacroObject( SUPERV::Graph::_narrow( aMacroGraphDataFlowEditor->Graph()->ObjRef() ) ) ;
698 MESSAGE( "LoadDataFlows aMacroGraph " << aMacroGraph << " " << aMacroGraph->Name()
699 << " coupled to " << aMacroGraph->CoupledNode() << " "
700 << aMacroGraph->CoupledNode()->Name() << " Editor " << aMacroGraph->GraphEditor() ) ;
701 MESSAGE( "LoadDataFlows aMacroNode " << aMacroNode << " " << aMacroNode->Name()
702 << " coupled to " << aMacroNode->CoupledNode() << " "
703 << aMacroNode->CoupledNode()->Name() << " Editor " << aMacroNode->GraphEditor() ) ;
704 MESSAGE( "LoadDataFlows current Graph " << aGraph << " " << aGraph->Name()
705 << " coupled to " << aGraph->CoupledNode()
706 << " Editor " << aGraph->GraphEditor() << " " << aGraph->Name() ) ;
712 return SUPERV::Graph::_duplicate( SUPERV::Graph::_nil() ) ;
717 else if ( (*aListOfDataFlows).size() == 1 ) {
718 StreamGraph_Impl * myStreamGraph ;
719 // We create a Graph ObjRef for that graph
720 myStreamGraph = new StreamGraph_Impl( _Orb , _Poa, _ContId,
721 instanceName() , interfaceName() ,
722 aDataFlowEditor , NULL ) ;
723 PortableServer::ObjectId * id = myStreamGraph->getId() ;
724 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
725 SUPERV::StreamGraph_var Streamiobject = SUPERV::StreamGraph::_nil() ;
726 Streamiobject = SUPERV::StreamGraph::_narrow( obj ) ;
727 myStreamGraph->SetObjRef( SUPERV::StreamGraph::_duplicate( Streamiobject ) ) ;
728 myStreamGraph->SetObjImpl( (CNode_Impl * ) myStreamGraph ) ;
729 // iobject = SUPERV::Graph::_narrow( obj ) ;
730 iobject = SUPERV::Graph::_narrow( Streamiobject ) ;
733 MESSAGE( "Graph_Impl::LoadDataFlows StreamGraph with MacroNodes not yet implemented" ) ;
736 endService( "Graph_Impl::EditorLoadDataFlows" );
737 return SUPERV::Graph::_duplicate( iobject ) ;
740 SUPERV::Graph_var Graph_Impl::LoadDataFlows( GraphExecutor::DataFlow * aDataFlowExecutor ,
741 GraphBase::ListOfSGraphs * aListOfDataFlows ,
743 beginService( "Graph_Impl::ExecutorLoadDataFlows" ) ;
744 MESSAGE("Graph_Impl::LoadDataFlows(Executor) index " << index << " " << (*aListOfDataFlows)[index].Info.theName.c_str() << " aDataFlowExecutor " << aDataFlowExecutor ) ;
746 // That method is recursive :
747 // At first we load the supergraph with index = 0 :
748 // (After we load the graph corresponding to each MacroNode :)
749 if ( !aDataFlowExecutor->LoadDataFlow( &(*aListOfDataFlows)[ index ] ) ) {
750 MESSAGE("Graph_Impl::LoadDataFlows(Executor) failed, could not LoadDataFlow(supergraph)" ) ;
751 return SUPERV::Graph::_duplicate( SUPERV::Graph::_nil() ) ;
754 // That graph is not a StreamGraph :
756 aDataFlowExecutor->Graph()->Kind( SUPERV::DataFlowGraph ) ;
757 GraphEditor::DataFlow * aDataFlowEditor ;
758 aDataFlowEditor = DataFlowEditor() ;
759 GraphBase::Graph * anEditorGraph = aDataFlowEditor->Graph() ;
760 GraphBase::Graph * anExecutorGraph = aDataFlowExecutor->Graph() ;
761 if ( aDataFlowEditor->Executor() ) {
762 delete aDataFlowEditor->Executor() ;
763 aDataFlowEditor->Executor( NULL ) ;
764 aDataFlowEditor->Editing() ;
766 aDataFlowEditor->Executor( aDataFlowExecutor ) ;
767 anExecutorGraph->GraphEditor( aDataFlowEditor ) ;
769 if ( !aDataFlowExecutor->Graph()->HasDataStream() ) {
770 // For the supergraph or each graph of MacroNodes we search MacroNodes recursively :
772 for ( i = 0 ; i < anExecutorGraph->GraphNodesSize() ; i++ ) {
773 if ( anExecutorGraph->GraphNodes( i )->IsMacroNode() ) {
774 GraphBase::GOTONode * aMacroNode = (GraphBase::GOTONode * ) anExecutorGraph->GraphNodes( i ) ;
775 aMacroNode->GraphEditor( aDataFlowEditor ) ;
777 // get the macro node's editor object
778 char * aMacroGraphName = aMacroNode->CoupledNodeName() ;
779 GraphBase::Graph* aMacroGraph = (GraphBase::Graph*)((GraphBase::GOTONode *)anEditorGraph->GetGraphNode( aMacroNode->Name() ))->CoupledNode() ;
780 GraphEditor::DataFlow* aMacroGraphEditor = aMacroGraph->GraphEditor();
782 MESSAGE( "LoadDataFlows(Executor) MacroNode " << aMacroNode->Name() << " Coupled to " << aMacroGraphName
783 << " to be searched among " << (*aListOfDataFlows).size() << " Graphs" << endl ) ;
786 for ( index = 0 ; index < (int ) (*aListOfDataFlows).size() && !found; index++ ) {
787 if ( !strcmp( aMacroGraphName , (*aListOfDataFlows)[index].Info.theName.c_str() ) )
791 MESSAGE("Graph_Impl::LoadDataFlows(Executor) failed, Macro node's coupled graph \"" << aMacroGraphName << "\" was not found" ) ;
792 return SUPERV::Graph::_duplicate( SUPERV::Graph::_nil() ) ;
794 index--; // it was incremented in "for ..." before last check ( !found ).
796 // At first create the editor and a StreamGraph
798 GraphExecutor::DataFlow * aMacroGraphExecutor ;
799 CreateExecutor( _Orb , instanceName() , aMacroGraphName , SUPERV::DataStreamGraph ,
800 dbgfile , &aMacroGraphExecutor );
802 // set GraphMacroLevel for Executor's graph
803 GraphBase::Graph* aMacroGraphExe = aMacroGraphExecutor->Graph();
804 aMacroGraphExe->GraphMacroLevel( anExecutorGraph->GraphMacroLevel() + 1 );
806 // load data flows in MacroGraph's executor
807 Graph_Impl* aMacroGraphImpl = (Graph_Impl*) aMacroGraphEditor->Graph()->ObjImpl();
808 MESSAGE( "RECURSIVE IMPORT OF GRAPHS OF MACRONODES : " << aMacroGraphName ) ;
809 if ( CORBA::is_nil( aMacroGraphImpl->LoadDataFlows( aMacroGraphExecutor, aListOfDataFlows , index ) ) ) {
810 MESSAGE("Graph_Impl::LoadDataFlows(Executor) failed, could not LoadDataFlow( MacroNodeGraph \"" <<aMacroGraphName << "\" )" ) ;
811 return SUPERV::Graph::_duplicate( SUPERV::Graph::_nil() ) ;
814 // set coupled pair MacroNode <--> MacroGraph
815 aMacroGraphExe->CoupledNode( aMacroNode ) ;
816 aMacroNode->CoupledNode( aMacroGraphExe ) ;
818 // initialize MacroNode's InPorts with corresponding "external" values
820 for ( q = 0 ; q < aMacroNode->GetNodeInPortsSize() ; q++ ) {
821 const GraphBase::InPort * anInPort = aMacroNode->GetNodeInPort( q ) ;
822 if ( anInPort->IsDataConnected() ) {
823 const char* aMacroGraphInPortName = aMacroGraph->GetNodeInPort( q )->PortName();
824 if ( !aMacroGraphExecutor->InputOfAny( aMacroGraphInPortName, *anInPort->GetOutPort()->Value(),false ) ) {
825 return SUPERV::Graph::_duplicate( SUPERV::Graph::_nil() ) ;
828 MESSAGE( "LoadDataFlows(Executor) " << aMacroGraph->Name() << "->InputOfAny( "
829 << aMacroGraphInPortName << " , Value )" ) ;
832 } // end of init MacroNode's InPorts
834 aMacroGraphImpl->Run() ;
837 } // end of for( get nodes of the graph...)
839 } // end of setting initial graph's structure..
841 endService( "Graph_Impl::ExecutorLoadDataFlows" );
843 PortableServer::ObjectId * id = getId();
844 CORBA::Object_var obj = _poa->id_to_reference( *id );
845 SUPERV::Graph_var iobject = SUPERV::Graph::_narrow( obj ) ;
846 return SUPERV::Graph::_duplicate( iobject ) ;
849 SUPERV::Graph_ptr Graph_Impl::MNode( const char * aXmlFileName ) {
850 beginService( "Graph_Impl::MNode" );
851 SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ;
852 MESSAGE( "Graph_Impl::MNode( " << aXmlFileName << " )" ) ;
854 GraphBase::ListOfSGraphs aListOfDataFlows ;
856 // At first create the editor and a StreamGraph with the xml file
857 GraphEditor::DataFlow * aDataFlowEditor ;
858 CreateEditor( _Orb , instanceName() , aXmlFileName , SUPERV::DataStreamGraph ,
859 dbgfile , &aDataFlowEditor ) ;
861 if ( _DebugFileName ) {
862 delete [] _DebugFileName ;
864 _DebugFileName = new char[ strlen( dbgfile.c_str() )+1 ] ;
865 strcpy( _DebugFileName , dbgfile.c_str() ) ;
867 int lenname = strlen( aXmlFileName ) ;
868 bool loaded = false ;
869 // Import of the xml file
870 if ( lenname > 4 && !strcmp( &aXmlFileName[ lenname - 4 ] , ".xml" ) ) {
871 loaded = aDataFlowEditor->LoadXml( aXmlFileName , aListOfDataFlows ) ;
873 iobject = MNode( aDataFlowEditor , &aListOfDataFlows ) ;
880 // WARNING : THIS IS COMPLICATED :
881 // I should have to remove duplicated code ...
882 SUPERV::Graph_ptr Graph_Impl::MNode( GraphEditor::DataFlow * aMacroGraphDataFlowEditor ,
883 GraphBase::ListOfSGraphs * aListOfDataFlows ) {
884 beginService( "Graph_Impl::MNode" ) ;
885 SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ;
886 SUPERV::Graph_var macroiobject = SUPERV::Graph::_nil() ;
889 MESSAGE( "Graph_Impl::MNode DataFlowEditor->LoadDataFlow" ) ;
890 // if ( !aMacroGraphDataFlowEditor->LoadDataFlow( &aListOfDataFlows[ 0 ] ) ) {
891 iobject = LoadDataFlows( aMacroGraphDataFlowEditor , aListOfDataFlows , 0 ) ;
892 if ( CORBA::is_nil( iobject ) ) {
893 MESSAGE("Graph_Impl::MNode LoadDataFlow failed" ) ;
897 // That graph is not a StreamGraph :
898 else if ( !aMacroGraphDataFlowEditor->Graph()->HasDataStream() ) {
899 aMacroGraphDataFlowEditor->Graph()->Kind( SUPERV::DataFlowGraph ) ;
900 aMacroGraphDataFlowEditor->Graph()->GraphEditor( aMacroGraphDataFlowEditor ) ;
902 Graph_Impl * myMacroGraph = (Graph_Impl * ) aMacroGraphDataFlowEditor->Graph()->ObjImpl() ;
903 // Creation of a GraphMacroNode in the current editor
904 string aMacroNodeName = string( "Macro_" ) + string( myMacroGraph->Name() ) ;
905 Graph_Impl * myMacroNode ;
906 myMacroNode = new Graph_Impl( _Orb , _Poa, _ContId,
907 instanceName() , interfaceName() ,
908 aMacroNodeName.c_str() , SUPERV::MacroNode ) ;
909 PortableServer::ObjectId * id = myMacroNode->getId() ;
910 CORBA::Object_var obj = _poa->id_to_reference(*id);
911 macroiobject = SUPERV::Graph::_narrow( obj ) ;
912 myMacroNode->DataFlowEditor( DataFlowEditor() ) ;
914 // Creation of the MacroNode itself in the current Graph
915 GraphBase::ListOfFuncName aFuncName ;
916 aFuncName.resize( 1 ) ;
918 SUPERV::ListOfStrings aListOfStrings ;
919 aListOfStrings.length( 1 ) ;
920 aListOfStrings[0] = "" ;
921 GraphBase::ListOfPythonFunctions aPythonFunction ;
922 aPythonFunction.resize( 1 ) ;
923 aPythonFunction[0] = &aListOfStrings ;
924 SALOME_ModuleCatalog::Service * aMacroNodeService = myMacroGraph->Service() ;
925 GraphEditor::InNode * aDataFlowNode = DataFlowEditor()->AddNode( *aMacroNodeService , "" , "" ,
926 aMacroNodeName.c_str() , SUPERV::MacroNode ,
927 aFuncName , aPythonFunction ) ;
928 aDataFlowNode->SetPythonFunction( "" , aListOfStrings ) ;
929 myMacroNode->DataFlowNode( aDataFlowNode ) ;
930 aDataFlowNode->ComputingNode()->SetService( *aMacroNodeService ) ;
931 aDataFlowNode->SetObjRef( SUPERV::CNode::_duplicate( SUPERV::CNode::_narrow( obj ) ) ) ;
932 aDataFlowNode->SetObjImpl( this ) ;
934 GraphBase::Graph * aGraph = myMacroGraph->DataFlowEditor()->Graph() ;
935 GraphBase::Graph * aGraphOfMacroGraph = myMacroNode->DataFlowEditor()->Graph() ;
936 GraphBase::Graph * aMacroGraph = myMacroNode->DataFlowNode()->GraphMacroNode() ;
937 aMacroGraph->Kind( SUPERV::MacroNode ) ;
938 aMacroGraph->GraphEditor( DataFlowEditor() ) ;
939 // Creation of the Ports of the MacroNode from the ports of the GraphMacroNode
940 aMacroGraph->SetMacroPorts( aGraph ) ;
941 // Valid ==> creation of Service and the ports of the current Graph
942 DataFlowEditor()->IsValid() ;
943 // Set the Input Datas from the GraphMacroNode to the current Graph
944 aMacroGraph->SetMacroDatas( aGraph , aGraphOfMacroGraph ) ;
945 aMacroGraphDataFlowEditor->UnValid() ;
946 // Set the MacroNode ObjRef in the GraphMacroNode
947 aGraph->CoupledNode( aMacroGraph ) ;
948 aGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ;
949 // Set the GraphMacroNode ObjRef in the MacroNode
950 aDataFlowNode->GraphMacroNode()->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ;
951 aMacroGraph->CoupledNode( aGraph ) ;
952 // aGraphOfMacroGraph->CoupledNode( aGraph ) ;
953 aMacroGraph->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ;
954 // aGraphOfMacroGraph->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ;
955 // aDataFlowNode->CoupledNode( aGraph ) ;
956 // aDataFlowNode->ComputingNode()->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ;
957 // Set the MacroLevel of that graph
958 aGraph->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ;
959 aMacroGraph->Coordinates( 0 , 0 ) ;
960 MESSAGE( "DataFlowNode Graph " << this << " DataFlowEditor " << DataFlowEditor() << " aDataFlowNode "
961 << aDataFlowNode << " " << aDataFlowNode->Name() << " created" ) ;
962 MESSAGE( "MNode aGraph " << aGraph << " " << aGraph->Name()
963 << " coupled to " << aGraph->CoupledNode() << " "
964 << aGraph->CoupledNode()->Name() ) ;
965 MESSAGE( "MNode aMacroGraph " << aMacroGraph << " " << aMacroGraph->Name()
966 << " coupled to " << aMacroGraph->CoupledNode() << " "
967 << aMacroGraph->CoupledNode()->Name() ) ;
968 MESSAGE( "MNode aMacroGraph " << myMacroNode->DataFlowEditor()->Graph() << " "
969 << myMacroNode->DataFlowEditor()->Graph()->Name()
970 << " coupled to " << myMacroNode->DataFlowEditor()->Graph()->CoupledNode() ) ;
973 delete aMacroGraphDataFlowEditor ;
976 endService( "Graph_Impl::MNode" );
977 return SUPERV::Graph::_duplicate( macroiobject ) ;
980 // For python supergraph
981 SUPERV::Graph_ptr Graph_Impl::GraphMNode( SUPERV::Graph_ptr myMacroGraph ) {
982 SUPERV::Graph_var iobject = myMacroGraph ;
983 beginService( "Graph_Impl::GraphMNode" ) ;
985 // GraphBase::Graph * myMacroGraph = aGraph;
986 SUPERV::Graph_var macroiobject = SUPERV::StreamGraph::_nil() ;
987 // Creation of a GraphMacroNode in the current editor
989 string aMacroNodeName = string( "Macro_" ) + string( myMacroGraph->Name() ) ;
990 //string aMacroNodeName = string( myMacroGraph->CoupledName() ) ;
991 MESSAGE( "GraphMNode( " << myMacroGraph->Name() << " )" ) ;
992 Graph_Impl * myMacroNode ;
993 myMacroNode = new Graph_Impl( _Orb , _Poa, _ContId,
994 instanceName() , interfaceName() ,
995 aMacroNodeName.c_str() , SUPERV::MacroNode ) ;
996 PortableServer::ObjectId * id = myMacroNode->getId() ;
997 CORBA::Object_var obj = _poa->id_to_reference(*id);
998 macroiobject = SUPERV::Graph::_narrow( obj ) ;
999 myMacroNode->DataFlowEditor( DataFlowEditor() ) ;
1001 // Creation of the MacroNode itself in the current Graph
1002 GraphBase::ListOfFuncName aFuncName ;
1003 aFuncName.resize( 1 ) ;
1005 SUPERV::ListOfStrings aListOfStrings ;
1006 aListOfStrings.length( 1 ) ;
1007 aListOfStrings[0] = "" ;
1008 GraphBase::ListOfPythonFunctions aPythonFunction ;
1009 aPythonFunction.resize( 1 ) ;
1010 aPythonFunction[0] = &aListOfStrings ;
1011 SALOME_ModuleCatalog::Service * aMacroNodeService = myMacroGraph->Service() ;
1012 GraphEditor::InNode * aDataFlowNode ;
1013 aDataFlowNode = DataFlowEditor()->AddNode( *aMacroNodeService , "" , "" ,
1014 aMacroNodeName.c_str() , SUPERV::MacroNode ,
1015 aFuncName , aPythonFunction ) ;
1016 aDataFlowNode->SetPythonFunction( "" , aListOfStrings ) ;
1017 myMacroNode->DataFlowNode( aDataFlowNode ) ;
1018 aDataFlowNode->ComputingNode()->SetService( *aMacroNodeService ) ;
1019 aDataFlowNode->SetObjRef( SUPERV::CNode::_duplicate( SUPERV::CNode::_narrow( obj ) ) ) ;
1020 aDataFlowNode->SetObjImpl( this ) ;
1022 // GraphBase::Graph * aGraph = DataFlowEditor()->Automaton()->MapGraph( myMacroGraph->Name() ) ;
1023 GraphBase::Graph * aGraph ;
1024 //DataFlowEditor()->Automaton()->GraphBase( &aGraph ) ;
1025 myMacroGraph->Coupled() ;
1026 GraphBase::Graph * aGraphOfMacroGraph = myMacroNode->DataFlowEditor()->Graph() ;
1027 GraphBase::Graph * aMacroGraph = myMacroNode->DataFlowNode()->GraphMacroNode() ;
1028 aMacroGraph->Kind( SUPERV::MacroNode ) ;
1029 aMacroGraph->GraphEditor( DataFlowEditor() ) ;
1030 // Creation of the Ports of the MacroNode from the ports of the GraphMacroNode
1031 aMacroGraph->SetMacroPorts( aGraph ) ;
1032 // Valid ==> creation of Service and the ports of the current Graph
1033 DataFlowEditor()->IsValid() ;
1034 // Set the Input Datas from the GraphMacroNode to the current Graph
1035 aMacroGraph->SetMacroDatas( aGraph , aGraphOfMacroGraph ) ;
1036 // aMacroGraphDataFlowEditor->UnValid() ;
1037 aGraph->GraphEditor()->UnValid() ;
1038 // Set the MacroNode ObjRef in the GraphMacroNode
1039 aGraph->CoupledNode( aMacroGraph ) ;
1040 aGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ;
1041 // Set the GraphMacroNode ObjRef in the MacroNode
1042 aDataFlowNode->GraphMacroNode()->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ;
1043 aMacroGraph->CoupledNode( aGraph ) ;
1044 aMacroGraph->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ;
1045 // aDataFlowNode->CoupledNode( aGraph ) ;
1046 // aDataFlowNode->ComputingNode()->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ;
1047 // Set the MacroLevel of that graph
1048 aGraph->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ;
1049 aMacroGraph->Coordinates( 0 , 0 ) ;
1050 MESSAGE( aGraph->Name() << "->CoupledNode()->GraphEditor() : " << aGraph->CoupledNode()->GraphEditor() ) ;
1051 MESSAGE( aMacroGraph->Name() << "->CoupledNode()->GraphEditor() : "
1052 << aMacroGraph->CoupledNode()->GraphEditor() ) ;
1053 MESSAGE( "DataFlowNode Graph " << this << " DataFlowEditor " << DataFlowEditor() << " aDataFlowNode "
1054 << aDataFlowNode << " " << aDataFlowNode->Name() << " created" ) ;
1056 endService( "Graph_Impl::GraphMNode" ) ;
1057 return SUPERV::Graph::_duplicate( macroiobject ) ;
1060 SUPERV::Graph_ptr Graph_Impl::FlowObjRef() {
1061 beginService( "Graph_Impl::FlowObjRef" );
1062 SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ;
1064 iobject = SUPERV::Graph::_narrow( DataFlowNode()->GraphMacroNode()->MacroObject() ) ;
1066 else if ( IsGraph() ) {
1067 iobject = SUPERV::Graph::_narrow( DataFlowEditor()->Graph()->MacroObject() ) ;
1069 if ( CORBA::is_nil( iobject ) ) {
1070 MESSAGE( "Graph_Impl::FlowObjRef() returns a NIL Object" ) ;
1072 endService( "Graph_Impl::FlowObjRef" );
1073 return SUPERV::Graph::_duplicate( iobject ) ;
1076 SUPERV::StreamGraph_ptr Graph_Impl::StreamObjRef() {
1077 beginService( "Graph_Impl::StreamObjRef" );
1078 SUPERV::StreamGraph_var iobject = SUPERV::StreamGraph::_nil() ;
1080 iobject = SUPERV::StreamGraph::_narrow( DataFlowNode()->GraphMacroNode()->MacroObject() ) ;
1082 else if ( IsGraph() || IsStreamGraph() ) {
1083 iobject = SUPERV::StreamGraph::_narrow( DataFlowEditor()->Graph()->MacroObject() ) ;
1085 if ( CORBA::is_nil( iobject ) ) {
1086 MESSAGE( "Graph_Impl::StreamObjRef() returns a NIL Object" ) ;
1088 endService( "Graph_Impl::StreamObjRef" );
1089 return SUPERV::StreamGraph::_duplicate( iobject ) ;
1092 SUPERV::CNode_ptr Graph_Impl::Node(char const * aNodeName ) {
1093 // beginService( "Graph_Impl::Node" );
1094 SUPERV::CNode_var iobject = SUPERV::CNode::_nil() ;
1096 if ( CORBA::is_nil( DataFlowEditor()->GetNode( aNodeName )->ObjRef() ) ) {
1097 CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId ,
1098 instanceName() , interfaceName() ,
1100 DataFlowEditor()->GetNode( aNodeName ) ) ;
1101 PortableServer::ObjectId * id = myNode->getId() ;
1102 CORBA::Object_var obj = _poa->id_to_reference(*id);
1103 iobject = SUPERV::CNode::_narrow(obj) ;
1104 myNode->SetObjRef( SUPERV::CNode::_duplicate( iobject ) ) ;
1107 iobject = DataFlowEditor()->GetNode( aNodeName )->ObjRef() ;
1110 GraphEditor::InNode * anInNode = DataFlowEditor()->GetNode( aNodeName ) ;
1112 if ( CORBA::is_nil( anInNode->ObjRef() ) ) {
1113 SetNodeObjRef( anInNode ) ;
1115 iobject = anInNode->ObjRef() ;
1118 // endService( "Graph_Impl::Node" );
1119 return SUPERV::CNode::_duplicate( iobject ) ;
1122 SUPERV::Link_ptr Graph_Impl::Link( SUPERV::Port_ptr OutPort ,
1123 SUPERV::Port_ptr InPort ) {
1124 // beginService( "Graph_Impl::Link" );
1125 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
1126 if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() &&
1127 !OutPort->IsDataStream() && !InPort->IsDataStream() && !IsMacro() ) {
1128 MESSAGE( "Graph_Impl::Link( " << OutPort->Node()->Name() << "( " << OutPort->Name() << " ) --> "
1129 << InPort->Node()->Name() << "( " << InPort->Name() << " )" ) ;
1130 GraphEditor::InNode * anInNode = DataFlowEditor()->GetNode( InPort->Node()->Name() ) ;
1131 GraphEditor::InNode * anOutNode = DataFlowEditor()->GetNode( OutPort->Node()->Name() ) ;
1132 if ( anInNode == NULL || anOutNode== NULL ) {
1133 MESSAGE( "Graph_Impl::Link( " << OutPort->Node()->Name() << " " << anOutNode << " , "
1134 << InPort->Node()->Name() << " " << anInNode << " ) Node(s) not found in " << Name() ) ;
1137 GraphBase::InPort * anInPort = anInNode->ComputingNode()->GetChangeInPort( InPort->Name() ) ;
1138 GraphBase::OutPort * anOutPort = anOutNode->ComputingNode()->GetChangeOutPort( OutPort->Name() ) ;
1139 if ( anInPort == NULL || anOutPort== NULL ) {
1140 MESSAGE( "Graph_Impl::Link( " << OutPort->Name() << " " << anOutPort << " , "
1141 << InPort->Name() << " " << anInPort << " ) Port(s) not found" ) ;
1143 else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
1144 const char * DataFlowOutNodeName = OutPort->Node()->Name() ;
1145 GraphEditor::InNode * DataFlowOutNode = DataFlowEditor()->GetNode( DataFlowOutNodeName ) ;
1146 const char * DataFlowInNodeName = InPort->Node()->Name() ;
1147 GraphEditor::InNode * DataFlowInNode = DataFlowEditor()->GetNode( DataFlowInNodeName ) ;
1148 if ( DataFlowOutNode && DataFlowInNode ) {
1150 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
1151 instanceName() , interfaceName() ,
1157 true , false , Success ) ;
1159 PortableServer::ObjectId * id = myLink->getId() ;
1160 CORBA::Object_var obj = _poa->id_to_reference(*id);
1161 iobject = SUPERV::Link::_narrow(obj) ;
1162 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
1167 iobject = anOutPort->InPortObjRef( anInPort ) ;
1171 DataFlowEditor()->UnValid() ;
1172 // endService( "Graph_Impl::Link" );
1173 return SUPERV::Link::_duplicate( iobject ) ;
1176 // Only to see MacroNodes with actual GUI ... :
1177 #define GOTOMacroNode 0
1179 void Graph_Impl::SetNodeObjRef( GraphEditor::InNode * anInNode ) {
1180 MESSAGE("Graph_Impl::SetNodeObjRef " << anInNode->Name() << " " << anInNode->Kind() ) ;
1181 CORBA::Object_var obj ;
1182 if ( anInNode->IsComputingNode() ) {
1183 CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId ,
1184 instanceName() , interfaceName() ,
1187 PortableServer::ObjectId * id = myNode->getId() ;
1188 obj = _poa->id_to_reference(*id);
1189 SUPERV::CNode_var iobject = SUPERV::CNode::_narrow(obj) ;
1190 myNode->SetObjRef( SUPERV::CNode::_duplicate( iobject ) ) ;
1192 else if ( anInNode->IsFactoryNode() ) {
1193 FNode_Impl * myNode = new FNode_Impl( _Orb , _Poa , _ContId ,
1194 instanceName() , interfaceName() ,
1197 PortableServer::ObjectId * id = myNode->getId() ;
1198 obj = _poa->id_to_reference(*id);
1199 SUPERV::FNode_var iobject = SUPERV::FNode::_narrow(obj) ;
1200 myNode->SetObjRef( SUPERV::FNode::_duplicate( iobject ) ) ;
1202 else if ( anInNode->IsInLineNode() ) {
1203 INode_Impl * myNode = new INode_Impl( _Orb , _Poa , _ContId ,
1204 instanceName() , interfaceName() ,
1207 PortableServer::ObjectId * id = myNode->getId() ;
1208 obj = _poa->id_to_reference(*id);
1209 SUPERV::INode_var iobject = SUPERV::INode::_narrow(obj) ;
1210 myNode->SetObjRef( SUPERV::INode::_duplicate( iobject ) ) ;
1213 else if ( anInNode->IsGOTONode() || anInNode->IsMacroNode() ) {
1214 if ( anInNode->IsMacroNode() ) {
1215 anInNode->ComputingNode()->Kind( SUPERV::GOTONode ) ;
1218 else if ( anInNode->IsGOTONode() ) {
1220 GNode_Impl * myNode = new GNode_Impl( _Orb , _Poa , _ContId ,
1221 instanceName() , interfaceName() ,
1224 PortableServer::ObjectId * id = myNode->getId() ;
1225 obj = _poa->id_to_reference(*id);
1226 SUPERV::GNode_var iobject = SUPERV::GNode::_narrow(obj) ;
1227 myNode->SetObjRef( SUPERV::GNode::_duplicate( iobject ) ) ;
1229 else if ( anInNode->IsMacroNode() ) {
1230 Graph_Impl * myNode = new Graph_Impl( _Orb , _Poa , _ContId ,
1231 instanceName() , interfaceName() ,
1234 PortableServer::ObjectId * id = myNode->getId() ;
1235 obj = _poa->id_to_reference(*id);
1236 SUPERV::Graph_var iobject = SUPERV::Graph::_narrow(obj) ;
1237 myNode->SetObjRef( SUPERV::Graph::_duplicate( iobject ) ) ;
1239 else if ( anInNode->IsLoopNode() ) {
1240 LNode_Impl * myNode = new LNode_Impl( _Orb , _Poa , _ContId ,
1241 instanceName() , interfaceName() ,
1244 PortableServer::ObjectId * id = myNode->getId() ;
1245 obj = _poa->id_to_reference(*id);
1246 SUPERV::LNode_var iobject = SUPERV::LNode::_narrow(obj) ;
1247 myNode->SetObjRef( SUPERV::LNode::_duplicate( iobject ) ) ;
1249 else if ( anInNode->IsEndLoopNode() ) {
1250 ELNode_Impl * myNode = new ELNode_Impl( _Orb , _Poa , _ContId ,
1251 instanceName() , interfaceName() ,
1254 PortableServer::ObjectId * id = myNode->getId() ;
1255 obj = _poa->id_to_reference(*id);
1256 SUPERV::ELNode_var iobject = SUPERV::ELNode::_narrow(obj) ;
1257 myNode->SetObjRef( SUPERV::ELNode::_duplicate( iobject ) ) ;
1259 else if ( anInNode->IsSwitchNode() ) {
1260 SNode_Impl * myNode = new SNode_Impl( _Orb , _Poa , _ContId ,
1261 instanceName() , interfaceName() ,
1264 PortableServer::ObjectId * id = myNode->getId() ;
1265 obj = _poa->id_to_reference(*id);
1266 SUPERV::SNode_var iobject = SUPERV::SNode::_narrow(obj) ;
1267 myNode->SetObjRef( SUPERV::SNode::_duplicate( iobject ) ) ;
1269 else if ( anInNode->IsEndSwitchNode() ) {
1270 ESNode_Impl * myNode = new ESNode_Impl( _Orb , _Poa , _ContId ,
1271 instanceName() , interfaceName() ,
1274 PortableServer::ObjectId * id = myNode->getId() ;
1275 obj = _poa->id_to_reference(*id);
1276 SUPERV::ESNode_var iobject = SUPERV::ESNode::_narrow(obj) ;
1277 myNode->SetObjRef( SUPERV::ESNode::_duplicate( iobject ) ) ;
1281 SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal ,
1282 GraphBase::ComputingNode * aNode ) {
1284 // if ( _DataFlowExecutor ) {
1285 if ( DataFlowExecutor() ) {
1286 MESSAGE("Graph_Impl::SetNode " << aNode->Name() << " " << aNode->Kind() << " "
1287 << DataFlowExecutor()->StateName( DataFlowExecutor()->AutomatonState( aNode->Name() ) ) ) ;
1290 MESSAGE("Graph_Impl::SetNode " << aNode->Name() << " " << aNode->Kind() ) ;
1292 if ( aNode->IsComputingNode() ) {
1293 index = RetVal->CNodes.length() ;
1294 RetVal->CNodes.length( index+1 );
1296 else if ( aNode->IsFactoryNode() ) {
1297 index = RetVal->FNodes.length() ;
1298 RetVal->FNodes.length( index+1 );
1300 else if ( aNode->IsInLineNode() ) {
1301 index = RetVal->INodes.length() ;
1302 RetVal->INodes.length( index+1 );
1305 else if ( aNode->IsGOTONode() || aNode->IsMacroNode() ) {
1307 else if ( aNode->IsGOTONode() ) {
1309 index = RetVal->GNodes.length() ;
1310 RetVal->GNodes.length( index+1 );
1312 else if ( aNode->IsMacroNode() ) {
1313 index = RetVal->Graphs.length() ;
1314 RetVal->Graphs.length( index+1 );
1316 else if ( aNode->IsLoopNode() ) {
1317 index = RetVal->LNodes.length() ;
1318 RetVal->LNodes.length( index+1 );
1320 else if ( aNode->IsEndLoopNode() ) {
1321 index = RetVal->ELNodes.length() ;
1322 RetVal->ELNodes.length( index+1 );
1324 else if ( aNode->IsSwitchNode() ) {
1325 index = RetVal->SNodes.length() ;
1326 RetVal->SNodes.length( index+1 );
1328 else if ( aNode->IsEndSwitchNode() ) {
1329 index = RetVal->ESNodes.length() ;
1330 RetVal->ESNodes.length( index+1 );
1332 if ( CORBA::is_nil( aNode->ObjRef() ) ) {
1333 SetNodeObjRef( (GraphEditor::InNode * ) aNode->GetInNode() ) ;
1335 SUPERV::CNode_var aNodeObjRef = aNode->ObjRef() ;
1336 if ( aNode->IsComputingNode() ) {
1337 RetVal->CNodes[index] = SUPERV::CNode::_duplicate( aNodeObjRef ) ;
1339 else if ( aNode->IsFactoryNode() ) {
1340 RetVal->FNodes[index] = SUPERV::FNode::_duplicate( SUPERV::FNode::_narrow( aNodeObjRef ) ) ;
1342 else if ( aNode->IsInLineNode() ) {
1343 RetVal->INodes[index] = SUPERV::INode::_duplicate( SUPERV::INode::_narrow( aNodeObjRef ) ) ;
1346 else if ( aNode->IsGOTONode() || aNode->IsMacroNode() ) {
1348 else if ( aNode->IsGOTONode() ) {
1350 RetVal->GNodes[index] = SUPERV::GNode::_duplicate( SUPERV::GNode::_narrow( aNodeObjRef ) ) ;
1352 else if ( aNode->IsMacroNode() ) {
1353 RetVal->Graphs[index] = SUPERV::Graph::_duplicate( SUPERV::Graph::_narrow( aNodeObjRef ) ) ;
1355 else if ( aNode->IsLoopNode() ) {
1356 RetVal->LNodes[index] = SUPERV::LNode::_duplicate( SUPERV::LNode::_narrow( aNodeObjRef ) ) ;
1358 else if ( aNode->IsEndLoopNode() ) {
1359 RetVal->ELNodes[index] = SUPERV::ELNode::_duplicate( SUPERV::ELNode::_narrow( aNodeObjRef ) ) ;
1361 else if ( aNode->IsSwitchNode() ) {
1362 RetVal->SNodes[index] = SUPERV::SNode::_duplicate( SUPERV::SNode::_narrow( aNodeObjRef ) ) ;
1364 else if ( aNode->IsEndSwitchNode() ) {
1365 RetVal->ESNodes[index] = SUPERV::ESNode::_duplicate( SUPERV::ESNode::_narrow( aNodeObjRef ) ) ;
1367 return ( RetVal._retn() ) ;
1370 SUPERV::ListOfNodes * Graph_Impl::Nodes() {
1371 SUPERV::ListOfNodes_var RetVal = new SUPERV::ListOfNodes;
1372 beginService( "Graph_Impl::Nodes" );
1373 RetVal->CNodes.length(0) ;
1374 RetVal->FNodes.length(0) ;
1375 RetVal->INodes.length(0) ;
1376 RetVal->LNodes.length(0) ;
1377 RetVal->SNodes.length(0) ;
1378 RetVal->GNodes.length(0) ;
1379 RetVal->Graphs.length(0) ;
1382 for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) {
1383 GraphBase::ComputingNode * aNode = DataFlowEditor()->Graph()->GraphNodes( i ) ;
1384 RetVal = SetNode( RetVal , aNode ) ;
1387 char * aStateG = "" ;
1388 if ( DataFlowExecutor() ) {
1389 aStateG = (char *) DataFlowExecutor()->StateName( DataFlowExecutor()->AutomatonState() ) ;
1391 MESSAGE("Graph_Impl::Nodes GraphState " << aStateG << " CNodes " << RetVal->CNodes.length() ) ;
1392 for ( i = 0 ; i < RetVal->CNodes.length() ; i++ ) {
1393 MESSAGE(" " << RetVal->CNodes[ i ] ->Name() ) ;
1395 MESSAGE("FNodes " << RetVal->FNodes.length() ) ;
1396 for ( i = 0 ; i < RetVal->FNodes.length() ; i++ ) {
1397 MESSAGE(" " << RetVal->FNodes[ i ] ->Name() ) ;
1399 MESSAGE("INodes " << RetVal->INodes.length() ) ;
1400 for ( i = 0 ; i < RetVal->INodes.length() ; i++ ) {
1401 MESSAGE(" " << RetVal->INodes[ i ] ->Name() ) ;
1403 MESSAGE("GNodes " << RetVal->GNodes.length() ) ;
1404 for ( i = 0 ; i < RetVal->GNodes.length() ; i++ ) {
1405 MESSAGE(" " << RetVal->GNodes[ i ] ->Name() ) ;
1407 MESSAGE("LNodes " << RetVal->LNodes.length() ) ;
1408 for ( i = 0 ; i < RetVal->LNodes.length() ; i++ ) {
1409 MESSAGE(" " << RetVal->LNodes[ i ] ->Name() ) ;
1411 MESSAGE("ELNodes " << RetVal->ELNodes.length() ) ;
1412 for ( i = 0 ; i < RetVal->ELNodes.length() ; i++ ) {
1413 MESSAGE(" " << RetVal->ELNodes[ i ] ->Name() ) ;
1415 MESSAGE("SNodes " << RetVal->SNodes.length() ) ;
1416 for ( i = 0 ; i < RetVal->SNodes.length() ; i++ ) {
1417 MESSAGE(" " << RetVal->SNodes[ i ] ->Name() ) ;
1419 MESSAGE("ESNodes " << RetVal->ESNodes.length() ) ;
1420 for ( i = 0 ; i < RetVal->ESNodes.length() ; i++ ) {
1421 MESSAGE(" " << RetVal->ESNodes[ i ] ->Name() ) ;
1423 MESSAGE("Graphs " << RetVal->Graphs.length() ) ;
1424 for ( i = 0 ; i < RetVal->Graphs.length() ; i++ ) {
1425 MESSAGE(" " << RetVal->Graphs[ i ] ->Name() ) ;
1427 if ( DataFlowExecutor() ) {
1428 DataFlowExecutor()->EventList() ;
1432 endService( "Graph_Impl::Nodes" );
1433 return ( RetVal._retn() ) ;
1436 SUPERV::ListOfLinks * Graph_Impl::GLinks() {
1437 return Links( NULL , NULL ) ;
1440 SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode ,
1441 const char * anInputParam ) {
1443 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
1444 RetVal->length( 0 ) ;
1446 int i , j , countlink ;
1448 for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) {
1449 GraphEditor::InNode * aNode = NULL ;
1450 aNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GraphNodes( i )->GetInNode() ;
1451 bool ToProcess = false ;
1452 if ( theNode == NULL ) {
1456 if ( !strcmp( theNode->Name() , aNode->Name() ) ) {
1457 if ( !theNode->IsEndSwitchNode() ) {
1461 else if ( theNode->IsEndSwitchNode() ) {
1466 for ( j = 0 ; j < aNode->GetNodeInPortsSize() ; j++ ) {
1467 GraphBase::InPort * anInPort = NULL ;
1468 anInPort = aNode->GetChangeNodeInPort( j ) ;
1469 if ( anInputParam == NULL ||
1470 !strcmp( anInPort->PortName() , anInputParam ) ) {
1471 GraphBase::OutPort * anOutPort = NULL ;
1472 anOutPort = anInPort->GetOutPort() ;
1473 if ( anOutPort && !anOutPort->IsDataStream() ) {
1474 if ( strcmp( anOutPort->NodeName() , Name() ) ) {
1475 // MESSAGE("Graph_Impl::Links " << anOutPort->NodeName() << "("
1476 // << anOutPort->PortName() << ") --> " << aNode->Name() << "("
1477 // << anInPort->PortName() << ")" ) ;
1478 if ( theNode == NULL ||
1479 ( theNode != NULL && !theNode->IsEndSwitchNode() &&
1480 !strcmp( theNode->Name() , aNode->Name() ) ) ) {
1481 if ( anInPort->IsLoop() || anOutPort->IsLoop() ||
1482 ( aNode->IsEndLoopNode() && !strcmp( aNode->CoupledNode()->Name() ,
1483 anOutPort->NodeName() ) ) ) {
1484 // MESSAGE( "Link " << anOutPort->NodeName() << "("
1485 // << anOutPort->PortName() << ") --> " << aNode->Name() << "("
1486 // << anInPort->PortName() << ")" << " ignored" ) ;
1488 else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
1490 beginService( "Graph_Impl::Links" );
1493 GraphEditor::InNode * anOutNode = NULL ;
1494 anOutNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anOutPort->NodeName() )->GetInNode() ;
1497 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
1498 instanceName() , interfaceName() ,
1501 anInPort->PortName() ,
1503 anOutPort->PortName() ,
1504 false , true , Success ) ;
1506 PortableServer::ObjectId * id = myLink->getId() ;
1507 CORBA::Object_var obj = _poa->id_to_reference(*id);
1508 SUPERV::Link_var iobject ;
1509 iobject = SUPERV::Link::_narrow(obj) ;
1510 RetVal->length( countlink + 1 ) ;
1511 RetVal[ countlink++ ] = SUPERV::Link::_duplicate( iobject ) ;
1512 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
1517 RetVal->length( countlink + 1 ) ;
1518 RetVal[ countlink++ ] = SUPERV::Link::_duplicate( anOutPort->InPortObjRef( anInPort ) ) ;
1520 // MESSAGE( "Link " << anOutPort->NodeName() << "("
1521 // << anOutPort->PortName() << ") --> " << aNode->Name() << "("
1522 // << anInPort->PortName() << ")" << " selected" ) ;
1525 // MESSAGE( "Link " << anOutPort->NodeName() << "("
1526 // << anOutPort->PortName() << ") --> " << aNode->Name() << "("
1527 // << anInPort->PortName() << ")" << " skipped" ) ;
1534 for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
1535 GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( j ) ;
1536 // MESSAGE( "Graph_Impl::Links " << aNode->Name() << " Out" << j << " " << anOutPort->PortName() << " "
1537 // << anOutPort->PortStatus() << " PortConnected to " << anOutPort->InPortsSize() << " InPorts" ) ;
1539 for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) {
1540 GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ;
1541 // MESSAGE( " --> In" << k << " " << anInPort->NodeName() << " " << anInPort->PortName()
1542 // << " " << anInPort->PortStatus() ) ;
1543 if ( anInPort->IsPortConnected() ) {
1544 GraphBase::ComputingNode * aComputingNode = DataFlowEditor()->Graph()->GetChangeGraphNode( anInPort->NodeName() ) ;
1545 GraphEditor::InNode * toNode = (GraphEditor::InNode * ) aComputingNode->GetInNode() ;
1546 if ( theNode == NULL ||
1547 !strcmp( theNode->Name() , aNode->Name() ) ) {
1548 if ( !anInPort->IsDataStream() ) {
1549 if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) {
1550 if ( anInputParam == NULL ||
1551 !strcmp( anInPort->PortName() , anInputParam ) ) {
1552 if ( anInPort->IsLoop() || anOutPort->IsLoop() ||
1553 ( toNode->IsEndLoopNode() && !strcmp( toNode->CoupledNode()->Name() ,
1554 anOutPort->NodeName() ) ) ) {
1555 // MESSAGE( "Link " << anOutPort->NodeName() << "("
1556 // << anOutPort->PortName() << ") --> " << toNode->Name() << "("
1557 // << anInPort->PortName() << ")" << " ignored" ) ;
1559 else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
1561 beginService( "Graph_Impl::Links" );
1565 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
1566 instanceName() , interfaceName() ,
1569 anInPort->PortName() ,
1571 anOutPort->PortName() ,
1572 false , true , Success ) ;
1574 PortableServer::ObjectId * id = myLink->getId() ;
1575 CORBA::Object_var obj = _poa->id_to_reference(*id);
1576 SUPERV::Link_var iobject ;
1577 iobject = SUPERV::Link::_narrow(obj) ;
1578 RetVal->length( countlink + 1 ) ;
1579 RetVal[ countlink++ ] = SUPERV::Link::_duplicate( iobject ) ;
1580 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
1584 RetVal->length( countlink + 1 ) ;
1585 RetVal[ countlink++ ] = SUPERV::Link::_duplicate( SUPERV::Link::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ;
1587 // MESSAGE( "Link " << anOutPort->NodeName() << "("
1588 // << anOutPort->PortName() << ") --> " << toNode->Name() << "("
1589 // << anInPort->PortName() << ")" << " selected" ) ;
1592 // MESSAGE( "Link " << anOutPort->NodeName() << "("
1593 // << anOutPort->PortName() << ") --> " << toNode->Name() << "("
1594 // << anInPort->PortName() << ")" << " skipped" ) ;
1605 const char * NodeName = "" ;
1606 const char * InputParamName = "" ;
1608 NodeName = theNode->Name() ;
1610 if ( anInputParam ) {
1611 InputParamName = anInputParam ;
1613 MESSAGE( RetVal->length() << " Links of Node " << NodeName << " and of InPort " << InputParamName ) ;
1614 for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) {
1615 MESSAGE( "Link " << RetVal[i]->OutPort()->Node()->Name() << "("
1616 << RetVal[i]->OutPort()->Name() << ") --> "
1617 << RetVal[i]->InPort()->Node()->Name() << "("
1618 << RetVal[i]->InPort()->Name() << ")" ) ;
1622 endService( "Graph_Impl::Links" );
1625 return ( RetVal._retn() ) ;
1628 Engines::Component_ptr Graph_Impl::ComponentRef( const char * aComputerContainer ,
1629 const char * aComponentName ) {
1630 Engines::Component_var objComponent = Engines::Component::_nil() ;
1632 Engines::Container_var myContainer ;
1633 DataFlowEditor()->Graph()->StartComponent( 0 , aComputerContainer , aComponentName ,
1634 myContainer , objComponent ) ;
1636 return Engines::Component::_duplicate( objComponent ) ;
1639 bool Graph_Impl::IsValid() {
1640 // beginService( "Graph_Impl::IsValid" );
1641 bool RetVal = false ;
1643 RetVal = DataFlowEditor()->IsValid() ;
1645 // endService( "Graph_Impl::IsValid" );
1648 bool Graph_Impl::IsExecutable() {
1649 // beginService( "Graph_Impl::IsExecutable" );
1650 bool RetVal = false ;
1652 // asv : 15.11.04 : added "&& GraphMacroLevel() == 0" ->
1653 // subgraphs are not executable by themselves, RetVal = false..
1654 if ( !IsMacro() && DataFlowEditor()->Graph()->GraphMacroLevel() == 0 ) {
1655 RetVal = DataFlowEditor()->IsExecutable() ;
1657 // endService( "Graph_Impl::IsExecutable" );
1661 bool Graph_Impl::IsEditing() {
1663 bool RetVal = false ;
1665 RetVal = DataFlowEditor()->IsEditing() ;
1671 return !IsExecuting();
1674 bool Graph_Impl::IsExecuting() {
1676 bool RetVal = false ;
1678 RetVal = !DataFlowEditor()->IsEditing() ;
1682 return CNode_Impl::IsExecuting();
1685 bool Graph_Impl::IsReadOnly() {
1686 // beginService( "Graph_Impl::IsExecuting" );
1687 bool RetVal = false ;
1689 RetVal = DataFlowEditor()->IsReadOnly() ;
1691 // endService( "Graph_Impl::IsExecuting" );
1695 long Graph_Impl::LevelMax() {
1696 // beginService( "Graph_Impl::LevelMax" );
1699 RetVal = DataFlowEditor()->LevelMax() ;
1701 // endService( "Graph_Impl::LevelMax" );
1704 SUPERV::ListOfNodes * Graph_Impl::LevelNodes(long aLevel ) {
1705 // beginService( "Graph_Impl::LevelNodes" );
1706 SUPERV::ListOfNodes_var RetVal = new SUPERV::ListOfNodes;
1709 SUPERV::ListOfStrings_var Nodes = DataFlowEditor()->LevelNodes( aLevel ) ;
1710 // RetVal->length( Nodes->length() );
1711 for ( i = 0 ; i < (int ) Nodes->length() ; i++ ) {
1712 // char * aNode = Nodes[ i ] ;
1713 GraphBase::ComputingNode * aNode = DataFlowEditor()->Graph()->GetChangeGraphNode( Nodes[ i ] ) ;
1714 RetVal = SetNode( RetVal , aNode ) ;
1715 // cout << "Graph_Impl::LevelNodes( " << aLevel << " ) " << aNode->Name() << endl ;
1716 // CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId ,
1717 // instanceName() , interfaceName() ,
1718 // DataFlowEditor() ,
1719 // (GraphEditor::InNode * ) DataFlowEditor()->GetChangeGraphNode( aNode )->GetInNode() ) ;
1720 // PortableServer::ObjectId * id = myNode->getId() ;
1721 // CORBA::Object_var obj = _poa->id_to_reference(*id);
1722 // SUPERV::CNode_var iobject ;
1723 // iobject = SUPERV::CNode::_narrow(obj) ;
1724 // RetVal[i] = SUPERV::CNode::_duplicate( iobject ) ;
1727 // endService( "Graph_Impl::LevelNodes" );
1728 return ( RetVal._retn() ) ;
1730 long Graph_Impl::ThreadsMax() {
1731 // beginService( "Graph_Impl::ThreadsMax" );
1734 RetVal = DataFlowEditor()->ThreadsMax() ;
1736 // endService( "Graph_Impl::ThreadsMax" );
1739 long Graph_Impl::Threads() {
1740 // beginService( "Node_Impl::Threads" );
1741 long RetVal = false ;
1743 RetVal = DataFlowExecutor()->Threads() ;
1745 // endService( "Node_Impl::Threads" );
1748 long Graph_Impl::SuspendedThreads() {
1749 // beginService( "Node_Impl::SuspendedThreads" );
1750 long RetVal = false ;
1752 RetVal = DataFlowExecutor()->SuspendedThreads() ;
1754 // endService( "Node_Impl::SuspendedThreads" );
1758 bool Graph_Impl::Begin() {
1759 bool RetVal = false ;
1760 if ( DataFlowEditor()->IsEditing() ) {
1761 if ( pthread_mutex_lock( &_MutexExecutorWait ) ) {
1762 perror("pthread_mutex_lock _MutexExecutorWait") ;
1765 if ( DataFlowExecutor() ) {
1766 MESSAGE( "Graph_Impl::Begin " << DataFlowExecutor()->Threads() << " threads" )
1767 Editing(); // just in case it was not called before by GUI..
1769 if ( DataFlowEditor()->IsExecutable() ) {
1770 DataFlowEditor()->EditedAfterExecution( false ) ;
1771 GraphBase::ListOfSGraphs * myListOfGraphs = DataFlowEditor()->GetDataFlows() ;
1773 GraphExecutor::DataFlow * aDataFlowExecutor ;
1775 CreateExecutor( _Orb , instanceName() , (*myListOfGraphs)[ 0 ].Info.theName.c_str() , Kind() ,
1776 dbgfile , &aDataFlowExecutor ) ;
1778 MESSAGE( "Graph_Impl::Begin : DataFlowExecutor created" );
1779 if ( !CORBA::is_nil( LoadDataFlows( aDataFlowExecutor, myListOfGraphs , 0 ) ) )
1783 DataFlowExecutor()->Graph()->SetObjImpl( DataFlowEditor()->Graph()->ObjImpl() ) ;
1786 if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) {
1787 perror("pthread_mutex_unlock _MutexExecutorWait") ;
1795 * run() : was created in order to reduce code dublication, Run() and Start() do the same thing
1796 * except for final call to Executor->Run( bool ) - Run() calls with AndSuspend=false
1797 * and Start() calls with AndSuspend=true flag. The rest of the actions are the same:
1798 * 1. if a MacroNode's coupled graph (MacroLevel>0) -> simply Run() it.
1799 * 2. if a Supergraph -> create executor, load dataflow in it (done in Begin()), then - Run() it.
1801 bool Graph_Impl::run( const bool andSuspend ) {
1802 bool RetVal = false ;
1804 // if Editing or Finished state, and, naturally, 'this' is not a MacroNode.
1805 if ( ( DataFlowEditor()->IsEditing() || IsDone() ) && !IsMacro() ) {
1807 if ( DataFlowEditor()->Graph()->GraphMacroLevel() ) {
1808 // MacroGraph's Executor was created in recursive function LoadDataflows(Executor), called from
1809 // Begin() of Supergraph. See Begin() and LoadDataflows(Executor) for details.
1813 // Create Executor instance and its datamodel
1817 // Set Executing flag to avoid edition operations during execution, EditedAfterExecution=false
1818 DataFlowEditor()->Executing() ;
1819 DataFlowEditor()->EditedAfterExecution( false );
1821 // THE MAIN RUN METHOD
1822 RetVal = DataFlowExecutor()->Run( andSuspend );
1830 * Run() - called on "Execute" command
1832 bool Graph_Impl::Run() {
1833 beginService( "Graph_Impl::Run" );
1834 bool RetVal = run( /*andSuspend=*/false ) ;
1835 MESSAGE( "Graph_Impl::Run " << DataFlowEditor()->Graph()->Name() << " RetVal " << RetVal ) ;
1836 endService( "Graph_Impl::Run" );
1841 * Run() - called on "Execute step-by-step" command
1843 bool Graph_Impl::Start() {
1844 beginService( "Graph_Impl::Start" );
1845 bool RetVal = run( /*andSuspend=*/true ) ;
1846 MESSAGE( "Graph_Impl::Start " << DataFlowEditor()->Graph()->Name() << " RetVal " << RetVal ) ;
1847 endService( "Graph_Impl::Start" );
1851 bool Graph_Impl::EventNoW( SUPERV::CNode_out aNode ,
1852 SUPERV::GraphEvent & anEvent ,
1853 SUPERV::GraphState & aState ) {
1854 bool RetVal = false ;
1855 char * aNodeName = NULL ;
1856 SUPERV::GraphEvent theEvent = SUPERV::UndefinedEvent ;
1857 SUPERV::GraphState theState = SUPERV::UndefinedState ;
1858 if ( pthread_mutex_lock( &_MutexExecutorWait ) ) {
1859 perror("pthread_mutex_lock _MutexExecutorWait") ;
1862 if ( DataFlowExecutor() && !IsMacro() &&
1863 ( DataFlowExecutor()->GetListSize() || !DataFlowEditor()->IsEditing() ) ) {
1864 RetVal = DataFlowExecutor()->Event( & aNodeName , theEvent , theState , false ) ;
1865 // endService( "Graph_Impl::Event" );
1866 if ( strlen( aNodeName ) ) {
1867 if ( strcmp( aNodeName , Name() ) ) {
1868 aNode = Node( aNodeName ) ;
1875 aNode = SUPERV::Graph::_duplicate( SUPERV::Graph::_nil() ) ;
1877 // cout << "Graph_Impl::EventNoW " << aNode->Name() << " QSize " << DataFlowExecutor()->GetListSize() << endl ;
1880 // cout << "Graph_Impl::EventNoW NO DataFlowExecutor() or QSize=0 " << endl ;
1882 if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) {
1883 perror("pthread_mutex_unlock _MutexExecutorWait") ;
1886 anEvent = theEvent ;
1891 bool Graph_Impl::Event( SUPERV::CNode_out aNode ,
1892 SUPERV::GraphEvent & anEvent ,
1893 SUPERV::GraphState & aState ) {
1894 // beginService( "Graph_Impl::Event" );
1895 bool RetVal = false ;
1896 char * aNodeName = NULL ;
1897 SUPERV::GraphEvent theEvent = SUPERV::UndefinedEvent ;
1898 SUPERV::GraphState theState = SUPERV::UndefinedState ;
1899 if ( pthread_mutex_lock( &_MutexExecutorWait ) ) {
1900 perror("pthread_mutex_lock _MutexExecutorWait") ;
1903 if ( DataFlowExecutor() && !IsMacro() &&
1904 ( DataFlowExecutor()->GetListSize() || !DataFlowEditor()->IsEditing() ) ){
1905 RetVal = DataFlowExecutor()->Event( & aNodeName , theEvent , theState ) ;
1906 // endService( "Graph_Impl::Event" );
1907 if ( strlen( aNodeName ) ) {
1908 if ( strcmp( aNodeName , Name() ) ) {
1909 aNode = Node( aNodeName ) ;
1916 aNode = SUPERV::Graph::_duplicate( SUPERV::Graph::_nil() ) ;
1918 // cout << "Graph_Impl::Event " << aNode->Name() << " QSize " << DataFlowExecutor()->GetListSize() << endl ;
1921 // cout << "Graph_Impl::Event NO DataFlowExecutor() or QSize=0 " << endl ;
1923 if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) {
1924 perror("pthread_mutex_unlock _MutexExecutorWait") ;
1927 anEvent = theEvent ;
1933 bool Graph_Impl::EventW( SUPERV::CNode_out aNode ,
1934 SUPERV::GraphEvent & anEvent ,
1935 SUPERV::GraphState & aState ) {
1936 // beginService( "Graph_Impl::EventW" );
1937 bool RetVal = false ;
1938 char * aNodeName = NULL ;
1939 SUPERV::GraphEvent theEvent = SUPERV::UndefinedEvent ;
1940 SUPERV::GraphState theState = SUPERV::UndefinedState ;
1941 if ( pthread_mutex_lock( &_MutexExecutorWait ) ) {
1942 perror("pthread_mutex_lock _MutexExecutorWait") ;
1945 if ( DataFlowExecutor() && !IsMacro() &&
1946 ( DataFlowExecutor()->GetListSize() || !DataFlowEditor()->IsEditing() ) ) {
1947 RetVal = DataFlowExecutor()->EventW( & aNodeName , theEvent , theState ) ;
1948 if ( RetVal && strcmp( aNodeName , Name() ) ) {
1949 aNode = Node( aNodeName ) ;
1955 if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) {
1956 perror("pthread_mutex_unlock _MutexExecutorWait") ;
1959 anEvent = theEvent ;
1961 // endService( "Graph_Impl::EventW" );
1965 long Graph_Impl::EventQSize() {
1966 // beginService( "Graph_Impl::EventQSize" );
1968 if ( pthread_mutex_lock( &_MutexExecutorWait ) ) {
1969 perror("pthread_mutex_lock _MutexExecutorWait") ;
1972 if ( DataFlowExecutor() && !IsMacro() ) {
1973 QSize = DataFlowExecutor()->EventQSize() ;
1975 if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) {
1976 perror("pthread_mutex_unlock _MutexExecutorWait") ;
1979 // endService( "Graph_Impl::EventQSize" );
1983 long Graph_Impl::LastLevelDone() {
1984 // beginService( "Graph_Impl::LastLevelDone" );
1985 if ( pthread_mutex_lock( &_MutexExecutorWait ) ) {
1986 perror("pthread_mutex_lock _MutexExecutorWait") ;
1990 if ( DataFlowExecutor() && !IsMacro() ) {
1991 RetVal = DataFlowExecutor()->LastLevelDone() ;
1993 if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) {
1994 perror("pthread_mutex_unlock _MutexExecutorWait") ;
1997 // endService( "Graph_Impl::LastLevelDone" );
2001 long Graph_Impl::SubGraphsNumber() {
2002 // beginService( "Graph_Impl::SubGraphsNumber" );
2004 if ( DataFlowEditor()->IsExecutable() && !IsMacro() ) {
2005 RetVal = DataFlowEditor()->SubGraphsNumber() ;
2007 // endService( "Graph_Impl::SubGraphsNumber" );
2011 SUPERV::ListOfNodes * Graph_Impl::SubGraphsNodes( const long aSubGraphNumber ) {
2012 beginService( "Graph_Impl::SubGraphsNodes" );
2013 SUPERV::ListOfNodes_var RetVal = new SUPERV::ListOfNodes ;
2014 if ( DataFlowEditor()->IsEditing() && !IsMacro() ) {
2015 SUPERV::ListOfNodes * aGraphNodes = Nodes() ;
2018 for ( i = 0 ; i < (int ) aGraphNodes->CNodes.length() ; i++ ) {
2019 SUPERV::CNode_var aNode = (aGraphNodes->CNodes)[ i ] ;
2020 if ( aNode->SubGraph() == aSubGraphNumber ) {
2021 RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
2025 for ( i = 0 ; i < (int ) aGraphNodes->FNodes.length() ; i++ ) {
2026 SUPERV::FNode_var aNode = (aGraphNodes->FNodes)[ i ] ;
2027 if ( aNode->SubGraph() == aSubGraphNumber ) {
2028 RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
2032 for ( i = 0 ; i < (int ) aGraphNodes->INodes.length() ; i++ ) {
2033 SUPERV::INode_var aNode = (aGraphNodes->INodes)[ i ] ;
2034 if ( aNode->SubGraph() == aSubGraphNumber ) {
2035 RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
2039 for ( i = 0 ; i < (int ) aGraphNodes->GNodes.length() ; i++ ) {
2040 SUPERV::GNode_var aNode = (aGraphNodes->GNodes)[ i ] ;
2041 if ( aNode->SubGraph() == aSubGraphNumber ) {
2042 RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
2046 for ( i = 0 ; i < (int ) aGraphNodes->LNodes.length() ; i++ ) {
2047 SUPERV::LNode_var aNode = (aGraphNodes->LNodes)[ i ] ;
2048 if ( aNode->SubGraph() == aSubGraphNumber ) {
2049 RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
2053 for ( i = 0 ; i < (int ) aGraphNodes->ELNodes.length() ; i++ ) {
2054 SUPERV::ELNode_var aNode = (aGraphNodes->ELNodes)[ i ] ;
2055 if ( aNode->SubGraph() == aSubGraphNumber ) {
2056 RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
2060 for ( i = 0 ; i < (int ) aGraphNodes->SNodes.length() ; i++ ) {
2061 SUPERV::SNode_var aNode = (aGraphNodes->SNodes)[ i ] ;
2062 if ( aNode->SubGraph() == aSubGraphNumber ) {
2063 RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
2067 for ( i = 0 ; i < (int ) aGraphNodes->ESNodes.length() ; i++ ) {
2068 SUPERV::ESNode_var aNode = (aGraphNodes->ESNodes)[ i ] ;
2069 if ( aNode->SubGraph() == aSubGraphNumber ) {
2070 RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
2074 endService( "Graph_Impl::SubGraphsNodes" );
2075 return ( RetVal._retn() ) ;
2078 bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) {
2079 // beginService( "Graph_Impl::Merge" );
2080 bool RetVal = true ;
2082 map< string , int > aMapOfNodes ;
2083 RetVal = Merge( aGraph , aMapOfNodes ) ;
2085 // endService( "Graph_Impl::Merge" );
2089 bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aMapOfNodes ) {
2090 beginService( "Graph_Impl::Merge" );
2091 bool RetVal = true ;
2092 if ( DataFlowEditor()->IsEditing() && !IsMacro() ) {
2093 SUPERV::ListOfNodes * aGraphNodes = aGraph->Nodes() ;
2095 SUPERV::Port_ptr aPort ;
2096 // SUPERV::StreamPort_ptr aStreamPort ;
2098 for ( i = 0 ; i < (int ) aGraphNodes->CNodes.length() ; i++ ) {
2099 SUPERV::CNode_var aNode = (aGraphNodes->CNodes)[ i ] ;
2100 SUPERV::CNode_ptr myNode = CNode( *(aNode->Service()) ) ;
2101 if ( !CORBA::is_nil( myNode ) ) {
2102 myNode->SetName( aNode->Name() ) ;
2103 myNode->SetAuthor( aNode->Author() ) ;
2104 myNode->SetComment( aNode->Comment() ) ;
2105 myNode->Coords( aNode->X() , aNode->Y() ) ;
2106 string * aNodetheName = new string( aNode->Name() ) ;
2107 aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ;
2108 delete aNodetheName ;
2115 // The following informations are now in the service from SALOME_ModuleCatalog
2116 // SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ;
2118 // for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) {
2119 // if ( myStreamPorts[ j ]->IsInput() && myStreamPorts[ j ]->IsDataStream() ) {
2120 // aStreamPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , myStreamPorts[ j ]->Type() ) ;
2122 // else if ( myStreamPorts[ j ]->IsDataStream() ) {
2123 // aStreamPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , myStreamPorts[ j ]->Type() ) ;
2129 for ( i = 0 ; i < (int ) aGraphNodes->FNodes.length() ; i++ ) {
2130 SUPERV::FNode_var aNode = (aGraphNodes->FNodes)[ i ] ;
2131 SUPERV::FNode_ptr myNode = FNode( aNode->GetComponentName() ,
2132 aNode->GetInterfaceName() ,
2133 *(aNode->Service()) ) ;
2134 if ( !CORBA::is_nil( myNode ) ) {
2135 myNode->SetName( aNode->Name() ) ;
2136 myNode->SetAuthor( aNode->Author() ) ;
2137 myNode->SetComment( aNode->Comment() ) ;
2138 myNode->Coords( aNode->X() , aNode->Y() ) ;
2139 string * aNodetheName = new string( aNode->Name() ) ;
2140 aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ;
2141 delete aNodetheName ;
2148 // The following informations are now in the service from SALOME_ModuleCatalog
2149 // SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ;
2151 // for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) {
2152 // if ( myStreamPorts[ j ]->IsInput() && myStreamPorts[ j ]->IsDataStream() ) {
2153 // aStreamPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , myStreamPorts[ j ]->Type() ) ;
2155 // else if ( myStreamPorts[ j ]->IsDataStream() ) {
2156 // aStreamPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , myStreamPorts[ j ]->Type() ) ;
2163 for ( i = 0 ; i < (int ) aGraphNodes->INodes.length() ; i++ ) {
2164 SUPERV::INode_var aNode = (aGraphNodes->INodes)[ i ] ;
2165 SUPERV::INode_ptr myNode = INode( aNode->PyFuncName() , *(aNode->PyFunction()) ) ;
2166 if ( !CORBA::is_nil( myNode ) ) {
2167 myNode->SetName( aNode->Name() ) ;
2168 myNode->SetAuthor( aNode->Author() ) ;
2169 myNode->SetComment( aNode->Comment() ) ;
2170 myNode->Coords( aNode->X() , aNode->Y() ) ;
2171 string * aNodetheName = new string( aNode->Name() ) ;
2172 aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ;
2173 delete aNodetheName ;
2174 SUPERV::ListOfPorts myPorts = *(aNode->Ports()) ;
2176 for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) {
2177 if ( myPorts[ j ]->IsInput() ) {
2178 aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
2181 aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
2184 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
2185 SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ;
2186 for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) {
2187 if ( myStreamPorts[ j ]->IsInput() ) {
2188 aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ;
2191 aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ;
2205 for ( i = 0 ; i < (int ) aGraphNodes->GNodes.length() ; i++ ) {
2206 SUPERV::GNode_var aNode = (aGraphNodes->GNodes)[ i ] ;
2207 SUPERV::GNode_ptr myNode = GNode( aNode->PyFuncName() , *(aNode->PyFunction()) , aNode->Coupled()->Name() ) ;
2208 if ( !CORBA::is_nil( myNode ) ) {
2209 myNode->SetName( aNode->Name() ) ;
2210 myNode->SetAuthor( aNode->Author() ) ;
2211 myNode->SetComment( aNode->Comment() ) ;
2212 myNode->Coords( aNode->X() , aNode->Y() ) ;
2213 string * aNodetheName = new string( aNode->Name() ) ;
2214 aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ;
2215 delete aNodetheName ;
2216 SUPERV::ListOfPorts myPorts = *(aNode->Ports()) ;
2218 for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) {
2219 if ( myPorts[ j ]->IsInput() ) {
2220 aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
2223 aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
2226 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
2227 SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ;
2228 for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) {
2229 if ( myStreamPorts[ j ]->IsInput() ) {
2230 aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ;
2233 aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ;
2247 for ( i = 0 ; i < (int ) aGraphNodes->LNodes.length() ; i++ ) {
2248 SUPERV::LNode_var aNode = (aGraphNodes->LNodes)[ i ] ;
2249 SUPERV::INode_ptr anEndOfLoop ;
2250 SUPERV::LNode_ptr myNode = LNode( aNode->PyInitName() ,
2251 *(aNode->PyInit()) ,
2252 aNode->PyMoreName() ,
2253 *(aNode->PyMore()) ,
2254 aNode->PyNextName() ,
2255 *(aNode->PyNext()) ,
2257 if ( !CORBA::is_nil( myNode ) ) {
2258 myNode->SetName( aNode->Name() ) ;
2259 myNode->SetAuthor( aNode->Author() ) ;
2260 myNode->SetComment( aNode->Comment() ) ;
2261 myNode->Coords( aNode->X() , aNode->Y() ) ;
2262 string * aNodetheName = new string( aNode->Name() ) ;
2263 aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ;
2264 delete aNodetheName ;
2265 SUPERV::ListOfPorts myPorts = *(aNode->Ports()) ;
2267 for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) {
2268 if ( myPorts[ j ]->IsInput() ) {
2269 aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
2272 aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
2275 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
2276 SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ;
2277 for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) {
2278 if ( myStreamPorts[ j ]->IsInput() ) {
2279 aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ;
2282 aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ;
2286 SUPERV::INode_ptr myEndOfLoop = aNode->Coupled() ;
2287 anEndOfLoop->SetName( myEndOfLoop->Name() ) ;
2288 anEndOfLoop->SetAuthor( myEndOfLoop->Author() ) ;
2289 anEndOfLoop->SetComment( myEndOfLoop->Comment() ) ;
2290 anEndOfLoop->Coords( myEndOfLoop->X() , myEndOfLoop->Y() ) ;
2291 anEndOfLoop->SetPyFunction( myEndOfLoop->PyFuncName() , *(myEndOfLoop->PyFunction()) ) ;
2292 aNodetheName = new string( myEndOfLoop->Name() ) ;
2293 aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( anEndOfLoop->Name() ) ;
2294 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
2295 SUPERV::ListOfStreamPorts myStreamLoopPorts = *(myEndOfLoop->StreamPorts()) ;
2296 for ( j = 0 ; j < (int ) myStreamLoopPorts.length() ; j++ ) {
2297 if ( myStreamLoopPorts[ j ]->IsInput() ) {
2298 aPort = myNode->InStreamPort( myStreamLoopPorts[ j ]->Name() , StringToDataStreamType( myStreamLoopPorts[ j ]->Type() ) , myStreamLoopPorts[ j ]->Dependency() ) ;
2301 aPort = myNode->OutStreamPort( myStreamLoopPorts[ j ]->Name() , StringToDataStreamType( myStreamLoopPorts[ j ]->Type() ) , myStreamLoopPorts[ j ]->Dependency() ) ;
2305 delete aNodetheName ;
2316 for ( i = 0 ; i < (int ) aGraphNodes->SNodes.length() ; i++ ) {
2317 SUPERV::SNode_var aNode = (aGraphNodes->SNodes)[ i ] ;
2318 SUPERV::INode_ptr anEndOfSwitch ;
2319 SUPERV::SNode_ptr myNode = SNode( aNode->PyFuncName() , *(aNode->PyFunction()) , anEndOfSwitch ) ;
2320 if ( !CORBA::is_nil( myNode ) ) {
2321 myNode->SetName( aNode->Name() ) ;
2322 myNode->SetAuthor( aNode->Author() ) ;
2323 myNode->SetComment( aNode->Comment() ) ;
2324 myNode->Coords( aNode->X() , aNode->Y() ) ;
2325 string * aNodetheName = new string( aNode->Name() ) ;
2326 aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ;
2327 delete aNodetheName ;
2328 SUPERV::ListOfPorts myPorts = *(aNode->Ports()) ;
2330 for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) {
2331 if ( myPorts[ j ]->IsInput() ) {
2332 aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
2335 aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
2338 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
2339 SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ;
2340 for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) {
2341 if ( myStreamPorts[ j ]->IsInput() ) {
2342 aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ;
2345 aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ;
2349 SUPERV::INode_ptr myEndOfSwitch = aNode->Coupled() ;
2350 anEndOfSwitch->SetName( myEndOfSwitch->Name() ) ;
2351 anEndOfSwitch->SetAuthor( myEndOfSwitch->Author() ) ;
2352 anEndOfSwitch->SetComment( myEndOfSwitch->Comment() ) ;
2353 anEndOfSwitch->Coords( myEndOfSwitch->X() , myEndOfSwitch->Y() ) ;
2354 anEndOfSwitch->SetPyFunction( myEndOfSwitch->PyFuncName() , *(myEndOfSwitch->PyFunction()) ) ;
2355 aNodetheName = new string( myEndOfSwitch->Name() ) ;
2356 aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( anEndOfSwitch->Name() ) ;
2357 delete aNodetheName ;
2358 myPorts = *(myEndOfSwitch->Ports()) ;
2359 for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) {
2360 if ( myPorts[ j ]->IsInput() ) {
2361 aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
2364 aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
2367 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
2368 SUPERV::ListOfStreamPorts myStreamSwitchPorts = *(myEndOfSwitch->StreamPorts()) ;
2369 for ( j = 0 ; j < (int ) myStreamSwitchPorts.length() ; j++ ) {
2370 if ( myStreamSwitchPorts[ j ]->IsInput() ) {
2371 aPort = myNode->InStreamPort( myStreamSwitchPorts[ j ]->Name() , StringToDataStreamType( myStreamSwitchPorts[ j ]->Type() ) , myStreamSwitchPorts[ j ]->Dependency() ) ;
2374 aPort = myNode->OutStreamPort( myStreamSwitchPorts[ j ]->Name() , StringToDataStreamType( myStreamSwitchPorts[ j ]->Type() ) , myStreamSwitchPorts[ j ]->Dependency() ) ;
2387 SUPERV::ListOfLinks * aGraphLinks = aGraph->GLinks() ;
2388 SUPERV::ListOfPorts * aGraphPorts = aGraph->Ports() ;
2389 // cout << "Graph_Impl::Merge " << aGraphLinks->length() << " links " << aGraphPorts->length() << " GraphPorts"
2391 for ( i = 0 ; i < (int ) aGraphLinks->length() ; i++ ) {
2392 SUPERV::Link_var aLink = (*aGraphLinks)[ i ] ;
2393 SUPERV::Port_var OutPort = aLink->OutPort() ;
2394 SUPERV::Port_var InPort = aLink->InPort() ;
2395 string * aLinkFromNodeName = new string( OutPort->Node()->Name() ) ;
2396 string * aLinkToNodeName = new string( InPort->Node()->Name() ) ;
2397 RetVal = DataFlowEditor()->AddLink( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
2399 DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
2403 for ( j = 1 ; j <= aLink->CoordsSize() ; j++ ) {
2405 RetVal = aLink->Coords( j , X , Y ) ;
2408 RetVal = DataFlowEditor()->AddLinkCoord( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
2410 DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
2418 delete aLinkFromNodeName ;
2419 delete aLinkToNodeName ;
2425 for ( i = 0 ; i < (int ) aGraphPorts->length() ; i++ ) {
2426 SUPERV::Port_var aPort = (*aGraphPorts)[ i ] ;
2427 if ( !aPort->IsGate() ) {
2428 MESSAGE( "Graph_Impl::Merge " << i << ". " << aPort->Node()->Name() << " " << aPort->Name() ) ;
2429 char * aPortName = aPort->Name() ;
2430 char * aNodeName = new char[ strlen( aPortName ) + 1 ] ;
2431 strcpy( aNodeName , aPortName ) ;
2432 // char * thePortName = strchr( aNodeName , '\\' ) ;
2433 char * thePortName = aNodeName ;
2434 while ( ( thePortName = strchr( thePortName , '_' ) ) ) {
2435 if ( thePortName[1] == '_' ) {
2436 thePortName[ 0 ] = '\0' ;
2440 thePortName = &thePortName[2] ;
2443 bool hasinput = aGraph->Node( aNodeName )->Port( thePortName + 2 )->HasInput() ;
2444 // cout << "Graph_Impl::Merge " << " aNodeName " << aNodeName << " aPort " << thePortName + 1
2445 // << " HasInput " << hasinput << endl ;
2447 RetVal = DataFlowEditor()->AddInputData( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aNodeName ] )->Name() ,
2449 *(aPort->ToAny()) ) ;
2451 delete [] aNodeName ;
2460 MESSAGE( "Graph_Impl::Merge returns " << RetVal ) ;
2461 endService( "Graph_Impl::Merge" );
2465 SUPERV::StreamGraph_ptr Graph_Impl::ToStreamGraph() {
2466 SUPERV::StreamGraph_var iobject = SUPERV::StreamGraph::_nil() ;
2467 beginService( "Graph_Impl::ToStreamGraph" );
2468 if ( IsStreamGraph() && !IsMacro() ) {
2469 // StreamGraph_Impl * myStreamGraph = new StreamGraph_Impl( _Orb , _Poa , _ContId ,
2470 // instanceName() , interfaceName() ) ;
2471 // PortableServer::ObjectId * id = myStreamGraph->getId() ;
2472 // CORBA::Object_var obj = _poa->id_to_reference(*id);
2473 iobject = SUPERV::StreamGraph::_narrow( ObjRef() ) ;
2474 if ( CORBA::is_nil( iobject ) ) {
2475 MESSAGE( "ToStreamGraph of " << Name() << " (IsStreamGraph) --> nil reference" ) ;
2479 MESSAGE( "ToStreamGraph of " << Name() << " (IsNOTStreamGraph) --> nil reference" ) ;
2481 endService( "Graph_Impl::ToStreamGraph" );
2482 return SUPERV::StreamGraph::_duplicate( iobject ) ;
2486 * Destroy Executor and use only Editor and its data model
2488 void Graph_Impl::Editing() {
2489 if ( DataFlowEditor() && DataFlowExecutor() ) {
2490 delete DataFlowExecutor() ;
2491 DataFlowEditor()->Executor( NULL );