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 MESSAGE("CNode_Impl::destroy ERROR ") ;
190 // endService( "CNode_Impl::Destroy" );
193 bool CNode_Impl::Delete() {
194 beginService( "CNode_Impl::Delete" );
195 bool RetVal = false ;
196 if ( DataFlowEditor()->IsEditing() ) {
198 RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
200 RetVal = DataFlowEditor()->UnValid() ;
203 endService( "CNode_Impl::Delete" );
207 void CNode_Impl::DeletePorts() {
208 beginService( "CNode_Impl::DeletePorts" );
209 if ( DataFlowEditor()->IsEditing() && DataFlowNode() ) {
211 for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeInPortsSize() ; i++ ) {
212 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeInPort( i )->ObjRef() ;
213 if ( !CORBA::is_nil( aPort ) ) {
217 for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeOutPortsSize() ; i++ ) {
218 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeOutPort( i )->ObjRef() ;
219 if ( !CORBA::is_nil( aPort ) ) {
224 endService( "CNode_Impl::DeletePorts" );
227 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
228 // beginService( "CNode_Impl::Service" );
229 SALOME_ModuleCatalog::Service * RetVal ;
231 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowNode()->GetService() ) ;
234 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowEditor()->GetService() ) ;
236 // endService( "CNode_Impl::Service" );
240 char * CNode_Impl::Name() {
241 // beginService( "CNode_Impl::Name" );
242 char * RetVal = NULL ;
244 RetVal = DataFlowNode()->Name() ;
247 RetVal = DataFlowEditor()->Graph()->Name() ;
249 // endService( "CNode_Impl::Name" );
250 return CORBA::string_dup( RetVal );
252 bool CNode_Impl::SetName( const char * aDataFlowName ) {
253 // beginService( "CNode_Impl::SetName" );
254 bool RetVal = false ;
255 if ( DataFlowEditor()->IsEditing() ) {
257 RetVal = DataFlowEditor()->ReNameNode( DataFlowNode()->Name() ,
261 // RetVal = DataFlowEditor()->Graph()->Name( aDataFlowName ) ;
262 RetVal = DataFlowEditor()->Name( aDataFlowName ) ;
265 // endService( "CNode_Impl::SetName" );
268 SUPERV::KindOfNode CNode_Impl::Kind() {
269 // beginService( "CNode_Impl::Kind" );
270 SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
272 RetVal = DataFlowNode()->Kind() ;
275 RetVal = DataFlowEditor()->Graph()->Kind() ;
277 // endService( "CNode_Impl::Kind" );
280 bool CNode_Impl::IsGraph() {
281 // beginService( "CNode_Impl::IsGraph" );
282 bool RetVal = false ;
284 RetVal = DataFlowNode()->IsDataFlowNode() ;
287 RetVal = DataFlowEditor()->Graph()->IsDataFlowNode() ;
289 // endService( "CNode_Impl::IsGraph" );
292 bool CNode_Impl::IsStreamGraph() {
293 // beginService( "CNode_Impl::IsStreamGraph" );
294 bool RetVal = false ;
296 RetVal = DataFlowNode()->IsDataStreamNode() ;
299 RetVal = DataFlowEditor()->Graph()->IsDataStreamNode() ;
301 // endService( "CNode_Impl::IsStreamGraph" );
304 bool CNode_Impl::IsMacro() {
305 // beginService( "CNode_Impl::IsMacro" );
306 bool RetVal = false ;
307 if ( _IsNode && DataFlowNode()->IsMacroNode() ) {
310 // endService( "CNode_Impl::IsMacro" );
313 bool CNode_Impl::IsFlowMacro() {
314 // beginService( "CNode_Impl::IsFlowMacro" );
315 bool RetVal = false ;
316 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsGraph() ) {
319 // endService( "CNode_Impl::IsFlowMacro" );
322 bool CNode_Impl::IsStreamMacro() {
323 // beginService( "CNode_Impl::IsStreamMacro" );
324 bool RetVal = false ;
325 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsStreamGraph() ) {
328 // endService( "CNode_Impl::IsStreamMacro" );
331 bool CNode_Impl::IsHeadGraph() {
332 bool RetVal = false ;
333 beginService( "CNode_Impl::IsHeadGraph" );
334 endService( "CNode_Impl::IsHeadGraph" );
337 long CNode_Impl::GraphLevel() {
339 beginService( "CNode_Impl::GraphLevel" );
340 RetVal = DataFlowEditor()->Graph()->GraphMacroLevel() ;
341 endService( "CNode_Impl::GraphLevel" );
345 bool CNode_Impl::IsComputing() {
346 // beginService( "CNode_Impl::IsComputing" );
347 bool RetVal = SUPERV::UnknownNode ;
349 RetVal = DataFlowNode()->IsComputingNode() ;
352 RetVal = DataFlowEditor()->Graph()->IsComputingNode() ;
354 // endService( "CNode_Impl::IsComputing" );
357 bool CNode_Impl::IsFactory() {
358 // beginService( "CNode_Impl::IsFactory" );
359 bool RetVal = SUPERV::UnknownNode ;
361 RetVal = DataFlowNode()->IsFactoryNode() ;
364 RetVal = DataFlowEditor()->Graph()->IsFactoryNode() ;
366 // endService( "CNode_Impl::IsFactory" );
369 bool CNode_Impl::IsInLine() {
370 // beginService( "CNode_Impl::IsInLine" );
371 bool RetVal = SUPERV::UnknownNode ;
373 RetVal = DataFlowNode()->IsInLineNode() ;
376 RetVal = DataFlowEditor()->Graph()->IsInLineNode() ;
378 // endService( "CNode_Impl::IsInLine" );
381 bool CNode_Impl::IsGOTO() {
382 // beginService( "CNode_Impl::IsGOTO" );
383 bool RetVal = SUPERV::UnknownNode ;
385 RetVal = DataFlowNode()->IsGOTONode() ;
388 RetVal = DataFlowEditor()->Graph()->IsGOTONode() ;
390 // endService( "CNode_Impl::IsGOTO" );
393 bool CNode_Impl::IsLoop() {
394 // beginService( "CNode_Impl::IsLoop" );
395 bool RetVal = SUPERV::UnknownNode ;
397 RetVal = DataFlowNode()->IsLoopNode() ;
400 RetVal = DataFlowEditor()->Graph()->IsLoopNode() ;
402 // endService( "CNode_Impl::IsLoop" );
405 bool CNode_Impl::IsEndLoop() {
406 // beginService( "CNode_Impl::IsEndLoop" );
407 bool RetVal = SUPERV::UnknownNode ;
409 RetVal = DataFlowNode()->IsEndLoopNode() ;
412 RetVal = DataFlowEditor()->Graph()->IsEndLoopNode() ;
414 // endService( "CNode_Impl::IsEndLoop" );
417 bool CNode_Impl::IsSwitch() {
418 // beginService( "CNode_Impl::IsSwitch" );
419 bool RetVal = SUPERV::UnknownNode ;
421 RetVal = DataFlowNode()->IsSwitchNode() ;
424 RetVal = DataFlowEditor()->Graph()->IsSwitchNode() ;
426 // endService( "CNode_Impl::IsSwitch" );
429 bool CNode_Impl::IsEndSwitch() {
430 // beginService( "CNode_Impl::IsEndSwitch" );
431 bool RetVal = SUPERV::UnknownNode ;
433 RetVal = DataFlowNode()->IsEndSwitchNode() ;
436 RetVal = DataFlowEditor()->Graph()->IsEndSwitchNode() ;
438 // endService( "CNode_Impl::IsEndSwitch" );
442 SUPERV::SDate CNode_Impl::CreationDate() {
443 // beginService( "CNode_Impl::CreationDate" );
444 SUPERV::SDate_var RetVal ;
446 RetVal = new SUPERV::SDate( DataFlowNode()->FirstCreation() ) ;
449 // cout << " CNode_Impl::CreationDate " << DataFlowEditor()->FirstCreation()
451 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->FirstCreation() ) ;
453 // endService( "CNode_Impl::CreationDate" );
454 return (RetVal._retn()) ;
456 SUPERV::SDate CNode_Impl::LastUpdateDate() {
457 // beginService( "CNode_Impl::LastUpdateDate" );
458 SUPERV::SDate_var RetVal ;
460 RetVal = new SUPERV::SDate( DataFlowNode()->LastModification() ) ;
463 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->LastModification() ) ;
465 // endService( "CNode_Impl::LastUpdateDate" );
466 return (RetVal._retn()) ;
468 char * CNode_Impl::Version() {
469 // beginService( "CNode_Impl::Version" );
472 RetVal = DataFlowNode()->EditorRelease() ;
475 RetVal = DataFlowEditor()->Graph()->EditorRelease() ;
477 // endService( "CNode_Impl::Version" );
478 return CORBA::string_dup( RetVal ) ;
480 char * CNode_Impl::Author() {
481 // beginService( "CNode_Impl::Author" );
484 RetVal = DataFlowNode()->Author() ;
487 RetVal = DataFlowEditor()->Graph()->Author() ;
489 // endService( "CNode_Impl::Author" );
490 return CORBA::string_dup( RetVal ) ;
492 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
493 // beginService( "CNode_Impl::SetAuthor" );
494 bool RetVal = false ;
495 if ( DataFlowEditor()->IsEditing() ) {
497 RetVal = DataFlowNode()->Author( aDataFlowAuthor ) ;
500 RetVal = DataFlowEditor()->Graph()->Author( aDataFlowAuthor ) ;
503 // endService( "CNode_Impl::SetAuthor" );
506 char * CNode_Impl::Comment() {
507 // beginService( "CNode_Impl::Comment" );
510 RetVal = DataFlowNode()->Comment() ;
513 RetVal = DataFlowEditor()->Graph()->Comment() ;
515 // endService( "CNode_Impl::Comment" );
516 return CORBA::string_dup( RetVal ) ;
518 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
519 // beginService( "CNode_Impl::SetComment" );
520 bool RetVal = false ;
521 if ( DataFlowEditor()->IsEditing() ) {
523 RetVal = DataFlowNode()->Comment( aDataFlowComment ) ;
526 RetVal = DataFlowEditor()->Graph()->Comment( aDataFlowComment ) ;
529 // endService( "CNode_Impl::SetComment" );
533 void CNode_Impl::Coords(long X , long Y ) {
534 // beginService( "CNode_Impl::Coords" );
535 if ( DataFlowEditor()->IsEditing() ) {
537 ((GraphEditor::InNode *) DataFlowNode())->Coordinates( X , Y ) ;
540 DataFlowEditor()->Graph()->Coordinates( X , Y ) ;
543 // endService( "CNode_Impl::Coords" );
545 long CNode_Impl::X() {
546 // beginService( "CNode_Impl::X" );
549 RetVal = DataFlowNode()->XCoordinate() ;
552 RetVal = DataFlowEditor()->Graph()->XCoordinate() ;
554 // endService( "CNode_Impl::X" );
557 long CNode_Impl::Y() {
558 // beginService( "CNode_Impl::Y" );
561 RetVal = DataFlowNode()->YCoordinate() ;
564 RetVal = DataFlowEditor()->Graph()->YCoordinate() ;
566 // endService( "CNode_Impl::Y" );
570 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
572 Port_Impl * myPort = NULL ;
573 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
576 aninport = DataFlowNode()->GetInPort( ServiceParameterName ) ;
579 aninport = DataFlowEditor()->GetInPort( ServiceParameterName ) ;
583 anoutport = DataFlowNode()->GetOutPort( ServiceParameterName ) ;
586 anoutport = DataFlowEditor()->GetOutPort( ServiceParameterName ) ;
589 GraphBase::InPort * anInPort ;
591 anInPort = DataFlowNode()->GetChangeInPort( ServiceParameterName ) ;
594 anInPort = DataFlowEditor()->GetChangeInPort( ServiceParameterName ) ;
596 if ( anInPort->IsDataStream() ) {
597 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
599 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
601 beginService( "CNode_Impl::Port" );
606 hasinput = DataFlowNode()->HasInput( anInPort->PortName() ) ;
609 hasinput = DataFlowEditor()->HasInput( anInPort->PortName() ) ;
612 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
613 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
614 instanceName() , interfaceName() ,
617 // ServiceParameterName ,
618 (GraphBase::Port * ) anInPort ,
623 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
624 instanceName() , interfaceName() ,
627 // ServiceParameterName ) ;
628 (GraphBase::Port * ) anInPort ,
631 PortableServer::ObjectId * id = myPort->getId() ;
632 CORBA::Object_var obj = _poa->id_to_reference(*id);
633 iobject = SUPERV::Port::_narrow(obj) ;
634 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
637 iobject = anInPort->ObjRef() ;
640 else if ( anoutport ) {
641 GraphBase::OutPort * anOutPort ;
643 anOutPort = DataFlowNode()->GetChangeOutPort( ServiceParameterName ) ;
646 anOutPort = DataFlowEditor()->GetChangeOutPort( ServiceParameterName ) ;
648 if ( anOutPort->IsDataStream() ) {
649 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
651 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
653 beginService( "CNode_Impl::Port" );
656 const CORBA::Any * anAny = anOutPort->Value() ;
657 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
658 instanceName() , interfaceName() ,
661 // ServiceParameterName ,
662 (GraphBase::Port * ) anOutPort ,
665 PortableServer::ObjectId * id = myPort->getId() ;
666 CORBA::Object_var obj = _poa->id_to_reference(*id);
667 iobject = SUPERV::Port::_narrow(obj) ;
668 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
671 iobject = anOutPort->ObjRef() ;
675 endService( "CNode_Impl::Port" );
677 DataFlowEditor()->UnValid() ;
678 return SUPERV::Port::_duplicate( iobject ) ;
681 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
682 const SUPERV::Value_ptr aValue ) {
684 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
685 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
687 GraphBase::InPort * anInPort = NULL ;
688 if ( DataFlowEditor()->IsEditing() /*&& DataFlowEditor()->Graph()->GraphMacroLevel() == 0*/ ) {
690 sts = DataFlowEditor()->AddInputData( DataFlowNode()->Name() ,
691 ToServiceParameterName ,
693 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
696 sts = DataFlowEditor()->AddInputData( DataFlowEditor()->Graph()->Name() ,
697 ToServiceParameterName ,
699 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
701 if ( sts && anInPort ) {
702 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
704 beginService( "CNode_Impl::Input" );
708 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
709 instanceName() , interfaceName() ,
712 // ToServiceParameterName ,
713 (GraphBase::Port * ) anInPort ,
716 PortableServer::ObjectId * id = myPort->getId() ;
717 CORBA::Object_var obj = _poa->id_to_reference(*id);
718 iobject = SUPERV::Port::_narrow(obj) ;
719 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
722 iobject = anInPort->ObjRef() ;
725 DataFlowEditor()->UnValid() ;
727 else if ( aDataFlowExecutor ) {
729 sts = aDataFlowExecutor->ChangeInputData( DataFlowNode()->Name() ,
730 ToServiceParameterName ,
732 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
735 sts = aDataFlowExecutor->ChangeInputData( DataFlowEditor()->Graph()->Name() ,
736 ToServiceParameterName ,
738 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
740 if ( sts && anInPort ) {
741 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
743 beginService( "CNode_Impl::Input" );
747 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
748 instanceName() , interfaceName() ,
751 // ToServiceParameterName ,
752 (GraphBase::Port * ) anInPort ,
755 PortableServer::ObjectId * id = myPort->getId() ;
756 CORBA::Object_var obj = _poa->id_to_reference(*id);
757 iobject = SUPERV::Port::_narrow(obj) ;
758 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
761 iobject = anInPort->ObjRef() ;
766 endService( "CNode_Impl::Input" );
768 if ( CORBA::is_nil( iobject ) ) {
769 MESSAGE( "CNode_Impl::Input returns nil object _IsNode " << _IsNode << " sts " << sts
770 << " Node " << Name() << " ToServiceParameterName " << ToServiceParameterName
771 << " anInPort " << anInPort ) ;
773 return SUPERV::Port::_duplicate( iobject ) ;
777 SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) {
778 SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ;
779 Port_Impl * myInPort = NULL ;
780 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
781 if ( anInPort && !anInPort->IsDataStream() ) {
782 Inobject = anInPort->ObjRef() ;
783 if ( CORBA::is_nil( Inobject ) ) {
784 myInPort = new Port_Impl( _Orb , _Poa , _ContId ,
785 instanceName() , interfaceName() ,
788 (GraphBase::Port * ) anInPort ,
791 PortableServer::ObjectId * id = myInPort->getId() ;
792 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
793 Inobject = SUPERV::Port::_narrow(obj) ;
794 anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ;
798 return SUPERV::Port::_duplicate( Inobject ) ;
801 SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) {
802 Port_Impl * myOutPort = NULL ;
803 SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
804 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
805 if ( anOutPort && !anOutPort->IsDataStream() ) {
806 Outobject = anOutPort->ObjRef() ;
807 if ( CORBA::is_nil( Outobject ) ) {
808 const CORBA::Any * anAny = anOutPort->Value() ;
809 myOutPort = new Port_Impl( _Orb , _Poa , _ContId ,
810 instanceName() , interfaceName() ,
813 (GraphBase::Port * ) anOutPort ,
817 PortableServer::ObjectId * id = myOutPort->getId() ;
818 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
819 Outobject = SUPERV::Port::_narrow(obj) ;
820 anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ;
824 return SUPERV::Port::_duplicate( Outobject );
827 SUPERV::StreamPort_ptr CNode_Impl::GetInStreamPort( const char *aParameterName ) {
828 SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ;
829 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
830 StreamPort_Impl * myInStreamPort = NULL ;
831 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
832 if ( anInPort && anInPort->IsDataStream() ) {
833 Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
834 if ( CORBA::is_nil( Inobject ) ) {
835 myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
836 instanceName() , interfaceName() ,
839 (GraphBase::Port * ) anInPort ,
841 if ( myInStreamPort ) {
842 PortableServer::ObjectId * id = myInStreamPort->getId() ;
843 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
844 Inobject = SUPERV::StreamPort::_narrow(obj) ;
845 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ;
850 return SUPERV::StreamPort::_duplicate( Inobject ) ;
853 SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName ) {
854 StreamPort_Impl * myOutStreamPort = NULL ;
855 SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ;
856 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
857 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
858 if ( anOutPort && anOutPort->IsDataStream() ) {
859 Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
860 if ( CORBA::is_nil( Outobject ) ) {
861 const CORBA::Any * anAny = anOutPort->Value() ;
862 myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
863 instanceName() , interfaceName() ,
866 (GraphBase::Port * ) anOutPort ,
869 if ( myOutStreamPort ) {
870 PortableServer::ObjectId * id = myOutStreamPort->getId() ;
871 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
872 Outobject = SUPERV::StreamPort::_narrow(obj) ;
873 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ;
878 return SUPERV::StreamPort::_duplicate( Outobject );
881 bool CNode_Impl::HasStreamPort() {
882 bool RetVal = false ;
883 beginService( "CNode_Impl::HasStreamPort" );
884 endService( "CNode_Impl::HasStreamPort" );
888 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
890 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
892 char* FromServiceParameterName ;
893 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
894 ToServiceParameterName ,
896 & FromServiceParameterName ) ;
898 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
899 if ( !anInPort->IsDataStream() && anInPort->GetOutPort() ) {
900 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
901 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
903 beginService( "CNode_Impl::GetLink" );
907 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
908 instanceName() , interfaceName() ,
911 ToServiceParameterName ,
912 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
913 FromServiceParameterName ,
914 true , false , Success ) ;
916 PortableServer::ObjectId * id = myLink->getId() ;
917 CORBA::Object_var obj = _poa->id_to_reference(*id);
918 iobject = SUPERV::Link::_narrow(obj) ;
919 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
923 iobject = anOutPort->InPortObjRef( anInPort ) ;
928 endService( "CNode_Impl::GetLink" );
930 return SUPERV::Link::_duplicate( iobject ) ;
933 SUPERV::StreamLink_ptr CNode_Impl::GetStreamLink(const char * ToServiceParameterName ) {
935 SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
937 char* FromServiceParameterName ;
938 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
939 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
940 ToServiceParameterName ,
942 & FromServiceParameterName ) ;
944 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
945 if ( anInPort->IsDataStream() && anInPort->GetOutPort() ) {
946 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
947 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
949 beginService( "CNode_Impl::GetLink" );
953 StreamLink_Impl * myStreamLink = new StreamLink_Impl(
954 _Orb , _Poa , _ContId ,
955 instanceName() , interfaceName() ,
958 ToServiceParameterName ,
959 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
960 FromServiceParameterName ,
963 PortableServer::ObjectId * id = myStreamLink->getId() ;
964 CORBA::Object_var obj = _poa->id_to_reference(*id);
965 iobject = SUPERV::StreamLink::_narrow(obj) ;
966 anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
970 iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
976 endService( "CNode_Impl::GetLink" );
978 return SUPERV::StreamLink::_duplicate( iobject ) ;
981 SUPERV::ListOfPorts * CNode_Impl::Ports() {
985 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
987 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
988 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
989 if ( !anInPort->IsDataStream() ) {
991 beginService( "CNode_Impl::Ports" );
994 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
995 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
996 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
998 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
999 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1000 // << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1001 // << "/" << anInPort->IsNotConnected() ) ;
1002 Port_Impl * myPort ;
1003 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1004 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1005 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1006 instanceName() , interfaceName() ,
1009 (GraphBase::Port * ) anInPort ,
1014 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1015 instanceName() , interfaceName() ,
1018 (GraphBase::Port * ) anInPort ,
1021 PortableServer::ObjectId * id = myPort->getId() ;
1022 CORBA::Object_var obj = _poa->id_to_reference(*id);
1023 SUPERV::Port_var iobject ;
1024 iobject = SUPERV::Port::_narrow(obj) ;
1026 RetVal->length( PortCount ) ;
1027 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1028 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1031 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1033 RetVal->length( PortCount ) ;
1034 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1038 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1041 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1042 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1043 if ( !anOutPort->IsDataStream() ) {
1045 beginService( "CNode_Impl::Ports" );
1048 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1049 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1050 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1052 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1053 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1054 const CORBA::Any * anAny = anOutPort->Value() ;
1055 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1056 instanceName() , interfaceName() ,
1059 (GraphBase::Port * ) anOutPort ,
1062 PortableServer::ObjectId * id = myPort->getId() ;
1063 CORBA::Object_var obj = _poa->id_to_reference(*id);
1064 SUPERV::Port_var iobject ;
1065 iobject = SUPERV::Port::_narrow(obj) ;
1067 RetVal->length( PortCount ) ;
1068 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1069 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1072 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1074 RetVal->length( PortCount ) ;
1075 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1079 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1084 if ( DataFlowEditor()->IsValid() ) {
1085 //DataFlowEditor()->Graph()->Values() ;
1086 RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1087 DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1088 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1089 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1090 if ( !anOutPort->IsDataStream() ) {
1091 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1093 beginService( "CNode_Impl::Ports" );
1096 Port_Impl * myPort ;
1097 if ( anOutPort->IsDataConnected() ) {
1098 const CORBA::Any * anAny = anOutPort->Value() ;
1099 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1100 instanceName() , interfaceName() ,
1103 (GraphBase::Port * ) anOutPort ,
1108 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1109 instanceName() , interfaceName() ,
1112 (GraphBase::Port * ) anOutPort ,
1115 PortableServer::ObjectId * id = myPort->getId() ;
1116 CORBA::Object_var obj = _poa->id_to_reference(*id);
1117 SUPERV::Port_var iobject ;
1118 iobject = SUPERV::Port::_narrow(obj) ;
1120 RetVal->length( PortCount ) ;
1121 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1122 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1126 RetVal->length( PortCount ) ;
1127 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1133 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1134 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1135 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1136 if ( !anInPort->IsDataStream() ) {
1137 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1139 beginService( "CNode_Impl::Ports" );
1142 Port_Impl * myPort ;
1143 if ( anInPort->IsDataConnected() ) {
1144 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1145 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1146 instanceName() , interfaceName() ,
1149 (GraphBase::Port * ) anInPort ,
1154 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1155 instanceName() , interfaceName() ,
1161 PortableServer::ObjectId * id = myPort->getId() ;
1162 CORBA::Object_var obj = _poa->id_to_reference(*id);
1163 SUPERV::Port_var iobject ;
1164 iobject = SUPERV::Port::_narrow(obj) ;
1166 RetVal->length( PortCount ) ;
1167 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1168 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1172 RetVal->length( PortCount ) ;
1173 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1182 int RetVallength = (unsigned int ) RetVal->length() ;
1183 for ( i = 0 ; i < RetVallength ; i++ ) {
1184 MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1188 endService( "CNode_Impl::Ports " ) ;
1190 return ( RetVal._retn() ) ;
1193 SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() {
1197 SUPERV::ListOfStreamPorts_var RetVal = new SUPERV::ListOfStreamPorts ;
1198 if ( !DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1199 // MESSAGE("CNode_Impl::StreamPorts NOT a DataStreamNode" ) ;
1201 else if ( _IsNode ) {
1202 // RetVal->length( DataFlowNode()->GetNodeInPortsSize() +
1203 // DataFlowNode()->GetNodeOutPortsSize() ) ;
1204 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1205 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1206 if ( anInPort->IsDataStream() ) {
1208 beginService( "CNode_Impl::StreamPorts" );
1211 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1212 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1213 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1214 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1216 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1217 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1218 << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1219 << "/" << anInPort->IsNotConnected() ) ;
1220 StreamPort_Impl * myStreamPort ;
1221 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1222 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1223 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1224 instanceName() , interfaceName() ,
1227 (GraphBase::Port * ) anInPort ,
1232 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1233 instanceName() , interfaceName() ,
1236 (GraphBase::Port * ) anInPort ,
1239 PortableServer::ObjectId * id = myStreamPort->getId() ;
1240 CORBA::Object_var obj = _poa->id_to_reference(*id);
1241 SUPERV::StreamPort_var iobject ;
1242 iobject = SUPERV::StreamPort::_narrow(obj) ;
1244 RetVal->length( PortCount ) ;
1245 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1246 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1249 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1251 RetVal->length( PortCount ) ;
1252 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1256 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1259 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1260 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1261 if ( anOutPort->IsDataStream() ) {
1263 beginService( "CNode_Impl::StreamPorts" );
1266 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1267 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1268 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1269 // RetVal[ DataFlowNode()->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1271 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1272 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1273 const CORBA::Any * anAny = anOutPort->Value() ;
1274 StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1275 instanceName() , interfaceName() ,
1278 (GraphBase::Port * ) anOutPort ,
1281 PortableServer::ObjectId * id = myStreamPort->getId() ;
1282 CORBA::Object_var obj = _poa->id_to_reference(*id);
1283 SUPERV::StreamPort_var iobject ;
1284 iobject = SUPERV::StreamPort::_narrow(obj) ;
1286 RetVal->length( PortCount ) ;
1287 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1288 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1291 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1293 RetVal->length( PortCount ) ;
1294 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1298 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1303 if ( DataFlowEditor()->IsValid() ) {
1304 // RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1305 // DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1306 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1307 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1308 if ( anOutPort->IsDataStream() ) {
1309 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1311 beginService( "CNode_Impl::StreamPorts" );
1314 StreamPort_Impl * myStreamPort ;
1315 if ( anOutPort->IsDataConnected() ) {
1316 const CORBA::Any * anAny = anOutPort->Value() ;
1317 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1318 instanceName() , interfaceName() ,
1321 (GraphBase::Port * ) anOutPort ,
1326 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1327 instanceName() , interfaceName() ,
1330 (GraphBase::Port * ) anOutPort ,
1333 PortableServer::ObjectId * id = myStreamPort->getId() ;
1334 CORBA::Object_var obj = _poa->id_to_reference(*id);
1335 SUPERV::StreamPort_var iobject ;
1336 iobject = SUPERV::StreamPort::_narrow(obj) ;
1338 RetVal->length( PortCount ) ;
1339 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1340 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1344 RetVal->length( PortCount ) ;
1345 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1349 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1352 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1353 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1354 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1355 if ( anInPort->IsDataStream() ) {
1356 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1358 beginService( "CNode_Impl::StreamPorts" );
1361 StreamPort_Impl * myStreamPort ;
1362 if ( anInPort->IsDataConnected() ) {
1363 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1364 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1365 instanceName() , interfaceName() ,
1368 (GraphBase::Port * ) anInPort ,
1373 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1374 instanceName() , interfaceName() ,
1380 PortableServer::ObjectId * id = myStreamPort->getId() ;
1381 CORBA::Object_var obj = _poa->id_to_reference(*id);
1382 SUPERV::StreamPort_var iobject ;
1383 iobject = SUPERV::StreamPort::_narrow(obj) ;
1385 RetVal->length( PortCount ) ;
1386 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1387 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1391 RetVal->length( PortCount ) ;
1392 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1396 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1401 // int RetVallength = (unsigned int ) RetVal->length() ;
1402 // for ( i = 0 ; i < RetVallength ; i++ ) {
1403 // MESSAGE( "StreamPort " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1406 endService( "CNode_Impl::StreamPorts " ) ;
1408 return ( RetVal._retn() ) ;
1411 SUPERV::ListOfLinks * CNode_Impl::Links() {
1412 beginService( "CNode_Impl::Links" ) ;
1413 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
1414 if ( DataFlowNode() ) {
1415 // MESSAGE( "CNode_Impl::Links " << DataFlowEditor() << " " << DataFlowEditor()->Graph() << " " << DataFlowEditor()->Graph()->ObjImpl() << " " << DataFlowNode()->ComputingNode() << " " << DataFlowNode()->ComputingNode()->Name() ) ;
1416 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( DataFlowNode()->ComputingNode() , NULL ) ;
1419 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( NULL , NULL ) ;
1421 MESSAGE( "CNode_Impl::Links " << RetVal->length() << " Links" ) ;
1422 endService( "CNode_Impl::Links" ) ;
1423 return ( RetVal._retn() ) ;
1426 SUPERV::ListOfStreamLinks * CNode_Impl::StreamLinks() {
1427 beginService( "CNode_Impl::StreamLinks" ) ;
1428 SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
1429 if ( DataFlowNode() && DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1430 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( DataFlowNode()->ComputingNode() , NULL ) ;
1432 else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1433 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( NULL , NULL ) ;
1435 MESSAGE( "CNode_Impl::StreamLinks " << RetVal->length() << " StreamLinks" ) ;
1436 endService( "CNode_Impl::StreamLinks" ) ;
1437 return ( RetVal._retn() ) ;
1440 long CNode_Impl::SubGraph() {
1441 // beginService( "CNode_Impl::SubGraph" );
1444 RetVal = DataFlowNode()->SubGraph() ;
1446 // endService( "CNode_Impl::SubGraph" );
1450 long CNode_Impl::SubStreamGraph() {
1451 // beginService( "CNode_Impl::SubStreamGraph" );
1454 RetVal = DataFlowNode()->SubStreamGraph() ;
1456 // endService( "CNode_Impl::SubStreamGraph" );
1460 bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
1461 beginService( "CNode_Impl::IsLinked" );
1462 bool RetVal = DataFlowNode()->IsLinked( ServiceParameterName ) ;
1463 MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
1464 endService( "CNode_Impl::IsLinked" );
1468 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
1469 // beginService( "CNode_Impl::HasInput" );
1470 bool RetVal = DataFlowNode()->HasInput( ServiceParameterName ) ;
1471 // endService( "CNode_Impl::HasInput" );
1475 SUPERV::GraphState CNode_Impl::State() {
1476 // beginService( "CNode_Impl::State" );
1477 SUPERV::GraphState RetVal = SUPERV::EditingState ;
1478 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1479 if ( aDataFlowExecutor && !DataFlowEditor()->EditedAfterExecution() ) {
1480 //JR : 12/06/03 if ( aDataFlowExecutor ) {
1482 RetVal = aDataFlowExecutor->State( Name() ) ;
1485 RetVal = aDataFlowExecutor->State() ;
1488 // endService( "CNode_Impl::State" );
1491 long CNode_Impl::Thread() {
1492 // beginService( "CNode_Impl::Thread" );
1494 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1495 if ( aDataFlowExecutor ) {
1497 RetVal = aDataFlowExecutor->Thread( Name() ) ;
1500 RetVal = aDataFlowExecutor->Thread() ;
1503 // endService( "CNode_Impl::Thread" );
1506 GraphExecutor::AutomatonState CNode_Impl::AutoState() {
1507 // beginService( "CNode_Impl::AutoState" );
1508 GraphExecutor::AutomatonState RetVal = GraphExecutor::UnKnownState ;
1509 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1510 if ( aDataFlowExecutor ) {
1512 RetVal = aDataFlowExecutor->AutomatonState( Name() ) ;
1515 RetVal = aDataFlowExecutor->AutomatonState() ;
1518 // endService( "CNode_Impl::AutoState" );
1521 SUPERV::ControlState CNode_Impl::Control() {
1522 // beginService( "CNode_Impl::Control" );
1523 SUPERV::ControlState RetVal = SUPERV::VoidState ;
1524 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1525 if ( aDataFlowExecutor ) {
1527 RetVal = aDataFlowExecutor->ControlState( Name() ) ;
1530 RetVal = aDataFlowExecutor->ControlState() ;
1533 // endService( "CNode_Impl::Control" );
1536 void CNode_Impl::ControlClear() {
1537 // beginService( "CNode_Impl::ControlClear" );
1538 // SUPERV::ControlState RetVal = SUPERV::VoidState ;
1539 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1540 if ( aDataFlowExecutor ) {
1542 aDataFlowExecutor->ControlClear( Name() ) ;
1545 aDataFlowExecutor->ControlClear() ;
1548 // endService( "CNode_Impl::ControlClear" );
1552 bool CNode_Impl::IsReady() {
1553 // beginService( "CNode_Impl::IsReady" );
1554 bool RetVal = false ;
1555 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1556 if ( aDataFlowExecutor ) {
1558 RetVal = aDataFlowExecutor->IsReady( Name() ) ;
1561 RetVal = aDataFlowExecutor->IsReady() ;
1564 // endService( "CNode_Impl::IsReady" );
1568 bool CNode_Impl::IsWaiting() {
1569 // beginService( "CNode_Impl::IsWaiting" );
1570 bool RetVal = false ;
1571 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1572 if ( aDataFlowExecutor ) {
1574 RetVal = aDataFlowExecutor->IsWaiting( Name() ) ;
1577 RetVal = aDataFlowExecutor->IsWaiting() ;
1580 // endService( "CNode_Impl::IsWaiting" );
1584 bool CNode_Impl::IsRunning() {
1585 // beginService( "CNode_Impl::IsRunning" );
1586 bool RetVal = false ;
1587 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1588 if ( aDataFlowExecutor ) {
1590 RetVal = aDataFlowExecutor->IsRunning( Name() ) ;
1593 RetVal = aDataFlowExecutor->IsRunning() ;
1596 // endService( "CNode_Impl::IsRunning" );
1600 bool CNode_Impl::IsDone() {
1601 // beginService( "CNode_Impl::IsDone" );
1602 bool RetVal = false ;
1603 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1604 if ( aDataFlowExecutor ) {
1606 RetVal = aDataFlowExecutor->IsDone( Name() ) ;
1609 RetVal = aDataFlowExecutor->IsDone() ;
1612 // endService( "CNode_Impl::IsDone" );
1616 bool CNode_Impl::IsSuspended() {
1617 // beginService( "CNode_Impl::IsSuspended" );
1618 bool RetVal = false ;
1619 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1620 if ( aDataFlowExecutor ) {
1622 RetVal = aDataFlowExecutor->IsSuspended( Name() ) ;
1625 RetVal = aDataFlowExecutor->IsSuspended() ;
1628 // endService( "CNode_Impl::IsSuspended" );
1632 bool CNode_Impl::ReadyW() {
1633 // beginService( "CNode_Impl::ReadyW" );
1634 bool RetVal = false ;
1635 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1636 if ( aDataFlowExecutor ) {
1638 RetVal = aDataFlowExecutor->ReadyWait( Name() ) ;
1641 RetVal = aDataFlowExecutor->ReadyWait() ;
1644 // endService( "CNode_Impl::ReadyW" );
1648 bool CNode_Impl::RunningW() {
1649 // beginService( "CNode_Impl::RunningW" );
1650 bool RetVal = false ;
1651 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1652 if ( aDataFlowExecutor ) {
1654 RetVal = aDataFlowExecutor->RunningWait( Name() ) ;
1657 RetVal = aDataFlowExecutor->RunningWait() ;
1660 // endService( "CNode_Impl::RunningW" );
1664 bool CNode_Impl::DoneW() {
1665 // beginService( "CNode_Impl::DoneW" );
1666 bool RetVal = false ;
1667 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1668 if ( aDataFlowExecutor ) {
1670 RetVal = aDataFlowExecutor->DoneWait( Name() ) ;
1673 RetVal = aDataFlowExecutor->DoneWait() ;
1676 // endService( "CNode_Impl::DoneW" );
1680 bool CNode_Impl::SuspendedW() {
1681 // beginService( "CNode_Impl::SuspendedW" );
1682 bool RetVal = false ;
1683 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1684 if ( aDataFlowExecutor ) {
1686 RetVal = aDataFlowExecutor->SuspendedWait( Name() ) ;
1689 RetVal = aDataFlowExecutor->SuspendedWait() ;
1692 // endService( "CNode_Impl::SuspendedW" );
1696 void CNode_Impl::ping() {
1697 // beginService( "CNode_Impl::ping" );
1698 bool RetVal = false ;
1699 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1700 if ( aDataFlowExecutor ) {
1702 RetVal = aDataFlowExecutor->Ping( Name() ) ;
1708 // endService( "CNode_Impl::ping" );
1712 bool CNode_Impl::ContainerKill() {
1713 beginService( "CNode_Impl::ContainerKill" );
1714 bool RetVal = false ;
1715 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1716 if ( aDataFlowExecutor && IsExecuting() ) {
1718 RetVal = aDataFlowExecutor->ContainerKill( Name() ) ;
1721 RetVal = aDataFlowExecutor->ContainerKill() ;
1724 endService( "CNode_Impl::ContainerKill" );
1727 bool CNode_Impl::Kill() {
1728 beginService( "CNode_Impl::Kill" );
1729 bool RetVal = false ;
1730 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1731 if ( aDataFlowExecutor ) {
1733 RetVal = aDataFlowExecutor->Kill( Name() ) ;
1734 MESSAGE( "Node " << Name() << " execution was killed : " << RetVal ) ;
1737 RetVal = aDataFlowExecutor->Kill() ;
1738 MESSAGE( "Graph execution was killed : " << RetVal ) ;
1741 endService( "CNode_Impl::Kill" );
1744 bool CNode_Impl::KillDone() {
1745 // beginService( "CNode_Impl::KillDone" );
1746 bool RetVal = false ;
1747 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1748 if ( aDataFlowExecutor ) {
1750 RetVal = aDataFlowExecutor->KillDone( Name() ) ;
1753 // endService( "CNode_Impl::KillDone" );
1756 bool CNode_Impl::Stop() {
1757 // beginService( "CNode_Impl::Stop" );
1758 bool RetVal ; // = aDataFlowExecutor->Stop() ;
1759 // endService( "CNode_Impl::Stop" );
1762 bool CNode_Impl::Suspend() {
1763 beginService( "CNode_Impl::Suspend" );
1764 bool RetVal = false ;
1765 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1766 if ( aDataFlowExecutor ) {
1768 MESSAGE( "CNode_Impl::Suspend " << Name() ) ;
1769 RetVal = aDataFlowExecutor->Suspend( Name() ) ;
1772 MESSAGE( "CNode_Impl::Suspend " << aDataFlowExecutor->Graph()->Name() ) ;
1773 RetVal = aDataFlowExecutor->Suspend() ;
1776 endService( "CNode_Impl::Suspend" );
1779 bool CNode_Impl::SuspendDone() {
1780 // beginService( "CNode_Impl::SuspendDone" );
1781 bool RetVal = false ;
1782 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1783 if ( aDataFlowExecutor ) {
1785 RetVal = aDataFlowExecutor->SuspendDone( Name() ) ;
1788 RetVal = aDataFlowExecutor->SuspendDone() ;
1791 // endService( "CNode_Impl::SuspendDone" );
1794 bool CNode_Impl::Resume() {
1795 bool RetVal = false ;
1796 beginService( "CNode_Impl::Resume" );
1797 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1798 if ( aDataFlowExecutor ) {
1800 MESSAGE( "CNode_Impl::Resume " << Name() ) ;
1801 RetVal = aDataFlowExecutor->Resume( Name() ) ;
1804 MESSAGE( "CNode_Impl::Resume " << aDataFlowExecutor->Graph()->Name() ) ;
1805 RetVal = aDataFlowExecutor->Resume() ;
1808 endService( "CNode_Impl::Resume" );
1812 long CNode_Impl::CpuUsed() {
1814 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1815 if ( aDataFlowExecutor ) {
1817 RetVal = aDataFlowExecutor->CpuUsed( Name() ) ;
1820 RetVal = aDataFlowExecutor->CpuUsed() ;
1826 bool CNode_Impl::IsExecuting() {
1827 bool RetVal = false;
1828 if ( !IsMacro() && DataFlowEditor() && DataFlowEditor()->Executor() ) {
1829 // asv : the statement below normally does not return true, Executor_OutNode
1830 // sets Editor->Editing() after finishing of execution (see Executor_OutNode.cxx)
1831 if ( DataFlowEditor()->IsExecuting() && DataFlowEditor()->Executor()->IsDone() ) {
1832 DataFlowEditor()->Editing();
1835 RetVal = DataFlowEditor()->IsExecuting();