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 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 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
613 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
614 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
615 instanceName() , interfaceName() ,
618 // ServiceParameterName ,
619 (GraphBase::Port * ) anInPort ,
624 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
625 instanceName() , interfaceName() ,
628 // ServiceParameterName ) ;
629 (GraphBase::Port * ) anInPort ,
632 PortableServer::ObjectId * id = myPort->getId() ;
633 CORBA::Object_var obj = _poa->id_to_reference(*id);
634 iobject = SUPERV::Port::_narrow(obj) ;
635 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
638 iobject = anInPort->ObjRef() ;
641 else if ( anoutport ) {
642 GraphBase::OutPort * anOutPort ;
644 anOutPort = DataFlowNode()->GetChangeOutPort( ServiceParameterName ) ;
647 anOutPort = DataFlowEditor()->GetChangeOutPort( ServiceParameterName ) ;
649 if ( anOutPort->IsDataStream() ) {
650 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
652 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
654 beginService( "CNode_Impl::Port" );
657 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
658 const CORBA::Any anAny = anOutPort->Value() ;
659 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
660 instanceName() , interfaceName() ,
663 // ServiceParameterName ,
664 (GraphBase::Port * ) anOutPort ,
667 PortableServer::ObjectId * id = myPort->getId() ;
668 CORBA::Object_var obj = _poa->id_to_reference(*id);
669 iobject = SUPERV::Port::_narrow(obj) ;
670 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
673 iobject = anOutPort->ObjRef() ;
677 endService( "CNode_Impl::Port" );
679 DataFlowEditor()->UnValid() ;
680 return SUPERV::Port::_duplicate( iobject ) ;
683 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
684 const SUPERV::Value_ptr aValue ) {
686 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
687 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
689 GraphBase::InPort * anInPort = NULL ;
690 if ( DataFlowEditor()->IsEditing() /*&& DataFlowEditor()->Graph()->GraphMacroLevel() == 0*/ ) {
692 sts = DataFlowEditor()->AddInputData( DataFlowNode()->Name() ,
693 ToServiceParameterName ,
695 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
698 sts = DataFlowEditor()->AddInputData( DataFlowEditor()->Graph()->Name() ,
699 ToServiceParameterName ,
701 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
703 if ( sts && anInPort ) {
704 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
706 beginService( "CNode_Impl::Input" );
710 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
711 instanceName() , interfaceName() ,
714 // ToServiceParameterName ,
715 (GraphBase::Port * ) anInPort ,
718 PortableServer::ObjectId * id = myPort->getId() ;
719 CORBA::Object_var obj = _poa->id_to_reference(*id);
720 iobject = SUPERV::Port::_narrow(obj) ;
721 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
724 iobject = anInPort->ObjRef() ;
727 DataFlowEditor()->UnValid() ;
729 else if ( aDataFlowExecutor ) {
731 sts = aDataFlowExecutor->ChangeInputData( DataFlowNode()->Name() ,
732 ToServiceParameterName ,
734 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
737 sts = aDataFlowExecutor->ChangeInputData( DataFlowEditor()->Graph()->Name() ,
738 ToServiceParameterName ,
740 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
742 if ( sts && anInPort ) {
743 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
745 beginService( "CNode_Impl::Input" );
749 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
750 instanceName() , interfaceName() ,
753 // ToServiceParameterName ,
754 (GraphBase::Port * ) anInPort ,
757 PortableServer::ObjectId * id = myPort->getId() ;
758 CORBA::Object_var obj = _poa->id_to_reference(*id);
759 iobject = SUPERV::Port::_narrow(obj) ;
760 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
763 iobject = anInPort->ObjRef() ;
768 endService( "CNode_Impl::Input" );
770 if ( CORBA::is_nil( iobject ) ) {
771 MESSAGE( "CNode_Impl::Input returns nil object _IsNode " << _IsNode << " sts " << sts
772 << " Node " << Name() << " ToServiceParameterName " << ToServiceParameterName
773 << " anInPort " << anInPort ) ;
775 return SUPERV::Port::_duplicate( iobject ) ;
779 SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) {
780 SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ;
781 Port_Impl * myInPort = NULL ;
782 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
783 if ( anInPort && !anInPort->IsDataStream() ) {
784 Inobject = anInPort->ObjRef() ;
785 if ( CORBA::is_nil( Inobject ) ) {
786 myInPort = new Port_Impl( _Orb , _Poa , _ContId ,
787 instanceName() , interfaceName() ,
790 (GraphBase::Port * ) anInPort ,
793 PortableServer::ObjectId * id = myInPort->getId() ;
794 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
795 Inobject = SUPERV::Port::_narrow(obj) ;
796 anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ;
800 return SUPERV::Port::_duplicate( Inobject ) ;
803 SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) {
804 Port_Impl * myOutPort = NULL ;
805 SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
806 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
807 if ( anOutPort && !anOutPort->IsDataStream() ) {
808 Outobject = anOutPort->ObjRef() ;
809 if ( CORBA::is_nil( Outobject ) ) {
810 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
811 const CORBA::Any anAny = anOutPort->Value() ;
812 myOutPort = new Port_Impl( _Orb , _Poa , _ContId ,
813 instanceName() , interfaceName() ,
816 (GraphBase::Port * ) anOutPort ,
820 PortableServer::ObjectId * id = myOutPort->getId() ;
821 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
822 Outobject = SUPERV::Port::_narrow(obj) ;
823 anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ;
827 return SUPERV::Port::_duplicate( Outobject );
830 SUPERV::StreamPort_ptr CNode_Impl::GetInStreamPort( const char *aParameterName ) {
831 SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ;
832 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
833 StreamPort_Impl * myInStreamPort = NULL ;
834 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
835 if ( anInPort && anInPort->IsDataStream() ) {
836 Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
837 if ( CORBA::is_nil( Inobject ) ) {
838 myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
839 instanceName() , interfaceName() ,
842 (GraphBase::Port * ) anInPort ,
844 if ( myInStreamPort ) {
845 PortableServer::ObjectId * id = myInStreamPort->getId() ;
846 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
847 Inobject = SUPERV::StreamPort::_narrow(obj) ;
848 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ;
853 return SUPERV::StreamPort::_duplicate( Inobject ) ;
856 SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName ) {
857 StreamPort_Impl * myOutStreamPort = NULL ;
858 SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ;
859 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
860 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
861 if ( anOutPort && anOutPort->IsDataStream() ) {
862 Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
863 if ( CORBA::is_nil( Outobject ) ) {
864 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
865 const CORBA::Any anAny = anOutPort->Value() ;
866 myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
867 instanceName() , interfaceName() ,
870 (GraphBase::Port * ) anOutPort ,
873 if ( myOutStreamPort ) {
874 PortableServer::ObjectId * id = myOutStreamPort->getId() ;
875 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
876 Outobject = SUPERV::StreamPort::_narrow(obj) ;
877 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ;
882 return SUPERV::StreamPort::_duplicate( Outobject );
885 bool CNode_Impl::HasStreamPort() {
886 bool RetVal = false ;
887 beginService( "CNode_Impl::HasStreamPort" );
888 endService( "CNode_Impl::HasStreamPort" );
892 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
894 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
896 char* FromServiceParameterName ;
897 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
898 ToServiceParameterName ,
900 & FromServiceParameterName ) ;
902 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
903 if ( !anInPort->IsDataStream() && anInPort->GetOutPort() ) {
904 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
905 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
907 beginService( "CNode_Impl::GetLink" );
911 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
912 instanceName() , interfaceName() ,
915 ToServiceParameterName ,
916 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
917 FromServiceParameterName ,
918 true , false , Success ) ;
920 PortableServer::ObjectId * id = myLink->getId() ;
921 CORBA::Object_var obj = _poa->id_to_reference(*id);
922 iobject = SUPERV::Link::_narrow(obj) ;
923 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
927 iobject = anOutPort->InPortObjRef( anInPort ) ;
932 endService( "CNode_Impl::GetLink" );
934 return SUPERV::Link::_duplicate( iobject ) ;
937 SUPERV::StreamLink_ptr CNode_Impl::GetStreamLink(const char * ToServiceParameterName ) {
939 SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
941 char* FromServiceParameterName ;
942 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
943 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
944 ToServiceParameterName ,
946 & FromServiceParameterName ) ;
948 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
949 if ( anInPort->IsDataStream() && anInPort->GetOutPort() ) {
950 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
951 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
953 beginService( "CNode_Impl::GetLink" );
957 StreamLink_Impl * myStreamLink = new StreamLink_Impl(
958 _Orb , _Poa , _ContId ,
959 instanceName() , interfaceName() ,
962 ToServiceParameterName ,
963 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
964 FromServiceParameterName ,
967 PortableServer::ObjectId * id = myStreamLink->getId() ;
968 CORBA::Object_var obj = _poa->id_to_reference(*id);
969 iobject = SUPERV::StreamLink::_narrow(obj) ;
970 anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
974 iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
980 endService( "CNode_Impl::GetLink" );
982 return SUPERV::StreamLink::_duplicate( iobject ) ;
985 SUPERV::ListOfPorts * CNode_Impl::Ports() {
989 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
991 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
992 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
993 if ( !anInPort->IsDataStream() ) {
995 beginService( "CNode_Impl::Ports" );
998 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
999 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1000 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1002 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1003 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1004 // << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1005 // << "/" << anInPort->IsNotConnected() ) ;
1006 Port_Impl * myPort ;
1007 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1008 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1009 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1010 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1011 instanceName() , interfaceName() ,
1014 (GraphBase::Port * ) anInPort ,
1019 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1020 instanceName() , interfaceName() ,
1023 (GraphBase::Port * ) anInPort ,
1026 PortableServer::ObjectId * id = myPort->getId() ;
1027 CORBA::Object_var obj = _poa->id_to_reference(*id);
1028 SUPERV::Port_var iobject ;
1029 iobject = SUPERV::Port::_narrow(obj) ;
1031 RetVal->length( PortCount ) ;
1032 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1033 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1036 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1038 RetVal->length( PortCount ) ;
1039 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1043 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1046 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1047 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1048 if ( !anOutPort->IsDataStream() ) {
1050 beginService( "CNode_Impl::Ports" );
1053 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1054 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1055 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1057 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1058 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1059 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1060 const CORBA::Any anAny = anOutPort->Value() ;
1061 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1062 instanceName() , interfaceName() ,
1065 (GraphBase::Port * ) anOutPort ,
1068 PortableServer::ObjectId * id = myPort->getId() ;
1069 CORBA::Object_var obj = _poa->id_to_reference(*id);
1070 SUPERV::Port_var iobject ;
1071 iobject = SUPERV::Port::_narrow(obj) ;
1073 RetVal->length( PortCount ) ;
1074 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1075 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1078 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1080 RetVal->length( PortCount ) ;
1081 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1085 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1090 if ( DataFlowEditor()->IsValid() ) {
1091 //DataFlowEditor()->Graph()->Values() ;
1092 RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1093 DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1094 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1095 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1096 if ( !anOutPort->IsDataStream() ) {
1097 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1099 beginService( "CNode_Impl::Ports" );
1102 Port_Impl * myPort ;
1103 if ( anOutPort->IsDataConnected() ) {
1104 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1105 const CORBA::Any anAny = anOutPort->Value() ;
1106 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1107 instanceName() , interfaceName() ,
1110 (GraphBase::Port * ) anOutPort ,
1115 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1116 instanceName() , interfaceName() ,
1119 (GraphBase::Port * ) anOutPort ,
1122 PortableServer::ObjectId * id = myPort->getId() ;
1123 CORBA::Object_var obj = _poa->id_to_reference(*id);
1124 SUPERV::Port_var iobject ;
1125 iobject = SUPERV::Port::_narrow(obj) ;
1127 RetVal->length( PortCount ) ;
1128 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1129 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1133 RetVal->length( PortCount ) ;
1134 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1140 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1141 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1142 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1143 if ( !anInPort->IsDataStream() ) {
1144 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1146 beginService( "CNode_Impl::Ports" );
1149 Port_Impl * myPort ;
1150 if ( anInPort->IsDataConnected() ) {
1151 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1152 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1153 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1154 instanceName() , interfaceName() ,
1157 (GraphBase::Port * ) anInPort ,
1162 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1163 instanceName() , interfaceName() ,
1169 PortableServer::ObjectId * id = myPort->getId() ;
1170 CORBA::Object_var obj = _poa->id_to_reference(*id);
1171 SUPERV::Port_var iobject ;
1172 iobject = SUPERV::Port::_narrow(obj) ;
1174 RetVal->length( PortCount ) ;
1175 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1176 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1180 RetVal->length( PortCount ) ;
1181 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1190 int RetVallength = (unsigned int ) RetVal->length() ;
1191 for ( i = 0 ; i < RetVallength ; i++ ) {
1192 MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1196 endService( "CNode_Impl::Ports " ) ;
1198 return ( RetVal._retn() ) ;
1201 SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() {
1205 SUPERV::ListOfStreamPorts_var RetVal = new SUPERV::ListOfStreamPorts ;
1206 if ( !DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1207 // MESSAGE("CNode_Impl::StreamPorts NOT a DataStreamNode" ) ;
1209 else if ( _IsNode ) {
1210 // RetVal->length( DataFlowNode()->GetNodeInPortsSize() +
1211 // DataFlowNode()->GetNodeOutPortsSize() ) ;
1212 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1213 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1214 if ( anInPort->IsDataStream() ) {
1216 beginService( "CNode_Impl::StreamPorts" );
1219 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1220 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1221 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1222 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1224 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1225 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1226 << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1227 << "/" << anInPort->IsNotConnected() ) ;
1228 StreamPort_Impl * myStreamPort ;
1229 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1230 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1231 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1232 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1233 instanceName() , interfaceName() ,
1236 (GraphBase::Port * ) anInPort ,
1241 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1242 instanceName() , interfaceName() ,
1245 (GraphBase::Port * ) anInPort ,
1248 PortableServer::ObjectId * id = myStreamPort->getId() ;
1249 CORBA::Object_var obj = _poa->id_to_reference(*id);
1250 SUPERV::StreamPort_var iobject ;
1251 iobject = SUPERV::StreamPort::_narrow(obj) ;
1253 RetVal->length( PortCount ) ;
1254 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1255 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1258 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1260 RetVal->length( PortCount ) ;
1261 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1265 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1268 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1269 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1270 if ( anOutPort->IsDataStream() ) {
1272 beginService( "CNode_Impl::StreamPorts" );
1275 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1276 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1277 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1278 // RetVal[ DataFlowNode()->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1280 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1281 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1282 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1283 const CORBA::Any anAny = anOutPort->Value() ;
1284 StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1285 instanceName() , interfaceName() ,
1288 (GraphBase::Port * ) anOutPort ,
1291 PortableServer::ObjectId * id = myStreamPort->getId() ;
1292 CORBA::Object_var obj = _poa->id_to_reference(*id);
1293 SUPERV::StreamPort_var iobject ;
1294 iobject = SUPERV::StreamPort::_narrow(obj) ;
1296 RetVal->length( PortCount ) ;
1297 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1298 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1301 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1303 RetVal->length( PortCount ) ;
1304 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1308 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1313 if ( DataFlowEditor()->IsValid() ) {
1314 // RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1315 // DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1316 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1317 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1318 if ( anOutPort->IsDataStream() ) {
1319 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1321 beginService( "CNode_Impl::StreamPorts" );
1324 StreamPort_Impl * myStreamPort ;
1325 if ( anOutPort->IsDataConnected() ) {
1326 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1327 const CORBA::Any anAny = anOutPort->Value() ;
1328 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1329 instanceName() , interfaceName() ,
1332 (GraphBase::Port * ) anOutPort ,
1337 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1338 instanceName() , interfaceName() ,
1341 (GraphBase::Port * ) anOutPort ,
1344 PortableServer::ObjectId * id = myStreamPort->getId() ;
1345 CORBA::Object_var obj = _poa->id_to_reference(*id);
1346 SUPERV::StreamPort_var iobject ;
1347 iobject = SUPERV::StreamPort::_narrow(obj) ;
1349 RetVal->length( PortCount ) ;
1350 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1351 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1355 RetVal->length( PortCount ) ;
1356 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1360 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1363 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1364 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1365 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1366 if ( anInPort->IsDataStream() ) {
1367 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1369 beginService( "CNode_Impl::StreamPorts" );
1372 StreamPort_Impl * myStreamPort ;
1373 if ( anInPort->IsDataConnected() ) {
1374 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1375 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1376 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1377 instanceName() , interfaceName() ,
1380 (GraphBase::Port * ) anInPort ,
1385 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1386 instanceName() , interfaceName() ,
1392 PortableServer::ObjectId * id = myStreamPort->getId() ;
1393 CORBA::Object_var obj = _poa->id_to_reference(*id);
1394 SUPERV::StreamPort_var iobject ;
1395 iobject = SUPERV::StreamPort::_narrow(obj) ;
1397 RetVal->length( PortCount ) ;
1398 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1399 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1403 RetVal->length( PortCount ) ;
1404 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1408 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1413 // int RetVallength = (unsigned int ) RetVal->length() ;
1414 // for ( i = 0 ; i < RetVallength ; i++ ) {
1415 // MESSAGE( "StreamPort " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1418 endService( "CNode_Impl::StreamPorts " ) ;
1420 return ( RetVal._retn() ) ;
1423 SUPERV::ListOfLinks * CNode_Impl::Links() {
1424 beginService( "CNode_Impl::Links" ) ;
1425 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
1426 if ( DataFlowNode() ) {
1427 // MESSAGE( "CNode_Impl::Links " << DataFlowEditor() << " " << DataFlowEditor()->Graph() << " " << DataFlowEditor()->Graph()->ObjImpl() << " " << DataFlowNode()->ComputingNode() << " " << DataFlowNode()->ComputingNode()->Name() ) ;
1428 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( DataFlowNode()->ComputingNode() , NULL ) ;
1431 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( NULL , NULL ) ;
1433 MESSAGE( "CNode_Impl::Links " << RetVal->length() << " Links" ) ;
1434 endService( "CNode_Impl::Links" ) ;
1435 return ( RetVal._retn() ) ;
1438 SUPERV::ListOfStreamLinks * CNode_Impl::StreamLinks() {
1439 beginService( "CNode_Impl::StreamLinks" ) ;
1440 SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
1441 if ( DataFlowNode() && DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1442 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( DataFlowNode()->ComputingNode() , NULL ) ;
1444 else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1445 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( NULL , NULL ) ;
1447 MESSAGE( "CNode_Impl::StreamLinks " << RetVal->length() << " StreamLinks" ) ;
1448 endService( "CNode_Impl::StreamLinks" ) ;
1449 return ( RetVal._retn() ) ;
1452 long CNode_Impl::SubGraph() {
1453 // beginService( "CNode_Impl::SubGraph" );
1456 RetVal = DataFlowNode()->SubGraph() ;
1458 // endService( "CNode_Impl::SubGraph" );
1462 long CNode_Impl::SubStreamGraph() {
1463 // beginService( "CNode_Impl::SubStreamGraph" );
1466 RetVal = DataFlowNode()->SubStreamGraph() ;
1468 // endService( "CNode_Impl::SubStreamGraph" );
1472 bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
1473 beginService( "CNode_Impl::IsLinked" );
1474 bool RetVal = DataFlowNode()->IsLinked( ServiceParameterName ) ;
1475 MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
1476 endService( "CNode_Impl::IsLinked" );
1480 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
1481 // beginService( "CNode_Impl::HasInput" );
1482 bool RetVal = DataFlowNode()->HasInput( ServiceParameterName ) ;
1483 // endService( "CNode_Impl::HasInput" );
1487 SUPERV::GraphState CNode_Impl::State() {
1488 // beginService( "CNode_Impl::State" );
1489 SUPERV::GraphState RetVal = SUPERV::EditingState ;
1490 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1491 if ( aDataFlowExecutor && !DataFlowEditor()->EditedAfterExecution() ) {
1492 //JR : 12/06/03 if ( aDataFlowExecutor ) {
1494 RetVal = aDataFlowExecutor->State( Name() ) ;
1497 RetVal = aDataFlowExecutor->State() ;
1500 // endService( "CNode_Impl::State" );
1503 long CNode_Impl::Thread() {
1504 // beginService( "CNode_Impl::Thread" );
1506 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1507 if ( aDataFlowExecutor ) {
1509 RetVal = aDataFlowExecutor->Thread( Name() ) ;
1512 RetVal = aDataFlowExecutor->Thread() ;
1515 // endService( "CNode_Impl::Thread" );
1518 GraphExecutor::AutomatonState CNode_Impl::AutoState() {
1519 // beginService( "CNode_Impl::AutoState" );
1520 GraphExecutor::AutomatonState RetVal = GraphExecutor::UnKnownState ;
1521 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1522 if ( aDataFlowExecutor ) {
1524 RetVal = aDataFlowExecutor->AutomatonState( Name() ) ;
1527 RetVal = aDataFlowExecutor->AutomatonState() ;
1530 // endService( "CNode_Impl::AutoState" );
1533 SUPERV::ControlState CNode_Impl::Control() {
1534 // beginService( "CNode_Impl::Control" );
1535 SUPERV::ControlState RetVal = SUPERV::VoidState ;
1536 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1537 if ( aDataFlowExecutor ) {
1539 RetVal = aDataFlowExecutor->ControlState( Name() ) ;
1542 RetVal = aDataFlowExecutor->ControlState() ;
1545 // endService( "CNode_Impl::Control" );
1548 void CNode_Impl::ControlClear() {
1549 // beginService( "CNode_Impl::ControlClear" );
1550 // SUPERV::ControlState RetVal = SUPERV::VoidState ;
1551 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1552 if ( aDataFlowExecutor ) {
1554 aDataFlowExecutor->ControlClear( Name() ) ;
1557 aDataFlowExecutor->ControlClear() ;
1560 // endService( "CNode_Impl::ControlClear" );
1564 bool CNode_Impl::IsReady() {
1565 // beginService( "CNode_Impl::IsReady" );
1566 bool RetVal = false ;
1567 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1568 if ( aDataFlowExecutor ) {
1570 RetVal = aDataFlowExecutor->IsReady( Name() ) ;
1573 RetVal = aDataFlowExecutor->IsReady() ;
1576 // endService( "CNode_Impl::IsReady" );
1580 bool CNode_Impl::IsWaiting() {
1581 // beginService( "CNode_Impl::IsWaiting" );
1582 bool RetVal = false ;
1583 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1584 if ( aDataFlowExecutor ) {
1586 RetVal = aDataFlowExecutor->IsWaiting( Name() ) ;
1589 RetVal = aDataFlowExecutor->IsWaiting() ;
1592 // endService( "CNode_Impl::IsWaiting" );
1596 bool CNode_Impl::IsRunning() {
1597 // beginService( "CNode_Impl::IsRunning" );
1598 bool RetVal = false ;
1599 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1600 if ( aDataFlowExecutor ) {
1602 RetVal = aDataFlowExecutor->IsRunning( Name() ) ;
1605 RetVal = aDataFlowExecutor->IsRunning() ;
1608 // endService( "CNode_Impl::IsRunning" );
1612 bool CNode_Impl::IsDone() {
1613 // beginService( "CNode_Impl::IsDone" );
1614 bool RetVal = false ;
1615 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1616 if ( aDataFlowExecutor ) {
1618 RetVal = aDataFlowExecutor->IsDone( Name() ) ;
1621 RetVal = aDataFlowExecutor->IsDone() ;
1624 // endService( "CNode_Impl::IsDone" );
1628 bool CNode_Impl::IsSuspended() {
1629 // beginService( "CNode_Impl::IsSuspended" );
1630 bool RetVal = false ;
1631 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1632 if ( aDataFlowExecutor ) {
1634 RetVal = aDataFlowExecutor->IsSuspended( Name() ) ;
1637 RetVal = aDataFlowExecutor->IsSuspended() ;
1640 // endService( "CNode_Impl::IsSuspended" );
1644 bool CNode_Impl::ReadyW() {
1645 // beginService( "CNode_Impl::ReadyW" );
1646 bool RetVal = false ;
1647 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1648 if ( aDataFlowExecutor ) {
1650 RetVal = aDataFlowExecutor->ReadyWait( Name() ) ;
1653 RetVal = aDataFlowExecutor->ReadyWait() ;
1656 // endService( "CNode_Impl::ReadyW" );
1660 bool CNode_Impl::RunningW() {
1661 // beginService( "CNode_Impl::RunningW" );
1662 bool RetVal = false ;
1663 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1664 if ( aDataFlowExecutor ) {
1666 RetVal = aDataFlowExecutor->RunningWait( Name() ) ;
1669 RetVal = aDataFlowExecutor->RunningWait() ;
1672 // endService( "CNode_Impl::RunningW" );
1676 bool CNode_Impl::DoneW() {
1677 // beginService( "CNode_Impl::DoneW" );
1678 bool RetVal = false ;
1679 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1680 if ( aDataFlowExecutor ) {
1682 RetVal = aDataFlowExecutor->DoneWait( Name() ) ;
1685 RetVal = aDataFlowExecutor->DoneWait() ;
1688 // endService( "CNode_Impl::DoneW" );
1692 bool CNode_Impl::SuspendedW() {
1693 // beginService( "CNode_Impl::SuspendedW" );
1694 bool RetVal = false ;
1695 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1696 if ( aDataFlowExecutor ) {
1698 RetVal = aDataFlowExecutor->SuspendedWait( Name() ) ;
1701 RetVal = aDataFlowExecutor->SuspendedWait() ;
1704 // endService( "CNode_Impl::SuspendedW" );
1708 void CNode_Impl::ping() {
1709 // beginService( "CNode_Impl::ping" );
1710 bool RetVal = false ;
1711 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1712 if ( aDataFlowExecutor ) {
1714 RetVal = aDataFlowExecutor->Ping( Name() ) ;
1720 // endService( "CNode_Impl::ping" );
1724 bool CNode_Impl::ContainerKill() {
1725 beginService( "CNode_Impl::ContainerKill" );
1726 bool RetVal = false ;
1727 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1728 if ( aDataFlowExecutor && IsExecuting() ) {
1730 RetVal = aDataFlowExecutor->ContainerKill( Name() ) ;
1733 RetVal = aDataFlowExecutor->ContainerKill() ;
1736 endService( "CNode_Impl::ContainerKill" );
1739 bool CNode_Impl::Kill() {
1740 beginService( "CNode_Impl::Kill" );
1741 bool RetVal = false ;
1742 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1743 if ( aDataFlowExecutor ) {
1745 RetVal = aDataFlowExecutor->Kill( Name() ) ;
1746 MESSAGE( "Node " << Name() << " execution was killed : " << RetVal ) ;
1749 RetVal = aDataFlowExecutor->Kill() ;
1750 MESSAGE( "Graph execution was killed : " << RetVal ) ;
1753 endService( "CNode_Impl::Kill" );
1756 bool CNode_Impl::KillDone() {
1757 // beginService( "CNode_Impl::KillDone" );
1758 bool RetVal = false ;
1759 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1760 if ( aDataFlowExecutor ) {
1762 RetVal = aDataFlowExecutor->KillDone( Name() ) ;
1765 // endService( "CNode_Impl::KillDone" );
1768 bool CNode_Impl::Stop() {
1769 // beginService( "CNode_Impl::Stop" );
1770 bool RetVal ; // = aDataFlowExecutor->Stop() ;
1771 // endService( "CNode_Impl::Stop" );
1774 bool CNode_Impl::Suspend() {
1775 beginService( "CNode_Impl::Suspend" );
1776 bool RetVal = false ;
1777 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1778 if ( aDataFlowExecutor ) {
1780 MESSAGE( "CNode_Impl::Suspend " << Name() ) ;
1781 RetVal = aDataFlowExecutor->Suspend( Name() ) ;
1784 MESSAGE( "CNode_Impl::Suspend " << aDataFlowExecutor->Graph()->Name() ) ;
1785 RetVal = aDataFlowExecutor->Suspend() ;
1788 endService( "CNode_Impl::Suspend" );
1791 bool CNode_Impl::SuspendDone() {
1792 // beginService( "CNode_Impl::SuspendDone" );
1793 bool RetVal = false ;
1794 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1795 if ( aDataFlowExecutor ) {
1797 RetVal = aDataFlowExecutor->SuspendDone( Name() ) ;
1800 RetVal = aDataFlowExecutor->SuspendDone() ;
1803 // endService( "CNode_Impl::SuspendDone" );
1806 bool CNode_Impl::Resume() {
1807 bool RetVal = false ;
1808 beginService( "CNode_Impl::Resume" );
1809 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1810 if ( aDataFlowExecutor ) {
1812 MESSAGE( "CNode_Impl::Resume " << Name() ) ;
1813 RetVal = aDataFlowExecutor->Resume( Name() ) ;
1816 MESSAGE( "CNode_Impl::Resume " << aDataFlowExecutor->Graph()->Name() ) ;
1817 RetVal = aDataFlowExecutor->Resume() ;
1820 endService( "CNode_Impl::Resume" );
1824 long CNode_Impl::CpuUsed() {
1826 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1827 if ( aDataFlowExecutor ) {
1829 RetVal = aDataFlowExecutor->CpuUsed( Name() ) ;
1832 RetVal = aDataFlowExecutor->CpuUsed() ;
1838 bool CNode_Impl::IsExecuting() {
1839 bool RetVal = false;
1840 if ( !IsMacro() && DataFlowEditor() && DataFlowEditor()->Executor() ) {
1841 // asv : the statement below normally does not return true, Executor_OutNode
1842 // sets Editor->Editing() after finishing of execution (see Executor_OutNode.cxx)
1843 if ( DataFlowEditor()->IsExecuting() && DataFlowEditor()->Executor()->IsDone() ) {
1844 DataFlowEditor()->Editing();
1847 RetVal = DataFlowEditor()->IsExecuting();