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