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 char *FACTORYSERVERPY = "localhost/FactoryServerPy" ;
28 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
29 PortableServer::POA_ptr poa ,
30 PortableServer::ObjectId * contId ,
31 const char *instanceName ,
32 const char *interfaceName ,
33 const char *aDataFlowName ,
34 const SUPERV::KindOfNode aKindOfNode ) :
35 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
36 // MESSAGE("CNode_Impl::CNode_Impl activate object instanceName("
37 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
38 // << hex << (void *) this << dec )
40 // _id = _poa->activate_object(_thisObj);
41 // MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
42 // beginService( "CNode_Impl::CNode_Impl" );
43 _Orb = CORBA::ORB::_duplicate(orb);
46 _DataFlowEditor = NULL ;
47 _DataFlowNode = NULL ;
48 if ( aKindOfNode == SUPERV::MacroNode ) {
54 // endService( "CNode_Impl::CNode_Impl" );
57 CNode_Impl::CNode_Impl() {
60 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
61 PortableServer::POA_ptr poa ,
62 PortableServer::ObjectId * contId ,
63 const char *instanceName ,
64 const char *interfaceName ,
65 GraphEditor::DataFlow * aDataFlowEditor ,
66 const SALOME_ModuleCatalog::Service &NodeService ,
67 const char * NodeName ,
68 const SUPERV::KindOfNode NodeKindOfNode ,
69 const char * FuncName ,
70 const SUPERV::ListOfStrings & PythonFunction ,
72 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
73 // beginService( "CNode_Impl::CNode_Impl" );
74 // cout << "CNode_Impl::CNode_Impl -->" << endl ;
75 // if ( FuncName && NodeName ) {
76 // cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
77 // << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
78 // << " " << strlen( FuncName ) << endl ;
80 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
81 // MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
83 _id = _poa->activate_object(_thisObj);
85 _Orb = CORBA::ORB::_duplicate(orb);
88 _DataFlowEditor = aDataFlowEditor ;
89 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
90 GraphBase::ListOfFuncName aFuncName ;
91 GraphBase::ListOfPythonFunctions aPythonFunction ;
94 aFuncName[0] = my_strdup( FuncName ) ;
95 aPythonFunction.resize(1) ;
96 aPythonFunction[0] = &PythonFunction ;
100 if ( isCimpl ) // C++ implementation
101 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
105 else // Python implementation
106 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
115 // mkr : PAL11273 <--
118 // endService( "CNode_Impl::CNode_Impl" );
119 // cout << "<-- CNode_Impl::CNode_Impl" << endl ;
122 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
123 PortableServer::POA_ptr poa ,
124 PortableServer::ObjectId * contId ,
125 const char *instanceName ,
126 const char *interfaceName ,
127 GraphEditor::DataFlow * aDataFlowEditor ,
128 const SALOME_ModuleCatalog::Service &NodeService ,
129 const char * NodeName ,
130 const SUPERV::KindOfNode NodeKindOfNode ,
131 const GraphBase::ListOfFuncName & aFuncName ,
132 const GraphBase::ListOfPythonFunctions & aPythonFunction ) :
133 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
134 // MESSAGE( NodeName << " " );
135 // beginService( "CNode_Impl::CNode_Impl" );
137 // MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ;
139 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
140 // MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" );
142 _id = _poa->activate_object(_thisObj);
144 _Orb = CORBA::ORB::_duplicate(orb);
147 _DataFlowEditor = aDataFlowEditor ;
148 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
149 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
154 // endService( "CNode_Impl::CNode_Impl" );
157 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
158 PortableServer::POA_ptr poa ,
159 PortableServer::ObjectId * contId ,
160 const char *instanceName ,
161 const char *interfaceName ,
162 GraphEditor::DataFlow * aDataFlowEditor ,
163 GraphEditor::InNode * aDataFlowNode ) :
164 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
165 // beginService( "CNode_Impl::CNode_Impl" );
166 if ( aDataFlowNode && aDataFlowNode->IsComputingNode() ) {
167 // MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" );
169 _id = _poa->activate_object(_thisObj);
172 // MESSAGE( "CNode_Impl::CNode_Impl NO _poa->activate_object " );
174 _Orb = CORBA::ORB::_duplicate(orb);
177 _DataFlowEditor = aDataFlowEditor ;
178 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
179 _DataFlowNode = aDataFlowNode ;
180 if ( aDataFlowNode ) {
186 // endService( "CNode_Impl::CNode_Impl" );
189 CNode_Impl::~CNode_Impl() {
190 beginService( "CNode_Impl::~CNode_Impl" );
191 endService( "CNode_Impl::~CNode_Impl" );
194 void CNode_Impl::destroy() {
195 beginService( "CNode_Impl::Destroy" );
196 if ( DataFlowEditor()->IsEditing() ) {
198 _DataFlowNode = NULL ;
199 _poa->deactivate_object(*_id) ;
200 // CORBA::release(_poa) ;
202 // _thisObj->_remove_ref();
205 MESSAGE("CNode_Impl::destroy ERROR ") ;
208 // endService( "CNode_Impl::Destroy" );
211 bool CNode_Impl::Delete() {
212 beginService( "CNode_Impl::Delete" );
213 bool RetVal = false ;
214 if ( DataFlowEditor()->IsEditing() ) {
216 RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
218 DataFlowEditor()->UnValid() ;
221 endService( "CNode_Impl::Delete" );
225 void CNode_Impl::DeletePorts() {
226 beginService( "CNode_Impl::DeletePorts" );
227 if ( DataFlowEditor()->IsEditing() && DataFlowNode() ) {
229 //JR Debug 06.09.2005 : Ports must be explored in the reversed side because deletion
230 // of a port changes indexes !!!...
231 // for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeInPortsSize() ; i++ ) {
232 for ( i = DataFlowNode()->ComputingNode()->GetNodeInPortsSize()-1 ; i >= 0 ; i-- ) {
233 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeInPort( i )->ObjRef() ;
234 if ( !CORBA::is_nil( aPort ) ) {
238 // for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeOutPortsSize() ; i++ ) {
239 for ( i = DataFlowNode()->ComputingNode()->GetNodeOutPortsSize()-1 ; i >= 0 ; i-- ) {
240 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeOutPort( i )->ObjRef() ;
241 if ( !CORBA::is_nil( aPort ) ) {
246 endService( "CNode_Impl::DeletePorts" );
249 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
250 // beginService( "CNode_Impl::Service" );
251 SALOME_ModuleCatalog::Service * RetVal ;
253 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowNode()->GetService() ) ;
256 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowEditor()->GetService() ) ;
258 // endService( "CNode_Impl::Service" );
262 char * CNode_Impl::Name() {
263 // beginService( "CNode_Impl::Name" );
264 char * RetVal = NULL ;
266 RetVal = DataFlowNode()->Name() ;
269 RetVal = DataFlowEditor()->Graph()->Name() ;
271 // endService( "CNode_Impl::Name" );
272 return CORBA::string_dup( RetVal );
274 bool CNode_Impl::SetName( const char * aDataFlowName ) {
275 // beginService( "CNode_Impl::SetName" );
276 bool RetVal = false ;
278 if ( DataFlowEditor()->IsEditing() ) {
280 //JR 29.06.2005 debug :
281 char * OldNodeName = my_strdup( DataFlowNode()->Name() ) ;
282 // RetVal = DataFlowEditor()->ReNameNode( DataFlowNode()->Name() ,
283 SameName = !strcmp( OldNodeName , aDataFlowName ) ;
285 RetVal = DataFlowEditor()->ReNameNode( OldNodeName ,
288 delete [] OldNodeName ;
291 // RetVal = DataFlowEditor()->Graph()->Name( aDataFlowName ) ;
292 SameName = !strcmp( DataFlowEditor()->Graph()->Name() , aDataFlowName ) ;
294 RetVal = DataFlowEditor()->Name( aDataFlowName ) ;
297 //JR Debug 06.09.2005 : UnValid was missing
299 DataFlowEditor()->UnValid() ;
300 DataFlowEditor()->IsValid() ;
303 // endService( "CNode_Impl::SetName" );
306 SUPERV::KindOfNode CNode_Impl::Kind() {
307 // beginService( "CNode_Impl::Kind" );
308 SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
310 RetVal = DataFlowNode()->Kind() ;
313 RetVal = DataFlowEditor()->Graph()->Kind() ;
315 // endService( "CNode_Impl::Kind" );
318 bool CNode_Impl::IsGraph() {
319 // beginService( "CNode_Impl::IsGraph" );
320 bool RetVal = false ;
322 RetVal = DataFlowNode()->IsDataFlowNode() ;
325 RetVal = DataFlowEditor()->Graph()->IsDataFlowNode() ;
327 // endService( "CNode_Impl::IsGraph" );
330 bool CNode_Impl::IsStreamGraph() {
331 beginService( "CNode_Impl::IsStreamGraph" );
332 bool RetVal = false ;
334 RetVal = DataFlowNode()->IsDataStreamNode() ;
337 RetVal = DataFlowEditor()->Graph()->IsDataStreamNode() ;
339 MESSAGE( "CNode_Impl::IsStreamGraph " << RetVal );
340 endService( "CNode_Impl::IsStreamGraph" );
343 bool CNode_Impl::IsMacro() {
344 // beginService( "CNode_Impl::IsMacro" );
345 bool RetVal = false ;
346 if ( _IsNode && DataFlowNode()->IsMacroNode() ) {
349 // endService( "CNode_Impl::IsMacro" );
352 bool CNode_Impl::IsFlowMacro() {
353 // beginService( "CNode_Impl::IsFlowMacro" );
354 bool RetVal = false ;
355 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsGraph() ) {
358 // endService( "CNode_Impl::IsFlowMacro" );
361 bool CNode_Impl::IsStreamMacro() {
362 // beginService( "CNode_Impl::IsStreamMacro" );
363 bool RetVal = false ;
364 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsStreamGraph() ) {
367 // endService( "CNode_Impl::IsStreamMacro" );
370 bool CNode_Impl::IsHeadGraph() {
371 bool RetVal = false ;
372 beginService( "CNode_Impl::IsHeadGraph" );
373 endService( "CNode_Impl::IsHeadGraph" );
376 CORBA::Long CNode_Impl::GraphLevel() {
377 CORBA::Long RetVal = 0 ;
378 beginService( "CNode_Impl::GraphLevel" );
379 RetVal = DataFlowEditor()->Graph()->GraphMacroLevel() ;
380 endService( "CNode_Impl::GraphLevel" );
384 bool CNode_Impl::IsComputing() {
385 // beginService( "CNode_Impl::IsComputing" );
386 bool RetVal = SUPERV::UnknownNode ;
388 RetVal = DataFlowNode()->IsComputingNode() ;
391 RetVal = DataFlowEditor()->Graph()->IsComputingNode() ;
393 // endService( "CNode_Impl::IsComputing" );
396 bool CNode_Impl::IsFactory() {
397 // beginService( "CNode_Impl::IsFactory" );
398 bool RetVal = SUPERV::UnknownNode ;
400 RetVal = DataFlowNode()->IsFactoryNode() ;
403 RetVal = DataFlowEditor()->Graph()->IsFactoryNode() ;
405 // endService( "CNode_Impl::IsFactory" );
408 bool CNode_Impl::IsInLine() {
409 // beginService( "CNode_Impl::IsInLine" );
410 bool RetVal = SUPERV::UnknownNode ;
412 RetVal = DataFlowNode()->IsInLineNode() ;
415 RetVal = DataFlowEditor()->Graph()->IsInLineNode() ;
417 // endService( "CNode_Impl::IsInLine" );
420 bool CNode_Impl::IsGOTO() {
421 // beginService( "CNode_Impl::IsGOTO" );
422 bool RetVal = SUPERV::UnknownNode ;
424 RetVal = DataFlowNode()->IsGOTONode() ;
427 RetVal = DataFlowEditor()->Graph()->IsGOTONode() ;
429 // endService( "CNode_Impl::IsGOTO" );
432 bool CNode_Impl::IsLoop() {
433 // beginService( "CNode_Impl::IsLoop" );
434 bool RetVal = SUPERV::UnknownNode ;
436 RetVal = DataFlowNode()->IsLoopNode() ;
439 RetVal = DataFlowEditor()->Graph()->IsLoopNode() ;
441 // endService( "CNode_Impl::IsLoop" );
444 bool CNode_Impl::IsEndLoop() {
445 // beginService( "CNode_Impl::IsEndLoop" );
446 bool RetVal = SUPERV::UnknownNode ;
448 RetVal = DataFlowNode()->IsEndLoopNode() ;
451 RetVal = DataFlowEditor()->Graph()->IsEndLoopNode() ;
453 // endService( "CNode_Impl::IsEndLoop" );
456 bool CNode_Impl::IsSwitch() {
457 // beginService( "CNode_Impl::IsSwitch" );
458 bool RetVal = SUPERV::UnknownNode ;
460 RetVal = DataFlowNode()->IsSwitchNode() ;
463 RetVal = DataFlowEditor()->Graph()->IsSwitchNode() ;
465 // endService( "CNode_Impl::IsSwitch" );
468 bool CNode_Impl::IsEndSwitch() {
469 // beginService( "CNode_Impl::IsEndSwitch" );
470 bool RetVal = SUPERV::UnknownNode ;
472 RetVal = DataFlowNode()->IsEndSwitchNode() ;
475 RetVal = DataFlowEditor()->Graph()->IsEndSwitchNode() ;
477 // endService( "CNode_Impl::IsEndSwitch" );
481 SUPERV::SDate CNode_Impl::CreationDate() {
482 // beginService( "CNode_Impl::CreationDate" );
483 SUPERV::SDate_var RetVal ;
485 RetVal = new SUPERV::SDate( DataFlowNode()->FirstCreation() ) ;
488 // cout << " CNode_Impl::CreationDate " << DataFlowEditor()->FirstCreation()
490 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->FirstCreation() ) ;
492 // endService( "CNode_Impl::CreationDate" );
493 return (RetVal._retn()) ;
495 SUPERV::SDate CNode_Impl::LastUpdateDate() {
496 // beginService( "CNode_Impl::LastUpdateDate" );
497 SUPERV::SDate_var RetVal ;
499 RetVal = new SUPERV::SDate( DataFlowNode()->LastModification() ) ;
502 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->LastModification() ) ;
504 // endService( "CNode_Impl::LastUpdateDate" );
505 return (RetVal._retn()) ;
507 char * CNode_Impl::Version() {
508 // beginService( "CNode_Impl::Version" );
511 RetVal = DataFlowNode()->EditorRelease() ;
514 RetVal = DataFlowEditor()->Graph()->EditorRelease() ;
516 // endService( "CNode_Impl::Version" );
517 return CORBA::string_dup( RetVal ) ;
519 char * CNode_Impl::Author() {
520 // beginService( "CNode_Impl::Author" );
523 RetVal = DataFlowNode()->Author() ;
526 RetVal = DataFlowEditor()->Graph()->Author() ;
528 // endService( "CNode_Impl::Author" );
529 return CORBA::string_dup( RetVal ) ;
531 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
532 // beginService( "CNode_Impl::SetAuthor" );
533 bool RetVal = false ;
534 if ( DataFlowEditor()->IsEditing() ) {
536 RetVal = DataFlowNode()->Author( aDataFlowAuthor ) ;
539 RetVal = DataFlowEditor()->Graph()->Author( aDataFlowAuthor ) ;
542 // endService( "CNode_Impl::SetAuthor" );
545 char * CNode_Impl::Comment() {
546 // beginService( "CNode_Impl::Comment" );
549 RetVal = DataFlowNode()->Comment() ;
552 RetVal = DataFlowEditor()->Graph()->Comment() ;
554 // endService( "CNode_Impl::Comment" );
555 return CORBA::string_dup( RetVal ) ;
557 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
558 // beginService( "CNode_Impl::SetComment" );
559 bool RetVal = false ;
560 if ( DataFlowEditor()->IsEditing() ) {
562 RetVal = DataFlowNode()->Comment( aDataFlowComment ) ;
565 RetVal = DataFlowEditor()->Graph()->Comment( aDataFlowComment ) ;
568 // endService( "CNode_Impl::SetComment" );
572 void CNode_Impl::Coords(CORBA::Long X , CORBA::Long Y ) {
573 // beginService( "CNode_Impl::Coords" );
574 if ( DataFlowEditor()->IsEditing() ) {
576 ((GraphEditor::InNode *) DataFlowNode())->Coordinates( X , Y ) ;
579 DataFlowEditor()->Graph()->Coordinates( X , Y ) ;
582 // endService( "CNode_Impl::Coords" );
584 CORBA::Long CNode_Impl::X() {
585 // beginService( "CNode_Impl::X" );
588 RetVal = DataFlowNode()->XCoordinate() ;
591 RetVal = DataFlowEditor()->Graph()->XCoordinate() ;
593 // endService( "CNode_Impl::X" );
596 CORBA::Long CNode_Impl::Y() {
597 // beginService( "CNode_Impl::Y" );
600 RetVal = DataFlowNode()->YCoordinate() ;
603 RetVal = DataFlowEditor()->Graph()->YCoordinate() ;
605 // endService( "CNode_Impl::Y" );
609 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
611 Port_Impl * myPort = NULL ;
612 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
615 aninport = DataFlowNode()->GetInPort( ServiceParameterName ) ;
618 aninport = DataFlowEditor()->GetInPort( ServiceParameterName ) ;
622 anoutport = DataFlowNode()->GetOutPort( ServiceParameterName ) ;
625 anoutport = DataFlowEditor()->GetOutPort( ServiceParameterName ) ;
628 GraphBase::InPort * anInPort ;
630 anInPort = DataFlowNode()->GetChangeInPort( ServiceParameterName ) ;
633 anInPort = DataFlowEditor()->GetChangeInPort( ServiceParameterName ) ;
635 if ( anInPort->IsDataStream() ) {
636 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
638 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
640 beginService( "CNode_Impl::Port" );
645 hasinput = DataFlowNode()->HasInput( anInPort->PortName() ) ;
648 hasinput = DataFlowEditor()->HasInput( anInPort->PortName() ) ;
651 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
652 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
653 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
654 instanceName() , interfaceName() ,
657 // ServiceParameterName ,
658 (GraphBase::Port * ) anInPort ,
663 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
664 instanceName() , interfaceName() ,
667 // ServiceParameterName ) ;
668 (GraphBase::Port * ) anInPort ,
671 PortableServer::ObjectId * id = myPort->getId() ;
672 CORBA::Object_var obj = _poa->id_to_reference(*id);
673 iobject = SUPERV::Port::_narrow(obj) ;
674 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
677 iobject = anInPort->ObjRef() ;
680 else if ( anoutport ) {
681 GraphBase::OutPort * anOutPort ;
683 anOutPort = DataFlowNode()->GetChangeOutPort( ServiceParameterName ) ;
686 anOutPort = DataFlowEditor()->GetChangeOutPort( ServiceParameterName ) ;
688 if ( anOutPort->IsDataStream() ) {
689 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
691 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
693 beginService( "CNode_Impl::Port" );
696 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
697 const CORBA::Any anAny = anOutPort->Value() ;
698 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
699 instanceName() , interfaceName() ,
702 // ServiceParameterName ,
703 (GraphBase::Port * ) anOutPort ,
706 PortableServer::ObjectId * id = myPort->getId() ;
707 CORBA::Object_var obj = _poa->id_to_reference(*id);
708 iobject = SUPERV::Port::_narrow(obj) ;
709 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
712 iobject = anOutPort->ObjRef() ;
716 endService( "CNode_Impl::Port" );
718 DataFlowEditor()->UnValid() ;
719 return SUPERV::Port::_duplicate( iobject ) ;
722 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
723 const SUPERV::Value_ptr aValue ) {
725 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
726 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
728 GraphBase::InPort * anInPort = NULL ;
729 if ( DataFlowEditor()->IsEditing() /*&& DataFlowEditor()->Graph()->GraphMacroLevel() == 0*/ ) {
731 sts = DataFlowEditor()->AddInputData( DataFlowNode()->Name() ,
732 ToServiceParameterName ,
734 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
737 sts = DataFlowEditor()->AddInputData( 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() ;
766 DataFlowEditor()->UnValid() ;
768 else if ( aDataFlowExecutor ) {
770 sts = aDataFlowExecutor->ChangeInputData( DataFlowNode()->Name() ,
771 ToServiceParameterName ,
773 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
776 sts = aDataFlowExecutor->ChangeInputData( DataFlowEditor()->Graph()->Name() ,
777 ToServiceParameterName ,
779 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
781 if ( sts && anInPort ) {
782 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
784 beginService( "CNode_Impl::Input" );
788 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
789 instanceName() , interfaceName() ,
792 // ToServiceParameterName ,
793 (GraphBase::Port * ) anInPort ,
796 PortableServer::ObjectId * id = myPort->getId() ;
797 CORBA::Object_var obj = _poa->id_to_reference(*id);
798 iobject = SUPERV::Port::_narrow(obj) ;
799 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
802 iobject = anInPort->ObjRef() ;
807 endService( "CNode_Impl::Input" );
809 if ( CORBA::is_nil( iobject ) ) {
810 MESSAGE( "CNode_Impl::Input returns nil object _IsNode " << _IsNode << " sts " << sts
811 << " Node " << Name() << " ToServiceParameterName " << ToServiceParameterName
812 << " anInPort " << anInPort ) ;
814 return SUPERV::Port::_duplicate( iobject ) ;
818 SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) {
819 SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ;
820 Port_Impl * myInPort = NULL ;
821 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
822 if ( anInPort && !anInPort->IsDataStream() ) {
823 Inobject = anInPort->ObjRef() ;
824 if ( CORBA::is_nil( Inobject ) ) {
825 myInPort = new Port_Impl( _Orb , _Poa , _ContId ,
826 instanceName() , interfaceName() ,
829 (GraphBase::Port * ) anInPort ,
832 PortableServer::ObjectId * id = myInPort->getId() ;
833 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
834 Inobject = SUPERV::Port::_narrow(obj) ;
835 anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ;
839 return SUPERV::Port::_duplicate( Inobject ) ;
842 SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) {
843 Port_Impl * myOutPort = NULL ;
844 SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
845 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
846 if ( anOutPort && !anOutPort->IsDataStream() ) {
847 Outobject = anOutPort->ObjRef() ;
848 if ( CORBA::is_nil( Outobject ) ) {
849 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
850 const CORBA::Any anAny = anOutPort->Value() ;
851 myOutPort = new Port_Impl( _Orb , _Poa , _ContId ,
852 instanceName() , interfaceName() ,
855 (GraphBase::Port * ) anOutPort ,
859 PortableServer::ObjectId * id = myOutPort->getId() ;
860 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
861 Outobject = SUPERV::Port::_narrow(obj) ;
862 anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ;
866 return SUPERV::Port::_duplicate( Outobject );
869 SUPERV::StreamPort_ptr CNode_Impl::GetInStreamPort( const char *aParameterName ) {
870 SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ;
871 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
872 StreamPort_Impl * myInStreamPort = NULL ;
873 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
874 if ( anInPort && anInPort->IsDataStream() ) {
875 Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
876 if ( CORBA::is_nil( Inobject ) ) {
877 myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
878 instanceName() , interfaceName() ,
881 (GraphBase::Port * ) anInPort ,
883 if ( myInStreamPort ) {
884 PortableServer::ObjectId * id = myInStreamPort->getId() ;
885 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
886 Inobject = SUPERV::StreamPort::_narrow(obj) ;
887 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ;
892 return SUPERV::StreamPort::_duplicate( Inobject ) ;
895 SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName ) {
896 StreamPort_Impl * myOutStreamPort = NULL ;
897 SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ;
898 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
899 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
900 if ( anOutPort && anOutPort->IsDataStream() ) {
901 Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
902 if ( CORBA::is_nil( Outobject ) ) {
903 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
904 const CORBA::Any anAny = anOutPort->Value() ;
905 myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
906 instanceName() , interfaceName() ,
909 (GraphBase::Port * ) anOutPort ,
912 if ( myOutStreamPort ) {
913 PortableServer::ObjectId * id = myOutStreamPort->getId() ;
914 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
915 Outobject = SUPERV::StreamPort::_narrow(obj) ;
916 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ;
921 return SUPERV::StreamPort::_duplicate( Outobject );
924 bool CNode_Impl::HasStreamPort() {
925 bool RetVal = false ;
926 beginService( "CNode_Impl::HasStreamPort" );
927 endService( "CNode_Impl::HasStreamPort" );
931 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
933 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
935 char* FromServiceParameterName ;
936 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
937 ToServiceParameterName ,
939 & FromServiceParameterName ) ;
941 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
942 if ( !anInPort->IsDataStream() && anInPort->GetOutPort() ) {
943 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
944 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
946 beginService( "CNode_Impl::GetLink" );
950 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
951 instanceName() , interfaceName() ,
954 ToServiceParameterName ,
955 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
956 FromServiceParameterName ,
957 true , false , Success ) ;
959 PortableServer::ObjectId * id = myLink->getId() ;
960 CORBA::Object_var obj = _poa->id_to_reference(*id);
961 iobject = SUPERV::Link::_narrow(obj) ;
962 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
966 iobject = anOutPort->InPortObjRef( anInPort ) ;
971 endService( "CNode_Impl::GetLink" );
973 return SUPERV::Link::_duplicate( iobject ) ;
976 SUPERV::StreamLink_ptr CNode_Impl::GetStreamLink(const char * ToServiceParameterName ) {
978 SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
980 char* FromServiceParameterName ;
981 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
982 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
983 ToServiceParameterName ,
985 & FromServiceParameterName ) ;
987 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
988 if ( anInPort->IsDataStream() && anInPort->GetOutPort() ) {
989 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
990 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
992 beginService( "CNode_Impl::GetLink" );
996 StreamLink_Impl * myStreamLink = new StreamLink_Impl(
997 _Orb , _Poa , _ContId ,
998 instanceName() , interfaceName() ,
1001 ToServiceParameterName ,
1002 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
1003 FromServiceParameterName ,
1006 PortableServer::ObjectId * id = myStreamLink->getId() ;
1007 CORBA::Object_var obj = _poa->id_to_reference(*id);
1008 iobject = SUPERV::StreamLink::_narrow(obj) ;
1009 anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
1013 iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
1019 endService( "CNode_Impl::GetLink" );
1021 return SUPERV::StreamLink::_duplicate( iobject ) ;
1024 SUPERV::ListOfPorts * CNode_Impl::Ports() {
1028 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
1030 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1031 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1032 if ( !anInPort->IsDataStream() ) {
1034 beginService( "CNode_Impl::Ports" );
1037 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1038 ( /*IsExecuting() || */DataFlowEditor()->IsReadOnly() ) ) ) { // mkr : IPAL11362
1039 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1041 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1042 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1043 // << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1044 // << "/" << anInPort->IsNotConnected() ) ;
1045 Port_Impl * myPort ;
1046 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1047 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1048 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1049 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1050 instanceName() , interfaceName() ,
1053 (GraphBase::Port * ) anInPort ,
1058 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1059 instanceName() , interfaceName() ,
1062 (GraphBase::Port * ) anInPort ,
1065 PortableServer::ObjectId * id = myPort->getId() ;
1066 CORBA::Object_var obj = _poa->id_to_reference(*id);
1067 SUPERV::Port_var iobject ;
1068 iobject = SUPERV::Port::_narrow(obj) ;
1070 RetVal->length( PortCount ) ;
1071 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1072 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1075 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1077 RetVal->length( PortCount ) ;
1078 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1082 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1085 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1086 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1087 if ( !anOutPort->IsDataStream() ) {
1089 beginService( "CNode_Impl::Ports" );
1092 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1093 ( /*IsExecuting() || */DataFlowEditor()->IsReadOnly() ) ) ) { // mkr : IPAL11362
1094 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1096 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1097 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1098 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1099 const CORBA::Any anAny = anOutPort->Value() ;
1100 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1101 instanceName() , interfaceName() ,
1104 (GraphBase::Port * ) anOutPort ,
1107 PortableServer::ObjectId * id = myPort->getId() ;
1108 CORBA::Object_var obj = _poa->id_to_reference(*id);
1109 SUPERV::Port_var iobject ;
1110 iobject = SUPERV::Port::_narrow(obj) ;
1112 RetVal->length( PortCount ) ;
1113 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1114 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1117 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1119 RetVal->length( PortCount ) ;
1120 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1124 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1129 if ( DataFlowEditor()->IsValid() ) {
1130 //DataFlowEditor()->Graph()->Values() ;
1131 RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1132 DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1133 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1134 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1135 if ( !anOutPort->IsDataStream() ) {
1136 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1138 beginService( "CNode_Impl::Ports" );
1141 Port_Impl * myPort ;
1142 if ( anOutPort->IsDataConnected() ) {
1143 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1144 const CORBA::Any anAny = anOutPort->Value() ;
1145 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1146 instanceName() , interfaceName() ,
1149 (GraphBase::Port * ) anOutPort ,
1154 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1155 instanceName() , interfaceName() ,
1158 (GraphBase::Port * ) anOutPort ,
1161 PortableServer::ObjectId * id = myPort->getId() ;
1162 CORBA::Object_var obj = _poa->id_to_reference(*id);
1163 SUPERV::Port_var iobject ;
1164 iobject = SUPERV::Port::_narrow(obj) ;
1166 RetVal->length( PortCount ) ;
1167 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1168 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1172 RetVal->length( PortCount ) ;
1173 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1179 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1180 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1181 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1182 if ( !anInPort->IsDataStream() ) {
1183 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1185 beginService( "CNode_Impl::Ports" );
1188 Port_Impl * myPort ;
1189 if ( anInPort->IsDataConnected() ) {
1190 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1191 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1192 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1193 instanceName() , interfaceName() ,
1196 (GraphBase::Port * ) anInPort ,
1201 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1202 instanceName() , interfaceName() ,
1208 PortableServer::ObjectId * id = myPort->getId() ;
1209 CORBA::Object_var obj = _poa->id_to_reference(*id);
1210 SUPERV::Port_var iobject ;
1211 iobject = SUPERV::Port::_narrow(obj) ;
1213 RetVal->length( PortCount ) ;
1214 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1215 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1219 RetVal->length( PortCount ) ;
1220 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1229 int RetVallength = (unsigned int ) RetVal->length() ;
1230 for ( i = 0 ; i < RetVallength ; i++ ) {
1231 MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1235 endService( "CNode_Impl::Ports " ) ;
1237 return ( RetVal._retn() ) ;
1240 SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() {
1244 SUPERV::ListOfStreamPorts_var RetVal = new SUPERV::ListOfStreamPorts ;
1245 if ( !DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1246 // MESSAGE("CNode_Impl::StreamPorts NOT a DataStreamNode" ) ;
1248 else if ( _IsNode ) {
1249 // RetVal->length( DataFlowNode()->GetNodeInPortsSize() +
1250 // DataFlowNode()->GetNodeOutPortsSize() ) ;
1251 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1252 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1253 if ( anInPort->IsDataStream() ) {
1255 beginService( "CNode_Impl::StreamPorts" );
1258 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1259 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1260 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1261 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1263 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1264 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1265 << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1266 << "/" << anInPort->IsNotConnected() ) ;
1267 StreamPort_Impl * myStreamPort ;
1268 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1269 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1270 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1271 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1272 instanceName() , interfaceName() ,
1275 (GraphBase::Port * ) anInPort ,
1280 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1281 instanceName() , interfaceName() ,
1284 (GraphBase::Port * ) anInPort ,
1287 PortableServer::ObjectId * id = myStreamPort->getId() ;
1288 CORBA::Object_var obj = _poa->id_to_reference(*id);
1289 SUPERV::StreamPort_var iobject ;
1290 iobject = SUPERV::StreamPort::_narrow(obj) ;
1292 RetVal->length( PortCount ) ;
1293 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1294 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1297 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1299 RetVal->length( PortCount ) ;
1300 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1304 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1307 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1308 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1309 if ( anOutPort->IsDataStream() ) {
1311 beginService( "CNode_Impl::StreamPorts" );
1314 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1315 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1316 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1317 // RetVal[ DataFlowNode()->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1319 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1320 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1321 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1322 const CORBA::Any anAny = anOutPort->Value() ;
1323 StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1324 instanceName() , interfaceName() ,
1327 (GraphBase::Port * ) anOutPort ,
1330 PortableServer::ObjectId * id = myStreamPort->getId() ;
1331 CORBA::Object_var obj = _poa->id_to_reference(*id);
1332 SUPERV::StreamPort_var iobject ;
1333 iobject = SUPERV::StreamPort::_narrow(obj) ;
1335 RetVal->length( PortCount ) ;
1336 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1337 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1340 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1342 RetVal->length( PortCount ) ;
1343 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1347 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1352 if ( DataFlowEditor()->IsValid() ) {
1353 // RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1354 // DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1355 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1356 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1357 if ( anOutPort->IsDataStream() ) {
1358 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1360 beginService( "CNode_Impl::StreamPorts" );
1363 StreamPort_Impl * myStreamPort ;
1364 if ( anOutPort->IsDataConnected() ) {
1365 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1366 const CORBA::Any anAny = anOutPort->Value() ;
1367 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1368 instanceName() , interfaceName() ,
1371 (GraphBase::Port * ) anOutPort ,
1376 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1377 instanceName() , interfaceName() ,
1380 (GraphBase::Port * ) anOutPort ,
1383 PortableServer::ObjectId * id = myStreamPort->getId() ;
1384 CORBA::Object_var obj = _poa->id_to_reference(*id);
1385 SUPERV::StreamPort_var iobject ;
1386 iobject = SUPERV::StreamPort::_narrow(obj) ;
1388 RetVal->length( PortCount ) ;
1389 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1390 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1394 RetVal->length( PortCount ) ;
1395 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1399 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1402 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1403 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1404 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1405 if ( anInPort->IsDataStream() ) {
1406 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1408 beginService( "CNode_Impl::StreamPorts" );
1411 StreamPort_Impl * myStreamPort ;
1412 if ( anInPort->IsDataConnected() ) {
1413 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1414 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1415 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1416 instanceName() , interfaceName() ,
1419 (GraphBase::Port * ) anInPort ,
1424 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1425 instanceName() , interfaceName() ,
1431 PortableServer::ObjectId * id = myStreamPort->getId() ;
1432 CORBA::Object_var obj = _poa->id_to_reference(*id);
1433 SUPERV::StreamPort_var iobject ;
1434 iobject = SUPERV::StreamPort::_narrow(obj) ;
1436 RetVal->length( PortCount ) ;
1437 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1438 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1442 RetVal->length( PortCount ) ;
1443 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1447 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1452 // int RetVallength = (unsigned int ) RetVal->length() ;
1453 // for ( i = 0 ; i < RetVallength ; i++ ) {
1454 // MESSAGE( "StreamPort " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1457 endService( "CNode_Impl::StreamPorts " ) ;
1459 return ( RetVal._retn() ) ;
1462 SUPERV::ListOfLinks * CNode_Impl::Links() {
1463 beginService( "CNode_Impl::Links" ) ;
1464 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
1465 if ( DataFlowNode() ) {
1466 // MESSAGE( "CNode_Impl::Links " << DataFlowEditor() << " " << DataFlowEditor()->Graph() << " " << DataFlowEditor()->Graph()->ObjImpl() << " " << DataFlowNode()->ComputingNode() << " " << DataFlowNode()->ComputingNode()->Name() ) ;
1467 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( DataFlowNode()->ComputingNode() , NULL ) ;
1470 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( NULL , NULL ) ;
1472 MESSAGE( "CNode_Impl::Links " << RetVal->length() << " Links" ) ;
1473 endService( "CNode_Impl::Links" ) ;
1474 return ( RetVal._retn() ) ;
1477 SUPERV::ListOfStreamLinks * CNode_Impl::StreamLinks() {
1478 beginService( "CNode_Impl::StreamLinks" ) ;
1479 SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
1480 if ( DataFlowNode() && DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1481 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( DataFlowNode()->ComputingNode() , NULL ) ;
1483 else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1484 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( NULL , NULL ) ;
1486 MESSAGE( "CNode_Impl::StreamLinks " << RetVal->length() << " StreamLinks" ) ;
1487 endService( "CNode_Impl::StreamLinks" ) ;
1488 return ( RetVal._retn() ) ;
1491 CORBA::Long CNode_Impl::SubGraph() {
1492 // beginService( "CNode_Impl::SubGraph" );
1493 CORBA::Long RetVal = 0 ;
1495 RetVal = DataFlowNode()->SubGraph() ;
1497 // endService( "CNode_Impl::SubGraph" );
1501 CORBA::Long CNode_Impl::SubStreamGraph() {
1502 // beginService( "CNode_Impl::SubStreamGraph" );
1503 CORBA::Long RetVal = 0 ;
1505 RetVal = DataFlowNode()->SubStreamGraph() ;
1507 // endService( "CNode_Impl::SubStreamGraph" );
1511 // mkr : PAL8060 : this method is not used
1512 /*bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
1513 beginService( "CNode_Impl::IsLinked" );
1514 bool RetVal = DataFlowNode()->IsLinked( ServiceParameterName ) ;
1515 MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
1516 endService( "CNode_Impl::IsLinked" );
1520 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
1521 // beginService( "CNode_Impl::HasInput" );
1522 bool RetVal = DataFlowNode()->HasInput( ServiceParameterName ) ;
1523 // endService( "CNode_Impl::HasInput" );
1527 SUPERV::GraphState CNode_Impl::State() {
1528 // beginService( "CNode_Impl::State" );
1529 SUPERV::GraphState RetVal = SUPERV::EditingState ;
1530 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1531 if ( aDataFlowExecutor && !DataFlowEditor()->EditedAfterExecution() ) {
1532 //JR : 12/06/03 if ( aDataFlowExecutor ) {
1534 RetVal = aDataFlowExecutor->State( Name() ) ;
1537 RetVal = aDataFlowExecutor->State() ;
1540 // endService( "CNode_Impl::State" );
1543 CORBA::Long CNode_Impl::Thread() {
1544 // beginService( "CNode_Impl::Thread" );
1545 CORBA::Long RetVal = 0 ;
1546 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1547 if ( aDataFlowExecutor ) {
1549 RetVal = aDataFlowExecutor->Thread( Name() ) ;
1552 RetVal = aDataFlowExecutor->Thread() ;
1555 // endService( "CNode_Impl::Thread" );
1558 GraphExecutor::AutomatonState CNode_Impl::AutoState() {
1559 // beginService( "CNode_Impl::AutoState" );
1560 GraphExecutor::AutomatonState RetVal = GraphExecutor::UnKnownState ;
1561 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1562 if ( aDataFlowExecutor ) {
1564 RetVal = aDataFlowExecutor->AutomatonState( Name() ) ;
1567 RetVal = aDataFlowExecutor->AutomatonState() ;
1570 // endService( "CNode_Impl::AutoState" );
1573 SUPERV::ControlState CNode_Impl::Control() {
1574 // beginService( "CNode_Impl::Control" );
1575 SUPERV::ControlState RetVal = SUPERV::VoidState ;
1576 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1577 if ( aDataFlowExecutor ) {
1579 RetVal = aDataFlowExecutor->ControlState( Name() ) ;
1582 RetVal = aDataFlowExecutor->ControlState() ;
1585 // endService( "CNode_Impl::Control" );
1588 void CNode_Impl::ControlClear() {
1589 // beginService( "CNode_Impl::ControlClear" );
1590 // SUPERV::ControlState RetVal = SUPERV::VoidState ;
1591 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1592 if ( aDataFlowExecutor ) {
1594 aDataFlowExecutor->ControlClear( Name() ) ;
1597 aDataFlowExecutor->ControlClear() ;
1600 // endService( "CNode_Impl::ControlClear" );
1604 bool CNode_Impl::IsReady() {
1605 // beginService( "CNode_Impl::IsReady" );
1606 bool RetVal = false ;
1607 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1608 if ( aDataFlowExecutor ) {
1610 RetVal = aDataFlowExecutor->IsReady( Name() ) ;
1613 RetVal = aDataFlowExecutor->IsReady() ;
1616 // endService( "CNode_Impl::IsReady" );
1620 bool CNode_Impl::IsWaiting() {
1621 // beginService( "CNode_Impl::IsWaiting" );
1622 bool RetVal = false ;
1623 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1624 if ( aDataFlowExecutor ) {
1626 RetVal = aDataFlowExecutor->IsWaiting( Name() ) ;
1629 RetVal = aDataFlowExecutor->IsWaiting() ;
1632 // endService( "CNode_Impl::IsWaiting" );
1636 bool CNode_Impl::IsRunning() {
1637 // beginService( "CNode_Impl::IsRunning" );
1638 bool RetVal = false ;
1639 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1640 if ( aDataFlowExecutor ) {
1642 RetVal = aDataFlowExecutor->IsRunning( Name() ) ;
1645 RetVal = aDataFlowExecutor->IsRunning() ;
1648 // endService( "CNode_Impl::IsRunning" );
1652 bool CNode_Impl::IsDone() {
1653 // beginService( "CNode_Impl::IsDone" );
1654 bool RetVal = false ;
1655 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1656 if ( aDataFlowExecutor ) {
1658 RetVal = aDataFlowExecutor->IsDone( Name() ) ;
1661 RetVal = aDataFlowExecutor->IsDone() ;
1664 // endService( "CNode_Impl::IsDone" );
1668 bool CNode_Impl::IsSuspended() {
1669 // beginService( "CNode_Impl::IsSuspended" );
1670 bool RetVal = false ;
1671 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1672 if ( aDataFlowExecutor ) {
1674 RetVal = aDataFlowExecutor->IsSuspended( Name() ) ;
1677 RetVal = aDataFlowExecutor->IsSuspended() ;
1680 // endService( "CNode_Impl::IsSuspended" );
1684 bool CNode_Impl::ReadyW() {
1685 // beginService( "CNode_Impl::ReadyW" );
1686 bool RetVal = false ;
1687 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1688 if ( aDataFlowExecutor ) {
1690 RetVal = aDataFlowExecutor->ReadyWait( Name() ) ;
1693 RetVal = aDataFlowExecutor->ReadyWait() ;
1696 // endService( "CNode_Impl::ReadyW" );
1700 bool CNode_Impl::RunningW() {
1701 // beginService( "CNode_Impl::RunningW" );
1702 bool RetVal = false ;
1703 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1704 if ( aDataFlowExecutor ) {
1706 RetVal = aDataFlowExecutor->RunningWait( Name() ) ;
1709 RetVal = aDataFlowExecutor->RunningWait() ;
1712 // endService( "CNode_Impl::RunningW" );
1716 bool CNode_Impl::DoneW() {
1717 // beginService( "CNode_Impl::DoneW" );
1718 bool RetVal = false ;
1719 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1720 if ( aDataFlowExecutor ) {
1722 RetVal = aDataFlowExecutor->DoneWait( Name() ) ;
1725 RetVal = aDataFlowExecutor->DoneWait() ;
1728 // endService( "CNode_Impl::DoneW" );
1732 bool CNode_Impl::SuspendedW() {
1733 // beginService( "CNode_Impl::SuspendedW" );
1734 bool RetVal = false ;
1735 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1736 if ( aDataFlowExecutor ) {
1738 RetVal = aDataFlowExecutor->SuspendedWait( Name() ) ;
1741 RetVal = aDataFlowExecutor->SuspendedWait() ;
1744 // endService( "CNode_Impl::SuspendedW" );
1748 void CNode_Impl::ping() {
1749 // beginService( "CNode_Impl::ping" );
1750 bool RetVal = false ;
1751 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1752 if ( aDataFlowExecutor ) {
1754 RetVal = aDataFlowExecutor->Ping( Name() ) ;
1760 if ( IsGraph() || IsStreamGraph() ) {
1761 theAutomaton->GraphImpl( (Graph_Impl * ) this ) ;
1763 // endService( "CNode_Impl::ping" );
1767 bool CNode_Impl::ContainerKill() {
1768 beginService( "CNode_Impl::ContainerKill" );
1769 bool RetVal = false ;
1770 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1771 if ( aDataFlowExecutor && IsExecuting() ) {
1773 RetVal = aDataFlowExecutor->ContainerKill( Name() ) ;
1776 RetVal = aDataFlowExecutor->ContainerKill() ;
1779 endService( "CNode_Impl::ContainerKill" );
1782 bool CNode_Impl::Kill() {
1783 beginService( "CNode_Impl::Kill" );
1784 bool RetVal = false ;
1785 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1786 if ( aDataFlowExecutor ) {
1788 RetVal = aDataFlowExecutor->Kill( Name() ) ;
1789 MESSAGE( "Node " << Name() << " execution was killed : " << RetVal ) ;
1792 RetVal = aDataFlowExecutor->Kill() ;
1793 MESSAGE( "Graph execution was killed : " << RetVal ) ;
1796 endService( "CNode_Impl::Kill" );
1799 bool CNode_Impl::KillDone() {
1800 // beginService( "CNode_Impl::KillDone" );
1801 bool RetVal = false ;
1802 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1803 if ( aDataFlowExecutor ) {
1805 RetVal = aDataFlowExecutor->KillDone( Name() ) ;
1808 // endService( "CNode_Impl::KillDone" );
1811 bool CNode_Impl::Stop() {
1812 // beginService( "CNode_Impl::Stop" );
1813 bool RetVal ; // = aDataFlowExecutor->Stop() ;
1814 // endService( "CNode_Impl::Stop" );
1817 bool CNode_Impl::Suspend() {
1818 beginService( "CNode_Impl::Suspend" );
1819 bool RetVal = false ;
1820 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1821 if ( aDataFlowExecutor ) {
1823 MESSAGE( "CNode_Impl::Suspend " << Name() ) ;
1824 RetVal = aDataFlowExecutor->Suspend( Name() ) ;
1827 MESSAGE( "CNode_Impl::Suspend " << aDataFlowExecutor->Graph()->Name() ) ;
1828 RetVal = aDataFlowExecutor->Suspend() ;
1831 endService( "CNode_Impl::Suspend" );
1834 bool CNode_Impl::SuspendDone() {
1835 // beginService( "CNode_Impl::SuspendDone" );
1836 bool RetVal = false ;
1837 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1838 if ( aDataFlowExecutor ) {
1840 RetVal = aDataFlowExecutor->SuspendDone( Name() ) ;
1843 RetVal = aDataFlowExecutor->SuspendDone() ;
1846 // endService( "CNode_Impl::SuspendDone" );
1849 bool CNode_Impl::Resume() {
1850 bool RetVal = false ;
1851 beginService( "CNode_Impl::Resume" );
1852 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1853 if ( aDataFlowExecutor ) {
1855 MESSAGE( "CNode_Impl::Resume " << Name() ) ;
1856 RetVal = aDataFlowExecutor->Resume( Name() ) ;
1859 MESSAGE( "CNode_Impl::Resume " << aDataFlowExecutor->Graph()->Name() ) ;
1860 RetVal = aDataFlowExecutor->Resume() ;
1863 endService( "CNode_Impl::Resume" );
1867 CORBA::Long CNode_Impl::CpuUsed() {
1868 CORBA::Long RetVal = 0 ;
1869 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1870 if ( aDataFlowExecutor ) {
1872 RetVal = aDataFlowExecutor->CpuUsed( Name() ) ;
1875 RetVal = aDataFlowExecutor->CpuUsed() ;
1881 bool CNode_Impl::IsExecuting() {
1882 bool RetVal = false;
1883 if ( !IsMacro() && DataFlowEditor() && DataFlowEditor()->Executor() ) {
1884 // asv : the statement below normally does not return true, Executor_OutNode
1885 // sets Editor->Editing() after finishing of execution (see Executor_OutNode.cxx)
1886 if ( DataFlowEditor()->IsExecuting() && DataFlowEditor()->Executor()->IsDone() ) {
1887 DataFlowEditor()->Editing();
1890 RetVal = DataFlowEditor()->IsExecuting();