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 const SUPERV::KindOfNode aKindOfNode ) :
33 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
34 // MESSAGE("CNode_Impl::CNode_Impl activate object instanceName("
35 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
36 // << hex << (void *) this << dec )
38 // _id = _poa->activate_object(_thisObj);
39 // MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
40 // beginService( "CNode_Impl::CNode_Impl" );
41 _Orb = CORBA::ORB::_duplicate(orb);
44 _DataFlowEditor = NULL ;
45 _DataFlowNode = NULL ;
46 if ( aKindOfNode == SUPERV::MacroNode ) {
52 // endService( "CNode_Impl::CNode_Impl" );
55 CNode_Impl::CNode_Impl() {
58 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
59 PortableServer::POA_ptr poa ,
60 PortableServer::ObjectId * contId ,
61 const char *instanceName ,
62 const char *interfaceName ,
63 GraphEditor::DataFlow * aDataFlowEditor ,
64 const SALOME_ModuleCatalog::Service &NodeService ,
65 const char * NodeName ,
66 const SUPERV::KindOfNode NodeKindOfNode ,
67 const char * FuncName ,
68 const SUPERV::ListOfStrings & PythonFunction ) :
69 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
70 // beginService( "CNode_Impl::CNode_Impl" );
71 // cout << "CNode_Impl::CNode_Impl -->" << endl ;
72 // if ( FuncName && NodeName ) {
73 // cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
74 // << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
75 // << " " << strlen( FuncName ) << endl ;
77 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
78 // MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
80 _id = _poa->activate_object(_thisObj);
82 _Orb = CORBA::ORB::_duplicate(orb);
85 _DataFlowEditor = aDataFlowEditor ;
86 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
87 GraphBase::ListOfFuncName aFuncName ;
88 GraphBase::ListOfPythonFunctions aPythonFunction ;
91 aFuncName[0] = my_strdup( FuncName ) ;
92 aPythonFunction.resize(1) ;
93 aPythonFunction[0] = &PythonFunction ;
95 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
100 // endService( "CNode_Impl::CNode_Impl" );
101 // cout << "<-- CNode_Impl::CNode_Impl" << endl ;
104 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
105 PortableServer::POA_ptr poa ,
106 PortableServer::ObjectId * contId ,
107 const char *instanceName ,
108 const char *interfaceName ,
109 GraphEditor::DataFlow * aDataFlowEditor ,
110 const SALOME_ModuleCatalog::Service &NodeService ,
111 const char * NodeName ,
112 const SUPERV::KindOfNode NodeKindOfNode ,
113 const GraphBase::ListOfFuncName & aFuncName ,
114 const GraphBase::ListOfPythonFunctions & aPythonFunction ) :
115 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
116 // MESSAGE( NodeName << " " );
117 // beginService( "CNode_Impl::CNode_Impl" );
119 // MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ;
121 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
122 // MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" );
124 _id = _poa->activate_object(_thisObj);
126 _Orb = CORBA::ORB::_duplicate(orb);
129 _DataFlowEditor = aDataFlowEditor ;
130 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
131 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
136 // endService( "CNode_Impl::CNode_Impl" );
139 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
140 PortableServer::POA_ptr poa ,
141 PortableServer::ObjectId * contId ,
142 const char *instanceName ,
143 const char *interfaceName ,
144 GraphEditor::DataFlow * aDataFlowEditor ,
145 GraphEditor::InNode * aDataFlowNode ) :
146 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
147 // beginService( "CNode_Impl::CNode_Impl" );
148 if ( aDataFlowNode && aDataFlowNode->IsComputingNode() ) {
149 // MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" );
151 _id = _poa->activate_object(_thisObj);
154 // MESSAGE( "CNode_Impl::CNode_Impl NO _poa->activate_object " );
156 _Orb = CORBA::ORB::_duplicate(orb);
159 _DataFlowEditor = aDataFlowEditor ;
160 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
161 _DataFlowNode = aDataFlowNode ;
162 if ( aDataFlowNode ) {
168 // endService( "CNode_Impl::CNode_Impl" );
171 CNode_Impl::~CNode_Impl() {
172 beginService( "CNode_Impl::~CNode_Impl" );
173 endService( "CNode_Impl::~CNode_Impl" );
176 void CNode_Impl::destroy() {
177 beginService( "CNode_Impl::Destroy" );
178 if ( DataFlowEditor()->IsEditing() ) {
180 _DataFlowNode = NULL ;
181 _poa->deactivate_object(*_id) ;
182 CORBA::release(_poa) ;
184 _thisObj->_remove_ref();
187 // endService( "CNode_Impl::Destroy" );
190 bool CNode_Impl::Delete() {
191 beginService( "CNode_Impl::Delete" );
192 bool RetVal = false ;
193 if ( DataFlowEditor()->IsEditing() ) {
195 RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
197 RetVal = DataFlowEditor()->UnValid() ;
200 endService( "CNode_Impl::Delete" );
204 void CNode_Impl::DeletePorts() {
205 beginService( "CNode_Impl::DeletePorts" );
206 if ( DataFlowEditor()->IsEditing() && DataFlowNode() ) {
208 for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeInPortsSize() ; i++ ) {
209 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeInPort( i )->ObjRef() ;
210 if ( !CORBA::is_nil( aPort ) ) {
214 for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeOutPortsSize() ; i++ ) {
215 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeOutPort( i )->ObjRef() ;
216 if ( !CORBA::is_nil( aPort ) ) {
221 endService( "CNode_Impl::DeletePorts" );
224 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
225 // beginService( "CNode_Impl::Service" );
226 SALOME_ModuleCatalog::Service * RetVal ;
228 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowNode()->GetService() ) ;
231 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowEditor()->GetService() ) ;
233 // endService( "CNode_Impl::Service" );
237 char * CNode_Impl::Name() {
238 // beginService( "CNode_Impl::Name" );
239 char * RetVal = NULL ;
241 RetVal = DataFlowNode()->Name() ;
244 RetVal = DataFlowEditor()->Graph()->Name() ;
246 // endService( "CNode_Impl::Name" );
247 return CORBA::string_dup( RetVal );
249 bool CNode_Impl::SetName( const char * aDataFlowName ) {
250 // beginService( "CNode_Impl::SetName" );
251 bool RetVal = false ;
252 if ( DataFlowEditor()->IsEditing() ) {
254 RetVal = DataFlowEditor()->ReNameNode( DataFlowNode()->Name() ,
258 // RetVal = DataFlowEditor()->Graph()->Name( aDataFlowName ) ;
259 RetVal = DataFlowEditor()->Name( aDataFlowName ) ;
262 // endService( "CNode_Impl::SetName" );
265 SUPERV::KindOfNode CNode_Impl::Kind() {
266 // beginService( "CNode_Impl::Kind" );
267 SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
269 RetVal = DataFlowNode()->Kind() ;
272 RetVal = DataFlowEditor()->Graph()->Kind() ;
274 // endService( "CNode_Impl::Kind" );
277 bool CNode_Impl::IsGraph() {
278 // beginService( "CNode_Impl::IsGraph" );
279 bool RetVal = false ;
281 RetVal = DataFlowNode()->IsDataFlowNode() ;
284 RetVal = DataFlowEditor()->Graph()->IsDataFlowNode() ;
286 // endService( "CNode_Impl::IsGraph" );
289 bool CNode_Impl::IsStreamGraph() {
290 // beginService( "CNode_Impl::IsStreamGraph" );
291 bool RetVal = false ;
293 RetVal = DataFlowNode()->IsDataStreamNode() ;
296 RetVal = DataFlowEditor()->Graph()->IsDataStreamNode() ;
298 // endService( "CNode_Impl::IsStreamGraph" );
301 bool CNode_Impl::IsMacro() {
302 // beginService( "CNode_Impl::IsMacro" );
303 bool RetVal = false ;
304 if ( _IsNode && DataFlowNode()->IsMacroNode() ) {
307 // endService( "CNode_Impl::IsMacro" );
310 bool CNode_Impl::IsFlowMacro() {
311 // beginService( "CNode_Impl::IsFlowMacro" );
312 bool RetVal = false ;
313 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsGraph() ) {
316 // endService( "CNode_Impl::IsFlowMacro" );
319 bool CNode_Impl::IsStreamMacro() {
320 // beginService( "CNode_Impl::IsStreamMacro" );
321 bool RetVal = false ;
322 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsStreamGraph() ) {
325 // endService( "CNode_Impl::IsStreamMacro" );
328 bool CNode_Impl::IsHeadGraph() {
329 bool RetVal = false ;
330 beginService( "CNode_Impl::IsHeadGraph" );
331 endService( "CNode_Impl::IsHeadGraph" );
334 long CNode_Impl::GraphLevel() {
336 beginService( "CNode_Impl::GraphLevel" );
337 RetVal = DataFlowEditor()->Graph()->GraphMacroLevel() ;
338 endService( "CNode_Impl::GraphLevel" );
342 bool CNode_Impl::IsComputing() {
343 // beginService( "CNode_Impl::IsComputing" );
344 bool RetVal = SUPERV::UnknownNode ;
346 RetVal = DataFlowNode()->IsComputingNode() ;
349 RetVal = DataFlowEditor()->Graph()->IsComputingNode() ;
351 // endService( "CNode_Impl::IsComputing" );
354 bool CNode_Impl::IsFactory() {
355 // beginService( "CNode_Impl::IsFactory" );
356 bool RetVal = SUPERV::UnknownNode ;
358 RetVal = DataFlowNode()->IsFactoryNode() ;
361 RetVal = DataFlowEditor()->Graph()->IsFactoryNode() ;
363 // endService( "CNode_Impl::IsFactory" );
366 bool CNode_Impl::IsInLine() {
367 // beginService( "CNode_Impl::IsInLine" );
368 bool RetVal = SUPERV::UnknownNode ;
370 RetVal = DataFlowNode()->IsInLineNode() ;
373 RetVal = DataFlowEditor()->Graph()->IsInLineNode() ;
375 // endService( "CNode_Impl::IsInLine" );
378 bool CNode_Impl::IsGOTO() {
379 // beginService( "CNode_Impl::IsGOTO" );
380 bool RetVal = SUPERV::UnknownNode ;
382 RetVal = DataFlowNode()->IsGOTONode() ;
385 RetVal = DataFlowEditor()->Graph()->IsGOTONode() ;
387 // endService( "CNode_Impl::IsGOTO" );
390 bool CNode_Impl::IsLoop() {
391 // beginService( "CNode_Impl::IsLoop" );
392 bool RetVal = SUPERV::UnknownNode ;
394 RetVal = DataFlowNode()->IsLoopNode() ;
397 RetVal = DataFlowEditor()->Graph()->IsLoopNode() ;
399 // endService( "CNode_Impl::IsLoop" );
402 bool CNode_Impl::IsEndLoop() {
403 // beginService( "CNode_Impl::IsEndLoop" );
404 bool RetVal = SUPERV::UnknownNode ;
406 RetVal = DataFlowNode()->IsEndLoopNode() ;
409 RetVal = DataFlowEditor()->Graph()->IsEndLoopNode() ;
411 // endService( "CNode_Impl::IsEndLoop" );
414 bool CNode_Impl::IsSwitch() {
415 // beginService( "CNode_Impl::IsSwitch" );
416 bool RetVal = SUPERV::UnknownNode ;
418 RetVal = DataFlowNode()->IsSwitchNode() ;
421 RetVal = DataFlowEditor()->Graph()->IsSwitchNode() ;
423 // endService( "CNode_Impl::IsSwitch" );
426 bool CNode_Impl::IsEndSwitch() {
427 // beginService( "CNode_Impl::IsEndSwitch" );
428 bool RetVal = SUPERV::UnknownNode ;
430 RetVal = DataFlowNode()->IsEndSwitchNode() ;
433 RetVal = DataFlowEditor()->Graph()->IsEndSwitchNode() ;
435 // endService( "CNode_Impl::IsEndSwitch" );
439 SUPERV::SDate CNode_Impl::CreationDate() {
440 // beginService( "CNode_Impl::CreationDate" );
441 SUPERV::SDate_var RetVal ;
443 RetVal = new SUPERV::SDate( DataFlowNode()->FirstCreation() ) ;
446 // cout << " CNode_Impl::CreationDate " << DataFlowEditor()->FirstCreation()
448 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->FirstCreation() ) ;
450 // endService( "CNode_Impl::CreationDate" );
451 return (RetVal._retn()) ;
453 SUPERV::SDate CNode_Impl::LastUpdateDate() {
454 // beginService( "CNode_Impl::LastUpdateDate" );
455 SUPERV::SDate_var RetVal ;
457 RetVal = new SUPERV::SDate( DataFlowNode()->LastModification() ) ;
460 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->LastModification() ) ;
462 // endService( "CNode_Impl::LastUpdateDate" );
463 return (RetVal._retn()) ;
465 char * CNode_Impl::Version() {
466 // beginService( "CNode_Impl::Version" );
469 RetVal = DataFlowNode()->EditorRelease() ;
472 RetVal = DataFlowEditor()->Graph()->EditorRelease() ;
474 // endService( "CNode_Impl::Version" );
475 return CORBA::string_dup( RetVal ) ;
477 char * CNode_Impl::Author() {
478 // beginService( "CNode_Impl::Author" );
481 RetVal = DataFlowNode()->Author() ;
484 RetVal = DataFlowEditor()->Graph()->Author() ;
486 // endService( "CNode_Impl::Author" );
487 return CORBA::string_dup( RetVal ) ;
489 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
490 // beginService( "CNode_Impl::SetAuthor" );
491 bool RetVal = false ;
492 if ( DataFlowEditor()->IsEditing() ) {
494 RetVal = DataFlowNode()->Author( aDataFlowAuthor ) ;
497 RetVal = DataFlowEditor()->Graph()->Author( aDataFlowAuthor ) ;
500 // endService( "CNode_Impl::SetAuthor" );
503 char * CNode_Impl::Comment() {
504 // beginService( "CNode_Impl::Comment" );
507 RetVal = DataFlowNode()->Comment() ;
510 RetVal = DataFlowEditor()->Graph()->Comment() ;
512 // endService( "CNode_Impl::Comment" );
513 return CORBA::string_dup( RetVal ) ;
515 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
516 // beginService( "CNode_Impl::SetComment" );
517 bool RetVal = false ;
518 if ( DataFlowEditor()->IsEditing() ) {
520 RetVal = DataFlowNode()->Comment( aDataFlowComment ) ;
523 RetVal = DataFlowEditor()->Graph()->Comment( aDataFlowComment ) ;
526 // endService( "CNode_Impl::SetComment" );
530 void CNode_Impl::Coords(long X , long Y ) {
531 // beginService( "CNode_Impl::Coords" );
532 if ( DataFlowEditor()->IsEditing() ) {
534 ((GraphEditor::InNode *) DataFlowNode())->Coordinates( X , Y ) ;
537 DataFlowEditor()->Graph()->Coordinates( X , Y ) ;
540 // endService( "CNode_Impl::Coords" );
542 long CNode_Impl::X() {
543 // beginService( "CNode_Impl::X" );
546 RetVal = DataFlowNode()->XCoordinate() ;
549 RetVal = DataFlowEditor()->Graph()->XCoordinate() ;
551 // endService( "CNode_Impl::X" );
554 long CNode_Impl::Y() {
555 // beginService( "CNode_Impl::Y" );
558 RetVal = DataFlowNode()->YCoordinate() ;
561 RetVal = DataFlowEditor()->Graph()->YCoordinate() ;
563 // endService( "CNode_Impl::Y" );
567 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
569 Port_Impl * myPort = NULL ;
570 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
573 aninport = DataFlowNode()->GetInPort( ServiceParameterName ) ;
576 aninport = DataFlowEditor()->GetInPort( ServiceParameterName ) ;
580 anoutport = DataFlowNode()->GetOutPort( ServiceParameterName ) ;
583 anoutport = DataFlowEditor()->GetOutPort( ServiceParameterName ) ;
586 GraphBase::InPort * anInPort ;
588 anInPort = DataFlowNode()->GetChangeInPort( ServiceParameterName ) ;
591 anInPort = DataFlowEditor()->GetChangeInPort( ServiceParameterName ) ;
593 if ( anInPort->IsDataStream() ) {
594 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
596 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
598 beginService( "CNode_Impl::Port" );
603 hasinput = DataFlowNode()->HasInput( anInPort->PortName() ) ;
606 hasinput = DataFlowEditor()->HasInput( anInPort->PortName() ) ;
609 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
610 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
611 instanceName() , interfaceName() ,
614 // ServiceParameterName ,
615 (GraphBase::Port * ) anInPort ,
620 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
621 instanceName() , interfaceName() ,
624 // ServiceParameterName ) ;
625 (GraphBase::Port * ) anInPort ,
628 PortableServer::ObjectId * id = myPort->getId() ;
629 CORBA::Object_var obj = _poa->id_to_reference(*id);
630 iobject = SUPERV::Port::_narrow(obj) ;
631 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
634 iobject = anInPort->ObjRef() ;
637 else if ( anoutport ) {
638 GraphBase::OutPort * anOutPort ;
640 anOutPort = DataFlowNode()->GetChangeOutPort( ServiceParameterName ) ;
643 anOutPort = DataFlowEditor()->GetChangeOutPort( ServiceParameterName ) ;
645 if ( anOutPort->IsDataStream() ) {
646 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
648 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
650 beginService( "CNode_Impl::Port" );
653 const CORBA::Any * anAny = anOutPort->Value() ;
654 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
655 instanceName() , interfaceName() ,
658 // ServiceParameterName ,
659 (GraphBase::Port * ) anOutPort ,
662 PortableServer::ObjectId * id = myPort->getId() ;
663 CORBA::Object_var obj = _poa->id_to_reference(*id);
664 iobject = SUPERV::Port::_narrow(obj) ;
665 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
668 iobject = anOutPort->ObjRef() ;
672 endService( "CNode_Impl::Port" );
674 DataFlowEditor()->UnValid() ;
675 return SUPERV::Port::_duplicate( iobject ) ;
678 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
679 const SUPERV::Value_ptr aValue ) {
681 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
682 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
684 GraphBase::InPort * anInPort = NULL ;
685 if ( DataFlowEditor()->IsEditing() /*&& DataFlowEditor()->Graph()->GraphMacroLevel() == 0*/ ) {
687 sts = DataFlowEditor()->AddInputData( DataFlowNode()->Name() ,
688 ToServiceParameterName ,
690 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
693 sts = DataFlowEditor()->AddInputData( DataFlowEditor()->Graph()->Name() ,
694 ToServiceParameterName ,
696 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
698 if ( sts && anInPort ) {
699 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
701 beginService( "CNode_Impl::Input" );
705 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
706 instanceName() , interfaceName() ,
709 // ToServiceParameterName ,
710 (GraphBase::Port * ) anInPort ,
713 PortableServer::ObjectId * id = myPort->getId() ;
714 CORBA::Object_var obj = _poa->id_to_reference(*id);
715 iobject = SUPERV::Port::_narrow(obj) ;
716 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
719 iobject = anInPort->ObjRef() ;
722 DataFlowEditor()->UnValid() ;
724 else if ( aDataFlowExecutor ) {
726 sts = aDataFlowExecutor->ChangeInputData( DataFlowNode()->Name() ,
727 ToServiceParameterName ,
729 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
732 sts = aDataFlowExecutor->ChangeInputData( DataFlowEditor()->Graph()->Name() ,
733 ToServiceParameterName ,
735 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
737 if ( sts && anInPort ) {
738 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
740 beginService( "CNode_Impl::Input" );
744 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
745 instanceName() , interfaceName() ,
748 // ToServiceParameterName ,
749 (GraphBase::Port * ) anInPort ,
752 PortableServer::ObjectId * id = myPort->getId() ;
753 CORBA::Object_var obj = _poa->id_to_reference(*id);
754 iobject = SUPERV::Port::_narrow(obj) ;
755 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
758 iobject = anInPort->ObjRef() ;
763 endService( "CNode_Impl::Input" );
765 if ( CORBA::is_nil( iobject ) ) {
766 MESSAGE( "CNode_Impl::Input returns nil object _IsNode " << _IsNode << " sts " << sts
767 << " Node " << Name() << " ToServiceParameterName " << ToServiceParameterName
768 << " anInPort " << anInPort ) ;
770 return SUPERV::Port::_duplicate( iobject ) ;
774 SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) {
775 SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ;
776 Port_Impl * myInPort = NULL ;
777 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
778 if ( anInPort && !anInPort->IsDataStream() ) {
779 Inobject = anInPort->ObjRef() ;
780 if ( CORBA::is_nil( Inobject ) ) {
781 myInPort = new Port_Impl( _Orb , _Poa , _ContId ,
782 instanceName() , interfaceName() ,
785 (GraphBase::Port * ) anInPort ,
788 PortableServer::ObjectId * id = myInPort->getId() ;
789 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
790 Inobject = SUPERV::Port::_narrow(obj) ;
791 anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ;
795 return SUPERV::Port::_duplicate( Inobject ) ;
798 SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) {
799 Port_Impl * myOutPort = NULL ;
800 SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
801 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
802 if ( anOutPort && !anOutPort->IsDataStream() ) {
803 Outobject = anOutPort->ObjRef() ;
804 if ( CORBA::is_nil( Outobject ) ) {
805 const CORBA::Any * anAny = anOutPort->Value() ;
806 myOutPort = new Port_Impl( _Orb , _Poa , _ContId ,
807 instanceName() , interfaceName() ,
810 (GraphBase::Port * ) anOutPort ,
814 PortableServer::ObjectId * id = myOutPort->getId() ;
815 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
816 Outobject = SUPERV::Port::_narrow(obj) ;
817 anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ;
821 return SUPERV::Port::_duplicate( Outobject );
824 SUPERV::StreamPort_ptr CNode_Impl::GetInStreamPort( const char *aParameterName ) {
825 SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ;
826 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
827 StreamPort_Impl * myInStreamPort = NULL ;
828 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
829 if ( anInPort && anInPort->IsDataStream() ) {
830 Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
831 if ( CORBA::is_nil( Inobject ) ) {
832 myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
833 instanceName() , interfaceName() ,
836 (GraphBase::Port * ) anInPort ,
838 if ( myInStreamPort ) {
839 PortableServer::ObjectId * id = myInStreamPort->getId() ;
840 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
841 Inobject = SUPERV::StreamPort::_narrow(obj) ;
842 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ;
847 return SUPERV::StreamPort::_duplicate( Inobject ) ;
850 SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName ) {
851 StreamPort_Impl * myOutStreamPort = NULL ;
852 SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ;
853 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
854 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
855 if ( anOutPort && anOutPort->IsDataStream() ) {
856 Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
857 if ( CORBA::is_nil( Outobject ) ) {
858 const CORBA::Any * anAny = anOutPort->Value() ;
859 myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
860 instanceName() , interfaceName() ,
863 (GraphBase::Port * ) anOutPort ,
866 if ( myOutStreamPort ) {
867 PortableServer::ObjectId * id = myOutStreamPort->getId() ;
868 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
869 Outobject = SUPERV::StreamPort::_narrow(obj) ;
870 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ;
875 return SUPERV::StreamPort::_duplicate( Outobject );
878 bool CNode_Impl::HasStreamPort() {
879 bool RetVal = false ;
880 beginService( "CNode_Impl::HasStreamPort" );
881 endService( "CNode_Impl::HasStreamPort" );
885 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
887 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
889 char* FromServiceParameterName ;
890 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
891 ToServiceParameterName ,
893 & FromServiceParameterName ) ;
895 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
896 if ( !anInPort->IsDataStream() && anInPort->GetOutPort() ) {
897 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
898 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
900 beginService( "CNode_Impl::GetLink" );
904 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
905 instanceName() , interfaceName() ,
908 ToServiceParameterName ,
909 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
910 FromServiceParameterName ,
911 true , false , Success ) ;
913 PortableServer::ObjectId * id = myLink->getId() ;
914 CORBA::Object_var obj = _poa->id_to_reference(*id);
915 iobject = SUPERV::Link::_narrow(obj) ;
916 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
920 iobject = anOutPort->InPortObjRef( anInPort ) ;
925 endService( "CNode_Impl::GetLink" );
927 return SUPERV::Link::_duplicate( iobject ) ;
930 SUPERV::StreamLink_ptr CNode_Impl::GetStreamLink(const char * ToServiceParameterName ) {
932 SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
934 char* FromServiceParameterName ;
935 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
936 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
937 ToServiceParameterName ,
939 & FromServiceParameterName ) ;
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 ) ) ) {
946 beginService( "CNode_Impl::GetLink" );
950 StreamLink_Impl * myStreamLink = new StreamLink_Impl(
951 _Orb , _Poa , _ContId ,
952 instanceName() , interfaceName() ,
955 ToServiceParameterName ,
956 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
957 FromServiceParameterName ,
960 PortableServer::ObjectId * id = myStreamLink->getId() ;
961 CORBA::Object_var obj = _poa->id_to_reference(*id);
962 iobject = SUPERV::StreamLink::_narrow(obj) ;
963 anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
967 iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
973 endService( "CNode_Impl::GetLink" );
975 return SUPERV::StreamLink::_duplicate( iobject ) ;
978 SUPERV::ListOfPorts * CNode_Impl::Ports() {
982 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
984 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
985 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
986 if ( !anInPort->IsDataStream() ) {
988 beginService( "CNode_Impl::Ports" );
991 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
992 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
993 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
995 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
996 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
997 // << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
998 // << "/" << anInPort->IsNotConnected() ) ;
1000 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1001 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1002 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1003 instanceName() , interfaceName() ,
1006 (GraphBase::Port * ) anInPort ,
1011 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1012 instanceName() , interfaceName() ,
1015 (GraphBase::Port * ) anInPort ,
1018 PortableServer::ObjectId * id = myPort->getId() ;
1019 CORBA::Object_var obj = _poa->id_to_reference(*id);
1020 SUPERV::Port_var iobject ;
1021 iobject = SUPERV::Port::_narrow(obj) ;
1023 RetVal->length( PortCount ) ;
1024 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1025 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1028 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1030 RetVal->length( PortCount ) ;
1031 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1035 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1038 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1039 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1040 if ( !anOutPort->IsDataStream() ) {
1042 beginService( "CNode_Impl::Ports" );
1045 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1046 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1047 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1049 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1050 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1051 const CORBA::Any * anAny = anOutPort->Value() ;
1052 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1053 instanceName() , interfaceName() ,
1056 (GraphBase::Port * ) anOutPort ,
1059 PortableServer::ObjectId * id = myPort->getId() ;
1060 CORBA::Object_var obj = _poa->id_to_reference(*id);
1061 SUPERV::Port_var iobject ;
1062 iobject = SUPERV::Port::_narrow(obj) ;
1064 RetVal->length( PortCount ) ;
1065 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1066 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1069 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1071 RetVal->length( PortCount ) ;
1072 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1076 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1081 if ( DataFlowEditor()->IsValid() ) {
1082 //DataFlowEditor()->Graph()->Values() ;
1083 RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1084 DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1085 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1086 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1087 if ( !anOutPort->IsDataStream() ) {
1088 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1090 beginService( "CNode_Impl::Ports" );
1093 Port_Impl * myPort ;
1094 if ( anOutPort->IsDataConnected() ) {
1095 const CORBA::Any * anAny = anOutPort->Value() ;
1096 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1097 instanceName() , interfaceName() ,
1100 (GraphBase::Port * ) anOutPort ,
1105 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1106 instanceName() , interfaceName() ,
1109 (GraphBase::Port * ) anOutPort ,
1112 PortableServer::ObjectId * id = myPort->getId() ;
1113 CORBA::Object_var obj = _poa->id_to_reference(*id);
1114 SUPERV::Port_var iobject ;
1115 iobject = SUPERV::Port::_narrow(obj) ;
1117 RetVal->length( PortCount ) ;
1118 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1119 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1123 RetVal->length( PortCount ) ;
1124 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1130 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1131 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1132 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1133 if ( !anInPort->IsDataStream() ) {
1134 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1136 beginService( "CNode_Impl::Ports" );
1139 Port_Impl * myPort ;
1140 if ( anInPort->IsDataConnected() ) {
1141 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1142 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1143 instanceName() , interfaceName() ,
1146 (GraphBase::Port * ) anInPort ,
1151 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1152 instanceName() , interfaceName() ,
1158 PortableServer::ObjectId * id = myPort->getId() ;
1159 CORBA::Object_var obj = _poa->id_to_reference(*id);
1160 SUPERV::Port_var iobject ;
1161 iobject = SUPERV::Port::_narrow(obj) ;
1163 RetVal->length( PortCount ) ;
1164 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1165 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1169 RetVal->length( PortCount ) ;
1170 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1179 int RetVallength = (unsigned int ) RetVal->length() ;
1180 for ( i = 0 ; i < RetVallength ; i++ ) {
1181 MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1185 endService( "CNode_Impl::Ports " ) ;
1187 return ( RetVal._retn() ) ;
1190 SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() {
1194 SUPERV::ListOfStreamPorts_var RetVal = new SUPERV::ListOfStreamPorts ;
1195 if ( !DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1196 // MESSAGE("CNode_Impl::StreamPorts NOT a DataStreamNode" ) ;
1198 else if ( _IsNode ) {
1199 // RetVal->length( DataFlowNode()->GetNodeInPortsSize() +
1200 // DataFlowNode()->GetNodeOutPortsSize() ) ;
1201 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1202 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1203 if ( anInPort->IsDataStream() ) {
1205 beginService( "CNode_Impl::StreamPorts" );
1208 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1209 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1210 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1211 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1213 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1214 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1215 << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1216 << "/" << anInPort->IsNotConnected() ) ;
1217 StreamPort_Impl * myStreamPort ;
1218 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1219 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1220 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1221 instanceName() , interfaceName() ,
1224 (GraphBase::Port * ) anInPort ,
1229 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1230 instanceName() , interfaceName() ,
1233 (GraphBase::Port * ) anInPort ,
1236 PortableServer::ObjectId * id = myStreamPort->getId() ;
1237 CORBA::Object_var obj = _poa->id_to_reference(*id);
1238 SUPERV::StreamPort_var iobject ;
1239 iobject = SUPERV::StreamPort::_narrow(obj) ;
1241 RetVal->length( PortCount ) ;
1242 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1243 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1246 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1248 RetVal->length( PortCount ) ;
1249 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1253 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1256 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1257 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1258 if ( anOutPort->IsDataStream() ) {
1260 beginService( "CNode_Impl::StreamPorts" );
1263 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1264 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1265 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1266 // RetVal[ DataFlowNode()->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1268 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1269 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1270 const CORBA::Any * anAny = anOutPort->Value() ;
1271 StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1272 instanceName() , interfaceName() ,
1275 (GraphBase::Port * ) anOutPort ,
1278 PortableServer::ObjectId * id = myStreamPort->getId() ;
1279 CORBA::Object_var obj = _poa->id_to_reference(*id);
1280 SUPERV::StreamPort_var iobject ;
1281 iobject = SUPERV::StreamPort::_narrow(obj) ;
1283 RetVal->length( PortCount ) ;
1284 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1285 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1288 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1290 RetVal->length( PortCount ) ;
1291 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1295 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1300 if ( DataFlowEditor()->IsValid() ) {
1301 // RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1302 // DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1303 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1304 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1305 if ( anOutPort->IsDataStream() ) {
1306 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1308 beginService( "CNode_Impl::StreamPorts" );
1311 StreamPort_Impl * myStreamPort ;
1312 if ( anOutPort->IsDataConnected() ) {
1313 const CORBA::Any * anAny = anOutPort->Value() ;
1314 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1315 instanceName() , interfaceName() ,
1318 (GraphBase::Port * ) anOutPort ,
1323 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1324 instanceName() , interfaceName() ,
1327 (GraphBase::Port * ) anOutPort ,
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) ;
1335 RetVal->length( PortCount ) ;
1336 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1337 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1341 RetVal->length( PortCount ) ;
1342 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1346 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1349 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1350 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1351 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1352 if ( anInPort->IsDataStream() ) {
1353 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1355 beginService( "CNode_Impl::StreamPorts" );
1358 StreamPort_Impl * myStreamPort ;
1359 if ( anInPort->IsDataConnected() ) {
1360 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1361 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1362 instanceName() , interfaceName() ,
1365 (GraphBase::Port * ) anInPort ,
1370 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1371 instanceName() , interfaceName() ,
1377 PortableServer::ObjectId * id = myStreamPort->getId() ;
1378 CORBA::Object_var obj = _poa->id_to_reference(*id);
1379 SUPERV::StreamPort_var iobject ;
1380 iobject = SUPERV::StreamPort::_narrow(obj) ;
1382 RetVal->length( PortCount ) ;
1383 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1384 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1388 RetVal->length( PortCount ) ;
1389 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1393 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1398 // int RetVallength = (unsigned int ) RetVal->length() ;
1399 // for ( i = 0 ; i < RetVallength ; i++ ) {
1400 // MESSAGE( "StreamPort " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1403 endService( "CNode_Impl::StreamPorts " ) ;
1405 return ( RetVal._retn() ) ;
1408 SUPERV::ListOfLinks * CNode_Impl::Links() {
1409 beginService( "CNode_Impl::Links" ) ;
1410 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
1411 if ( DataFlowNode() ) {
1412 // MESSAGE( "CNode_Impl::Links " << DataFlowEditor() << " " << DataFlowEditor()->Graph() << " " << DataFlowEditor()->Graph()->ObjImpl() << " " << DataFlowNode()->ComputingNode() << " " << DataFlowNode()->ComputingNode()->Name() ) ;
1413 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( DataFlowNode()->ComputingNode() , NULL ) ;
1416 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( NULL , NULL ) ;
1418 MESSAGE( "CNode_Impl::Links " << RetVal->length() << " Links" ) ;
1419 endService( "CNode_Impl::Links" ) ;
1420 return ( RetVal._retn() ) ;
1423 SUPERV::ListOfStreamLinks * CNode_Impl::StreamLinks() {
1424 beginService( "CNode_Impl::StreamLinks" ) ;
1425 SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
1426 if ( DataFlowNode() && DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1427 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( DataFlowNode()->ComputingNode() , NULL ) ;
1429 else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1430 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( NULL , NULL ) ;
1432 MESSAGE( "CNode_Impl::StreamLinks " << RetVal->length() << " StreamLinks" ) ;
1433 endService( "CNode_Impl::StreamLinks" ) ;
1434 return ( RetVal._retn() ) ;
1437 long CNode_Impl::SubGraph() {
1438 // beginService( "CNode_Impl::SubGraph" );
1441 RetVal = DataFlowNode()->SubGraph() ;
1443 // endService( "CNode_Impl::SubGraph" );
1447 long CNode_Impl::SubStreamGraph() {
1448 // beginService( "CNode_Impl::SubStreamGraph" );
1451 RetVal = DataFlowNode()->SubStreamGraph() ;
1453 // endService( "CNode_Impl::SubStreamGraph" );
1457 bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
1458 beginService( "CNode_Impl::IsLinked" );
1459 bool RetVal = DataFlowNode()->IsLinked( ServiceParameterName ) ;
1460 MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
1461 endService( "CNode_Impl::IsLinked" );
1465 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
1466 // beginService( "CNode_Impl::HasInput" );
1467 bool RetVal = DataFlowNode()->HasInput( ServiceParameterName ) ;
1468 // endService( "CNode_Impl::HasInput" );
1472 SUPERV::GraphState CNode_Impl::State() {
1473 // beginService( "CNode_Impl::State" );
1474 SUPERV::GraphState RetVal = SUPERV::EditingState ;
1475 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1476 if ( aDataFlowExecutor && !DataFlowEditor()->EditedAfterExecution() ) {
1477 //JR : 12/06/03 if ( aDataFlowExecutor ) {
1479 RetVal = aDataFlowExecutor->State( Name() ) ;
1482 RetVal = aDataFlowExecutor->State() ;
1485 // endService( "CNode_Impl::State" );
1488 long CNode_Impl::Thread() {
1489 // beginService( "CNode_Impl::Thread" );
1491 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1492 if ( aDataFlowExecutor ) {
1494 RetVal = aDataFlowExecutor->Thread( Name() ) ;
1497 RetVal = aDataFlowExecutor->Thread() ;
1500 // endService( "CNode_Impl::Thread" );
1503 GraphExecutor::AutomatonState CNode_Impl::AutoState() {
1504 // beginService( "CNode_Impl::AutoState" );
1505 GraphExecutor::AutomatonState RetVal = GraphExecutor::UnKnownState ;
1506 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1507 if ( aDataFlowExecutor ) {
1509 RetVal = aDataFlowExecutor->AutomatonState( Name() ) ;
1512 RetVal = aDataFlowExecutor->AutomatonState() ;
1515 // endService( "CNode_Impl::AutoState" );
1518 SUPERV::ControlState CNode_Impl::Control() {
1519 // beginService( "CNode_Impl::Control" );
1520 SUPERV::ControlState RetVal = SUPERV::VoidState ;
1521 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1522 if ( aDataFlowExecutor ) {
1524 RetVal = aDataFlowExecutor->ControlState( Name() ) ;
1527 RetVal = aDataFlowExecutor->ControlState() ;
1530 // endService( "CNode_Impl::Control" );
1533 void CNode_Impl::ControlClear() {
1534 // beginService( "CNode_Impl::ControlClear" );
1535 // SUPERV::ControlState RetVal = SUPERV::VoidState ;
1536 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1537 if ( aDataFlowExecutor ) {
1539 aDataFlowExecutor->ControlClear( Name() ) ;
1542 aDataFlowExecutor->ControlClear() ;
1545 // endService( "CNode_Impl::ControlClear" );
1549 bool CNode_Impl::IsReady() {
1550 // beginService( "CNode_Impl::IsReady" );
1551 bool RetVal = false ;
1552 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1553 if ( aDataFlowExecutor ) {
1555 RetVal = aDataFlowExecutor->IsReady( Name() ) ;
1558 RetVal = aDataFlowExecutor->IsReady() ;
1561 // endService( "CNode_Impl::IsReady" );
1565 bool CNode_Impl::IsWaiting() {
1566 // beginService( "CNode_Impl::IsWaiting" );
1567 bool RetVal = false ;
1568 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1569 if ( aDataFlowExecutor ) {
1571 RetVal = aDataFlowExecutor->IsWaiting( Name() ) ;
1574 RetVal = aDataFlowExecutor->IsWaiting() ;
1577 // endService( "CNode_Impl::IsWaiting" );
1581 bool CNode_Impl::IsRunning() {
1582 // beginService( "CNode_Impl::IsRunning" );
1583 bool RetVal = false ;
1584 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1585 if ( aDataFlowExecutor ) {
1587 RetVal = aDataFlowExecutor->IsRunning( Name() ) ;
1590 RetVal = aDataFlowExecutor->IsRunning() ;
1593 // endService( "CNode_Impl::IsRunning" );
1597 bool CNode_Impl::IsDone() {
1598 // beginService( "CNode_Impl::IsDone" );
1599 bool RetVal = false ;
1600 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1601 if ( aDataFlowExecutor ) {
1603 RetVal = aDataFlowExecutor->IsDone( Name() ) ;
1606 RetVal = aDataFlowExecutor->IsDone() ;
1609 // endService( "CNode_Impl::IsDone" );
1613 bool CNode_Impl::IsSuspended() {
1614 // beginService( "CNode_Impl::IsSuspended" );
1615 bool RetVal = false ;
1616 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1617 if ( aDataFlowExecutor ) {
1619 RetVal = aDataFlowExecutor->IsSuspended( Name() ) ;
1622 RetVal = aDataFlowExecutor->IsSuspended() ;
1625 // endService( "CNode_Impl::IsSuspended" );
1629 bool CNode_Impl::ReadyW() {
1630 // beginService( "CNode_Impl::ReadyW" );
1631 bool RetVal = false ;
1632 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1633 if ( aDataFlowExecutor ) {
1635 RetVal = aDataFlowExecutor->ReadyWait( Name() ) ;
1638 RetVal = aDataFlowExecutor->ReadyWait() ;
1641 // endService( "CNode_Impl::ReadyW" );
1645 bool CNode_Impl::RunningW() {
1646 // beginService( "CNode_Impl::RunningW" );
1647 bool RetVal = false ;
1648 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1649 if ( aDataFlowExecutor ) {
1651 RetVal = aDataFlowExecutor->RunningWait( Name() ) ;
1654 RetVal = aDataFlowExecutor->RunningWait() ;
1657 // endService( "CNode_Impl::RunningW" );
1661 bool CNode_Impl::DoneW() {
1662 // beginService( "CNode_Impl::DoneW" );
1663 bool RetVal = false ;
1664 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1665 if ( aDataFlowExecutor ) {
1667 RetVal = aDataFlowExecutor->DoneWait( Name() ) ;
1670 RetVal = aDataFlowExecutor->DoneWait() ;
1673 // endService( "CNode_Impl::DoneW" );
1677 bool CNode_Impl::SuspendedW() {
1678 // beginService( "CNode_Impl::SuspendedW" );
1679 bool RetVal = false ;
1680 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1681 if ( aDataFlowExecutor ) {
1683 RetVal = aDataFlowExecutor->SuspendedWait( Name() ) ;
1686 RetVal = aDataFlowExecutor->SuspendedWait() ;
1689 // endService( "CNode_Impl::SuspendedW" );
1693 void CNode_Impl::ping() {
1694 // beginService( "CNode_Impl::ping" );
1695 bool RetVal = false ;
1696 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1697 if ( aDataFlowExecutor ) {
1699 RetVal = aDataFlowExecutor->Ping( Name() ) ;
1705 // endService( "CNode_Impl::ping" );
1709 bool CNode_Impl::ContainerKill() {
1710 beginService( "CNode_Impl::ContainerKill" );
1711 bool RetVal = false ;
1712 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1713 if ( aDataFlowExecutor && IsExecuting() ) {
1715 RetVal = aDataFlowExecutor->ContainerKill( Name() ) ;
1718 RetVal = aDataFlowExecutor->ContainerKill() ;
1721 endService( "CNode_Impl::ContainerKill" );
1724 bool CNode_Impl::Kill() {
1725 beginService( "CNode_Impl::Kill" );
1726 bool RetVal = false ;
1727 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1728 if ( aDataFlowExecutor ) {
1730 RetVal = aDataFlowExecutor->Kill( Name() ) ;
1731 MESSAGE( "Node " << Name() << " execution was killed : " << RetVal ) ;
1734 RetVal = aDataFlowExecutor->Kill() ;
1735 MESSAGE( "Graph execution was killed : " << RetVal ) ;
1738 endService( "CNode_Impl::Kill" );
1741 bool CNode_Impl::KillDone() {
1742 // beginService( "CNode_Impl::KillDone" );
1743 bool RetVal = false ;
1744 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1745 if ( aDataFlowExecutor ) {
1747 RetVal = aDataFlowExecutor->KillDone( Name() ) ;
1750 // endService( "CNode_Impl::KillDone" );
1753 bool CNode_Impl::Stop() {
1754 // beginService( "CNode_Impl::Stop" );
1755 bool RetVal ; // = aDataFlowExecutor->Stop() ;
1756 // endService( "CNode_Impl::Stop" );
1759 bool CNode_Impl::Suspend() {
1760 beginService( "CNode_Impl::Suspend" );
1761 bool RetVal = false ;
1762 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1763 if ( aDataFlowExecutor ) {
1765 MESSAGE( "CNode_Impl::Suspend " << Name() ) ;
1766 RetVal = aDataFlowExecutor->Suspend( Name() ) ;
1769 MESSAGE( "CNode_Impl::Suspend " << aDataFlowExecutor->Graph()->Name() ) ;
1770 RetVal = aDataFlowExecutor->Suspend() ;
1773 endService( "CNode_Impl::Suspend" );
1776 bool CNode_Impl::SuspendDone() {
1777 // beginService( "CNode_Impl::SuspendDone" );
1778 bool RetVal = false ;
1779 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1780 if ( aDataFlowExecutor ) {
1782 RetVal = aDataFlowExecutor->SuspendDone( Name() ) ;
1785 RetVal = aDataFlowExecutor->SuspendDone() ;
1788 // endService( "CNode_Impl::SuspendDone" );
1791 bool CNode_Impl::Resume() {
1792 bool RetVal = false ;
1793 beginService( "CNode_Impl::Resume" );
1794 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1795 if ( aDataFlowExecutor ) {
1797 MESSAGE( "CNode_Impl::Resume " << Name() ) ;
1798 RetVal = aDataFlowExecutor->Resume( Name() ) ;
1801 MESSAGE( "CNode_Impl::Resume " << aDataFlowExecutor->Graph()->Name() ) ;
1802 RetVal = aDataFlowExecutor->Resume() ;
1805 endService( "CNode_Impl::Resume" );
1809 // Old method used in the past for initial study about GOTO and Loop
1810 // Should not be used
1811 bool CNode_Impl::Run() {
1812 beginService( "CNode_Impl::Run" );
1813 bool RetVal = false ;
1814 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1815 MESSAGE( "CNode_Impl::Run DataFlowExecutor " << aDataFlowExecutor << Name() << " _IsNode " << _IsNode ) ;
1816 if ( aDataFlowExecutor ) {
1817 DataFlowEditor()->EditedAfterExecution( false ) ;
1819 RetVal = aDataFlowExecutor->Run( Name() , Name() , false ) ;
1822 RetVal = aDataFlowExecutor->Run( false ) ;
1825 endService( "CNode_Impl::Run" );
1829 bool CNode_Impl::ReRun() {
1830 beginService( "CNode_Impl::ReRun" );
1831 bool RetVal = false ;
1832 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1833 if ( aDataFlowExecutor ) {
1834 DataFlowEditor()->EditedAfterExecution( false ) ;
1836 RetVal = aDataFlowExecutor->Run( Name() , Name() , false ) ;
1838 // The GUI calls directly that method instead of calling Graph_Impl::Run() :
1839 // I redirect the call to Graph_Impl::Run()
1840 else if ( DataFlowEditor()->IsEditing() ) {
1841 RetVal = ((Graph_Impl::Graph_Impl *) this)->Graph_Impl::Run() ;
1844 RetVal = aDataFlowExecutor->Run( false ) ;
1847 endService( "CNode_Impl::ReRun" );
1851 // Old method used in the past for initial study about GOTO and Loop
1852 // Should not be used
1853 bool CNode_Impl::ReRunAt( const char * aNodeName ) {
1854 beginService( "CNode_Impl::ReRunAt" );
1855 bool RetVal = false ;
1856 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1857 if ( aDataFlowExecutor ) {
1858 DataFlowEditor()->EditedAfterExecution( false ) ;
1860 RetVal = aDataFlowExecutor->Run( Name() , aNodeName , false ) ;
1863 endService( "CNode_Impl::ReRunAt" );
1867 bool CNode_Impl::ReStart() {
1868 beginService( "CNode_Impl::ReStart" );
1869 bool RetVal = false ;
1870 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1871 if ( aDataFlowExecutor ) {
1873 RetVal = aDataFlowExecutor->Run( Name() , Name() , true ) ;
1875 // The GUI calls directly that method instead of calling Graph_Impl::Start() :
1876 // I redirect the call to Graph_Impl::Start()
1877 else if ( DataFlowEditor()->IsEditing() ) {
1878 RetVal = ((Graph_Impl::Graph_Impl *) this)->Graph_Impl::Start() ;
1881 RetVal = aDataFlowExecutor->Run( true ) ;
1884 endService( "CNode_Impl::ReStart" );
1888 // Old method used in the past for initial study about GOTO and Loop
1889 // Should not be used
1890 bool CNode_Impl::ReStartAt( const char * aNodeName ) {
1891 beginService( "CNode_Impl::ReStartAt" );
1892 bool RetVal = false ;
1893 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1894 if ( aDataFlowExecutor ) {
1896 RetVal = aDataFlowExecutor->Run( Name() , aNodeName , true ) ;
1899 endService( "CNode_Impl::ReStartAt" );
1903 long CNode_Impl::CpuUsed() {
1905 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1906 if ( aDataFlowExecutor ) {
1908 RetVal = aDataFlowExecutor->CpuUsed( Name() ) ;
1911 RetVal = aDataFlowExecutor->CpuUsed() ;
1917 bool CNode_Impl::IsExecuting() {
1918 bool RetVal = false;
1919 if ( !IsMacro() && DataFlowEditor() && DataFlowEditor()->Executor() ) {
1920 // asv : the statement below normally does not return true, Executor_OutNode
1921 // sets Editor->Editing() after finishing of execution (see Executor_OutNode.cxx)
1922 if ( DataFlowEditor()->IsExecuting() && DataFlowEditor()->Executor()->IsDone() ) {
1923 DataFlowEditor()->Editing();
1926 RetVal = DataFlowEditor()->IsExecuting();