Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[modules/superv.git] / src / Supervision / CNode_Impl.cxx
1 //  SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : CNode_Impl.cxx
8 //  Author : Jean Rahuel
9 //  Module : SUPERV
10 //  $Header: 
11
12 using namespace std;
13 #include <stdio.h>
14 #include <fstream>
15 //#include <sstream>
16 #include <string>
17
18 //#include "utilities.h"
19
20 #include "StreamGraph_Impl.hxx"
21
22 #include "CNode_Impl.hxx"
23
24 #include "StreamPort_Impl.hxx"
25
26 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
27                         PortableServer::POA_ptr poa ,
28                         PortableServer::ObjectId * contId , 
29                         const char *instanceName ,
30                         const char *interfaceName ,
31                         const char *aDataFlowName ) :
32   Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
33 //  MESSAGE("CNode_Impl::CNode_Impl activate object instanceName("
34 //          << instanceName << ") interfaceName(" << interfaceName << ") --> "
35 //          << hex << (void *) this << dec )
36 //  _thisObj = this ;
37 //  _id = _poa->activate_object(_thisObj);
38 //  MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
39   beginService( "CNode_Impl::CNode_Impl" );
40   _Orb = CORBA::ORB::_duplicate(orb);
41   _Poa = poa ;
42   _ContId = contId ;
43   _DataFlowNode = NULL ;
44   _IsNode = false ;
45   endService( "CNode_Impl::CNode_Impl" );  
46 }
47
48 CNode_Impl::CNode_Impl() {
49 }
50
51 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
52                         PortableServer::POA_ptr poa ,
53                         PortableServer::ObjectId * contId , 
54                         const char *instanceName ,
55                         const char *interfaceName ,
56                         GraphEditor::DataFlow * DataFlowEditor ,
57                         const SALOME_ModuleCatalog::Service &NodeService ,
58                         const char * NodeName ,
59                         const SUPERV::KindOfNode NodeKindOfNode ,
60                         const char * FuncName  ,
61                         const SUPERV::ListOfStrings & PythonFunction ) :
62   Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
63   beginService( "CNode_Impl::CNode_Impl" );
64 //  cout << "CNode_Impl::CNode_Impl -->" << endl ;
65 //  if ( FuncName && NodeName ) {
66 //    cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
67 //         << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
68 //         << " " << strlen( FuncName ) << endl ;
69 //  }
70   if ( NodeKindOfNode == SUPERV::ComputingNode ) {
71     MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
72     _thisObj = this ;
73     _id = _poa->activate_object(_thisObj);
74   }
75   _Orb = CORBA::ORB::_duplicate(orb);
76   _Poa = poa ;
77   _ContId = contId ;
78   _DataFlowEditor = DataFlowEditor ;
79   GraphBase::ListOfFuncName aFuncName ;
80   GraphBase::ListOfPythonFunctions aPythonFunction ;
81   if ( FuncName ) {
82     aFuncName.resize(1) ;
83     aFuncName[0] = my_strdup( FuncName ) ;
84     aPythonFunction.resize(1) ;
85     aPythonFunction[0] = &PythonFunction ;
86   }
87   _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName ,
88                                             NodeKindOfNode ,
89                                             aFuncName ,
90                                             aPythonFunction ) ;
91   _IsNode = true ;
92   endService( "CNode_Impl::CNode_Impl" );  
93 //  cout << "<-- CNode_Impl::CNode_Impl" << endl ;
94 }
95
96 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
97                         PortableServer::POA_ptr poa ,
98                         PortableServer::ObjectId * contId , 
99                         const char *instanceName ,
100                         const char *interfaceName ,
101                         GraphEditor::DataFlow * DataFlowEditor ,
102                         const SALOME_ModuleCatalog::Service &NodeService ,
103                         const char * NodeName ,
104                         const SUPERV::KindOfNode NodeKindOfNode ,
105                         const GraphBase::ListOfFuncName & aFuncName  ,
106                         const GraphBase::ListOfPythonFunctions & aPythonFunction ) :
107   Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
108   MESSAGE( NodeName << " " );
109   beginService( "CNode_Impl::CNode_Impl" );
110   if ( NodeName ) {
111     MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ;
112   }
113   if ( NodeKindOfNode == SUPERV::ComputingNode ) {
114     MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" );
115     _thisObj = this ;
116     _id = _poa->activate_object(_thisObj);
117   }
118   _Orb = CORBA::ORB::_duplicate(orb);
119   _Poa = poa ;
120   _ContId = contId ;
121   _DataFlowEditor = DataFlowEditor ;
122   _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName ,
123                                             NodeKindOfNode ,
124                                             aFuncName ,
125                                             aPythonFunction ) ;
126   _IsNode = true ;
127   endService( "CNode_Impl::CNode_Impl" );  
128 }
129
130 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
131                         PortableServer::POA_ptr poa ,
132                         PortableServer::ObjectId * contId , 
133                         const char *instanceName ,
134                         const char *interfaceName ,
135                         GraphEditor::DataFlow * DataFlowEditor ,
136                         GraphEditor::InNode * DataFlowNode ) :
137   Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
138   MESSAGE( DataFlowNode->Name() << " " );
139   beginService( "CNode_Impl::CNode_Impl" );
140   if ( DataFlowNode->IsComputingNode() ) {
141     MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" );
142     _thisObj = this ;
143     _id = _poa->activate_object(_thisObj);
144   }
145   else {
146     MESSAGE( "CNode_Impl::CNode_Impl NO _poa->activate_object " );
147   }
148   _Orb = CORBA::ORB::_duplicate(orb);
149   _Poa = poa ;
150   _ContId = contId ;
151   _DataFlowEditor = DataFlowEditor ;
152   _DataFlowNode = DataFlowNode ;
153   _IsNode = true ;
154   endService( "CNode_Impl::CNode_Impl" );  
155 }
156
157 CNode_Impl::~CNode_Impl() {
158   beginService( "CNode_Impl::~CNode_Impl" );
159   endService( "CNode_Impl::~CNode_Impl" );
160 }
161
162 void CNode_Impl::destroy() {
163   beginService( "CNode_Impl::Destroy" );
164   if ( _DataFlowEditor->IsEditing() ) {
165     if ( Delete() ) {
166       _DataFlowNode = NULL ;
167       _poa->deactivate_object(*_id) ;
168       CORBA::release(_poa) ;
169       delete(_id) ;
170       _thisObj->_remove_ref();
171     }
172   }
173 //  endService( "CNode_Impl::Destroy" );
174 }
175
176 bool CNode_Impl::Delete() {
177   beginService( "CNode_Impl::Delete" );
178   bool RetVal = false ;
179   if ( _DataFlowEditor->IsEditing() ) {
180     RetVal = _DataFlowEditor->RemoveNode( Name() ) ;
181     if ( RetVal ) {
182       RetVal = _DataFlowEditor->UnValid() ;
183     }
184   }
185   endService( "CNode_Impl::Delete" );
186   return RetVal ;
187 }
188
189 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
190 //  beginService( "CNode_Impl::Service" );
191   SALOME_ModuleCatalog::Service * RetVal ;
192   if ( _IsNode ) {
193     RetVal = new SALOME_ModuleCatalog::Service( *_DataFlowNode->GetService() ) ;
194   }
195   else {
196     RetVal = new SALOME_ModuleCatalog::Service( *_DataFlowEditor->GetService() ) ;
197   }
198 //  endService( "CNode_Impl::Service" );
199   return RetVal ;
200 }
201
202 char * CNode_Impl::Name() {
203 //  beginService( "CNode_Impl::Name" );
204   char * RetVal = NULL ;
205   if ( _IsNode ) {
206     RetVal = _DataFlowNode->Name() ;
207   }
208   else {
209     RetVal = _DataFlowEditor->Graph()->Name() ;
210   }
211 //  endService( "CNode_Impl::Name" );
212   return CORBA::string_dup( RetVal );
213 }
214 bool CNode_Impl::SetName( const char * aDataFlowName ) {
215 //  beginService( "CNode_Impl::SetName" );
216   bool RetVal = false ;
217   if ( _DataFlowEditor->IsEditing() ) {
218     if ( _IsNode ) {
219       RetVal = _DataFlowEditor->ReNameNode( _DataFlowNode->Name() ,
220                                             aDataFlowName ) ;
221     }
222     else {
223       RetVal = _DataFlowEditor->Graph()->Name( aDataFlowName ) ;
224     }
225   }
226 //  endService( "CNode_Impl::SetName" );
227   return RetVal ;
228 }
229 SUPERV::KindOfNode CNode_Impl::Kind() {
230 //  beginService( "CNode_Impl::Kind" );
231   SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
232   if ( _IsNode ) {
233     RetVal = _DataFlowNode->Kind() ;
234   }
235   else {
236     RetVal = _DataFlowEditor->Graph()->Kind() ;
237   }
238 //  endService( "CNode_Impl::Kind" );
239   return RetVal ;
240 }
241 bool CNode_Impl::IsGraph() {
242 //  beginService( "CNode_Impl::IsGraph" );
243   bool RetVal = false ;
244   if ( _IsNode ) {
245     RetVal = _DataFlowNode->IsDataFlowNode() ;
246   }
247   else {
248     RetVal = _DataFlowEditor->Graph()->IsDataFlowNode() ;
249   }
250 //  endService( "CNode_Impl::IsGraph" );
251   return RetVal ;
252 }
253 bool CNode_Impl::IsStreamGraph() {
254 //  beginService( "CNode_Impl::IsStreamGraph" );
255   bool RetVal = false ;
256   if ( _IsNode ) {
257     RetVal = _DataFlowNode->IsDataStreamNode() ;
258   }
259   else {
260     RetVal = _DataFlowEditor->Graph()->IsDataStreamNode() ;
261   }
262 //  endService( "CNode_Impl::IsStreamGraph" );
263   return RetVal ;
264 }
265 bool CNode_Impl::IsComputing() {
266 //  beginService( "CNode_Impl::IsComputing" );
267   bool RetVal = SUPERV::UnknownNode ;
268   if ( _IsNode ) {
269     RetVal = _DataFlowNode->IsComputingNode() ;
270   }
271   else {
272     RetVal = _DataFlowEditor->Graph()->IsComputingNode() ;
273   }
274 //  endService( "CNode_Impl::IsComputing" );
275   return RetVal ;
276 }
277 bool CNode_Impl::IsFactory() {
278 //  beginService( "CNode_Impl::IsFactory" );
279   bool RetVal = SUPERV::UnknownNode ;
280   if ( _IsNode ) {
281     RetVal = _DataFlowNode->IsFactoryNode() ;
282   }
283   else {
284     RetVal = _DataFlowEditor->Graph()->IsFactoryNode() ;
285   }
286 //  endService( "CNode_Impl::IsFactory" );
287   return RetVal ;
288 }
289 bool CNode_Impl::IsInLine() {
290 //  beginService( "CNode_Impl::IsInLine" );
291   bool RetVal = SUPERV::UnknownNode ;
292   if ( _IsNode ) {
293     RetVal = _DataFlowNode->IsInLineNode() ;
294   }
295   else {
296     RetVal = _DataFlowEditor->Graph()->IsInLineNode() ;
297   }
298 //  endService( "CNode_Impl::IsInLine" );
299   return RetVal ;
300 }
301 bool CNode_Impl::IsGOTO() {
302 //  beginService( "CNode_Impl::IsGOTO" );
303   bool RetVal = SUPERV::UnknownNode ;
304   if ( _IsNode ) {
305     RetVal = _DataFlowNode->IsGOTONode() ;
306   }
307   else {
308     RetVal = _DataFlowEditor->Graph()->IsGOTONode() ;
309   }
310 //  endService( "CNode_Impl::IsGOTO" );
311   return RetVal ;
312 }
313 bool CNode_Impl::IsLoop() {
314 //  beginService( "CNode_Impl::IsLoop" );
315   bool RetVal = SUPERV::UnknownNode ;
316   if ( _IsNode ) {
317     RetVal = _DataFlowNode->IsLoopNode() ;
318   }
319   else {
320     RetVal = _DataFlowEditor->Graph()->IsLoopNode() ;
321   }
322 //  endService( "CNode_Impl::IsLoop" );
323   return RetVal ;
324 }
325 bool CNode_Impl::IsEndLoop() {
326 //  beginService( "CNode_Impl::IsEndLoop" );
327   bool RetVal = SUPERV::UnknownNode ;
328   if ( _IsNode ) {
329     RetVal = _DataFlowNode->IsEndLoopNode() ;
330   }
331   else {
332     RetVal = _DataFlowEditor->Graph()->IsEndLoopNode() ;
333   }
334 //  endService( "CNode_Impl::IsEndLoop" );
335   return RetVal ;
336 }
337 bool CNode_Impl::IsSwitch() {
338 //  beginService( "CNode_Impl::IsSwitch" );
339   bool RetVal = SUPERV::UnknownNode ;
340   if ( _IsNode ) {
341     RetVal = _DataFlowNode->IsSwitchNode() ;
342   }
343   else {
344     RetVal = _DataFlowEditor->Graph()->IsSwitchNode() ;
345   }
346 //  endService( "CNode_Impl::IsSwitch" );
347   return RetVal ;
348 }
349 bool CNode_Impl::IsEndSwitch() {
350 //  beginService( "CNode_Impl::IsEndSwitch" );
351   bool RetVal = SUPERV::UnknownNode ;
352   if ( _IsNode ) {
353     RetVal = _DataFlowNode->IsEndSwitchNode() ;
354   }
355   else {
356     RetVal = _DataFlowEditor->Graph()->IsEndSwitchNode() ;
357   }
358 //  endService( "CNode_Impl::IsEndSwitch" );
359   return RetVal ;
360 }
361
362 SUPERV::SDate CNode_Impl::CreationDate() {
363 //  beginService( "CNode_Impl::CreationDate" );
364   SUPERV::SDate_var RetVal ;
365   if ( _IsNode ) {
366     RetVal = new SUPERV::SDate( _DataFlowNode->FirstCreation() ) ;
367   }
368   else {
369 //    cout << " CNode_Impl::CreationDate " << _DataFlowEditor->FirstCreation()
370 //         << endl ;
371     RetVal = new SUPERV::SDate( _DataFlowEditor->Graph()->FirstCreation() ) ;
372   }
373 //  endService( "CNode_Impl::CreationDate" );
374   return (RetVal._retn()) ;
375 }
376 SUPERV::SDate CNode_Impl::LastUpdateDate() {
377 //  beginService( "CNode_Impl::LastUpdateDate" );
378   SUPERV::SDate_var RetVal ;
379   if ( _IsNode ) {
380     RetVal = new SUPERV::SDate( _DataFlowNode->LastModification() ) ;
381   }
382   else {
383     RetVal = new SUPERV::SDate( _DataFlowEditor->Graph()->LastModification() ) ;
384   }
385 //  endService( "CNode_Impl::LastUpdateDate" );
386   return  (RetVal._retn()) ;
387 }
388 char * CNode_Impl::Version() {
389 //  beginService( "CNode_Impl::Version" );
390   char * RetVal ;
391   if ( _IsNode ) {
392     RetVal = _DataFlowNode->EditorRelease() ;
393   }
394   else {
395     RetVal = _DataFlowEditor->Graph()->EditorRelease() ;
396   }
397 //  endService( "CNode_Impl::Version" );
398   return CORBA::string_dup( RetVal ) ;
399 }
400 char * CNode_Impl::Author() {
401 //  beginService( "CNode_Impl::Author" );
402   char * RetVal ;
403   if ( _IsNode ) {
404     RetVal = _DataFlowNode->Author() ;
405   }
406   else {
407     RetVal = _DataFlowEditor->Graph()->Author() ;
408   }
409 //  endService( "CNode_Impl::Author" );
410   return CORBA::string_dup( RetVal ) ;
411 }
412 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
413 //  beginService( "CNode_Impl::SetAuthor" );
414   bool RetVal = false ;
415   if ( _DataFlowEditor->IsEditing() ) {
416     if ( _IsNode ) {
417       RetVal = _DataFlowNode->Author( aDataFlowAuthor ) ;
418     }
419     else {
420       RetVal = _DataFlowEditor->Graph()->Author( aDataFlowAuthor ) ;
421     }
422   }
423 //  endService( "CNode_Impl::SetAuthor" );
424   return RetVal ;
425 }
426 char * CNode_Impl::Comment() {
427 //  beginService( "CNode_Impl::Comment" );
428   char * RetVal ;
429   if ( _IsNode ) {
430     RetVal = _DataFlowNode->Comment() ;
431   }
432   else {
433     RetVal = _DataFlowEditor->Graph()->Comment() ;
434   }
435 //  endService( "CNode_Impl::Comment" );
436   return CORBA::string_dup( RetVal ) ;
437 }
438 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
439 //  beginService( "CNode_Impl::SetComment" );
440   bool RetVal = false ;
441   if ( _DataFlowEditor->IsEditing() ) {
442     if ( _IsNode ) {
443       RetVal = _DataFlowNode->Comment( aDataFlowComment ) ;
444     }
445     else {
446       RetVal = _DataFlowEditor->Graph()->Comment( aDataFlowComment ) ;
447     }
448   }
449 //  endService( "CNode_Impl::SetComment" );
450   return RetVal ;
451 }
452
453 void CNode_Impl::Coords(long X , long Y ) {
454 //  beginService( "CNode_Impl::Coords" );
455   if ( _DataFlowEditor->IsEditing() ) {
456     if ( _IsNode ) {
457       ((GraphEditor::InNode *) _DataFlowNode)->Coordinates( X , Y ) ;
458     }
459     else {
460       _DataFlowEditor->Graph()->Coordinates( X , Y ) ;
461     }
462   }
463 //  endService( "CNode_Impl::Coords" );
464 }
465 long CNode_Impl::X() {
466 //  beginService( "CNode_Impl::X" );
467   long RetVal ;
468   if ( _IsNode ) {
469     RetVal = _DataFlowNode->XCoordinate() ;
470   }
471   else {
472     RetVal = _DataFlowEditor->Graph()->XCoordinate() ;
473   }
474 //  endService( "CNode_Impl::X" );
475   return RetVal ;
476 }
477 long CNode_Impl::Y() {
478 //  beginService( "CNode_Impl::Y" );
479   long RetVal ;
480   if ( _IsNode ) {
481     RetVal = _DataFlowNode->YCoordinate() ;
482   }
483   else {
484     RetVal = _DataFlowEditor->Graph()->YCoordinate() ;
485   }
486 //  endService( "CNode_Impl::Y" );
487   return RetVal ;
488 }
489
490 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
491   bool begin = true ;
492   Port_Impl * myPort = NULL ;
493   SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
494   bool aninport ;
495   if ( _IsNode ) {
496     aninport = _DataFlowNode->GetInPort( ServiceParameterName ) ;
497   }
498   else {
499     aninport = _DataFlowEditor->GetInPort( ServiceParameterName ) ;
500   }  
501   bool anoutport ;
502   if ( _IsNode ) {
503     anoutport = _DataFlowNode->GetOutPort( ServiceParameterName ) ;
504   }
505   else {
506     anoutport = _DataFlowEditor->GetOutPort( ServiceParameterName ) ;
507   }
508   if ( aninport ) {
509     GraphBase::InPort * anInPort ;
510     if ( _IsNode ) {
511       anInPort = _DataFlowNode->GetChangeInPort( ServiceParameterName ) ;
512     }
513     else {
514       anInPort = _DataFlowEditor->GetChangeInPort( ServiceParameterName ) ;
515     }
516     if ( anInPort->IsDataStream() ) {
517       MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
518     }
519     else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
520       if ( begin ) {
521         beginService( "CNode_Impl::Port" );
522         begin = false ;
523       }
524       bool hasinput ;
525       if ( _IsNode ) {
526         hasinput = _DataFlowNode->HasInput( anInPort->PortName() ) ;
527       }
528       else {
529         hasinput = _DataFlowEditor->HasInput( anInPort->PortName() ) ;
530       }
531       if ( hasinput ) {
532         const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
533         myPort = new Port_Impl( _Orb , _Poa , _ContId ,
534                                 instanceName() , interfaceName() ,
535                                 _DataFlowEditor ,
536                                 _DataFlowNode ,
537 //                                ServiceParameterName ,
538                                 (GraphBase::Port * ) anInPort ,
539                                 true ,
540                                 anAny ) ;
541       }
542       else {
543         myPort = new Port_Impl( _Orb , _Poa , _ContId ,
544                                 instanceName() , interfaceName() ,
545                                 _DataFlowEditor ,
546                                 _DataFlowNode ,
547 //                                ServiceParameterName ) ;
548                                 (GraphBase::Port * ) anInPort ,
549                                 true ) ;
550       }
551       PortableServer::ObjectId * id = myPort->getId() ;
552       CORBA::Object_var obj = _poa->id_to_reference(*id);
553       iobject = SUPERV::Port::_narrow(obj) ;
554       anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
555     }
556     else {
557       iobject = anInPort->ObjRef() ;
558     }
559   }
560   else if ( anoutport ) {
561     GraphBase::OutPort * anOutPort ;
562     if ( _IsNode ) {
563       anOutPort = _DataFlowNode->GetChangeOutPort( ServiceParameterName ) ;
564     }
565     else {
566       anOutPort = _DataFlowEditor->GetChangeOutPort( ServiceParameterName ) ;
567     }
568     if ( anOutPort->IsDataStream() ) {
569       MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
570     }
571     else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
572       if ( begin ) {
573         beginService( "CNode_Impl::Port" );
574         begin = false ;
575       }
576       const CORBA::Any * anAny = anOutPort->Value() ;
577       myPort = new Port_Impl( _Orb , _Poa , _ContId ,
578                               instanceName() , interfaceName() ,
579                               _DataFlowEditor ,
580                               _DataFlowNode ,
581 //                              ServiceParameterName ,
582                               (GraphBase::Port * ) anOutPort ,
583                               false ,
584                               anAny ) ;
585       PortableServer::ObjectId * id = myPort->getId() ;
586       CORBA::Object_var obj = _poa->id_to_reference(*id);
587       iobject = SUPERV::Port::_narrow(obj) ;
588       anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
589     }
590     else {
591       iobject = anOutPort->ObjRef() ;
592     }
593   }
594   if ( !begin ) {
595     endService( "CNode_Impl::Port" );
596   }
597   DataFlowEditor()->UnValid() ;
598   return SUPERV::Port::_duplicate( iobject ) ;
599 }
600
601 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
602                                     const SUPERV::Value_ptr aValue ) {
603   bool begin = true ;
604   SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
605   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
606   bool sts = false ;
607   GraphBase::InPort * anInPort = NULL ;
608   if ( _DataFlowEditor->IsEditing() ) {
609     if ( _IsNode ) {
610       sts = _DataFlowEditor->AddInputData( _DataFlowNode->Name() ,
611                                            ToServiceParameterName ,
612                                            *aValue->ToAny() ) ;
613       anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
614     }
615     else {
616       sts = _DataFlowEditor->AddInputData( _DataFlowEditor->Graph()->Name() ,
617                                            ToServiceParameterName ,
618                                            *aValue->ToAny() ) ;
619       anInPort = _DataFlowEditor->Graph()->GetChangeInPort( ToServiceParameterName ) ;
620     }
621     if ( sts && anInPort ) {
622       if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
623         if ( begin ) {
624           beginService( "CNode_Impl::Input" );
625           begin = false ;
626         }
627         Port_Impl * myPort ;
628         myPort = new Port_Impl( _Orb , _Poa , _ContId ,
629                                 instanceName() , interfaceName() ,
630                                 _DataFlowEditor ,
631                                 _DataFlowNode ,
632 //                                ToServiceParameterName ,
633                                 (GraphBase::Port * ) anInPort ,
634                                 true ,
635                                 aValue->ToAny() ) ;
636         PortableServer::ObjectId * id = myPort->getId() ;
637         CORBA::Object_var obj = _poa->id_to_reference(*id);
638         iobject = SUPERV::Port::_narrow(obj) ;
639         anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
640       }
641       else {
642         iobject = anInPort->ObjRef() ;
643       }
644     }
645   }
646   else if ( _DataFlowExecutor ) {
647     if ( _IsNode ) {
648       sts = _DataFlowExecutor->ChangeInputData( _DataFlowNode->Name() ,
649                                                 ToServiceParameterName ,
650                                                 *aValue->ToAny() ) ;
651       anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
652     }
653     else {
654       sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Graph()->Name() ,
655                                                 ToServiceParameterName ,
656                                                 *aValue->ToAny() ) ;
657       anInPort = _DataFlowEditor->Graph()->GetChangeInPort( ToServiceParameterName ) ;
658     }
659     if ( sts && anInPort ) {
660       if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
661         if ( begin ) {
662           beginService( "CNode_Impl::Input" );
663           begin = false ;
664         }
665         Port_Impl * myPort ;
666         myPort = new Port_Impl( _Orb , _Poa , _ContId ,
667                                 instanceName() , interfaceName() ,
668                                 _DataFlowEditor ,
669                                 _DataFlowNode ,
670 //                                ToServiceParameterName ,
671                                 (GraphBase::Port * ) anInPort ,
672                                 true ,
673                                 aValue->ToAny() ) ;
674         PortableServer::ObjectId * id = myPort->getId() ;
675         CORBA::Object_var obj = _poa->id_to_reference(*id);
676         iobject = SUPERV::Port::_narrow(obj) ;
677         anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
678       }
679       else {
680         iobject = anInPort->ObjRef() ;
681       }
682     }
683   }
684   if ( !begin ) {
685     endService( "CNode_Impl::Input" );
686   }
687   if ( CORBA::is_nil( iobject ) ) {
688     MESSAGE( "CNode_Impl::Input returns nil object _IsNode " << _IsNode << " sts " << sts << " anInPort "
689              << anInPort ) ;
690   }
691   DataFlowEditor()->UnValid() ;
692   return SUPERV::Port::_duplicate( iobject ) ;
693 }
694
695 SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) {
696   SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ;
697   Port_Impl * myInPort = NULL ;
698   GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
699   if ( anInPort && !anInPort->IsDataStream() ) {
700     Inobject = anInPort->ObjRef() ;
701     if ( CORBA::is_nil( Inobject ) ) {
702       myInPort = new Port_Impl( _Orb , _Poa , _ContId ,
703                                 instanceName() , interfaceName() ,
704                                 DataFlowEditor() ,
705                                 DataFlowNode() ,
706                                 (GraphBase::Port * ) anInPort ,
707                                 true ) ;
708       if ( myInPort ) {
709         PortableServer::ObjectId * id = myInPort->getId() ;
710         CORBA::Object_var obj = _poa->id_to_reference(*id) ;
711         Inobject = SUPERV::Port::_narrow(obj) ;
712         anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ;
713       }
714     }
715   }
716   return SUPERV::Port::_duplicate( Inobject ) ;
717 }
718
719 SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) {
720   Port_Impl * myOutPort = NULL ;
721   SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
722   GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
723   if ( anOutPort && !anOutPort->IsDataStream() ) {
724     Outobject = anOutPort->ObjRef() ;
725     if ( CORBA::is_nil( Outobject ) ) {
726       const CORBA::Any * anAny = anOutPort->Value() ;
727       myOutPort = new Port_Impl( _Orb , _Poa , _ContId ,
728                                  instanceName() , interfaceName() ,
729                                  DataFlowEditor() ,
730                                  DataFlowNode() ,
731                                  (GraphBase::Port * ) anOutPort ,
732                                  false ,
733                                  anAny ) ;
734       if ( myOutPort ) {
735         PortableServer::ObjectId * id = myOutPort->getId() ;
736         CORBA::Object_var obj = _poa->id_to_reference(*id) ;
737         Outobject = SUPERV::Port::_narrow(obj) ;
738         anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ;
739       }
740     }
741   }
742   return SUPERV::Port::_duplicate( Outobject );
743 }
744
745 SUPERV::StreamPort_ptr CNode_Impl::GetInStreamPort( const char *aParameterName ) {
746   SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ;
747   if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
748     StreamPort_Impl * myInStreamPort = NULL ;
749     GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
750     if ( anInPort && anInPort->IsDataStream() ) {
751       Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
752       if ( CORBA::is_nil( Inobject ) ) {
753         myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
754                                 instanceName() , interfaceName() ,
755                                 DataFlowEditor() ,
756                                 DataFlowNode() ,
757                                 (GraphBase::Port * ) anInPort ,
758                                 true ) ;
759         if ( myInStreamPort ) {
760           PortableServer::ObjectId * id = myInStreamPort->getId() ;
761           CORBA::Object_var obj = _poa->id_to_reference(*id) ;
762           Inobject = SUPERV::StreamPort::_narrow(obj) ;
763           anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ;
764         }
765       }      
766     }
767   }
768   return SUPERV::StreamPort::_duplicate( Inobject ) ;
769 }
770
771 SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName ) {
772   StreamPort_Impl * myOutStreamPort = NULL ;
773   SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ;
774   if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
775     GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
776     if ( anOutPort && anOutPort->IsDataStream() ) {
777       Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
778       if ( CORBA::is_nil( Outobject ) ) {
779         const CORBA::Any * anAny = anOutPort->Value() ;
780         myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
781                                  instanceName() , interfaceName() ,
782                                  DataFlowEditor() ,
783                                  DataFlowNode() ,
784                                  (GraphBase::Port * ) anOutPort ,
785                                  false ,
786                                  anAny ) ;
787         if ( myOutStreamPort ) {
788           PortableServer::ObjectId * id = myOutStreamPort->getId() ;
789           CORBA::Object_var obj = _poa->id_to_reference(*id) ;
790           Outobject = SUPERV::StreamPort::_narrow(obj) ;
791           anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ;
792         }
793       }
794     }
795   }
796   return SUPERV::StreamPort::_duplicate( Outobject );
797 }
798
799 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
800   bool begin = true ;
801   SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
802   char* FromNodeName ;
803   char* FromServiceParameterName ;
804   bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
805                                           ToServiceParameterName ,
806                                           & FromNodeName ,
807                                           & FromServiceParameterName ) ;
808   if ( status ) {
809     GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
810     if ( !anInPort->IsDataStream() && anInPort->GetOutPort() ) {
811       GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
812       if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
813         if ( begin ) {
814           beginService( "CNode_Impl::GetLink" );
815           begin = false ;
816         }
817         bool Success ;
818         Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
819                                             instanceName() , interfaceName() ,
820                                             _DataFlowEditor ,
821                                             _DataFlowNode ,
822                                             ToServiceParameterName ,
823                                             (GraphEditor::InNode *) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
824                                             FromServiceParameterName ,
825                                             true , false , Success ) ;
826         if ( Success ) {
827           PortableServer::ObjectId * id = myLink->getId() ;
828           CORBA::Object_var obj = _poa->id_to_reference(*id);
829           iobject = SUPERV::Link::_narrow(obj) ;
830           anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
831         }
832       }
833       else {
834         iobject = anOutPort->InPortObjRef( anInPort ) ;
835       }
836     }
837   }
838   if ( !begin ) {
839     endService( "CNode_Impl::GetLink" );
840   }
841   return SUPERV::Link::_duplicate( iobject ) ;
842 }
843
844 SUPERV::StreamLink_ptr CNode_Impl::GetStreamLink(const char * ToServiceParameterName ) {
845   bool begin = true ;
846   SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
847   char* FromNodeName ;
848   char* FromServiceParameterName ;
849   if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
850     bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
851                                             ToServiceParameterName ,
852                                             & FromNodeName ,
853                                             & FromServiceParameterName ) ;
854     if ( status ) {
855       GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
856       if ( anInPort->IsDataStream() && anInPort->GetOutPort() ) {
857         GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
858         if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
859           if ( begin ) {
860             beginService( "CNode_Impl::GetLink" );
861             begin = false ;
862           }
863           bool Success ;
864           StreamLink_Impl * myStreamLink = new StreamLink_Impl(
865                                             _Orb , _Poa , _ContId ,
866                                             instanceName() , interfaceName() ,
867                                             _DataFlowEditor ,
868                                             _DataFlowNode ,
869                                             ToServiceParameterName ,
870                                             (GraphEditor::InNode *) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
871                                             FromServiceParameterName ,
872                                             true , Success ) ;
873           if ( Success ) {
874             PortableServer::ObjectId * id = myStreamLink->getId() ;
875             CORBA::Object_var obj = _poa->id_to_reference(*id);
876             iobject = SUPERV::StreamLink::_narrow(obj) ;
877             anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
878           }
879         }
880         else {
881           iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
882         }
883       }
884     }
885   }
886   if ( !begin ) {
887     endService( "CNode_Impl::GetLink" );
888   }
889   return SUPERV::StreamLink::_duplicate( iobject ) ;
890 }
891
892 SUPERV::ListOfPorts * CNode_Impl::Ports() {
893   bool begin = true ;
894   int i , j ;
895   int PortCount = 0 ;
896   SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
897   if ( _IsNode ) {
898 //    RetVal->length( _DataFlowNode->GetNodeInPortsSize() +
899 //                    _DataFlowNode->GetNodeOutPortsSize() ) ;
900     for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) {
901       GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ;
902       if ( !anInPort->IsDataStream() ) {
903         if ( begin ) {
904           beginService( "CNode_Impl::Ports" );
905           begin = false ;
906         }
907         if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() && 
908                                      ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
909           MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
910 //          RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
911         }
912         else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
913           MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
914                    << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
915                    << "/" << anInPort->IsConnected() ) ;
916           Port_Impl * myPort ;
917           if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) {
918             const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
919             myPort = new Port_Impl( _Orb , _Poa , _ContId ,
920                                     instanceName() , interfaceName() ,
921                                     _DataFlowEditor ,
922                                     _DataFlowNode ,
923                                     (GraphBase::Port * ) anInPort ,
924                                     true ,
925                                     anAny ) ;
926           }
927           else {
928             myPort = new Port_Impl( _Orb , _Poa , _ContId ,
929                                     instanceName() , interfaceName() ,
930                                     _DataFlowEditor ,
931                                     _DataFlowNode ,
932                                     (GraphBase::Port * ) anInPort ,
933                                     true ) ;
934           }
935           PortableServer::ObjectId * id = myPort->getId() ;
936           CORBA::Object_var obj = _poa->id_to_reference(*id);
937           SUPERV::Port_var iobject ;
938           iobject = SUPERV::Port::_narrow(obj) ;
939           PortCount += 1 ;
940           RetVal->length( PortCount ) ;
941           RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
942           anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
943         }
944         else {
945           MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
946           PortCount += 1 ;
947           RetVal->length( PortCount ) ;
948           RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
949         }
950       }
951       else {
952         MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
953 //        RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
954       }
955     }
956     for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) {
957       GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ;
958       if ( !anOutPort->IsDataStream() ) {
959         if ( begin ) {
960           beginService( "CNode_Impl::Ports" );
961           begin = false ;
962         }
963         if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() &&
964                                       ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
965           MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
966 //          RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
967         }
968         else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
969           MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
970           const CORBA::Any * anAny = anOutPort->Value() ;
971           Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
972                                               instanceName() , interfaceName() ,
973                                               _DataFlowEditor ,
974                                               _DataFlowNode ,
975                                               (GraphBase::Port * ) anOutPort ,
976                                               false ,
977                                               anAny ) ;
978           PortableServer::ObjectId * id = myPort->getId() ;
979           CORBA::Object_var obj = _poa->id_to_reference(*id);
980           SUPERV::Port_var iobject ;
981           iobject = SUPERV::Port::_narrow(obj) ;
982           PortCount += 1 ;
983           RetVal->length( PortCount ) ;
984           RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
985           anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
986         }
987         else {
988           MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
989           PortCount += 1 ;
990           RetVal->length( PortCount ) ;
991           RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
992         }
993       }
994       else {
995         MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
996 //        RetVal[  _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
997       }
998     }
999   }
1000   else {
1001     if ( _DataFlowEditor->IsValid() ) {
1002       RetVal->length( _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() +
1003                       _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ) ;
1004       for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1005         GraphBase::OutPort * anOutPort = _DataFlowEditor->Graph()->GetChangeNodeInDataNodePort(i) ;
1006         if ( !anOutPort->IsDataStream() ) {
1007           if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1008             if ( begin ) {
1009               beginService( "CNode_Impl::Ports" );
1010               begin = false ;
1011             }
1012             Port_Impl * myPort ;
1013             if ( anOutPort->IsDataConnected() ) {
1014               const CORBA::Any * anAny = anOutPort->Value() ;
1015               myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1016                                       instanceName() , interfaceName() ,
1017                                       _DataFlowEditor ,
1018                                       _DataFlowNode ,
1019                                       (GraphBase::Port * ) anOutPort ,
1020                                       true ,
1021                                       anAny ) ;
1022             }
1023             else {
1024               myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1025                                       instanceName() , interfaceName() ,
1026                                       _DataFlowEditor ,
1027                                       _DataFlowNode ,
1028                                       (GraphBase::Port * ) anOutPort ,
1029                                       true ) ;
1030             }
1031             PortableServer::ObjectId * id = myPort->getId() ;
1032             CORBA::Object_var obj = _poa->id_to_reference(*id);
1033             SUPERV::Port_var iobject ;
1034             iobject = SUPERV::Port::_narrow(obj) ;
1035             PortCount += 1 ;
1036             RetVal->length( PortCount ) ;
1037             RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1038             anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1039           }
1040           else {
1041             PortCount += 1 ;
1042             RetVal->length( PortCount ) ;
1043             RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1044           }
1045         }
1046         else {
1047 //          RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
1048         }
1049       }
1050       j = _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ;
1051       for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1052         GraphBase::InPort * anInPort = _DataFlowEditor->Graph()->GetChangeNodeOutDataNodePort(i) ;
1053         if ( !anInPort->IsDataStream() ) {
1054           if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1055             if ( begin ) {
1056               beginService( "CNode_Impl::Ports" );
1057               begin = false ;
1058             }
1059             Port_Impl * myPort ;
1060             if ( anInPort->IsDataConnected() ) {
1061               const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1062               myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1063                                       instanceName() , interfaceName() ,
1064                                       _DataFlowEditor ,
1065                                       _DataFlowNode ,
1066                                       (GraphBase::Port * ) anInPort ,
1067                                       false ,
1068                                       anAny ) ;
1069             }
1070             else {
1071               myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1072                                       instanceName() , interfaceName() ,
1073                                       _DataFlowEditor ,
1074                                       _DataFlowNode ,
1075                                       anInPort ,
1076                                       false ) ;
1077             }
1078             PortableServer::ObjectId * id = myPort->getId() ;
1079             CORBA::Object_var obj = _poa->id_to_reference(*id);
1080             SUPERV::Port_var iobject ;
1081             iobject = SUPERV::Port::_narrow(obj) ;
1082             PortCount += 1 ;
1083             RetVal->length( PortCount ) ;
1084             RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1085             anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1086           }
1087           else {
1088             PortCount += 1 ;
1089             RetVal->length( PortCount ) ;
1090             RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1091           }
1092         }
1093         else {
1094 //          RetVal[ j + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
1095         }
1096       }
1097     }
1098   }
1099 //  int RetVallength = (unsigned int ) RetVal->length() ;
1100 //  for ( i = 0 ; i < RetVallength ; i++ ) {
1101 //    MESSAGE( "Port " << i << " " <<  RetVal[i]->Name() << " of Node " << Name() ) ;
1102 //  }
1103   if ( !begin ) {
1104     endService( "CNode_Impl::Ports " ) ;
1105   }
1106   return ( RetVal._retn() ) ;
1107 }
1108
1109 SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() {
1110   bool begin = true ;
1111   int i , j ;
1112   int PortCount = 0 ;
1113   SUPERV::ListOfStreamPorts_var RetVal = new SUPERV::ListOfStreamPorts ;
1114   if ( !DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1115 //    MESSAGE("CNode_Impl::StreamPorts NOT a DataStreamNode" ) ;
1116   }
1117   else if ( _IsNode ) {
1118 //    RetVal->length( _DataFlowNode->GetNodeInPortsSize() +
1119 //                    _DataFlowNode->GetNodeOutPortsSize() ) ;
1120     for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) {
1121       GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ;
1122       if ( anInPort->IsDataStream() ) {
1123         if ( begin ) {
1124           beginService( "CNode_Impl::StreamPorts" );
1125           begin = false ;
1126         }
1127         if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() && 
1128                                      ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
1129           MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1130 //          RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1131         }
1132         else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1133           MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1134                    << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1135                    << "/" << anInPort->IsConnected() ) ;
1136           StreamPort_Impl * myStreamPort ;
1137           if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) {
1138             const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1139             myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1140                                     instanceName() , interfaceName() ,
1141                                     _DataFlowEditor ,
1142                                     _DataFlowNode ,
1143                                     (GraphBase::Port * ) anInPort ,
1144                                     true ,
1145                                     anAny ) ;
1146           }
1147           else {
1148             myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1149                                     instanceName() , interfaceName() ,
1150                                     _DataFlowEditor ,
1151                                     _DataFlowNode ,
1152                                     (GraphBase::Port * ) anInPort ,
1153                                     true ) ;
1154           }
1155           PortableServer::ObjectId * id = myStreamPort->getId() ;
1156           CORBA::Object_var obj = _poa->id_to_reference(*id);
1157           SUPERV::StreamPort_var iobject ;
1158           iobject = SUPERV::StreamPort::_narrow(obj) ;
1159           PortCount += 1 ;
1160           RetVal->length( PortCount ) ;
1161           RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1162           anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1163         }
1164         else {
1165           MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1166           PortCount += 1 ;
1167           RetVal->length( PortCount ) ;
1168           RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1169         }
1170       }
1171       else {
1172 //        RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1173       }
1174     }
1175     for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) {
1176       GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ;
1177       if ( anOutPort->IsDataStream() ) {
1178         if ( begin ) {
1179           beginService( "CNode_Impl::StreamPorts" );
1180           begin = false ;
1181         }
1182         if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() &&
1183                                       ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
1184           MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1185 //          RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1186         }
1187         else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1188           MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1189           const CORBA::Any * anAny = anOutPort->Value() ;
1190           StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1191                                               instanceName() , interfaceName() ,
1192                                               _DataFlowEditor ,
1193                                               _DataFlowNode ,
1194                                               (GraphBase::Port * ) anOutPort ,
1195                                               false ,
1196                                               anAny ) ;
1197           PortableServer::ObjectId * id = myStreamPort->getId() ;
1198           CORBA::Object_var obj = _poa->id_to_reference(*id);
1199           SUPERV::StreamPort_var iobject ;
1200           iobject = SUPERV::StreamPort::_narrow(obj) ;
1201           PortCount += 1 ;
1202           RetVal->length( PortCount ) ;
1203           RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1204           anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1205         }
1206         else {
1207           MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1208           PortCount += 1 ;
1209           RetVal->length( PortCount ) ;
1210           RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1211         }
1212       }
1213       else {
1214 //        RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1215       }
1216     }
1217   }
1218   else {
1219     if ( _DataFlowEditor->IsValid() ) {
1220 //      RetVal->length( _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() +
1221 //                      _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ) ;
1222       for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1223         GraphBase::OutPort * anOutPort = _DataFlowEditor->Graph()->GetChangeNodeInDataNodePort(i) ;
1224         if ( anOutPort->IsDataStream() ) {
1225           if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1226             if ( begin ) {
1227               beginService( "CNode_Impl::StreamPorts" );
1228               begin = false ;
1229             }
1230             StreamPort_Impl * myStreamPort ;
1231             if ( anOutPort->IsDataConnected() ) {
1232               const CORBA::Any * anAny = anOutPort->Value() ;
1233               myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1234                                       instanceName() , interfaceName() ,
1235                                       _DataFlowEditor ,
1236                                       _DataFlowNode ,
1237                                       (GraphBase::Port * ) anOutPort ,
1238                                       true ,
1239                                       anAny ) ;
1240             }
1241             else {
1242               myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1243                                       instanceName() , interfaceName() ,
1244                                       _DataFlowEditor ,
1245                                       _DataFlowNode ,
1246                                       (GraphBase::Port * ) anOutPort ,
1247                                       true ) ;
1248             }
1249             PortableServer::ObjectId * id = myStreamPort->getId() ;
1250             CORBA::Object_var obj = _poa->id_to_reference(*id);
1251             SUPERV::StreamPort_var iobject ;
1252             iobject = SUPERV::StreamPort::_narrow(obj) ;
1253             PortCount += 1 ;
1254             RetVal->length( PortCount ) ;
1255             RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1256             anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1257           }
1258           else {
1259             PortCount += 1 ;
1260             RetVal->length( PortCount ) ;
1261             RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1262           }
1263         }
1264         else {
1265 //          RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1266         }
1267       }
1268       j = _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ;
1269       for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1270         GraphBase::InPort * anInPort = _DataFlowEditor->Graph()->GetChangeNodeOutDataNodePort(i) ;
1271         if ( anInPort->IsDataStream() ) {
1272           if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1273             if ( begin ) {
1274               beginService( "CNode_Impl::StreamPorts" );
1275               begin = false ;
1276             }
1277             StreamPort_Impl * myStreamPort ;
1278             if ( anInPort->IsDataConnected() ) {
1279               const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1280               myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1281                                       instanceName() , interfaceName() ,
1282                                       _DataFlowEditor ,
1283                                       _DataFlowNode ,
1284                                       (GraphBase::Port * ) anInPort ,
1285                                       false ,
1286                                       anAny ) ;
1287             }
1288             else {
1289               myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1290                                       instanceName() , interfaceName() ,
1291                                       _DataFlowEditor ,
1292                                       _DataFlowNode ,
1293                                       anInPort ,
1294                                       false ) ;
1295             }
1296             PortableServer::ObjectId * id = myStreamPort->getId() ;
1297             CORBA::Object_var obj = _poa->id_to_reference(*id);
1298             SUPERV::StreamPort_var iobject ;
1299             iobject = SUPERV::StreamPort::_narrow(obj) ;
1300             PortCount += 1 ;
1301             RetVal->length( PortCount ) ;
1302             RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1303             anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1304           }
1305           else {
1306             PortCount += 1 ;
1307             RetVal->length( PortCount ) ;
1308             RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1309           }
1310         }
1311         else {
1312 //          RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1313         }
1314       }
1315     }
1316   }
1317 //  int RetVallength = (unsigned int ) RetVal->length() ;
1318 //  for ( i = 0 ; i < RetVallength ; i++ ) {
1319 //    MESSAGE( "StreamPort " << i << " " <<  RetVal[i]->Name() << " of Node " << Name() ) ;
1320 //  }
1321   if ( !begin ) {
1322     endService( "CNode_Impl::StreamPorts " ) ;
1323   }
1324   return ( RetVal._retn() ) ;
1325 }
1326
1327 SUPERV::ListOfLinks * CNode_Impl::Links() {
1328   beginService( "CNode_Impl::Links" ) ;
1329   SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
1330   if ( _DataFlowNode ) {
1331     RetVal = DataFlowEditor()->Graph()->ObjImpl()->Links( _DataFlowNode->ComputingNode() , NULL ) ;
1332   }
1333   else {
1334     RetVal = DataFlowEditor()->Graph()->ObjImpl()->Links( NULL , NULL ) ;
1335   }
1336   MESSAGE( "CNode_Impl::Links " << RetVal->length() << " Links" ) ;
1337   endService( "CNode_Impl::Links" ) ;
1338   return ( RetVal._retn() ) ;
1339 }
1340
1341 SUPERV::ListOfStreamLinks * CNode_Impl::StreamLinks() {
1342   beginService( "CNode_Impl::StreamLinks" ) ;
1343   SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
1344   if ( _DataFlowNode && DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1345     RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( _DataFlowNode->ComputingNode() , NULL ) ;
1346   }
1347   else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1348     RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( NULL , NULL ) ;
1349   }
1350   MESSAGE( "CNode_Impl::StreamLinks " << RetVal->length() << " StreamLinks" ) ;
1351   endService( "CNode_Impl::StreamLinks" ) ;
1352   return ( RetVal._retn() ) ;
1353 }
1354
1355 long CNode_Impl::SubGraph() {
1356 //  beginService( "CNode_Impl::SubGraph" );
1357   long RetVal = 0 ;
1358   if ( _IsNode ) {
1359     RetVal = _DataFlowNode->SubGraph() ;
1360   }
1361 //  endService( "CNode_Impl::SubGraph" );
1362   return RetVal ;
1363 }
1364
1365 long CNode_Impl::SubStreamGraph() {
1366 //  beginService( "CNode_Impl::SubStreamGraph" );
1367   long RetVal = 0 ;
1368   if ( _IsNode ) {
1369     RetVal = _DataFlowNode->SubStreamGraph() ;
1370   }
1371 //  endService( "CNode_Impl::SubStreamGraph" );
1372   return RetVal ;
1373 }
1374
1375 bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
1376   beginService( "CNode_Impl::IsLinked" );
1377   bool RetVal = _DataFlowNode->IsLinked( ServiceParameterName ) ;
1378   MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
1379   endService( "CNode_Impl::IsLinked" );
1380   return RetVal ;
1381 }
1382
1383 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
1384 //  beginService( "CNode_Impl::HasInput" );
1385   bool RetVal = _DataFlowNode->HasInput( ServiceParameterName ) ;
1386 //  endService( "CNode_Impl::HasInput" );
1387   return RetVal ;
1388 }
1389
1390 SUPERV::GraphState CNode_Impl::State() {
1391 //  beginService( "CNode_Impl::State" );
1392   SUPERV::GraphState RetVal = SUPERV::EditingState ;
1393   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1394   if ( _DataFlowExecutor && !_DataFlowEditor->EditedAfterExecution() ) {
1395     //JR : 12/06/03  if ( _DataFlowExecutor ) {
1396     if ( _IsNode ) {
1397       RetVal = _DataFlowExecutor->State( Name() ) ;
1398     }
1399     else {
1400       RetVal = _DataFlowExecutor->State() ;
1401     }
1402   }
1403 //  endService( "CNode_Impl::State" );
1404   return RetVal ;
1405 }
1406 long CNode_Impl::Thread() {
1407 //  beginService( "CNode_Impl::Thread" );
1408   long RetVal = 0 ;
1409   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1410   if ( _DataFlowExecutor ) {
1411     if ( _IsNode ) {
1412       RetVal = _DataFlowExecutor->Thread( Name() ) ;
1413     }
1414     else {
1415       RetVal = _DataFlowExecutor->Thread() ;
1416     }
1417   }
1418 //  endService( "CNode_Impl::Thread" );
1419   return RetVal ;
1420 }
1421 SUPERV::AutomatonState CNode_Impl::AutoState() {
1422 //  beginService( "CNode_Impl::AutoState" );
1423   SUPERV::AutomatonState RetVal = SUPERV::UnKnownState ;
1424   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1425   if ( _DataFlowExecutor ) {
1426     if ( _IsNode ) {
1427       RetVal = _DataFlowExecutor->AutomatonState( Name() ) ;
1428     }
1429     else {
1430       RetVal = _DataFlowExecutor->AutomatonState() ;
1431     }
1432   }
1433 //  endService( "CNode_Impl::AutoState" );
1434   return RetVal ;
1435 }
1436 SUPERV::ControlState CNode_Impl::Control() {
1437 //  beginService( "CNode_Impl::Control" );
1438   SUPERV::ControlState RetVal = SUPERV::VoidState ;
1439   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1440   if ( _DataFlowExecutor ) {
1441     if ( _IsNode ) {
1442       RetVal = _DataFlowExecutor->ControlState( Name() ) ;
1443     }
1444     else {
1445       RetVal = _DataFlowExecutor->ControlState() ;
1446     }
1447   }
1448 //  endService( "CNode_Impl::Control" );
1449   return RetVal ;
1450 }
1451 void CNode_Impl::ControlClear() {
1452 //  beginService( "CNode_Impl::ControlClear" );
1453 //  SUPERV::ControlState RetVal = SUPERV::VoidState ;
1454   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1455   if ( _DataFlowExecutor ) {
1456     if ( _IsNode ) {
1457       _DataFlowExecutor->ControlClear( Name() ) ;
1458     }
1459     else {
1460       _DataFlowExecutor->ControlClear() ;
1461     }
1462   }
1463 //  endService( "CNode_Impl::ControlClear" );
1464   return ;
1465 }
1466
1467 bool CNode_Impl::IsReady() {
1468 //  beginService( "CNode_Impl::IsReady" );
1469   bool RetVal = false ;
1470   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1471   if ( _DataFlowExecutor ) {
1472     if ( _IsNode ) {
1473       RetVal = _DataFlowExecutor->IsReady( Name() ) ;
1474     }
1475     else {
1476       RetVal = _DataFlowExecutor->IsReady() ;
1477     }
1478   }
1479 //  endService( "CNode_Impl::IsReady" );
1480   return RetVal ;
1481 }
1482
1483 bool CNode_Impl::IsWaiting() {
1484 //  beginService( "CNode_Impl::IsWaiting" );
1485   bool RetVal = false ;
1486   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1487   if ( _DataFlowExecutor ) {
1488     if ( _IsNode ) {
1489       RetVal = _DataFlowExecutor->IsWaiting( Name() ) ;
1490     }
1491     else {
1492       RetVal = _DataFlowExecutor->IsWaiting() ;
1493     }
1494   }
1495 //  endService( "CNode_Impl::IsWaiting" );
1496   return RetVal ;
1497 }
1498
1499 bool CNode_Impl::IsRunning() {
1500 //  beginService( "CNode_Impl::IsRunning" );
1501   bool RetVal = false ;
1502   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1503   if ( _DataFlowExecutor ) {
1504     if ( _IsNode ) {
1505       RetVal = _DataFlowExecutor->IsRunning( Name() ) ;
1506     }
1507     else {
1508       RetVal = _DataFlowExecutor->IsRunning() ;
1509     }
1510   }
1511 //  endService( "CNode_Impl::IsRunning" );
1512   return RetVal ;
1513 }
1514
1515 bool CNode_Impl::IsDone() {
1516 //  beginService( "CNode_Impl::IsDone" );
1517   bool RetVal = false ;
1518   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1519   if ( _DataFlowExecutor ) {
1520     if ( _IsNode ) {
1521       RetVal = _DataFlowExecutor->IsDone( Name() ) ;
1522     }
1523     else {
1524       RetVal = _DataFlowExecutor->IsDone() ;
1525     }
1526   }
1527 //  endService( "CNode_Impl::IsDone" );
1528   return RetVal ;
1529 }
1530
1531 bool CNode_Impl::IsSuspended() {
1532 //  beginService( "CNode_Impl::IsSuspended" );
1533   bool RetVal = false ;
1534   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1535   if ( _DataFlowExecutor ) {
1536     if ( _IsNode ) {
1537       RetVal = _DataFlowExecutor->IsSuspended( Name() ) ;
1538     }
1539     else {
1540       RetVal = _DataFlowExecutor->IsSuspended() ;
1541     }
1542   }
1543 //  endService( "CNode_Impl::IsSuspended" );
1544   return RetVal ;
1545 }
1546
1547 bool CNode_Impl::ReadyW() {
1548 //  beginService( "CNode_Impl::ReadyW" );
1549   bool RetVal = false ;
1550   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1551   if ( _DataFlowExecutor ) {
1552     if ( _IsNode ) {
1553       RetVal = _DataFlowExecutor->ReadyWait( Name() ) ;
1554     }
1555     else {
1556       RetVal = _DataFlowExecutor->ReadyWait() ;
1557     }
1558   }
1559 //  endService( "CNode_Impl::ReadyW" );
1560   return RetVal ;
1561 }
1562
1563 bool CNode_Impl::RunningW() {
1564 //  beginService( "CNode_Impl::RunningW" );
1565   bool RetVal = false ;
1566   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1567   if ( _DataFlowExecutor ) {
1568     if ( _IsNode ) {
1569       RetVal = _DataFlowExecutor->RunningWait( Name() ) ;
1570     }
1571     else {
1572       RetVal = _DataFlowExecutor->RunningWait() ;
1573     }
1574   }
1575 //  endService( "CNode_Impl::RunningW" );
1576   return RetVal ;
1577 }
1578
1579 bool CNode_Impl::DoneW() {
1580 //  beginService( "CNode_Impl::DoneW" );
1581   bool RetVal = false ;
1582   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1583   if ( _DataFlowExecutor ) {
1584     if ( _IsNode ) {
1585       RetVal = _DataFlowExecutor->DoneWait( Name() ) ;
1586     }
1587     else {
1588       RetVal = _DataFlowExecutor->DoneWait() ;
1589     }
1590   }
1591 //  endService( "CNode_Impl::DoneW" );
1592   return RetVal ;
1593 }
1594
1595 bool CNode_Impl::SuspendedW() {
1596 //  beginService( "CNode_Impl::SuspendedW" );
1597   bool RetVal = false ;
1598   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1599   if ( _DataFlowExecutor ) {
1600     if ( _IsNode ) {
1601       RetVal = _DataFlowExecutor->SuspendedWait( Name() ) ;
1602     }
1603     else {
1604       RetVal = _DataFlowExecutor->SuspendedWait() ;
1605     }
1606   }
1607 //  endService( "CNode_Impl::SuspendedW" );
1608   return RetVal ;
1609 }
1610
1611 void CNode_Impl::ping() {
1612 //  beginService( "CNode_Impl::ping" );
1613   bool RetVal = false ;
1614   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1615   if ( _DataFlowExecutor ) {
1616     if ( _IsNode ) {
1617       RetVal = _DataFlowExecutor->Ping( Name() ) ;
1618     }
1619     else {
1620       RetVal = false ;
1621     }
1622   }
1623 //  endService( "CNode_Impl::ping" );
1624   return ;
1625 }
1626
1627 bool CNode_Impl::ContainerKill() {
1628   beginService( "CNode_Impl::ContainerKill" );
1629   bool RetVal = false ;
1630   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1631   if ( _DataFlowExecutor && _DataFlowEditor->IsExecuting() ) {
1632     if ( _IsNode ) {
1633       RetVal = _DataFlowExecutor->ContainerKill( Name() ) ;
1634     }
1635     else {
1636       RetVal = _DataFlowExecutor->ContainerKill() ;
1637     }
1638   }
1639   endService( "CNode_Impl::ContainerKill" );
1640   return RetVal ;
1641 }
1642 bool CNode_Impl::Kill() {
1643   beginService( "CNode_Impl::Kill" );
1644   bool RetVal = false ;
1645   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1646   if ( _DataFlowExecutor ) {
1647     if ( _IsNode ) {
1648       RetVal = _DataFlowExecutor->Kill( Name() ) ;
1649     }
1650     else {
1651       RetVal = _DataFlowExecutor->Kill() ;
1652       MESSAGE( "Graph execution was killed " << RetVal ) ;
1653     }
1654   }
1655   endService( "CNode_Impl::Kill" );
1656   return RetVal ;
1657 }
1658 bool CNode_Impl::KillDone() {
1659 //  beginService( "CNode_Impl::KillDone" );
1660   bool RetVal = false ;
1661   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1662   if ( _DataFlowExecutor ) {
1663     if ( _IsNode ) {
1664       RetVal = _DataFlowExecutor->KillDone( Name() ) ;
1665     }
1666   }
1667 //  endService( "CNode_Impl::KillDone" );
1668   return RetVal ;
1669 }
1670 bool CNode_Impl::Stop() {
1671 //  beginService( "CNode_Impl::Stop" );
1672   bool RetVal ; // = _DataFlowExecutor->Stop() ;
1673 //  endService( "CNode_Impl::Stop" );
1674   return RetVal ;
1675 }
1676 bool CNode_Impl::Suspend() {
1677   beginService( "CNode_Impl::Suspend" );
1678   bool RetVal = false ;
1679   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1680   if ( _DataFlowExecutor ) {
1681     if ( _IsNode ) {
1682       MESSAGE( "CNode_Impl::Suspend " << Name() ) ;
1683       RetVal = _DataFlowExecutor->Suspend( Name() ) ;
1684     }
1685     else {
1686       MESSAGE( "CNode_Impl::Suspend " << _DataFlowExecutor->Graph()->Name() ) ;
1687       RetVal = _DataFlowExecutor->Suspend() ;
1688     }
1689   }
1690   endService( "CNode_Impl::Suspend" );
1691   return RetVal ;
1692 }
1693 bool CNode_Impl::SuspendDone() {
1694 //  beginService( "CNode_Impl::SuspendDone" );
1695   bool RetVal = false ;
1696   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1697   if ( _DataFlowExecutor ) {
1698     if ( _IsNode ) {
1699       RetVal = _DataFlowExecutor->SuspendDone( Name() ) ;
1700     }
1701     else {
1702       RetVal = _DataFlowExecutor->SuspendDone() ;
1703     }
1704   }
1705 //  endService( "CNode_Impl::SuspendDone" );
1706   return RetVal ;
1707 }
1708 bool CNode_Impl::Resume() {
1709   bool RetVal = false ;
1710   beginService( "CNode_Impl::Resume" );
1711   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1712   if ( _DataFlowExecutor ) {
1713     if ( _IsNode ) {
1714       MESSAGE( "CNode_Impl::Resume " << Name() ) ;
1715       RetVal = _DataFlowExecutor->Resume( Name() ) ;
1716     }
1717     else {
1718       MESSAGE( "CNode_Impl::Resume " << _DataFlowExecutor->Graph()->Name() ) ;
1719       RetVal = _DataFlowExecutor->Resume() ;
1720     }
1721   }
1722   endService( "CNode_Impl::Resume" );
1723   return RetVal ;
1724 }
1725
1726 bool CNode_Impl::Run() {
1727   beginService( "CNode_Impl::Run" );
1728   bool RetVal = false ;
1729   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1730   if ( _DataFlowExecutor ) {
1731     _DataFlowEditor->EditedAfterExecution( false ) ;
1732     if ( _IsNode ) {
1733       RetVal = _DataFlowExecutor->Run( Name() , Name() , false ) ;
1734     }
1735     else {
1736       RetVal = _DataFlowExecutor->Run( false ) ;
1737     }
1738   }
1739   endService( "CNode_Impl::Run" );
1740   return RetVal ;
1741 }
1742
1743 bool CNode_Impl::ReRun() {
1744   beginService( "CNode_Impl::ReRun" );
1745   bool RetVal = false ;
1746   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1747   if ( _DataFlowExecutor ) {
1748     _DataFlowEditor->EditedAfterExecution( false ) ;
1749     if ( _IsNode ) {
1750       RetVal = _DataFlowExecutor->Run( Name() , Name() , false ) ;
1751     }
1752     else if ( DataFlowEditor()->IsEditing() ) {
1753       //      RetVal = _DataFlowExecutor->Run( false ) ;
1754       return ((Graph_Impl::Graph_Impl *) this)->Graph_Impl::Run() ;
1755     }
1756   }
1757   endService( "CNode_Impl::ReRun" );
1758   return RetVal ;
1759 }
1760
1761 bool CNode_Impl::ReRunAt( const char * aNodeName ) {
1762   beginService( "CNode_Impl::ReRunAt" );
1763   bool RetVal = false ;
1764   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1765   if ( _DataFlowExecutor ) {
1766     _DataFlowEditor->EditedAfterExecution( false ) ;
1767     if ( _IsNode ) {
1768       RetVal = _DataFlowExecutor->Run( Name() , aNodeName , false ) ;
1769     }
1770   }
1771   endService( "CNode_Impl::ReRunAt" );
1772   return RetVal ;
1773 }
1774
1775 bool CNode_Impl::ReStart() {
1776   beginService( "CNode_Impl::ReStart" );
1777   bool RetVal = false ;
1778   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1779   if ( _DataFlowExecutor ) {
1780     if ( _IsNode ) {
1781       RetVal = _DataFlowExecutor->Run( Name() , Name() , true ) ;
1782     }
1783     else {
1784       RetVal = _DataFlowExecutor->Run( true ) ;
1785     }
1786   }
1787   endService( "CNode_Impl::ReStart" );
1788   return RetVal ;
1789 }
1790
1791 bool CNode_Impl::ReStartAt( const char * aNodeName ) {
1792   beginService( "CNode_Impl::ReStartAt" );
1793   bool RetVal = false ;
1794   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1795   if ( _DataFlowExecutor ) {
1796     if ( _IsNode ) {
1797       RetVal = _DataFlowExecutor->Run( Name() , aNodeName , true ) ;
1798     }
1799   }
1800   endService( "CNode_Impl::ReStartAt" );
1801   return RetVal ;
1802 }
1803
1804 long CNode_Impl::CpuUsed() {
1805   long RetVal = 0 ;
1806   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1807   if ( _DataFlowExecutor ) {
1808     if ( _IsNode ) {
1809       RetVal = _DataFlowExecutor->CpuUsed( Name() ) ;
1810     }
1811     else {
1812       RetVal = _DataFlowExecutor->CpuUsed() ;
1813     }
1814   }
1815   return RetVal ;
1816 }
1817
1818