Salome HOME
60d11ac02a05168636aba217f95458e9672c3080
[modules/superv.git] / src / Supervision / Port_Impl.cxx
1 //  SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : Port_Impl.cxx
25 //  Author : Jean Rahuel
26 //  Module : SUPERV
27 //  $Header: 
28
29 using namespace std;
30 #include <stdio.h>
31 #include <fstream>
32 //#include <sstream>
33 #include <string>
34
35 //#include "utilities.h"
36
37 #include "Graph_Impl.hxx"
38 #include "Port_Impl.hxx"
39
40 Port_Impl::Port_Impl( CORBA::ORB_ptr orb ,
41                       PortableServer::POA_ptr poa ,
42                       PortableServer::ObjectId * contId , 
43                       const char *instanceName ,
44                       const char *interfaceName ,
45                       GraphEditor::DataFlow * DataFlowEditor ,
46                       GraphEditor::InNode * DataFlowNode ,
47                       GraphBase::Port * DataFlowPort ,
48                       bool InputPort ,
49                       const CORBA::Any * anAny ) :
50   Value_Impl(orb, poa, contId, instanceName, interfaceName,
51              DataFlowEditor , DataFlowNode , DataFlowPort->PortName(), anAny ,
52              false ) {
53 //  MESSAGE("Port_Impl::Port_Impl activate object instanceName("
54 //          << instanceName << ") interfaceName(" << interfaceName
55 //          << ") IsDataStream " << DataFlowPort->IsDataStream() )
56   _Orb = CORBA::ORB::_duplicate(orb);
57   _Poa = poa ;
58   _ContId = contId ;
59   if ( !DataFlowPort->IsDataStream() ) {
60     _thisObj = this ;
61     _id = _poa->activate_object(_thisObj) ;
62   }
63   _DataFlowEditor = DataFlowEditor ;
64   _DataFlowNode = DataFlowNode ;
65   _DataFlowPort = DataFlowPort ;
66   _InputPort = InputPort ;
67   InPort( _InputPort ) ;
68 }
69
70 Port_Impl::Port_Impl( CORBA::ORB_ptr orb ,
71                       PortableServer::POA_ptr poa ,
72                       PortableServer::ObjectId * contId , 
73                       const char *instanceName ,
74                       const char *interfaceName ,
75                       GraphEditor::DataFlow * DataFlowEditor ,
76                       GraphEditor::InNode * DataFlowNode ,
77                       GraphBase::Port * DataFlowPort ,
78                       bool InputPort ) :
79   Value_Impl(orb, poa, contId, instanceName, interfaceName,
80              DataFlowEditor , DataFlowNode , DataFlowPort->PortName() , false ) {
81   char * nodename = DataFlowEditor->Graph()->Name() ;
82   if ( DataFlowNode ) {
83     nodename = DataFlowNode->Name() ;
84   }
85 //  MESSAGE("Port_Impl::Port_Impl activate object instanceName("
86 //          << instanceName << ") interfaceName(" << interfaceName
87 //          << ") " << nodename << "(" << DataFlowPort->PortName()
88 //          << ") IsDataStream " << DataFlowPort->IsDataStream() ) ;
89   _Orb = CORBA::ORB::_duplicate(orb);
90   _Poa = poa ;
91   _ContId = contId ;
92   if ( !DataFlowPort->IsDataStream() ) {
93     _thisObj = this ;
94     _id = _poa->activate_object(_thisObj) ;
95   }
96   _DataFlowEditor = DataFlowEditor ;
97   _DataFlowNode = DataFlowNode ;
98   _DataFlowPort = DataFlowPort ;
99   _InputPort = InputPort ;
100   InPort( _InputPort ) ;
101 }
102
103 Port_Impl::Port_Impl() {
104 }
105
106 Port_Impl::~Port_Impl() {
107   beginService( "Port_Impl::~Port_Impl" );
108   endService( "Port_Impl::~Port_Impl" );
109 }
110
111 void Port_Impl::destroy() {
112   beginService( "Port_Impl::destroy" );
113   bool destroyed = false ;
114   if ( _DataFlowNode->IsOneOfInLineNodes() ) {
115     if ( _InputPort ) {
116 //      GraphBase::InPort * anInPort = (GraphBase::InPort * ) _DataFlowPort ;
117 //      if ( anInPort->GetOutPort() ) {
118 //        anInPort->GetOutPort()->RemoveInPort( anInPort ) ;
119 //      }
120       if ( _DataFlowNode->IsOneOfInLineNodes() ) {
121         _DataFlowNode->DelInPort( _DataFlowPort->PortName() ) ;
122         if ( _DataFlowNode->IsLoopNode() ) {
123           _DataFlowNode->DelOutPort( _DataFlowPort->PortName() ) ;
124           _DataFlowNode->CoupledNode()->DelInPort( _DataFlowPort->PortName() ) ;
125           _DataFlowNode->CoupledNode()->DelOutPort( _DataFlowPort->PortName() ) ;
126         }
127       }
128       destroyed = true ;
129     }
130     else if ( _DataFlowNode->IsOneOfInLineNodes() && !_DataFlowNode->IsLoopNode() ) {
131       _DataFlowNode->DelOutPort( _DataFlowPort->PortName() ) ;
132       destroyed = true ;
133     }
134     else {
135       destroyed = true ;
136     }
137     if ( destroyed ) {
138       _DataFlowEditor->UnValid() ;
139     }
140   }
141   if ( destroyed ) {
142     _poa->deactivate_object(*_id) ;
143 //    CORBA::release(_poa) ;
144     delete(_id) ;
145 //    _thisObj->_remove_ref();
146   }
147   endService( "Port_Impl::destroy" );
148 }
149
150 // Only during delete of an InLineNode (because of Loop/EndLoop and Switch/EndSwitch
151 // CoupledNodes) ; look at destroy above ...
152 void Port_Impl::Remove() {
153   beginService( "Port_Impl::Remove" );
154   if ( _DataFlowNode->IsOneOfInLineNodes() ) {
155     if ( _InputPort ) {
156       _DataFlowNode->DelInPort( _DataFlowPort->PortName() ) ;
157     }
158     else {
159       _DataFlowNode->DelOutPort( _DataFlowPort->PortName() ) ;
160     }
161     _poa->deactivate_object(*_id) ;
162 //  CORBA::release(_poa) ;
163     delete(_id) ;
164 //    _thisObj->_remove_ref();
165   }
166   endService( "Port_Impl::Remove" );
167 }
168
169 bool Port_Impl::Input( const SUPERV::Value_ptr aValue ) {
170   return Input( aValue->ToAny() ) ;
171 }
172
173 bool Port_Impl::Input( const CORBA::Any * anAny ) {
174   beginService( "Port_Impl::Input" );
175   bool RetVal = false ;
176   MESSAGE( "Port_Impl::Input(CORBA::Any *) : " << _DataFlowNode->Name() << "( "
177            << _DataFlowPort->PortName() << " ) " ) ;
178   if ( _DataFlowEditor->Graph()->GraphMacroLevel() == 0 ) {
179     if ( _InputPort && _DataFlowEditor->IsEditing() ) {
180       RetVal = true ;
181       Value_Impl::Input( anAny ) ;
182       RetVal = _DataFlowEditor->AddInputData( _DataFlowNode->Name() ,
183                                               _DataFlowPort->PortName() ,
184                                               *anAny ) ;
185     }
186     else if ( _DataFlowEditor->IsExecuting() ) {
187       GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
188       
189       /* commenting out the lines below because it seems to be never executed
190          Editor::_Executing flag is set OFF in Executor::OutNode on execution finished
191          and in CNode_Impl class (also not called probably)
192       // asv: turn off Editor::_Executing flag
193       if ( _DataFlowExecutor->IsDone() ) {
194         _DataFlowEditor->Executing( false );
195       }
196       else 
197       */ 
198       if ( !_DataFlowExecutor->IsDone() ) {
199         RetVal = _DataFlowExecutor->ChangeInputData( _DataFlowNode->Name() ,
200                                                      _DataFlowPort->PortName() ,
201                                                      *anAny ) ;
202       }
203     }
204   }
205   if ( !RetVal ) {
206     MESSAGE( "Port_Impl::Input returns false _InputPort " << _InputPort << " IsEditing "
207              << _DataFlowEditor->IsEditing() << " Executor " << _DataFlowEditor->Executor() ) ;
208   }
209   endService( "Port_Impl::Input" );
210   return RetVal ;
211 }
212
213 char * Port_Impl::Name() {
214 //  beginService( "Port_Impl::Name" ) ;
215   const char * RetVal = _DataFlowPort->PortName() ;
216 //  endService( "Port_Impl::Name" ) ;
217   return CORBA::string_dup( RetVal ) ;
218 }
219
220 char * Port_Impl::Type() {
221 //  beginService( "Port_Impl::Type" ) ;
222   const char * RetVal = _DataFlowPort->PortType() ;
223 //  endService( "Port_Impl::Type" ) ;
224   return CORBA::string_dup( RetVal ) ;
225 }
226
227 SUPERV::CNode_ptr Port_Impl::Node() {
228   bool begin = true ;
229   SUPERV::CNode_var iobject ;
230   if ( _DataFlowNode ) {
231 //    MESSAGE( "Port_Impl::Node " << _DataFlowNode->Name() ) ;
232     iobject = SUPERV::CNode::_narrow( _DataFlowNode->ObjRef() ) ;
233     if ( CORBA::is_nil( iobject ) ) {
234       if ( begin ) {
235         beginService( "Port_Impl::Node" ) ;
236         begin = false ;
237       }
238       PortableServer::ObjectId * id ;
239       CORBA::Object_var obj ;
240       if ( _DataFlowNode->IsComputingNode() ) {
241         CNode_Impl * myNode = NULL ;
242         myNode = new CNode_Impl( _Orb , _Poa , _ContId ,
243                                  instanceName() , interfaceName() ,
244                                  _DataFlowEditor ,
245                                  _DataFlowNode ) ;
246         id = myNode->getId() ;
247         obj = _poa->id_to_reference(*id);
248         iobject = SUPERV::CNode::_narrow( obj ) ;
249         myNode->SetObjRef( SUPERV::CNode::_duplicate( iobject ) ) ;
250       }
251       else if ( _DataFlowNode->IsFactoryNode() ) {
252         FNode_Impl * myNode = NULL ;
253         myNode = new FNode_Impl( _Orb , _Poa , _ContId ,
254                                  instanceName() , interfaceName() ,
255                                  _DataFlowEditor ,
256                                  _DataFlowNode ) ;
257         id = myNode->getId() ;
258         obj = _poa->id_to_reference(*id);
259         SUPERV::FNode_var Fiobject = SUPERV::FNode::_narrow( obj ) ;
260         iobject = SUPERV::CNode::_narrow( Fiobject ) ;
261         myNode->SetObjRef( SUPERV::FNode::_duplicate( Fiobject ) ) ;
262       }
263       else if ( _DataFlowNode->IsInLineNode() ) {
264         INode_Impl * myNode = NULL ;
265         myNode = new INode_Impl( _Orb , _Poa , _ContId ,
266                                  instanceName() , interfaceName() ,
267                                  _DataFlowEditor ,
268                                  _DataFlowNode ) ;
269         id = myNode->getId() ;
270         obj = _poa->id_to_reference(*id);
271         SUPERV::INode_var Iiobject = SUPERV::INode::_narrow( obj ) ;
272         iobject = SUPERV::CNode::_narrow( Iiobject ) ;
273         myNode->SetObjRef( SUPERV::INode::_duplicate( Iiobject ) ) ;
274       }
275       else if ( _DataFlowNode->IsGOTONode() ) {
276         GNode_Impl * myNode = NULL ;
277         myNode = new GNode_Impl( _Orb , _Poa , _ContId ,
278                                  instanceName() , interfaceName() ,
279                                  _DataFlowEditor ,
280                                  _DataFlowNode ) ;
281         id = myNode->getId() ;
282         obj = _poa->id_to_reference(*id);
283         SUPERV::GNode_var Giobject = SUPERV::GNode::_narrow( obj ) ;
284         iobject = SUPERV::CNode::_narrow( Giobject ) ;
285         myNode->SetObjRef( SUPERV::GNode::_duplicate( Giobject ) ) ;
286       }
287       else if ( _DataFlowNode->IsLoopNode() ) {
288         LNode_Impl * myNode = NULL ;
289         myNode = new LNode_Impl( _Orb , _Poa , _ContId ,
290                                  instanceName() , interfaceName() ,
291                                  _DataFlowEditor ,
292                                  _DataFlowNode ) ;
293         id = myNode->getId() ;
294         obj = _poa->id_to_reference(*id);
295         SUPERV::LNode_var Liobject = SUPERV::LNode::_narrow( obj ) ;
296         iobject = SUPERV::CNode::_narrow( Liobject ) ;
297         myNode->SetObjRef( SUPERV::LNode::_duplicate( Liobject ) ) ;
298       }
299       else if ( _DataFlowNode->IsEndLoopNode() ) {
300         ELNode_Impl * myNode = NULL ;
301         myNode = new ELNode_Impl( _Orb , _Poa , _ContId ,
302                                   instanceName() , interfaceName() ,
303                                   _DataFlowEditor ,
304                                   _DataFlowNode ) ;
305         id = myNode->getId() ;
306         obj = _poa->id_to_reference(*id);
307         SUPERV::ELNode_var ELiobject = SUPERV::ELNode::_narrow( obj ) ;
308         iobject = SUPERV::CNode::_narrow( ELiobject ) ;
309         myNode->SetObjRef( SUPERV::ELNode::_duplicate( ELiobject ) ) ;
310       }
311       else if ( _DataFlowNode->IsSwitchNode() ) {
312         SNode_Impl * myNode = NULL ;
313         myNode = new SNode_Impl( _Orb , _Poa , _ContId ,
314                                  instanceName() , interfaceName() ,
315                                  _DataFlowEditor ,
316                                  _DataFlowNode ) ;
317         id = myNode->getId() ;
318         obj = _poa->id_to_reference(*id);
319         SUPERV::SNode_var Siobject = SUPERV::SNode::_narrow( obj ) ;
320         iobject = SUPERV::CNode::_narrow( Siobject ) ;
321         myNode->SetObjRef( SUPERV::SNode::_duplicate( Siobject ) ) ;
322       }
323       else if ( _DataFlowNode->IsEndSwitchNode() ) {
324         ESNode_Impl * myNode = NULL ;
325         myNode = new ESNode_Impl( _Orb , _Poa , _ContId ,
326                                   instanceName() , interfaceName() ,
327                                   _DataFlowEditor ,
328                                   _DataFlowNode ) ;
329         id = myNode->getId() ;
330         obj = _poa->id_to_reference(*id);
331         SUPERV::ESNode_var ESiobject = SUPERV::ESNode::_narrow( obj ) ;
332         iobject = SUPERV::CNode::_narrow( ESiobject ) ;
333         myNode->SetObjRef( SUPERV::ESNode::_duplicate( ESiobject ) ) ;
334       }
335     }
336     else {
337 //      MESSAGE( "Port_Impl::Node known objref " << iobject->Name() ) ;
338     }
339   }
340   else {
341     MESSAGE( "Port_Impl::GraphNode " << _DataFlowEditor->Graph()->Name() ) ;
342     iobject = SUPERV::CNode::_narrow( _DataFlowEditor->Graph()->ObjRef() ) ;
343     if ( CORBA::is_nil( iobject ) ) {
344       MESSAGE( "Port_Impl::GraphNode NilRef" ) ;
345     }
346   }
347   if ( !begin ) {
348     endService( "Port_Impl::Node" ) ;
349   }
350   return SUPERV::CNode::_duplicate( iobject ) ;
351 }
352
353 SUPERV::ListOfLinks * Port_Impl::Links() {
354   beginService( "Port_Impl::Links" ) ;
355   SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
356   RetVal = _DataFlowEditor->Graph()->ObjImpl()->Links( /*_DataFlowNode->ComputingNode() ,
357                                                          _DataFlowPort->PortName()*/ ) ;
358   MESSAGE( "Links of Node " << _DataFlowNode->ComputingNode()->Name()
359            << " and of Port " << _DataFlowPort->PortName()
360            << " _InputPort " << _InputPort ) ;
361   int i ;
362   for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) {
363     MESSAGE( "Link " << RetVal[i]->OutPort()->Node()->Name() << "("
364              << RetVal[i]->OutPort()->Name() << ") --> "
365              << RetVal[i]->InPort()->Node()->Name() << "("
366              << RetVal[i]->InPort()->Name() << ")" ) ;
367   }
368   endService( "Port_Impl::Links" ) ;
369   return ( RetVal._retn() ) ;
370 }
371
372 SUPERV::Link_ptr Port_Impl::Link() {
373   bool begin = true ;
374   SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
375   if ( _DataFlowNode->IsEndSwitchNode() ) {
376     beginService( "Port_Impl::Link" ) ;
377     begin = false ;
378     SUPERV::ListOfLinks_var Links = new SUPERV::ListOfLinks ;
379 //    cout << "Port_Impl::Link " << _DataFlowNode->Name() << " "
380 //         << _DataFlowPort->PortName() << endl ;
381     Links = _DataFlowEditor->Graph()->ObjImpl()->Links( /*_DataFlowNode->ComputingNode() ,
382                                                           _DataFlowPort->PortName()*/ ) ;
383     if ( Links->length() ) {
384       iobject = Links[ 0 ] ;
385     }
386   }
387   else {
388     char * FromNodeName = NULL ;
389     char * FromServiceParameterName = NULL ;
390     bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
391                                             _DataFlowPort->PortName() ,
392                                             & FromNodeName ,
393                                             & FromServiceParameterName ) ;
394     if ( status ) {
395 //      cout << "Port_Impl::Link " << FromNodeName << "("
396 //           << FromServiceParameterName << ") --> " << _DataFlowNode->Name()
397 //           << "(" << _DataFlowPort->PortName() << ")" << endl ;
398 //      SUPERV::Port_ptr theOutPort = Port( FromServiceParameterName ) ;
399
400       GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _DataFlowPort->PortName() ) ;
401       if ( anInPort->GetOutPort() ) {
402         GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
403         if ( _DataFlowNode->IsEndLoopNode() && !strcmp( _DataFlowNode->CoupledNode()->Name() ,
404                                                         anOutPort->NodeName() ) ) {
405 //          MESSAGE( "Link " << anOutPort->NodeName() << "("
406 //                  << anOutPort->PortName() << ") --> " << _DataFlowNode->Name() << "("
407 //                  << anInPort->PortName() << ")" << " ignored" ) ;
408         }
409         else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
410           if ( begin ) {
411             beginService( "Port_Impl::Link" ) ;
412             begin = false ;
413           }
414           bool Success ;
415           Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
416                                     instanceName() , interfaceName() ,
417                                     _DataFlowEditor ,
418                                     _DataFlowNode ,
419                                     _DataFlowPort->PortName() ,
420                                     (GraphEditor::InNode * ) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
421                                     FromServiceParameterName ,
422                                     false , true , Success ) ;
423           if ( Success ) {
424             PortableServer::ObjectId * id = myLink->getId() ;
425             CORBA::Object_var obj = _poa->id_to_reference(*id);
426             iobject = SUPERV::Link::_narrow(obj) ;
427             anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
428           }
429         }
430         else {
431           iobject = anOutPort->InPortObjRef( anInPort ) ;
432         }
433       }
434     }
435   }
436   if ( !begin ) {
437     MESSAGE( "Link " << iobject->OutPort()->Node()->Name() << "( " << iobject->OutPort()->Name() << " ) --> "
438              << iobject->InPort()->Node()->Name() << "( " << iobject->InPort()->Name() << " ) " ) ;
439     endService( "Port_Impl::Link" ) ;
440   }
441   return SUPERV::Link::_duplicate( iobject ) ;
442 }
443
444 bool Port_Impl::IsInput() {
445 //  beginService( "Port_Impl::IsInput" ) ;
446   bool RetVal = _InputPort ;
447 //  MESSAGE( Name() << "IsInput() " << _InputPort ) ;
448 //  endService( "Port_Impl::IsInput" ) ;
449   return RetVal ;
450 }
451
452 bool Port_Impl::IsLinked() {
453 //  beginService( "Port_Impl::IsLinked" ) ;
454   bool RetVal = false ;
455   if ( _DataFlowNode ) {
456     GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _DataFlowPort->PortName() ) ;
457     GraphBase::OutPort * anOutPort = NULL ;
458     if ( anInPort) {
459       anOutPort = anInPort->GetOutPort() ;
460     }
461     if ( _DataFlowNode->IsEndLoopNode() && anOutPort &&
462          !strcmp( _DataFlowNode->CoupledNode()->Name() , anOutPort->NodeName() ) ) {
463 //      MESSAGE( "Link " << anOutPort->NodeName() << "("
464 //              << anOutPort->PortName() << ") --> " << _DataFlowNode->Name() << "("
465 //              << anInPort->PortName() << ")" << " ignored" ) ;
466     }
467     else {
468       RetVal = _DataFlowNode->IsLinked( _DataFlowPort->PortName() ) ;
469     }
470   }
471 //  endService( "Port_Impl::IsLinked" ) ;
472   return RetVal ;
473 }
474
475 SUPERV::KindOfPort Port_Impl::Kind() {
476 //  beginService( "Port_Impl::Kind" ) ;
477   SUPERV::KindOfPort RetVal = _DataFlowPort->Kind() ;
478 //  endService( "Port_Impl::Kind" ) ;
479   return RetVal ;
480 }
481
482 void Port_Impl::SetKind( SUPERV::KindOfPort aKindOfPort ) {
483 //  beginService( "Port_Impl::SetKind" ) ;
484   _DataFlowPort->Kind( aKindOfPort ) ;
485 //  endService( "Port_Impl::SetKind" ) ;
486 }
487
488 bool Port_Impl::IsParam() {
489 //  beginService( "Port_Impl::IsParam" ) ;
490   bool RetVal = _DataFlowPort->IsParam() ;
491 //  endService( "Port_Impl::IsParam" ) ;
492   return RetVal ;
493 }
494
495 bool Port_Impl::IsGate() {
496 //  beginService( "Port_Impl::IsGate" ) ;
497   bool RetVal = _DataFlowPort->IsGate() ;
498 //  endService( "Port_Impl::IsGate" ) ;
499   return RetVal ;
500 }
501
502 bool Port_Impl::IsInLine() {
503 //  beginService( "Port_Impl::IsInLine" ) ;
504 //  bool RetVal = _DataFlowPort->IsBus() ;
505   bool RetVal = _DataFlowPort->IsInLine() ;
506 //  endService( "Port_Impl::IsInLine" ) ;
507   return RetVal ;
508 }
509
510 bool Port_Impl::IsLoop() {
511 //  beginService( "Port_Impl::IsLoop" ) ;
512   bool RetVal = _DataFlowPort->IsLoop() ;
513 //  endService( "Port_Impl::IsLoop" ) ;
514   return RetVal ;
515 }
516
517 bool Port_Impl::IsSwitch() {
518 //  beginService( "Port_Impl::IsSwitch" ) ;
519   bool RetVal = _DataFlowPort->IsSwitch() ;
520 //  endService( "Port_Impl::IsSwitch" ) ;
521   return RetVal ;
522 }
523
524 bool Port_Impl::IsEndSwitch() {
525 //  beginService( "Port_Impl::IsEndSwitch" ) ;
526   bool RetVal = _DataFlowPort->IsEndSwitch() ;
527 //  endService( "Port_Impl::IsEndSwitch" ) ;
528   return RetVal ;
529 }
530
531 bool Port_Impl::IsDataStream() {
532 //  beginService( "Port_Impl::IsDataStream" ) ;
533   bool RetVal = _DataFlowPort->IsDataStream() ;
534 //  endService( "Port_Impl::IsDataStream" ) ;
535   return RetVal ;
536 }
537
538 bool Port_Impl::HasInput() {
539 //  beginService( "Port_Impl::" ) ;
540   bool RetVal = false ;
541   if ( _DataFlowNode ) {
542     RetVal = _DataFlowNode->HasInput( _DataFlowPort->PortName() ) ;
543 //    cout << "Port_Impl::HasInput " << RetVal << " NodeName " << _DataFlowPort->NodeName() << " PortName "
544 //         << _DataFlowPort->PortName() << endl ;
545   }
546 //  endService( "Port_Impl::" ) ;
547   return RetVal ;
548 }
549
550 SUPERV::GraphState Port_Impl::State() {
551 //  beginService( "Port_Impl::State" );
552   SUPERV::GraphState RetVal = SUPERV::EditingState ;
553   if ( _DataFlowEditor ) {
554     GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
555     if ( _DataFlowExecutor ) {
556       RetVal = _DataFlowExecutor->State( _DataFlowPort->NodeName() ,
557                                          _DataFlowPort->PortName() ) ;
558     }
559   }
560 //  endService( "Port_Impl::State" );
561   return RetVal ;
562 }
563
564 bool Port_Impl::IsDone() {
565 //  beginService( "Port_Impl::IsDone" );
566   bool RetVal = false ;
567   if ( _DataFlowEditor ) {
568     GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
569     if ( _DataFlowExecutor ) {
570       RetVal = _DataFlowExecutor->PortDone( _DataFlowPort->NodeName() ,
571                                             _DataFlowPort->PortName() ) ;
572     }
573   }
574 //  endService( "Port_Impl::IsDone" );
575   return RetVal ;
576 }
577