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