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