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