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