1 // SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : CNode_Impl.cxx
8 // Author : Jean Rahuel
18 //#include "utilities.h"
20 #include "StreamGraph_Impl.hxx"
22 #include "CNode_Impl.hxx"
24 #include "StreamPort_Impl.hxx"
26 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
27 PortableServer::POA_ptr poa ,
28 PortableServer::ObjectId * contId ,
29 const char *instanceName ,
30 const char *interfaceName ,
31 const char *aDataFlowName ) :
32 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
33 // MESSAGE("CNode_Impl::CNode_Impl activate object instanceName("
34 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
35 // << hex << (void *) this << dec )
37 // _id = _poa->activate_object(_thisObj);
38 // MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
39 beginService( "CNode_Impl::CNode_Impl" );
40 _Orb = CORBA::ORB::_duplicate(orb);
43 _DataFlowNode = NULL ;
45 endService( "CNode_Impl::CNode_Impl" );
48 CNode_Impl::CNode_Impl() {
51 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
52 PortableServer::POA_ptr poa ,
53 PortableServer::ObjectId * contId ,
54 const char *instanceName ,
55 const char *interfaceName ,
56 GraphEditor::DataFlow * DataFlowEditor ,
57 const SALOME_ModuleCatalog::Service &NodeService ,
58 const char * NodeName ,
59 const SUPERV::KindOfNode NodeKindOfNode ,
60 const char * FuncName ,
61 const SUPERV::ListOfStrings & PythonFunction ) :
62 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
63 beginService( "CNode_Impl::CNode_Impl" );
64 // cout << "CNode_Impl::CNode_Impl -->" << endl ;
65 // if ( FuncName && NodeName ) {
66 // cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
67 // << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
68 // << " " << strlen( FuncName ) << endl ;
70 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
71 MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
73 _id = _poa->activate_object(_thisObj);
75 _Orb = CORBA::ORB::_duplicate(orb);
78 _DataFlowEditor = DataFlowEditor ;
79 GraphBase::ListOfFuncName aFuncName ;
80 GraphBase::ListOfPythonFunctions aPythonFunction ;
83 aFuncName[0] = my_strdup( FuncName ) ;
84 aPythonFunction.resize(1) ;
85 aPythonFunction[0] = &PythonFunction ;
87 _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName ,
92 endService( "CNode_Impl::CNode_Impl" );
93 // cout << "<-- CNode_Impl::CNode_Impl" << endl ;
96 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
97 PortableServer::POA_ptr poa ,
98 PortableServer::ObjectId * contId ,
99 const char *instanceName ,
100 const char *interfaceName ,
101 GraphEditor::DataFlow * DataFlowEditor ,
102 const SALOME_ModuleCatalog::Service &NodeService ,
103 const char * NodeName ,
104 const SUPERV::KindOfNode NodeKindOfNode ,
105 const GraphBase::ListOfFuncName & aFuncName ,
106 const GraphBase::ListOfPythonFunctions & aPythonFunction ) :
107 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
108 MESSAGE( NodeName << " " );
109 beginService( "CNode_Impl::CNode_Impl" );
111 MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ;
113 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
114 MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" );
116 _id = _poa->activate_object(_thisObj);
118 _Orb = CORBA::ORB::_duplicate(orb);
121 _DataFlowEditor = DataFlowEditor ;
122 _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName ,
127 endService( "CNode_Impl::CNode_Impl" );
130 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
131 PortableServer::POA_ptr poa ,
132 PortableServer::ObjectId * contId ,
133 const char *instanceName ,
134 const char *interfaceName ,
135 GraphEditor::DataFlow * DataFlowEditor ,
136 GraphEditor::InNode * DataFlowNode ) :
137 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
138 MESSAGE( DataFlowNode->Name() << " " );
139 beginService( "CNode_Impl::CNode_Impl" );
140 if ( DataFlowNode->IsComputingNode() ) {
141 MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" );
143 _id = _poa->activate_object(_thisObj);
146 MESSAGE( "CNode_Impl::CNode_Impl NO _poa->activate_object " );
148 _Orb = CORBA::ORB::_duplicate(orb);
151 _DataFlowEditor = DataFlowEditor ;
152 _DataFlowNode = DataFlowNode ;
154 endService( "CNode_Impl::CNode_Impl" );
157 CNode_Impl::~CNode_Impl() {
158 beginService( "CNode_Impl::~CNode_Impl" );
159 endService( "CNode_Impl::~CNode_Impl" );
162 void CNode_Impl::destroy() {
163 beginService( "CNode_Impl::Destroy" );
164 if ( _DataFlowEditor->IsEditing() ) {
166 _DataFlowNode = NULL ;
167 _poa->deactivate_object(*_id) ;
168 CORBA::release(_poa) ;
170 _thisObj->_remove_ref();
173 // endService( "CNode_Impl::Destroy" );
176 bool CNode_Impl::Delete() {
177 beginService( "CNode_Impl::Delete" );
178 bool RetVal = false ;
179 if ( _DataFlowEditor->IsEditing() ) {
180 RetVal = _DataFlowEditor->RemoveNode( Name() ) ;
182 RetVal = _DataFlowEditor->IsValid() ;
185 endService( "CNode_Impl::Delete" );
189 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
190 // beginService( "CNode_Impl::Service" );
191 SALOME_ModuleCatalog::Service * RetVal ;
193 RetVal = new SALOME_ModuleCatalog::Service( *_DataFlowNode->GetService() ) ;
196 RetVal = new SALOME_ModuleCatalog::Service( *_DataFlowEditor->GetService() ) ;
198 // endService( "CNode_Impl::Service" );
202 char * CNode_Impl::Name() {
203 // beginService( "CNode_Impl::Name" );
204 char * RetVal = NULL ;
206 RetVal = _DataFlowNode->Name() ;
209 RetVal = _DataFlowEditor->Graph()->Name() ;
211 // endService( "CNode_Impl::Name" );
212 return CORBA::string_dup( RetVal );
214 bool CNode_Impl::SetName( const char * aDataFlowName ) {
215 // beginService( "CNode_Impl::SetName" );
216 bool RetVal = false ;
217 if ( _DataFlowEditor->IsEditing() ) {
219 RetVal = _DataFlowEditor->ReNameNode( _DataFlowNode->Name() ,
223 RetVal = _DataFlowEditor->Graph()->Name( aDataFlowName ) ;
226 // endService( "CNode_Impl::SetName" );
229 SUPERV::KindOfNode CNode_Impl::Kind() {
230 // beginService( "CNode_Impl::Kind" );
231 SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
233 RetVal = _DataFlowNode->Kind() ;
236 RetVal = _DataFlowEditor->Graph()->Kind() ;
238 // endService( "CNode_Impl::Kind" );
241 bool CNode_Impl::IsGraph() {
242 // beginService( "CNode_Impl::IsGraph" );
243 bool RetVal = false ;
245 RetVal = _DataFlowNode->IsDataFlowNode() ;
248 RetVal = _DataFlowEditor->Graph()->IsDataFlowNode() ;
250 // endService( "CNode_Impl::IsGraph" );
253 bool CNode_Impl::IsStreamGraph() {
254 // beginService( "CNode_Impl::IsStreamGraph" );
255 bool RetVal = false ;
257 RetVal = _DataFlowNode->IsDataStreamNode() ;
260 RetVal = _DataFlowEditor->Graph()->IsDataStreamNode() ;
262 // endService( "CNode_Impl::IsStreamGraph" );
265 bool CNode_Impl::IsComputing() {
266 // beginService( "CNode_Impl::IsComputing" );
267 bool RetVal = SUPERV::UnknownNode ;
269 RetVal = _DataFlowNode->IsComputingNode() ;
272 RetVal = _DataFlowEditor->Graph()->IsComputingNode() ;
274 // endService( "CNode_Impl::IsComputing" );
277 bool CNode_Impl::IsFactory() {
278 // beginService( "CNode_Impl::IsFactory" );
279 bool RetVal = SUPERV::UnknownNode ;
281 RetVal = _DataFlowNode->IsFactoryNode() ;
284 RetVal = _DataFlowEditor->Graph()->IsFactoryNode() ;
286 // endService( "CNode_Impl::IsFactory" );
289 bool CNode_Impl::IsInLine() {
290 // beginService( "CNode_Impl::IsInLine" );
291 bool RetVal = SUPERV::UnknownNode ;
293 RetVal = _DataFlowNode->IsInLineNode() ;
296 RetVal = _DataFlowEditor->Graph()->IsInLineNode() ;
298 // endService( "CNode_Impl::IsInLine" );
301 bool CNode_Impl::IsGOTO() {
302 // beginService( "CNode_Impl::IsGOTO" );
303 bool RetVal = SUPERV::UnknownNode ;
305 RetVal = _DataFlowNode->IsGOTONode() ;
308 RetVal = _DataFlowEditor->Graph()->IsGOTONode() ;
310 // endService( "CNode_Impl::IsGOTO" );
313 bool CNode_Impl::IsLoop() {
314 // beginService( "CNode_Impl::IsLoop" );
315 bool RetVal = SUPERV::UnknownNode ;
317 RetVal = _DataFlowNode->IsLoopNode() ;
320 RetVal = _DataFlowEditor->Graph()->IsLoopNode() ;
322 // endService( "CNode_Impl::IsLoop" );
325 bool CNode_Impl::IsEndLoop() {
326 // beginService( "CNode_Impl::IsEndLoop" );
327 bool RetVal = SUPERV::UnknownNode ;
329 RetVal = _DataFlowNode->IsEndLoopNode() ;
332 RetVal = _DataFlowEditor->Graph()->IsEndLoopNode() ;
334 // endService( "CNode_Impl::IsEndLoop" );
337 bool CNode_Impl::IsSwitch() {
338 // beginService( "CNode_Impl::IsSwitch" );
339 bool RetVal = SUPERV::UnknownNode ;
341 RetVal = _DataFlowNode->IsSwitchNode() ;
344 RetVal = _DataFlowEditor->Graph()->IsSwitchNode() ;
346 // endService( "CNode_Impl::IsSwitch" );
349 bool CNode_Impl::IsEndSwitch() {
350 // beginService( "CNode_Impl::IsEndSwitch" );
351 bool RetVal = SUPERV::UnknownNode ;
353 RetVal = _DataFlowNode->IsEndSwitchNode() ;
356 RetVal = _DataFlowEditor->Graph()->IsEndSwitchNode() ;
358 // endService( "CNode_Impl::IsEndSwitch" );
362 SUPERV::SDate CNode_Impl::CreationDate() {
363 // beginService( "CNode_Impl::CreationDate" );
364 SUPERV::SDate_var RetVal ;
366 RetVal = new SUPERV::SDate( _DataFlowNode->FirstCreation() ) ;
369 // cout << " CNode_Impl::CreationDate " << _DataFlowEditor->FirstCreation()
371 RetVal = new SUPERV::SDate( _DataFlowEditor->Graph()->FirstCreation() ) ;
373 // endService( "CNode_Impl::CreationDate" );
374 return (RetVal._retn()) ;
376 SUPERV::SDate CNode_Impl::LastUpdateDate() {
377 // beginService( "CNode_Impl::LastUpdateDate" );
378 SUPERV::SDate_var RetVal ;
380 RetVal = new SUPERV::SDate( _DataFlowNode->LastModification() ) ;
383 RetVal = new SUPERV::SDate( _DataFlowEditor->Graph()->LastModification() ) ;
385 // endService( "CNode_Impl::LastUpdateDate" );
386 return (RetVal._retn()) ;
388 char * CNode_Impl::Version() {
389 // beginService( "CNode_Impl::Version" );
392 RetVal = _DataFlowNode->EditorRelease() ;
395 RetVal = _DataFlowEditor->Graph()->EditorRelease() ;
397 // endService( "CNode_Impl::Version" );
398 return CORBA::string_dup( RetVal ) ;
400 char * CNode_Impl::Author() {
401 // beginService( "CNode_Impl::Author" );
404 RetVal = _DataFlowNode->Author() ;
407 RetVal = _DataFlowEditor->Graph()->Author() ;
409 // endService( "CNode_Impl::Author" );
410 return CORBA::string_dup( RetVal ) ;
412 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
413 // beginService( "CNode_Impl::SetAuthor" );
414 bool RetVal = false ;
415 if ( _DataFlowEditor->IsEditing() ) {
417 RetVal = _DataFlowNode->Author( aDataFlowAuthor ) ;
420 RetVal = _DataFlowEditor->Graph()->Author( aDataFlowAuthor ) ;
423 // endService( "CNode_Impl::SetAuthor" );
426 char * CNode_Impl::Comment() {
427 // beginService( "CNode_Impl::Comment" );
430 RetVal = _DataFlowNode->Comment() ;
433 RetVal = _DataFlowEditor->Graph()->Comment() ;
435 // endService( "CNode_Impl::Comment" );
436 return CORBA::string_dup( RetVal ) ;
438 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
439 // beginService( "CNode_Impl::SetComment" );
440 bool RetVal = false ;
441 if ( _DataFlowEditor->IsEditing() ) {
443 RetVal = _DataFlowNode->Comment( aDataFlowComment ) ;
446 RetVal = _DataFlowEditor->Graph()->Comment( aDataFlowComment ) ;
449 // endService( "CNode_Impl::SetComment" );
453 void CNode_Impl::Coords(long X , long Y ) {
454 // beginService( "CNode_Impl::Coords" );
455 if ( _DataFlowEditor->IsEditing() ) {
457 ((GraphEditor::InNode *) _DataFlowNode)->Coordinates( X , Y ) ;
460 _DataFlowEditor->Graph()->Coordinates( X , Y ) ;
463 // endService( "CNode_Impl::Coords" );
465 long CNode_Impl::X() {
466 // beginService( "CNode_Impl::X" );
469 RetVal = _DataFlowNode->XCoordinate() ;
472 RetVal = _DataFlowEditor->Graph()->XCoordinate() ;
474 // endService( "CNode_Impl::X" );
477 long CNode_Impl::Y() {
478 // beginService( "CNode_Impl::Y" );
481 RetVal = _DataFlowNode->YCoordinate() ;
484 RetVal = _DataFlowEditor->Graph()->YCoordinate() ;
486 // endService( "CNode_Impl::Y" );
490 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
492 Port_Impl * myPort = NULL ;
493 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
496 aninport = _DataFlowNode->GetInPort( ServiceParameterName ) ;
499 aninport = _DataFlowEditor->GetInPort( ServiceParameterName ) ;
503 anoutport = _DataFlowNode->GetOutPort( ServiceParameterName ) ;
506 anoutport = _DataFlowEditor->GetOutPort( ServiceParameterName ) ;
509 GraphBase::InPort * anInPort ;
511 anInPort = _DataFlowNode->GetChangeInPort( ServiceParameterName ) ;
514 anInPort = _DataFlowEditor->GetChangeInPort( ServiceParameterName ) ;
516 if ( anInPort->IsDataStream() ) {
517 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
519 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
521 beginService( "CNode_Impl::Port" );
526 hasinput = _DataFlowNode->HasInput( anInPort->PortName() ) ;
529 hasinput = _DataFlowEditor->HasInput( anInPort->PortName() ) ;
532 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
533 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
534 instanceName() , interfaceName() ,
537 // ServiceParameterName ,
538 (GraphBase::Port * ) anInPort ,
543 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
544 instanceName() , interfaceName() ,
547 // ServiceParameterName ) ;
548 (GraphBase::Port * ) anInPort ,
551 PortableServer::ObjectId * id = myPort->getId() ;
552 CORBA::Object_var obj = _poa->id_to_reference(*id);
553 iobject = SUPERV::Port::_narrow(obj) ;
554 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
557 iobject = anInPort->ObjRef() ;
560 else if ( anoutport ) {
561 GraphBase::OutPort * anOutPort ;
563 anOutPort = _DataFlowNode->GetChangeOutPort( ServiceParameterName ) ;
566 anOutPort = _DataFlowEditor->GetChangeOutPort( ServiceParameterName ) ;
568 if ( anOutPort->IsDataStream() ) {
569 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
571 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
573 beginService( "CNode_Impl::Port" );
576 const CORBA::Any * anAny = anOutPort->Value() ;
577 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
578 instanceName() , interfaceName() ,
581 // ServiceParameterName ,
582 (GraphBase::Port * ) anOutPort ,
585 PortableServer::ObjectId * id = myPort->getId() ;
586 CORBA::Object_var obj = _poa->id_to_reference(*id);
587 iobject = SUPERV::Port::_narrow(obj) ;
588 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
591 iobject = anOutPort->ObjRef() ;
595 endService( "CNode_Impl::Port" );
597 return SUPERV::Port::_duplicate( iobject ) ;
600 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
601 const SUPERV::Value_ptr aValue ) {
603 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
604 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
606 GraphBase::InPort * anInPort = NULL ;
607 if ( _DataFlowEditor->IsEditing() ) {
609 sts = _DataFlowEditor->AddInputData( _DataFlowNode->Name() ,
610 ToServiceParameterName ,
612 anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
615 sts = _DataFlowEditor->AddInputData( _DataFlowEditor->Graph()->Name() ,
616 ToServiceParameterName ,
618 anInPort = _DataFlowEditor->Graph()->GetChangeInPort( ToServiceParameterName ) ;
620 if ( sts && anInPort ) {
621 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
623 beginService( "CNode_Impl::Input" );
627 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
628 instanceName() , interfaceName() ,
631 // ToServiceParameterName ,
632 (GraphBase::Port * ) anInPort ,
635 PortableServer::ObjectId * id = myPort->getId() ;
636 CORBA::Object_var obj = _poa->id_to_reference(*id);
637 iobject = SUPERV::Port::_narrow(obj) ;
638 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
641 iobject = anInPort->ObjRef() ;
645 else if ( _DataFlowExecutor ) {
647 sts = _DataFlowExecutor->ChangeInputData( _DataFlowNode->Name() ,
648 ToServiceParameterName ,
650 anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
653 sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Graph()->Name() ,
654 ToServiceParameterName ,
656 anInPort = _DataFlowEditor->Graph()->GetChangeInPort( ToServiceParameterName ) ;
658 if ( sts && anInPort ) {
659 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
661 beginService( "CNode_Impl::Input" );
665 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
666 instanceName() , interfaceName() ,
669 // ToServiceParameterName ,
670 (GraphBase::Port * ) anInPort ,
673 PortableServer::ObjectId * id = myPort->getId() ;
674 CORBA::Object_var obj = _poa->id_to_reference(*id);
675 iobject = SUPERV::Port::_narrow(obj) ;
676 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
679 iobject = anInPort->ObjRef() ;
684 endService( "CNode_Impl::Input" );
686 if ( CORBA::is_nil( iobject ) ) {
687 MESSAGE( "CNode_Impl::Input returns nil object _IsNode " << _IsNode << " sts " << sts << " anInPort "
690 return SUPERV::Port::_duplicate( iobject ) ;
693 SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) {
694 SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ;
695 Port_Impl * myInPort = NULL ;
696 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
697 if ( anInPort && !anInPort->IsDataStream() ) {
698 Inobject = anInPort->ObjRef() ;
699 if ( CORBA::is_nil( Inobject ) ) {
700 myInPort = new Port_Impl( _Orb , _Poa , _ContId ,
701 instanceName() , interfaceName() ,
704 (GraphBase::Port * ) anInPort ,
707 PortableServer::ObjectId * id = myInPort->getId() ;
708 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
709 Inobject = SUPERV::Port::_narrow(obj) ;
710 anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ;
714 return SUPERV::Port::_duplicate( Inobject ) ;
717 SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) {
718 Port_Impl * myOutPort = NULL ;
719 SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
720 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
721 if ( anOutPort && !anOutPort->IsDataStream() ) {
722 Outobject = anOutPort->ObjRef() ;
723 if ( CORBA::is_nil( Outobject ) ) {
724 const CORBA::Any * anAny = anOutPort->Value() ;
725 myOutPort = new Port_Impl( _Orb , _Poa , _ContId ,
726 instanceName() , interfaceName() ,
729 (GraphBase::Port * ) anOutPort ,
733 PortableServer::ObjectId * id = myOutPort->getId() ;
734 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
735 Outobject = SUPERV::Port::_narrow(obj) ;
736 anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ;
740 return SUPERV::Port::_duplicate( Outobject );
743 SUPERV::StreamPort_ptr CNode_Impl::GetInStreamPort( const char *aParameterName ) {
744 SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ;
745 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
746 StreamPort_Impl * myInStreamPort = NULL ;
747 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
748 if ( anInPort && anInPort->IsDataStream() ) {
749 Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
750 if ( CORBA::is_nil( Inobject ) ) {
751 myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
752 instanceName() , interfaceName() ,
755 (GraphBase::Port * ) anInPort ,
757 if ( myInStreamPort ) {
758 PortableServer::ObjectId * id = myInStreamPort->getId() ;
759 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
760 Inobject = SUPERV::StreamPort::_narrow(obj) ;
761 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ;
766 return SUPERV::StreamPort::_duplicate( Inobject ) ;
769 SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName ) {
770 StreamPort_Impl * myOutStreamPort = NULL ;
771 SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ;
772 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
773 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
774 if ( anOutPort && anOutPort->IsDataStream() ) {
775 Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
776 if ( CORBA::is_nil( Outobject ) ) {
777 const CORBA::Any * anAny = anOutPort->Value() ;
778 myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
779 instanceName() , interfaceName() ,
782 (GraphBase::Port * ) anOutPort ,
785 if ( myOutStreamPort ) {
786 PortableServer::ObjectId * id = myOutStreamPort->getId() ;
787 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
788 Outobject = SUPERV::StreamPort::_narrow(obj) ;
789 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ;
794 return SUPERV::StreamPort::_duplicate( Outobject );
797 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
799 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
801 char* FromServiceParameterName ;
802 bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
803 ToServiceParameterName ,
805 & FromServiceParameterName ) ;
807 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
808 if ( !anInPort->IsDataStream() && anInPort->GetOutPort() ) {
809 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
810 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
812 beginService( "CNode_Impl::GetLink" );
816 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
817 instanceName() , interfaceName() ,
820 ToServiceParameterName ,
821 (GraphEditor::InNode *) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
822 FromServiceParameterName ,
823 true , false , Success ) ;
825 PortableServer::ObjectId * id = myLink->getId() ;
826 CORBA::Object_var obj = _poa->id_to_reference(*id);
827 iobject = SUPERV::Link::_narrow(obj) ;
828 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
832 iobject = anOutPort->InPortObjRef( anInPort ) ;
837 endService( "CNode_Impl::GetLink" );
839 return SUPERV::Link::_duplicate( iobject ) ;
842 SUPERV::StreamLink_ptr CNode_Impl::GetStreamLink(const char * ToServiceParameterName ) {
844 SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
846 char* FromServiceParameterName ;
847 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
848 bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
849 ToServiceParameterName ,
851 & FromServiceParameterName ) ;
853 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
854 if ( anInPort->IsDataStream() && anInPort->GetOutPort() ) {
855 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
856 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
858 beginService( "CNode_Impl::GetLink" );
862 StreamLink_Impl * myStreamLink = new StreamLink_Impl(
863 _Orb , _Poa , _ContId ,
864 instanceName() , interfaceName() ,
867 ToServiceParameterName ,
868 (GraphEditor::InNode *) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
869 FromServiceParameterName ,
872 PortableServer::ObjectId * id = myStreamLink->getId() ;
873 CORBA::Object_var obj = _poa->id_to_reference(*id);
874 iobject = SUPERV::StreamLink::_narrow(obj) ;
875 anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
879 iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
885 endService( "CNode_Impl::GetLink" );
887 return SUPERV::StreamLink::_duplicate( iobject ) ;
890 SUPERV::ListOfPorts * CNode_Impl::Ports() {
894 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
896 // RetVal->length( _DataFlowNode->GetNodeInPortsSize() +
897 // _DataFlowNode->GetNodeOutPortsSize() ) ;
898 for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) {
899 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ;
900 if ( !anInPort->IsDataStream() ) {
902 beginService( "CNode_Impl::Ports" );
905 if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() &&
906 ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
907 MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
908 // RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
910 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
911 MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
912 << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
913 << "/" << anInPort->IsConnected() ) ;
915 if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) {
916 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
917 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
918 instanceName() , interfaceName() ,
921 (GraphBase::Port * ) anInPort ,
926 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
927 instanceName() , interfaceName() ,
930 (GraphBase::Port * ) anInPort ,
933 PortableServer::ObjectId * id = myPort->getId() ;
934 CORBA::Object_var obj = _poa->id_to_reference(*id);
935 SUPERV::Port_var iobject ;
936 iobject = SUPERV::Port::_narrow(obj) ;
938 RetVal->length( PortCount ) ;
939 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
940 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
943 MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
945 RetVal->length( PortCount ) ;
946 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
950 MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
951 // RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
954 for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) {
955 GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ;
956 if ( !anOutPort->IsDataStream() ) {
958 beginService( "CNode_Impl::Ports" );
961 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() &&
962 ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
963 MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
964 // RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
966 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
967 MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
968 const CORBA::Any * anAny = anOutPort->Value() ;
969 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
970 instanceName() , interfaceName() ,
973 (GraphBase::Port * ) anOutPort ,
976 PortableServer::ObjectId * id = myPort->getId() ;
977 CORBA::Object_var obj = _poa->id_to_reference(*id);
978 SUPERV::Port_var iobject ;
979 iobject = SUPERV::Port::_narrow(obj) ;
981 RetVal->length( PortCount ) ;
982 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
983 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
986 MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
988 RetVal->length( PortCount ) ;
989 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
993 MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
994 // RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
999 if ( _DataFlowEditor->IsValid() ) {
1000 RetVal->length( _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() +
1001 _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ) ;
1002 for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1003 GraphBase::OutPort * anOutPort = _DataFlowEditor->Graph()->GetChangeNodeInDataNodePort(i) ;
1004 if ( !anOutPort->IsDataStream() ) {
1005 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1007 beginService( "CNode_Impl::Ports" );
1010 Port_Impl * myPort ;
1011 if ( anOutPort->IsDataConnected() ) {
1012 const CORBA::Any * anAny = anOutPort->Value() ;
1013 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1014 instanceName() , interfaceName() ,
1017 (GraphBase::Port * ) anOutPort ,
1022 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1023 instanceName() , interfaceName() ,
1026 (GraphBase::Port * ) anOutPort ,
1029 PortableServer::ObjectId * id = myPort->getId() ;
1030 CORBA::Object_var obj = _poa->id_to_reference(*id);
1031 SUPERV::Port_var iobject ;
1032 iobject = SUPERV::Port::_narrow(obj) ;
1034 RetVal->length( PortCount ) ;
1035 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1036 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1040 RetVal->length( PortCount ) ;
1041 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1045 // RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
1048 j = _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ;
1049 for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1050 GraphBase::InPort * anInPort = _DataFlowEditor->Graph()->GetChangeNodeOutDataNodePort(i) ;
1051 if ( !anInPort->IsDataStream() ) {
1052 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1054 beginService( "CNode_Impl::Ports" );
1057 Port_Impl * myPort ;
1058 if ( anInPort->IsDataConnected() ) {
1059 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1060 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1061 instanceName() , interfaceName() ,
1064 (GraphBase::Port * ) anInPort ,
1069 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1070 instanceName() , interfaceName() ,
1076 PortableServer::ObjectId * id = myPort->getId() ;
1077 CORBA::Object_var obj = _poa->id_to_reference(*id);
1078 SUPERV::Port_var iobject ;
1079 iobject = SUPERV::Port::_narrow(obj) ;
1081 RetVal->length( PortCount ) ;
1082 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1083 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1087 RetVal->length( PortCount ) ;
1088 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1092 // RetVal[ j + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
1097 // int RetVallength = (unsigned int ) RetVal->length() ;
1098 // for ( i = 0 ; i < RetVallength ; i++ ) {
1099 // MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1102 endService( "CNode_Impl::Ports " ) ;
1104 return ( RetVal._retn() ) ;
1107 SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() {
1111 SUPERV::ListOfStreamPorts_var RetVal = new SUPERV::ListOfStreamPorts ;
1112 if ( !DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1113 // MESSAGE("CNode_Impl::StreamPorts NOT a DataStreamNode" ) ;
1115 else if ( _IsNode ) {
1116 // RetVal->length( _DataFlowNode->GetNodeInPortsSize() +
1117 // _DataFlowNode->GetNodeOutPortsSize() ) ;
1118 for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) {
1119 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ;
1120 if ( anInPort->IsDataStream() ) {
1122 beginService( "CNode_Impl::StreamPorts" );
1125 if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() &&
1126 ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
1127 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1128 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1130 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1131 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1132 << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1133 << "/" << anInPort->IsConnected() ) ;
1134 StreamPort_Impl * myStreamPort ;
1135 if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) {
1136 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1137 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1138 instanceName() , interfaceName() ,
1141 (GraphBase::Port * ) anInPort ,
1146 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1147 instanceName() , interfaceName() ,
1150 (GraphBase::Port * ) anInPort ,
1153 PortableServer::ObjectId * id = myStreamPort->getId() ;
1154 CORBA::Object_var obj = _poa->id_to_reference(*id);
1155 SUPERV::StreamPort_var iobject ;
1156 iobject = SUPERV::StreamPort::_narrow(obj) ;
1158 RetVal->length( PortCount ) ;
1159 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1160 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1163 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1165 RetVal->length( PortCount ) ;
1166 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1170 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1173 for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) {
1174 GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ;
1175 if ( anOutPort->IsDataStream() ) {
1177 beginService( "CNode_Impl::StreamPorts" );
1180 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() &&
1181 ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
1182 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1183 // RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1185 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1186 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1187 const CORBA::Any * anAny = anOutPort->Value() ;
1188 StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1189 instanceName() , interfaceName() ,
1192 (GraphBase::Port * ) anOutPort ,
1195 PortableServer::ObjectId * id = myStreamPort->getId() ;
1196 CORBA::Object_var obj = _poa->id_to_reference(*id);
1197 SUPERV::StreamPort_var iobject ;
1198 iobject = SUPERV::StreamPort::_narrow(obj) ;
1200 RetVal->length( PortCount ) ;
1201 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1202 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1205 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1207 RetVal->length( PortCount ) ;
1208 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1212 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1217 if ( _DataFlowEditor->IsValid() ) {
1218 // RetVal->length( _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() +
1219 // _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ) ;
1220 for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1221 GraphBase::OutPort * anOutPort = _DataFlowEditor->Graph()->GetChangeNodeInDataNodePort(i) ;
1222 if ( anOutPort->IsDataStream() ) {
1223 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1225 beginService( "CNode_Impl::StreamPorts" );
1228 StreamPort_Impl * myStreamPort ;
1229 if ( anOutPort->IsDataConnected() ) {
1230 const CORBA::Any * anAny = anOutPort->Value() ;
1231 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1232 instanceName() , interfaceName() ,
1235 (GraphBase::Port * ) anOutPort ,
1240 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1241 instanceName() , interfaceName() ,
1244 (GraphBase::Port * ) anOutPort ,
1247 PortableServer::ObjectId * id = myStreamPort->getId() ;
1248 CORBA::Object_var obj = _poa->id_to_reference(*id);
1249 SUPERV::StreamPort_var iobject ;
1250 iobject = SUPERV::StreamPort::_narrow(obj) ;
1252 RetVal->length( PortCount ) ;
1253 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1254 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1258 RetVal->length( PortCount ) ;
1259 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1263 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1266 j = _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ;
1267 for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1268 GraphBase::InPort * anInPort = _DataFlowEditor->Graph()->GetChangeNodeOutDataNodePort(i) ;
1269 if ( anInPort->IsDataStream() ) {
1270 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1272 beginService( "CNode_Impl::StreamPorts" );
1275 StreamPort_Impl * myStreamPort ;
1276 if ( anInPort->IsDataConnected() ) {
1277 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1278 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1279 instanceName() , interfaceName() ,
1282 (GraphBase::Port * ) anInPort ,
1287 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1288 instanceName() , interfaceName() ,
1294 PortableServer::ObjectId * id = myStreamPort->getId() ;
1295 CORBA::Object_var obj = _poa->id_to_reference(*id);
1296 SUPERV::StreamPort_var iobject ;
1297 iobject = SUPERV::StreamPort::_narrow(obj) ;
1299 RetVal->length( PortCount ) ;
1300 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1301 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1305 RetVal->length( PortCount ) ;
1306 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1310 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1315 // int RetVallength = (unsigned int ) RetVal->length() ;
1316 // for ( i = 0 ; i < RetVallength ; i++ ) {
1317 // MESSAGE( "StreamPort " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1320 endService( "CNode_Impl::StreamPorts " ) ;
1322 return ( RetVal._retn() ) ;
1325 SUPERV::ListOfLinks * CNode_Impl::Links() {
1326 beginService( "CNode_Impl::Links" ) ;
1327 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
1328 if ( _DataFlowNode ) {
1329 RetVal = DataFlowEditor()->Graph()->ObjImpl()->Links( _DataFlowNode->ComputingNode() , NULL ) ;
1332 RetVal = DataFlowEditor()->Graph()->ObjImpl()->Links( NULL , NULL ) ;
1334 MESSAGE( "CNode_Impl::Links " << RetVal->length() << " Links" ) ;
1335 endService( "CNode_Impl::Links" ) ;
1336 return ( RetVal._retn() ) ;
1339 SUPERV::ListOfStreamLinks * CNode_Impl::StreamLinks() {
1340 beginService( "CNode_Impl::StreamLinks" ) ;
1341 SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
1342 if ( _DataFlowNode && DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1343 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( _DataFlowNode->ComputingNode() , NULL ) ;
1345 else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1346 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( NULL , NULL ) ;
1348 MESSAGE( "CNode_Impl::StreamLinks " << RetVal->length() << " StreamLinks" ) ;
1349 endService( "CNode_Impl::StreamLinks" ) ;
1350 return ( RetVal._retn() ) ;
1353 long CNode_Impl::SubGraph() {
1354 // beginService( "CNode_Impl::SubGraph" );
1357 RetVal = _DataFlowNode->SubGraph() ;
1359 // endService( "CNode_Impl::SubGraph" );
1363 long CNode_Impl::SubStreamGraph() {
1364 // beginService( "CNode_Impl::SubStreamGraph" );
1367 RetVal = _DataFlowNode->SubStreamGraph() ;
1369 // endService( "CNode_Impl::SubStreamGraph" );
1373 bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
1374 beginService( "CNode_Impl::IsLinked" );
1375 bool RetVal = _DataFlowNode->IsLinked( ServiceParameterName ) ;
1376 MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
1377 endService( "CNode_Impl::IsLinked" );
1381 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
1382 // beginService( "CNode_Impl::HasInput" );
1383 bool RetVal = _DataFlowNode->HasInput( ServiceParameterName ) ;
1384 // endService( "CNode_Impl::HasInput" );
1388 SUPERV::GraphState CNode_Impl::State() {
1389 // beginService( "CNode_Impl::State" );
1390 SUPERV::GraphState RetVal = SUPERV::EditingState ;
1391 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1392 if ( _DataFlowExecutor && !_DataFlowEditor->EditedAfterExecution() ) {
1393 //JR : 12/06/03 if ( _DataFlowExecutor ) {
1395 RetVal = _DataFlowExecutor->State( Name() ) ;
1398 RetVal = _DataFlowExecutor->State() ;
1401 // endService( "CNode_Impl::State" );
1404 long CNode_Impl::Thread() {
1405 // beginService( "CNode_Impl::Thread" );
1407 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1408 if ( _DataFlowExecutor ) {
1410 RetVal = _DataFlowExecutor->Thread( Name() ) ;
1413 RetVal = _DataFlowExecutor->Thread() ;
1416 // endService( "CNode_Impl::Thread" );
1419 SUPERV::AutomatonState CNode_Impl::AutoState() {
1420 // beginService( "CNode_Impl::AutoState" );
1421 SUPERV::AutomatonState RetVal = SUPERV::UnKnownState ;
1422 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1423 if ( _DataFlowExecutor ) {
1425 RetVal = _DataFlowExecutor->AutomatonState( Name() ) ;
1428 RetVal = _DataFlowExecutor->AutomatonState() ;
1431 // endService( "CNode_Impl::AutoState" );
1434 SUPERV::ControlState CNode_Impl::Control() {
1435 // beginService( "CNode_Impl::Control" );
1436 SUPERV::ControlState RetVal = SUPERV::VoidState ;
1437 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1438 if ( _DataFlowExecutor ) {
1440 RetVal = _DataFlowExecutor->ControlState( Name() ) ;
1443 RetVal = _DataFlowExecutor->ControlState() ;
1446 // endService( "CNode_Impl::Control" );
1449 void CNode_Impl::ControlClear() {
1450 // beginService( "CNode_Impl::ControlClear" );
1451 // SUPERV::ControlState RetVal = SUPERV::VoidState ;
1452 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1453 if ( _DataFlowExecutor ) {
1455 _DataFlowExecutor->ControlClear( Name() ) ;
1458 _DataFlowExecutor->ControlClear() ;
1461 // endService( "CNode_Impl::ControlClear" );
1465 bool CNode_Impl::IsReady() {
1466 // beginService( "CNode_Impl::IsReady" );
1467 bool RetVal = false ;
1468 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1469 if ( _DataFlowExecutor ) {
1471 RetVal = _DataFlowExecutor->IsReady( Name() ) ;
1474 RetVal = _DataFlowExecutor->IsReady() ;
1477 // endService( "CNode_Impl::IsReady" );
1481 bool CNode_Impl::IsWaiting() {
1482 // beginService( "CNode_Impl::IsWaiting" );
1483 bool RetVal = false ;
1484 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1485 if ( _DataFlowExecutor ) {
1487 RetVal = _DataFlowExecutor->IsWaiting( Name() ) ;
1490 RetVal = _DataFlowExecutor->IsWaiting() ;
1493 // endService( "CNode_Impl::IsWaiting" );
1497 bool CNode_Impl::IsRunning() {
1498 // beginService( "CNode_Impl::IsRunning" );
1499 bool RetVal = false ;
1500 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1501 if ( _DataFlowExecutor ) {
1503 RetVal = _DataFlowExecutor->IsRunning( Name() ) ;
1506 RetVal = _DataFlowExecutor->IsRunning() ;
1509 // endService( "CNode_Impl::IsRunning" );
1513 bool CNode_Impl::IsDone() {
1514 // beginService( "CNode_Impl::IsDone" );
1515 bool RetVal = false ;
1516 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1517 if ( _DataFlowExecutor ) {
1519 RetVal = _DataFlowExecutor->IsDone( Name() ) ;
1522 RetVal = _DataFlowExecutor->IsDone() ;
1525 // endService( "CNode_Impl::IsDone" );
1529 bool CNode_Impl::IsSuspended() {
1530 // beginService( "CNode_Impl::IsSuspended" );
1531 bool RetVal = false ;
1532 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1533 if ( _DataFlowExecutor ) {
1535 RetVal = _DataFlowExecutor->IsSuspended( Name() ) ;
1538 RetVal = _DataFlowExecutor->IsSuspended() ;
1541 // endService( "CNode_Impl::IsSuspended" );
1545 bool CNode_Impl::ReadyW() {
1546 // beginService( "CNode_Impl::ReadyW" );
1547 bool RetVal = false ;
1548 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1549 if ( _DataFlowExecutor ) {
1551 RetVal = _DataFlowExecutor->ReadyWait( Name() ) ;
1554 RetVal = _DataFlowExecutor->ReadyWait() ;
1557 // endService( "CNode_Impl::ReadyW" );
1561 bool CNode_Impl::RunningW() {
1562 // beginService( "CNode_Impl::RunningW" );
1563 bool RetVal = false ;
1564 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1565 if ( _DataFlowExecutor ) {
1567 RetVal = _DataFlowExecutor->RunningWait( Name() ) ;
1570 RetVal = _DataFlowExecutor->RunningWait() ;
1573 // endService( "CNode_Impl::RunningW" );
1577 bool CNode_Impl::DoneW() {
1578 // beginService( "CNode_Impl::DoneW" );
1579 bool RetVal = false ;
1580 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1581 if ( _DataFlowExecutor ) {
1583 RetVal = _DataFlowExecutor->DoneWait( Name() ) ;
1586 RetVal = _DataFlowExecutor->DoneWait() ;
1589 // endService( "CNode_Impl::DoneW" );
1593 bool CNode_Impl::SuspendedW() {
1594 // beginService( "CNode_Impl::SuspendedW" );
1595 bool RetVal = false ;
1596 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1597 if ( _DataFlowExecutor ) {
1599 RetVal = _DataFlowExecutor->SuspendedWait( Name() ) ;
1602 RetVal = _DataFlowExecutor->SuspendedWait() ;
1605 // endService( "CNode_Impl::SuspendedW" );
1609 void CNode_Impl::ping() {
1610 // beginService( "CNode_Impl::ping" );
1611 bool RetVal = false ;
1612 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1613 if ( _DataFlowExecutor ) {
1615 RetVal = _DataFlowExecutor->Ping( Name() ) ;
1621 // endService( "CNode_Impl::ping" );
1625 bool CNode_Impl::ContainerKill() {
1626 beginService( "CNode_Impl::ContainerKill" );
1627 bool RetVal = false ;
1628 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1629 if ( _DataFlowExecutor && _DataFlowEditor->IsExecuting() ) {
1631 RetVal = _DataFlowExecutor->ContainerKill( Name() ) ;
1634 RetVal = _DataFlowExecutor->ContainerKill() ;
1637 endService( "CNode_Impl::ContainerKill" );
1640 bool CNode_Impl::Kill() {
1641 // beginService( "CNode_Impl::Kill" );
1642 bool RetVal = false ;
1643 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1644 if ( _DataFlowExecutor ) {
1646 RetVal = _DataFlowExecutor->Kill( Name() ) ;
1649 RetVal = _DataFlowExecutor->Kill() ;
1652 // endService( "CNode_Impl::Kill" );
1655 bool CNode_Impl::KillDone() {
1656 // beginService( "CNode_Impl::KillDone" );
1657 bool RetVal = false ;
1658 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1659 if ( _DataFlowExecutor ) {
1661 RetVal = _DataFlowExecutor->KillDone( Name() ) ;
1664 // endService( "CNode_Impl::KillDone" );
1667 bool CNode_Impl::Stop() {
1668 // beginService( "CNode_Impl::Stop" );
1669 bool RetVal ; // = _DataFlowExecutor->Stop() ;
1670 // endService( "CNode_Impl::Stop" );
1673 bool CNode_Impl::Suspend() {
1674 // beginService( "CNode_Impl::Suspend" );
1675 bool RetVal = false ;
1676 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1677 if ( _DataFlowExecutor ) {
1679 RetVal = _DataFlowExecutor->Suspend( Name() ) ;
1682 RetVal = _DataFlowExecutor->Suspend() ;
1685 // endService( "CNode_Impl::Suspend" );
1688 bool CNode_Impl::SuspendDone() {
1689 // beginService( "CNode_Impl::SuspendDone" );
1690 bool RetVal = false ;
1691 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1692 if ( _DataFlowExecutor ) {
1694 RetVal = _DataFlowExecutor->SuspendDone( Name() ) ;
1697 RetVal = _DataFlowExecutor->SuspendDone() ;
1700 // endService( "CNode_Impl::SuspendDone" );
1703 bool CNode_Impl::Resume() {
1704 // beginService( "CNode_Impl::Resume" );
1705 bool RetVal = false ;
1706 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1707 if ( _DataFlowExecutor ) {
1709 RetVal = _DataFlowExecutor->Resume( Name() ) ;
1712 RetVal = _DataFlowExecutor->Resume() ;
1715 // endService( "CNode_Impl::Resume" );
1719 bool CNode_Impl::Run() {
1720 beginService( "CNode_Impl::Run" );
1721 bool RetVal = false ;
1722 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1723 if ( _DataFlowExecutor ) {
1724 _DataFlowEditor->EditedAfterExecution( false ) ;
1726 RetVal = _DataFlowExecutor->Run( Name() , Name() , false ) ;
1729 RetVal = _DataFlowExecutor->Run( false ) ;
1732 endService( "CNode_Impl::Run" );
1736 bool CNode_Impl::ReRun() {
1737 beginService( "CNode_Impl::ReRun" );
1738 bool RetVal = false ;
1739 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1740 if ( _DataFlowExecutor ) {
1741 _DataFlowEditor->EditedAfterExecution( false ) ;
1743 RetVal = _DataFlowExecutor->Run( Name() , Name() , false ) ;
1745 else if ( DataFlowEditor()->IsEditing() ) {
1746 // RetVal = _DataFlowExecutor->Run( false ) ;
1747 return ((Graph_Impl::Graph_Impl *) this)->Graph_Impl::Run() ;
1750 endService( "CNode_Impl::ReRun" );
1754 bool CNode_Impl::ReRunAt( const char * aNodeName ) {
1755 beginService( "CNode_Impl::ReRunAt" );
1756 bool RetVal = false ;
1757 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1758 if ( _DataFlowExecutor ) {
1759 _DataFlowEditor->EditedAfterExecution( false ) ;
1761 RetVal = _DataFlowExecutor->Run( Name() , aNodeName , false ) ;
1764 endService( "CNode_Impl::ReRunAt" );
1768 bool CNode_Impl::ReStart() {
1769 beginService( "CNode_Impl::ReStart" );
1770 bool RetVal = false ;
1771 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1772 if ( _DataFlowExecutor ) {
1774 RetVal = _DataFlowExecutor->Run( Name() , Name() , true ) ;
1777 RetVal = _DataFlowExecutor->Run( true ) ;
1780 endService( "CNode_Impl::ReStart" );
1784 bool CNode_Impl::ReStartAt( const char * aNodeName ) {
1785 beginService( "CNode_Impl::ReStartAt" );
1786 bool RetVal = false ;
1787 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1788 if ( _DataFlowExecutor ) {
1790 RetVal = _DataFlowExecutor->Run( Name() , aNodeName , true ) ;
1793 endService( "CNode_Impl::ReStartAt" );
1797 long CNode_Impl::CpuUsed() {
1799 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1800 if ( _DataFlowExecutor ) {
1802 RetVal = _DataFlowExecutor->CpuUsed( Name() ) ;
1805 RetVal = _DataFlowExecutor->CpuUsed() ;