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