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 //JR Debug 06.09.2005 : Ports must be explored in the reversed side because deletion
212 // of a port changes indexes !!!...
213 // for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeInPortsSize() ; i++ ) {
214 for ( i = DataFlowNode()->ComputingNode()->GetNodeInPortsSize()-1 ; i >= 0 ; i-- ) {
215 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeInPort( i )->ObjRef() ;
216 if ( !CORBA::is_nil( aPort ) ) {
220 // for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeOutPortsSize() ; i++ ) {
221 for ( i = DataFlowNode()->ComputingNode()->GetNodeOutPortsSize()-1 ; i >= 0 ; i-- ) {
222 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeOutPort( i )->ObjRef() ;
223 if ( !CORBA::is_nil( aPort ) ) {
228 endService( "CNode_Impl::DeletePorts" );
231 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
232 // beginService( "CNode_Impl::Service" );
233 SALOME_ModuleCatalog::Service * RetVal ;
235 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowNode()->GetService() ) ;
238 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowEditor()->GetService() ) ;
240 // endService( "CNode_Impl::Service" );
244 char * CNode_Impl::Name() {
245 // beginService( "CNode_Impl::Name" );
246 char * RetVal = NULL ;
248 RetVal = DataFlowNode()->Name() ;
251 RetVal = DataFlowEditor()->Graph()->Name() ;
253 // endService( "CNode_Impl::Name" );
254 return CORBA::string_dup( RetVal );
256 bool CNode_Impl::SetName( const char * aDataFlowName ) {
257 // beginService( "CNode_Impl::SetName" );
258 bool RetVal = false ;
260 if ( DataFlowEditor()->IsEditing() ) {
262 //JR 29.06.2005 debug :
263 char * OldNodeName = my_strdup( DataFlowNode()->Name() ) ;
264 // RetVal = DataFlowEditor()->ReNameNode( DataFlowNode()->Name() ,
265 SameName = !strcmp( OldNodeName , aDataFlowName ) ;
267 RetVal = DataFlowEditor()->ReNameNode( OldNodeName ,
270 delete [] OldNodeName ;
273 // RetVal = DataFlowEditor()->Graph()->Name( aDataFlowName ) ;
274 SameName = !strcmp( DataFlowEditor()->Graph()->Name() , aDataFlowName ) ;
276 RetVal = DataFlowEditor()->Name( aDataFlowName ) ;
279 //JR Debug 06.09.2005 : UnValid was missing
281 DataFlowEditor()->UnValid() ;
282 DataFlowEditor()->IsValid() ;
285 // endService( "CNode_Impl::SetName" );
288 SUPERV::KindOfNode CNode_Impl::Kind() {
289 // beginService( "CNode_Impl::Kind" );
290 SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
292 RetVal = DataFlowNode()->Kind() ;
295 RetVal = DataFlowEditor()->Graph()->Kind() ;
297 // endService( "CNode_Impl::Kind" );
300 bool CNode_Impl::IsGraph() {
301 // beginService( "CNode_Impl::IsGraph" );
302 bool RetVal = false ;
304 RetVal = DataFlowNode()->IsDataFlowNode() ;
307 RetVal = DataFlowEditor()->Graph()->IsDataFlowNode() ;
309 // endService( "CNode_Impl::IsGraph" );
312 bool CNode_Impl::IsStreamGraph() {
313 beginService( "CNode_Impl::IsStreamGraph" );
314 bool RetVal = false ;
316 RetVal = DataFlowNode()->IsDataStreamNode() ;
319 RetVal = DataFlowEditor()->Graph()->IsDataStreamNode() ;
321 MESSAGE( "CNode_Impl::IsStreamGraph " << RetVal );
322 endService( "CNode_Impl::IsStreamGraph" );
325 bool CNode_Impl::IsMacro() {
326 // beginService( "CNode_Impl::IsMacro" );
327 bool RetVal = false ;
328 if ( _IsNode && DataFlowNode()->IsMacroNode() ) {
331 // endService( "CNode_Impl::IsMacro" );
334 bool CNode_Impl::IsFlowMacro() {
335 // beginService( "CNode_Impl::IsFlowMacro" );
336 bool RetVal = false ;
337 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsGraph() ) {
340 // endService( "CNode_Impl::IsFlowMacro" );
343 bool CNode_Impl::IsStreamMacro() {
344 // beginService( "CNode_Impl::IsStreamMacro" );
345 bool RetVal = false ;
346 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsStreamGraph() ) {
349 // endService( "CNode_Impl::IsStreamMacro" );
352 bool CNode_Impl::IsHeadGraph() {
353 bool RetVal = false ;
354 beginService( "CNode_Impl::IsHeadGraph" );
355 endService( "CNode_Impl::IsHeadGraph" );
358 long CNode_Impl::GraphLevel() {
360 beginService( "CNode_Impl::GraphLevel" );
361 RetVal = DataFlowEditor()->Graph()->GraphMacroLevel() ;
362 endService( "CNode_Impl::GraphLevel" );
366 bool CNode_Impl::IsComputing() {
367 // beginService( "CNode_Impl::IsComputing" );
368 bool RetVal = SUPERV::UnknownNode ;
370 RetVal = DataFlowNode()->IsComputingNode() ;
373 RetVal = DataFlowEditor()->Graph()->IsComputingNode() ;
375 // endService( "CNode_Impl::IsComputing" );
378 bool CNode_Impl::IsFactory() {
379 // beginService( "CNode_Impl::IsFactory" );
380 bool RetVal = SUPERV::UnknownNode ;
382 RetVal = DataFlowNode()->IsFactoryNode() ;
385 RetVal = DataFlowEditor()->Graph()->IsFactoryNode() ;
387 // endService( "CNode_Impl::IsFactory" );
390 bool CNode_Impl::IsInLine() {
391 // beginService( "CNode_Impl::IsInLine" );
392 bool RetVal = SUPERV::UnknownNode ;
394 RetVal = DataFlowNode()->IsInLineNode() ;
397 RetVal = DataFlowEditor()->Graph()->IsInLineNode() ;
399 // endService( "CNode_Impl::IsInLine" );
402 bool CNode_Impl::IsGOTO() {
403 // beginService( "CNode_Impl::IsGOTO" );
404 bool RetVal = SUPERV::UnknownNode ;
406 RetVal = DataFlowNode()->IsGOTONode() ;
409 RetVal = DataFlowEditor()->Graph()->IsGOTONode() ;
411 // endService( "CNode_Impl::IsGOTO" );
414 bool CNode_Impl::IsLoop() {
415 // beginService( "CNode_Impl::IsLoop" );
416 bool RetVal = SUPERV::UnknownNode ;
418 RetVal = DataFlowNode()->IsLoopNode() ;
421 RetVal = DataFlowEditor()->Graph()->IsLoopNode() ;
423 // endService( "CNode_Impl::IsLoop" );
426 bool CNode_Impl::IsEndLoop() {
427 // beginService( "CNode_Impl::IsEndLoop" );
428 bool RetVal = SUPERV::UnknownNode ;
430 RetVal = DataFlowNode()->IsEndLoopNode() ;
433 RetVal = DataFlowEditor()->Graph()->IsEndLoopNode() ;
435 // endService( "CNode_Impl::IsEndLoop" );
438 bool CNode_Impl::IsSwitch() {
439 // beginService( "CNode_Impl::IsSwitch" );
440 bool RetVal = SUPERV::UnknownNode ;
442 RetVal = DataFlowNode()->IsSwitchNode() ;
445 RetVal = DataFlowEditor()->Graph()->IsSwitchNode() ;
447 // endService( "CNode_Impl::IsSwitch" );
450 bool CNode_Impl::IsEndSwitch() {
451 // beginService( "CNode_Impl::IsEndSwitch" );
452 bool RetVal = SUPERV::UnknownNode ;
454 RetVal = DataFlowNode()->IsEndSwitchNode() ;
457 RetVal = DataFlowEditor()->Graph()->IsEndSwitchNode() ;
459 // endService( "CNode_Impl::IsEndSwitch" );
463 SUPERV::SDate CNode_Impl::CreationDate() {
464 // beginService( "CNode_Impl::CreationDate" );
465 SUPERV::SDate_var RetVal ;
467 RetVal = new SUPERV::SDate( DataFlowNode()->FirstCreation() ) ;
470 // cout << " CNode_Impl::CreationDate " << DataFlowEditor()->FirstCreation()
472 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->FirstCreation() ) ;
474 // endService( "CNode_Impl::CreationDate" );
475 return (RetVal._retn()) ;
477 SUPERV::SDate CNode_Impl::LastUpdateDate() {
478 // beginService( "CNode_Impl::LastUpdateDate" );
479 SUPERV::SDate_var RetVal ;
481 RetVal = new SUPERV::SDate( DataFlowNode()->LastModification() ) ;
484 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->LastModification() ) ;
486 // endService( "CNode_Impl::LastUpdateDate" );
487 return (RetVal._retn()) ;
489 char * CNode_Impl::Version() {
490 // beginService( "CNode_Impl::Version" );
493 RetVal = DataFlowNode()->EditorRelease() ;
496 RetVal = DataFlowEditor()->Graph()->EditorRelease() ;
498 // endService( "CNode_Impl::Version" );
499 return CORBA::string_dup( RetVal ) ;
501 char * CNode_Impl::Author() {
502 // beginService( "CNode_Impl::Author" );
505 RetVal = DataFlowNode()->Author() ;
508 RetVal = DataFlowEditor()->Graph()->Author() ;
510 // endService( "CNode_Impl::Author" );
511 return CORBA::string_dup( RetVal ) ;
513 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
514 // beginService( "CNode_Impl::SetAuthor" );
515 bool RetVal = false ;
516 if ( DataFlowEditor()->IsEditing() ) {
518 RetVal = DataFlowNode()->Author( aDataFlowAuthor ) ;
521 RetVal = DataFlowEditor()->Graph()->Author( aDataFlowAuthor ) ;
524 // endService( "CNode_Impl::SetAuthor" );
527 char * CNode_Impl::Comment() {
528 // beginService( "CNode_Impl::Comment" );
531 RetVal = DataFlowNode()->Comment() ;
534 RetVal = DataFlowEditor()->Graph()->Comment() ;
536 // endService( "CNode_Impl::Comment" );
537 return CORBA::string_dup( RetVal ) ;
539 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
540 // beginService( "CNode_Impl::SetComment" );
541 bool RetVal = false ;
542 if ( DataFlowEditor()->IsEditing() ) {
544 RetVal = DataFlowNode()->Comment( aDataFlowComment ) ;
547 RetVal = DataFlowEditor()->Graph()->Comment( aDataFlowComment ) ;
550 // endService( "CNode_Impl::SetComment" );
554 void CNode_Impl::Coords(long X , long Y ) {
555 // beginService( "CNode_Impl::Coords" );
556 if ( DataFlowEditor()->IsEditing() ) {
558 ((GraphEditor::InNode *) DataFlowNode())->Coordinates( X , Y ) ;
561 DataFlowEditor()->Graph()->Coordinates( X , Y ) ;
564 // endService( "CNode_Impl::Coords" );
566 long CNode_Impl::X() {
567 // beginService( "CNode_Impl::X" );
570 RetVal = DataFlowNode()->XCoordinate() ;
573 RetVal = DataFlowEditor()->Graph()->XCoordinate() ;
575 // endService( "CNode_Impl::X" );
578 long CNode_Impl::Y() {
579 // beginService( "CNode_Impl::Y" );
582 RetVal = DataFlowNode()->YCoordinate() ;
585 RetVal = DataFlowEditor()->Graph()->YCoordinate() ;
587 // endService( "CNode_Impl::Y" );
591 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
593 Port_Impl * myPort = NULL ;
594 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
597 aninport = DataFlowNode()->GetInPort( ServiceParameterName ) ;
600 aninport = DataFlowEditor()->GetInPort( ServiceParameterName ) ;
604 anoutport = DataFlowNode()->GetOutPort( ServiceParameterName ) ;
607 anoutport = DataFlowEditor()->GetOutPort( ServiceParameterName ) ;
610 GraphBase::InPort * anInPort ;
612 anInPort = DataFlowNode()->GetChangeInPort( ServiceParameterName ) ;
615 anInPort = DataFlowEditor()->GetChangeInPort( ServiceParameterName ) ;
617 if ( anInPort->IsDataStream() ) {
618 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
620 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
622 beginService( "CNode_Impl::Port" );
627 hasinput = DataFlowNode()->HasInput( anInPort->PortName() ) ;
630 hasinput = DataFlowEditor()->HasInput( anInPort->PortName() ) ;
633 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
634 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
635 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
636 instanceName() , interfaceName() ,
639 // ServiceParameterName ,
640 (GraphBase::Port * ) anInPort ,
645 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
646 instanceName() , interfaceName() ,
649 // ServiceParameterName ) ;
650 (GraphBase::Port * ) anInPort ,
653 PortableServer::ObjectId * id = myPort->getId() ;
654 CORBA::Object_var obj = _poa->id_to_reference(*id);
655 iobject = SUPERV::Port::_narrow(obj) ;
656 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
659 iobject = anInPort->ObjRef() ;
662 else if ( anoutport ) {
663 GraphBase::OutPort * anOutPort ;
665 anOutPort = DataFlowNode()->GetChangeOutPort( ServiceParameterName ) ;
668 anOutPort = DataFlowEditor()->GetChangeOutPort( ServiceParameterName ) ;
670 if ( anOutPort->IsDataStream() ) {
671 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
673 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
675 beginService( "CNode_Impl::Port" );
678 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
679 const CORBA::Any anAny = anOutPort->Value() ;
680 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
681 instanceName() , interfaceName() ,
684 // ServiceParameterName ,
685 (GraphBase::Port * ) anOutPort ,
688 PortableServer::ObjectId * id = myPort->getId() ;
689 CORBA::Object_var obj = _poa->id_to_reference(*id);
690 iobject = SUPERV::Port::_narrow(obj) ;
691 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
694 iobject = anOutPort->ObjRef() ;
698 endService( "CNode_Impl::Port" );
700 DataFlowEditor()->UnValid() ;
701 return SUPERV::Port::_duplicate( iobject ) ;
704 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
705 const SUPERV::Value_ptr aValue ) {
707 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
708 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
710 GraphBase::InPort * anInPort = NULL ;
711 if ( DataFlowEditor()->IsEditing() /*&& DataFlowEditor()->Graph()->GraphMacroLevel() == 0*/ ) {
713 sts = DataFlowEditor()->AddInputData( DataFlowNode()->Name() ,
714 ToServiceParameterName ,
716 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
719 sts = DataFlowEditor()->AddInputData( DataFlowEditor()->Graph()->Name() ,
720 ToServiceParameterName ,
722 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
724 if ( sts && anInPort ) {
725 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
727 beginService( "CNode_Impl::Input" );
731 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
732 instanceName() , interfaceName() ,
735 // ToServiceParameterName ,
736 (GraphBase::Port * ) anInPort ,
739 PortableServer::ObjectId * id = myPort->getId() ;
740 CORBA::Object_var obj = _poa->id_to_reference(*id);
741 iobject = SUPERV::Port::_narrow(obj) ;
742 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
745 iobject = anInPort->ObjRef() ;
748 DataFlowEditor()->UnValid() ;
750 else if ( aDataFlowExecutor ) {
752 sts = aDataFlowExecutor->ChangeInputData( DataFlowNode()->Name() ,
753 ToServiceParameterName ,
755 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
758 sts = aDataFlowExecutor->ChangeInputData( DataFlowEditor()->Graph()->Name() ,
759 ToServiceParameterName ,
761 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
763 if ( sts && anInPort ) {
764 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
766 beginService( "CNode_Impl::Input" );
770 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
771 instanceName() , interfaceName() ,
774 // ToServiceParameterName ,
775 (GraphBase::Port * ) anInPort ,
778 PortableServer::ObjectId * id = myPort->getId() ;
779 CORBA::Object_var obj = _poa->id_to_reference(*id);
780 iobject = SUPERV::Port::_narrow(obj) ;
781 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
784 iobject = anInPort->ObjRef() ;
789 endService( "CNode_Impl::Input" );
791 if ( CORBA::is_nil( iobject ) ) {
792 MESSAGE( "CNode_Impl::Input returns nil object _IsNode " << _IsNode << " sts " << sts
793 << " Node " << Name() << " ToServiceParameterName " << ToServiceParameterName
794 << " anInPort " << anInPort ) ;
796 return SUPERV::Port::_duplicate( iobject ) ;
800 SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) {
801 SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ;
802 Port_Impl * myInPort = NULL ;
803 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
804 if ( anInPort && !anInPort->IsDataStream() ) {
805 Inobject = anInPort->ObjRef() ;
806 if ( CORBA::is_nil( Inobject ) ) {
807 myInPort = new Port_Impl( _Orb , _Poa , _ContId ,
808 instanceName() , interfaceName() ,
811 (GraphBase::Port * ) anInPort ,
814 PortableServer::ObjectId * id = myInPort->getId() ;
815 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
816 Inobject = SUPERV::Port::_narrow(obj) ;
817 anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ;
821 return SUPERV::Port::_duplicate( Inobject ) ;
824 SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) {
825 Port_Impl * myOutPort = NULL ;
826 SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
827 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
828 if ( anOutPort && !anOutPort->IsDataStream() ) {
829 Outobject = anOutPort->ObjRef() ;
830 if ( CORBA::is_nil( Outobject ) ) {
831 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
832 const CORBA::Any anAny = anOutPort->Value() ;
833 myOutPort = new Port_Impl( _Orb , _Poa , _ContId ,
834 instanceName() , interfaceName() ,
837 (GraphBase::Port * ) anOutPort ,
841 PortableServer::ObjectId * id = myOutPort->getId() ;
842 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
843 Outobject = SUPERV::Port::_narrow(obj) ;
844 anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ;
848 return SUPERV::Port::_duplicate( Outobject );
851 SUPERV::StreamPort_ptr CNode_Impl::GetInStreamPort( const char *aParameterName ) {
852 SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ;
853 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
854 StreamPort_Impl * myInStreamPort = NULL ;
855 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
856 if ( anInPort && anInPort->IsDataStream() ) {
857 Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
858 if ( CORBA::is_nil( Inobject ) ) {
859 myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
860 instanceName() , interfaceName() ,
863 (GraphBase::Port * ) anInPort ,
865 if ( myInStreamPort ) {
866 PortableServer::ObjectId * id = myInStreamPort->getId() ;
867 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
868 Inobject = SUPERV::StreamPort::_narrow(obj) ;
869 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ;
874 return SUPERV::StreamPort::_duplicate( Inobject ) ;
877 SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName ) {
878 StreamPort_Impl * myOutStreamPort = NULL ;
879 SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ;
880 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
881 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
882 if ( anOutPort && anOutPort->IsDataStream() ) {
883 Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
884 if ( CORBA::is_nil( Outobject ) ) {
885 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
886 const CORBA::Any anAny = anOutPort->Value() ;
887 myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
888 instanceName() , interfaceName() ,
891 (GraphBase::Port * ) anOutPort ,
894 if ( myOutStreamPort ) {
895 PortableServer::ObjectId * id = myOutStreamPort->getId() ;
896 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
897 Outobject = SUPERV::StreamPort::_narrow(obj) ;
898 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ;
903 return SUPERV::StreamPort::_duplicate( Outobject );
906 bool CNode_Impl::HasStreamPort() {
907 bool RetVal = false ;
908 beginService( "CNode_Impl::HasStreamPort" );
909 endService( "CNode_Impl::HasStreamPort" );
913 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
915 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
917 char* FromServiceParameterName ;
918 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
919 ToServiceParameterName ,
921 & FromServiceParameterName ) ;
923 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
924 if ( !anInPort->IsDataStream() && anInPort->GetOutPort() ) {
925 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
926 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
928 beginService( "CNode_Impl::GetLink" );
932 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
933 instanceName() , interfaceName() ,
936 ToServiceParameterName ,
937 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
938 FromServiceParameterName ,
939 true , false , Success ) ;
941 PortableServer::ObjectId * id = myLink->getId() ;
942 CORBA::Object_var obj = _poa->id_to_reference(*id);
943 iobject = SUPERV::Link::_narrow(obj) ;
944 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
948 iobject = anOutPort->InPortObjRef( anInPort ) ;
953 endService( "CNode_Impl::GetLink" );
955 return SUPERV::Link::_duplicate( iobject ) ;
958 SUPERV::StreamLink_ptr CNode_Impl::GetStreamLink(const char * ToServiceParameterName ) {
960 SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
962 char* FromServiceParameterName ;
963 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
964 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
965 ToServiceParameterName ,
967 & FromServiceParameterName ) ;
969 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
970 if ( anInPort->IsDataStream() && anInPort->GetOutPort() ) {
971 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
972 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
974 beginService( "CNode_Impl::GetLink" );
978 StreamLink_Impl * myStreamLink = new StreamLink_Impl(
979 _Orb , _Poa , _ContId ,
980 instanceName() , interfaceName() ,
983 ToServiceParameterName ,
984 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
985 FromServiceParameterName ,
988 PortableServer::ObjectId * id = myStreamLink->getId() ;
989 CORBA::Object_var obj = _poa->id_to_reference(*id);
990 iobject = SUPERV::StreamLink::_narrow(obj) ;
991 anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
995 iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
1001 endService( "CNode_Impl::GetLink" );
1003 return SUPERV::StreamLink::_duplicate( iobject ) ;
1006 SUPERV::ListOfPorts * CNode_Impl::Ports() {
1010 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
1012 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1013 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1014 if ( !anInPort->IsDataStream() ) {
1016 beginService( "CNode_Impl::Ports" );
1019 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1020 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1021 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1023 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1024 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1025 // << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1026 // << "/" << anInPort->IsNotConnected() ) ;
1027 Port_Impl * myPort ;
1028 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1029 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1030 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1031 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1032 instanceName() , interfaceName() ,
1035 (GraphBase::Port * ) anInPort ,
1040 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1041 instanceName() , interfaceName() ,
1044 (GraphBase::Port * ) anInPort ,
1047 PortableServer::ObjectId * id = myPort->getId() ;
1048 CORBA::Object_var obj = _poa->id_to_reference(*id);
1049 SUPERV::Port_var iobject ;
1050 iobject = SUPERV::Port::_narrow(obj) ;
1052 RetVal->length( PortCount ) ;
1053 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1054 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1057 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1059 RetVal->length( PortCount ) ;
1060 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1064 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1067 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1068 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1069 if ( !anOutPort->IsDataStream() ) {
1071 beginService( "CNode_Impl::Ports" );
1074 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1075 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1076 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1078 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1079 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1080 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1081 const CORBA::Any anAny = anOutPort->Value() ;
1082 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1083 instanceName() , interfaceName() ,
1086 (GraphBase::Port * ) anOutPort ,
1089 PortableServer::ObjectId * id = myPort->getId() ;
1090 CORBA::Object_var obj = _poa->id_to_reference(*id);
1091 SUPERV::Port_var iobject ;
1092 iobject = SUPERV::Port::_narrow(obj) ;
1094 RetVal->length( PortCount ) ;
1095 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1096 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1099 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1101 RetVal->length( PortCount ) ;
1102 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1106 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1111 if ( DataFlowEditor()->IsValid() ) {
1112 //DataFlowEditor()->Graph()->Values() ;
1113 RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1114 DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1115 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1116 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1117 if ( !anOutPort->IsDataStream() ) {
1118 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1120 beginService( "CNode_Impl::Ports" );
1123 Port_Impl * myPort ;
1124 if ( anOutPort->IsDataConnected() ) {
1125 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1126 const CORBA::Any anAny = anOutPort->Value() ;
1127 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1128 instanceName() , interfaceName() ,
1131 (GraphBase::Port * ) anOutPort ,
1136 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1137 instanceName() , interfaceName() ,
1140 (GraphBase::Port * ) anOutPort ,
1143 PortableServer::ObjectId * id = myPort->getId() ;
1144 CORBA::Object_var obj = _poa->id_to_reference(*id);
1145 SUPERV::Port_var iobject ;
1146 iobject = SUPERV::Port::_narrow(obj) ;
1148 RetVal->length( PortCount ) ;
1149 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1150 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1154 RetVal->length( PortCount ) ;
1155 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1161 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1162 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1163 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1164 if ( !anInPort->IsDataStream() ) {
1165 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1167 beginService( "CNode_Impl::Ports" );
1170 Port_Impl * myPort ;
1171 if ( anInPort->IsDataConnected() ) {
1172 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1173 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1174 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1175 instanceName() , interfaceName() ,
1178 (GraphBase::Port * ) anInPort ,
1183 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1184 instanceName() , interfaceName() ,
1190 PortableServer::ObjectId * id = myPort->getId() ;
1191 CORBA::Object_var obj = _poa->id_to_reference(*id);
1192 SUPERV::Port_var iobject ;
1193 iobject = SUPERV::Port::_narrow(obj) ;
1195 RetVal->length( PortCount ) ;
1196 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1197 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1201 RetVal->length( PortCount ) ;
1202 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1211 int RetVallength = (unsigned int ) RetVal->length() ;
1212 for ( i = 0 ; i < RetVallength ; i++ ) {
1213 MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1217 endService( "CNode_Impl::Ports " ) ;
1219 return ( RetVal._retn() ) ;
1222 SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() {
1226 SUPERV::ListOfStreamPorts_var RetVal = new SUPERV::ListOfStreamPorts ;
1227 if ( !DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1228 // MESSAGE("CNode_Impl::StreamPorts NOT a DataStreamNode" ) ;
1230 else if ( _IsNode ) {
1231 // RetVal->length( DataFlowNode()->GetNodeInPortsSize() +
1232 // DataFlowNode()->GetNodeOutPortsSize() ) ;
1233 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1234 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1235 if ( anInPort->IsDataStream() ) {
1237 beginService( "CNode_Impl::StreamPorts" );
1240 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1241 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1242 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1243 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1245 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1246 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1247 << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1248 << "/" << anInPort->IsNotConnected() ) ;
1249 StreamPort_Impl * myStreamPort ;
1250 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1251 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1252 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1253 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1254 instanceName() , interfaceName() ,
1257 (GraphBase::Port * ) anInPort ,
1262 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1263 instanceName() , interfaceName() ,
1266 (GraphBase::Port * ) anInPort ,
1269 PortableServer::ObjectId * id = myStreamPort->getId() ;
1270 CORBA::Object_var obj = _poa->id_to_reference(*id);
1271 SUPERV::StreamPort_var iobject ;
1272 iobject = SUPERV::StreamPort::_narrow(obj) ;
1274 RetVal->length( PortCount ) ;
1275 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1276 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1279 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1281 RetVal->length( PortCount ) ;
1282 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1286 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1289 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1290 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1291 if ( anOutPort->IsDataStream() ) {
1293 beginService( "CNode_Impl::StreamPorts" );
1296 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1297 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1298 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1299 // RetVal[ DataFlowNode()->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1301 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1302 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1303 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1304 const CORBA::Any anAny = anOutPort->Value() ;
1305 StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1306 instanceName() , interfaceName() ,
1309 (GraphBase::Port * ) anOutPort ,
1312 PortableServer::ObjectId * id = myStreamPort->getId() ;
1313 CORBA::Object_var obj = _poa->id_to_reference(*id);
1314 SUPERV::StreamPort_var iobject ;
1315 iobject = SUPERV::StreamPort::_narrow(obj) ;
1317 RetVal->length( PortCount ) ;
1318 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1319 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1322 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1324 RetVal->length( PortCount ) ;
1325 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1329 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1334 if ( DataFlowEditor()->IsValid() ) {
1335 // RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1336 // DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1337 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1338 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1339 if ( anOutPort->IsDataStream() ) {
1340 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1342 beginService( "CNode_Impl::StreamPorts" );
1345 StreamPort_Impl * myStreamPort ;
1346 if ( anOutPort->IsDataConnected() ) {
1347 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1348 const CORBA::Any anAny = anOutPort->Value() ;
1349 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1350 instanceName() , interfaceName() ,
1353 (GraphBase::Port * ) anOutPort ,
1358 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1359 instanceName() , interfaceName() ,
1362 (GraphBase::Port * ) anOutPort ,
1365 PortableServer::ObjectId * id = myStreamPort->getId() ;
1366 CORBA::Object_var obj = _poa->id_to_reference(*id);
1367 SUPERV::StreamPort_var iobject ;
1368 iobject = SUPERV::StreamPort::_narrow(obj) ;
1370 RetVal->length( PortCount ) ;
1371 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1372 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1376 RetVal->length( PortCount ) ;
1377 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1381 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1384 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1385 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1386 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1387 if ( anInPort->IsDataStream() ) {
1388 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1390 beginService( "CNode_Impl::StreamPorts" );
1393 StreamPort_Impl * myStreamPort ;
1394 if ( anInPort->IsDataConnected() ) {
1395 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1396 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1397 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1398 instanceName() , interfaceName() ,
1401 (GraphBase::Port * ) anInPort ,
1406 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1407 instanceName() , interfaceName() ,
1413 PortableServer::ObjectId * id = myStreamPort->getId() ;
1414 CORBA::Object_var obj = _poa->id_to_reference(*id);
1415 SUPERV::StreamPort_var iobject ;
1416 iobject = SUPERV::StreamPort::_narrow(obj) ;
1418 RetVal->length( PortCount ) ;
1419 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1420 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1424 RetVal->length( PortCount ) ;
1425 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1429 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1434 // int RetVallength = (unsigned int ) RetVal->length() ;
1435 // for ( i = 0 ; i < RetVallength ; i++ ) {
1436 // MESSAGE( "StreamPort " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1439 endService( "CNode_Impl::StreamPorts " ) ;
1441 return ( RetVal._retn() ) ;
1444 SUPERV::ListOfLinks * CNode_Impl::Links() {
1445 beginService( "CNode_Impl::Links" ) ;
1446 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
1447 if ( DataFlowNode() ) {
1448 // MESSAGE( "CNode_Impl::Links " << DataFlowEditor() << " " << DataFlowEditor()->Graph() << " " << DataFlowEditor()->Graph()->ObjImpl() << " " << DataFlowNode()->ComputingNode() << " " << DataFlowNode()->ComputingNode()->Name() ) ;
1449 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( DataFlowNode()->ComputingNode() , NULL ) ;
1452 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( NULL , NULL ) ;
1454 MESSAGE( "CNode_Impl::Links " << RetVal->length() << " Links" ) ;
1455 endService( "CNode_Impl::Links" ) ;
1456 return ( RetVal._retn() ) ;
1459 SUPERV::ListOfStreamLinks * CNode_Impl::StreamLinks() {
1460 beginService( "CNode_Impl::StreamLinks" ) ;
1461 SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
1462 if ( DataFlowNode() && DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1463 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( DataFlowNode()->ComputingNode() , NULL ) ;
1465 else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1466 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( NULL , NULL ) ;
1468 MESSAGE( "CNode_Impl::StreamLinks " << RetVal->length() << " StreamLinks" ) ;
1469 endService( "CNode_Impl::StreamLinks" ) ;
1470 return ( RetVal._retn() ) ;
1473 long CNode_Impl::SubGraph() {
1474 // beginService( "CNode_Impl::SubGraph" );
1477 RetVal = DataFlowNode()->SubGraph() ;
1479 // endService( "CNode_Impl::SubGraph" );
1483 long CNode_Impl::SubStreamGraph() {
1484 // beginService( "CNode_Impl::SubStreamGraph" );
1487 RetVal = DataFlowNode()->SubStreamGraph() ;
1489 // endService( "CNode_Impl::SubStreamGraph" );
1493 bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
1494 beginService( "CNode_Impl::IsLinked" );
1495 bool RetVal = DataFlowNode()->IsLinked( ServiceParameterName ) ;
1496 MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
1497 endService( "CNode_Impl::IsLinked" );
1501 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
1502 // beginService( "CNode_Impl::HasInput" );
1503 bool RetVal = DataFlowNode()->HasInput( ServiceParameterName ) ;
1504 // endService( "CNode_Impl::HasInput" );
1508 SUPERV::GraphState CNode_Impl::State() {
1509 // beginService( "CNode_Impl::State" );
1510 SUPERV::GraphState RetVal = SUPERV::EditingState ;
1511 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1512 if ( aDataFlowExecutor && !DataFlowEditor()->EditedAfterExecution() ) {
1513 //JR : 12/06/03 if ( aDataFlowExecutor ) {
1515 RetVal = aDataFlowExecutor->State( Name() ) ;
1518 RetVal = aDataFlowExecutor->State() ;
1521 // endService( "CNode_Impl::State" );
1524 long CNode_Impl::Thread() {
1525 // beginService( "CNode_Impl::Thread" );
1527 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1528 if ( aDataFlowExecutor ) {
1530 RetVal = aDataFlowExecutor->Thread( Name() ) ;
1533 RetVal = aDataFlowExecutor->Thread() ;
1536 // endService( "CNode_Impl::Thread" );
1539 GraphExecutor::AutomatonState CNode_Impl::AutoState() {
1540 // beginService( "CNode_Impl::AutoState" );
1541 GraphExecutor::AutomatonState RetVal = GraphExecutor::UnKnownState ;
1542 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1543 if ( aDataFlowExecutor ) {
1545 RetVal = aDataFlowExecutor->AutomatonState( Name() ) ;
1548 RetVal = aDataFlowExecutor->AutomatonState() ;
1551 // endService( "CNode_Impl::AutoState" );
1554 SUPERV::ControlState CNode_Impl::Control() {
1555 // beginService( "CNode_Impl::Control" );
1556 SUPERV::ControlState RetVal = SUPERV::VoidState ;
1557 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1558 if ( aDataFlowExecutor ) {
1560 RetVal = aDataFlowExecutor->ControlState( Name() ) ;
1563 RetVal = aDataFlowExecutor->ControlState() ;
1566 // endService( "CNode_Impl::Control" );
1569 void CNode_Impl::ControlClear() {
1570 // beginService( "CNode_Impl::ControlClear" );
1571 // SUPERV::ControlState RetVal = SUPERV::VoidState ;
1572 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1573 if ( aDataFlowExecutor ) {
1575 aDataFlowExecutor->ControlClear( Name() ) ;
1578 aDataFlowExecutor->ControlClear() ;
1581 // endService( "CNode_Impl::ControlClear" );
1585 bool CNode_Impl::IsReady() {
1586 // beginService( "CNode_Impl::IsReady" );
1587 bool RetVal = false ;
1588 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1589 if ( aDataFlowExecutor ) {
1591 RetVal = aDataFlowExecutor->IsReady( Name() ) ;
1594 RetVal = aDataFlowExecutor->IsReady() ;
1597 // endService( "CNode_Impl::IsReady" );
1601 bool CNode_Impl::IsWaiting() {
1602 // beginService( "CNode_Impl::IsWaiting" );
1603 bool RetVal = false ;
1604 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1605 if ( aDataFlowExecutor ) {
1607 RetVal = aDataFlowExecutor->IsWaiting( Name() ) ;
1610 RetVal = aDataFlowExecutor->IsWaiting() ;
1613 // endService( "CNode_Impl::IsWaiting" );
1617 bool CNode_Impl::IsRunning() {
1618 // beginService( "CNode_Impl::IsRunning" );
1619 bool RetVal = false ;
1620 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1621 if ( aDataFlowExecutor ) {
1623 RetVal = aDataFlowExecutor->IsRunning( Name() ) ;
1626 RetVal = aDataFlowExecutor->IsRunning() ;
1629 // endService( "CNode_Impl::IsRunning" );
1633 bool CNode_Impl::IsDone() {
1634 // beginService( "CNode_Impl::IsDone" );
1635 bool RetVal = false ;
1636 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1637 if ( aDataFlowExecutor ) {
1639 RetVal = aDataFlowExecutor->IsDone( Name() ) ;
1642 RetVal = aDataFlowExecutor->IsDone() ;
1645 // endService( "CNode_Impl::IsDone" );
1649 bool CNode_Impl::IsSuspended() {
1650 // beginService( "CNode_Impl::IsSuspended" );
1651 bool RetVal = false ;
1652 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1653 if ( aDataFlowExecutor ) {
1655 RetVal = aDataFlowExecutor->IsSuspended( Name() ) ;
1658 RetVal = aDataFlowExecutor->IsSuspended() ;
1661 // endService( "CNode_Impl::IsSuspended" );
1665 bool CNode_Impl::ReadyW() {
1666 // beginService( "CNode_Impl::ReadyW" );
1667 bool RetVal = false ;
1668 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1669 if ( aDataFlowExecutor ) {
1671 RetVal = aDataFlowExecutor->ReadyWait( Name() ) ;
1674 RetVal = aDataFlowExecutor->ReadyWait() ;
1677 // endService( "CNode_Impl::ReadyW" );
1681 bool CNode_Impl::RunningW() {
1682 // beginService( "CNode_Impl::RunningW" );
1683 bool RetVal = false ;
1684 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1685 if ( aDataFlowExecutor ) {
1687 RetVal = aDataFlowExecutor->RunningWait( Name() ) ;
1690 RetVal = aDataFlowExecutor->RunningWait() ;
1693 // endService( "CNode_Impl::RunningW" );
1697 bool CNode_Impl::DoneW() {
1698 // beginService( "CNode_Impl::DoneW" );
1699 bool RetVal = false ;
1700 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1701 if ( aDataFlowExecutor ) {
1703 RetVal = aDataFlowExecutor->DoneWait( Name() ) ;
1706 RetVal = aDataFlowExecutor->DoneWait() ;
1709 // endService( "CNode_Impl::DoneW" );
1713 bool CNode_Impl::SuspendedW() {
1714 // beginService( "CNode_Impl::SuspendedW" );
1715 bool RetVal = false ;
1716 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1717 if ( aDataFlowExecutor ) {
1719 RetVal = aDataFlowExecutor->SuspendedWait( Name() ) ;
1722 RetVal = aDataFlowExecutor->SuspendedWait() ;
1725 // endService( "CNode_Impl::SuspendedW" );
1729 void CNode_Impl::ping() {
1730 // beginService( "CNode_Impl::ping" );
1731 bool RetVal = false ;
1732 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1733 if ( aDataFlowExecutor ) {
1735 RetVal = aDataFlowExecutor->Ping( Name() ) ;
1741 // endService( "CNode_Impl::ping" );
1745 bool CNode_Impl::ContainerKill() {
1746 beginService( "CNode_Impl::ContainerKill" );
1747 bool RetVal = false ;
1748 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1749 if ( aDataFlowExecutor && IsExecuting() ) {
1751 RetVal = aDataFlowExecutor->ContainerKill( Name() ) ;
1754 RetVal = aDataFlowExecutor->ContainerKill() ;
1757 endService( "CNode_Impl::ContainerKill" );
1760 bool CNode_Impl::Kill() {
1761 beginService( "CNode_Impl::Kill" );
1762 bool RetVal = false ;
1763 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1764 if ( aDataFlowExecutor ) {
1766 RetVal = aDataFlowExecutor->Kill( Name() ) ;
1767 MESSAGE( "Node " << Name() << " execution was killed : " << RetVal ) ;
1770 RetVal = aDataFlowExecutor->Kill() ;
1771 MESSAGE( "Graph execution was killed : " << RetVal ) ;
1774 endService( "CNode_Impl::Kill" );
1777 bool CNode_Impl::KillDone() {
1778 // beginService( "CNode_Impl::KillDone" );
1779 bool RetVal = false ;
1780 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1781 if ( aDataFlowExecutor ) {
1783 RetVal = aDataFlowExecutor->KillDone( Name() ) ;
1786 // endService( "CNode_Impl::KillDone" );
1789 bool CNode_Impl::Stop() {
1790 // beginService( "CNode_Impl::Stop" );
1791 bool RetVal ; // = aDataFlowExecutor->Stop() ;
1792 // endService( "CNode_Impl::Stop" );
1795 bool CNode_Impl::Suspend() {
1796 beginService( "CNode_Impl::Suspend" );
1797 bool RetVal = false ;
1798 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1799 if ( aDataFlowExecutor ) {
1801 MESSAGE( "CNode_Impl::Suspend " << Name() ) ;
1802 RetVal = aDataFlowExecutor->Suspend( Name() ) ;
1805 MESSAGE( "CNode_Impl::Suspend " << aDataFlowExecutor->Graph()->Name() ) ;
1806 RetVal = aDataFlowExecutor->Suspend() ;
1809 endService( "CNode_Impl::Suspend" );
1812 bool CNode_Impl::SuspendDone() {
1813 // beginService( "CNode_Impl::SuspendDone" );
1814 bool RetVal = false ;
1815 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1816 if ( aDataFlowExecutor ) {
1818 RetVal = aDataFlowExecutor->SuspendDone( Name() ) ;
1821 RetVal = aDataFlowExecutor->SuspendDone() ;
1824 // endService( "CNode_Impl::SuspendDone" );
1827 bool CNode_Impl::Resume() {
1828 bool RetVal = false ;
1829 beginService( "CNode_Impl::Resume" );
1830 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1831 if ( aDataFlowExecutor ) {
1833 MESSAGE( "CNode_Impl::Resume " << Name() ) ;
1834 RetVal = aDataFlowExecutor->Resume( Name() ) ;
1837 MESSAGE( "CNode_Impl::Resume " << aDataFlowExecutor->Graph()->Name() ) ;
1838 RetVal = aDataFlowExecutor->Resume() ;
1841 endService( "CNode_Impl::Resume" );
1845 long CNode_Impl::CpuUsed() {
1847 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1848 if ( aDataFlowExecutor ) {
1850 RetVal = aDataFlowExecutor->CpuUsed( Name() ) ;
1853 RetVal = aDataFlowExecutor->CpuUsed() ;
1859 bool CNode_Impl::IsExecuting() {
1860 bool RetVal = false;
1861 if ( !IsMacro() && DataFlowEditor() && DataFlowEditor()->Executor() ) {
1862 // asv : the statement below normally does not return true, Executor_OutNode
1863 // sets Editor->Editing() after finishing of execution (see Executor_OutNode.cxx)
1864 if ( DataFlowEditor()->IsExecuting() && DataFlowEditor()->Executor()->IsDone() ) {
1865 DataFlowEditor()->Editing();
1868 RetVal = DataFlowEditor()->IsExecuting();