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