1 // SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : CNode_Impl.cxx
23 // Author : Jean Rahuel
32 //#include "utilities.h"
34 #include "StreamGraph_Impl.hxx"
36 #include "CNode_Impl.hxx"
38 #include "StreamPort_Impl.hxx"
40 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
41 PortableServer::POA_ptr poa ,
42 PortableServer::ObjectId * contId ,
43 const char *instanceName ,
44 const char *interfaceName ,
45 const char *aDataFlowName ,
46 const SUPERV::KindOfNode aKindOfNode ) :
47 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
48 // MESSAGE("CNode_Impl::CNode_Impl activate object instanceName("
49 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
50 // << hex << (void *) this << dec )
52 // _id = _poa->activate_object(_thisObj);
53 // MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
54 // beginService( "CNode_Impl::CNode_Impl" );
55 _Orb = CORBA::ORB::_duplicate(orb);
58 _DataFlowEditor = NULL ;
59 _DataFlowNode = NULL ;
60 if ( aKindOfNode == SUPERV::MacroNode ) {
66 // endService( "CNode_Impl::CNode_Impl" );
69 CNode_Impl::CNode_Impl() {
72 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
73 PortableServer::POA_ptr poa ,
74 PortableServer::ObjectId * contId ,
75 const char *instanceName ,
76 const char *interfaceName ,
77 GraphEditor::DataFlow * aDataFlowEditor ,
78 const SALOME_ModuleCatalog::Service &NodeService ,
79 const char * NodeName ,
80 const SUPERV::KindOfNode NodeKindOfNode ,
81 const char * FuncName ,
82 const SUPERV::ListOfStrings & PythonFunction ,
84 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
85 // beginService( "CNode_Impl::CNode_Impl" );
86 // cout << "CNode_Impl::CNode_Impl -->" << endl ;
87 // if ( FuncName && NodeName ) {
88 // cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
89 // << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
90 // << " " << strlen( FuncName ) << endl ;
92 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
93 // MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
95 _id = _poa->activate_object(_thisObj);
97 _Orb = CORBA::ORB::_duplicate(orb);
100 _DataFlowEditor = aDataFlowEditor ;
101 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
102 GraphBase::ListOfFuncName aFuncName ;
103 GraphBase::ListOfPythonFunctions aPythonFunction ;
105 aFuncName.resize(1) ;
106 aFuncName[0] = my_strdup( FuncName ) ;
107 aPythonFunction.resize(1) ;
108 aPythonFunction[0] = &PythonFunction ;
111 // mkr : PAL11273 -->
112 if ( isCimpl ) // C++ implementation
113 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
117 else // Python implementation
118 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
127 // mkr : PAL11273 <--
130 // endService( "CNode_Impl::CNode_Impl" );
131 // cout << "<-- CNode_Impl::CNode_Impl" << endl ;
134 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
135 PortableServer::POA_ptr poa ,
136 PortableServer::ObjectId * contId ,
137 const char *instanceName ,
138 const char *interfaceName ,
139 GraphEditor::DataFlow * aDataFlowEditor ,
140 const SALOME_ModuleCatalog::Service &NodeService ,
141 const char * NodeName ,
142 const SUPERV::KindOfNode NodeKindOfNode ,
143 const GraphBase::ListOfFuncName & aFuncName ,
144 const GraphBase::ListOfPythonFunctions & aPythonFunction ) :
145 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
146 // MESSAGE( NodeName << " " );
147 // beginService( "CNode_Impl::CNode_Impl" );
149 // MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ;
151 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
152 // MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" );
154 _id = _poa->activate_object(_thisObj);
156 _Orb = CORBA::ORB::_duplicate(orb);
159 _DataFlowEditor = aDataFlowEditor ;
160 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
161 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
166 // endService( "CNode_Impl::CNode_Impl" );
169 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
170 PortableServer::POA_ptr poa ,
171 PortableServer::ObjectId * contId ,
172 const char *instanceName ,
173 const char *interfaceName ,
174 GraphEditor::DataFlow * aDataFlowEditor ,
175 GraphEditor::InNode * aDataFlowNode ) :
176 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
177 // beginService( "CNode_Impl::CNode_Impl" );
178 if ( aDataFlowNode && aDataFlowNode->IsComputingNode() ) {
179 // MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" );
181 _id = _poa->activate_object(_thisObj);
184 // MESSAGE( "CNode_Impl::CNode_Impl NO _poa->activate_object " );
186 _Orb = CORBA::ORB::_duplicate(orb);
189 _DataFlowEditor = aDataFlowEditor ;
190 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
191 _DataFlowNode = aDataFlowNode ;
192 if ( aDataFlowNode ) {
198 // endService( "CNode_Impl::CNode_Impl" );
201 CNode_Impl::~CNode_Impl() {
202 beginService( "CNode_Impl::~CNode_Impl" );
203 endService( "CNode_Impl::~CNode_Impl" );
206 void CNode_Impl::destroy() {
207 beginService( "CNode_Impl::Destroy" );
208 if ( DataFlowEditor()->IsEditing() ) {
210 _DataFlowNode = NULL ;
211 _poa->deactivate_object(*_id) ;
212 // CORBA::release(_poa) ;
214 // _thisObj->_remove_ref();
217 MESSAGE("CNode_Impl::destroy ERROR ") ;
220 // endService( "CNode_Impl::Destroy" );
223 bool CNode_Impl::Delete() {
224 beginService( "CNode_Impl::Delete" );
225 bool RetVal = false ;
226 if ( DataFlowEditor()->IsEditing() ) {
228 RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
230 DataFlowEditor()->UnValid() ;
233 endService( "CNode_Impl::Delete" );
237 void CNode_Impl::DeletePorts() {
238 beginService( "CNode_Impl::DeletePorts" );
239 if ( DataFlowEditor()->IsEditing() && DataFlowNode() ) {
241 //JR Debug 06.09.2005 : Ports must be explored in the reversed side because deletion
242 // of a port changes indexes !!!...
243 // for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeInPortsSize() ; i++ ) {
244 for ( i = DataFlowNode()->ComputingNode()->GetNodeInPortsSize()-1 ; i >= 0 ; i-- ) {
245 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeInPort( i )->ObjRef() ;
246 if ( !CORBA::is_nil( aPort ) ) {
250 // for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeOutPortsSize() ; i++ ) {
251 for ( i = DataFlowNode()->ComputingNode()->GetNodeOutPortsSize()-1 ; i >= 0 ; i-- ) {
252 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeOutPort( i )->ObjRef() ;
253 if ( !CORBA::is_nil( aPort ) ) {
258 endService( "CNode_Impl::DeletePorts" );
261 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
262 // beginService( "CNode_Impl::Service" );
263 SALOME_ModuleCatalog::Service * RetVal ;
265 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowNode()->GetService() ) ;
268 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowEditor()->GetService() ) ;
270 // endService( "CNode_Impl::Service" );
274 char * CNode_Impl::Name() {
275 // beginService( "CNode_Impl::Name" );
276 char * RetVal = NULL ;
278 RetVal = DataFlowNode()->Name() ;
281 RetVal = DataFlowEditor()->Graph()->Name() ;
283 // endService( "CNode_Impl::Name" );
284 return CORBA::string_dup( RetVal );
286 bool CNode_Impl::SetName( const char * aDataFlowName ) {
287 // beginService( "CNode_Impl::SetName" );
288 bool RetVal = false ;
290 if ( DataFlowEditor()->IsEditing() ) {
292 //JR 29.06.2005 debug :
293 char * OldNodeName = my_strdup( DataFlowNode()->Name() ) ;
294 // RetVal = DataFlowEditor()->ReNameNode( DataFlowNode()->Name() ,
295 SameName = !strcmp( OldNodeName , aDataFlowName ) ;
297 RetVal = DataFlowEditor()->ReNameNode( OldNodeName ,
300 delete [] OldNodeName ;
303 // RetVal = DataFlowEditor()->Graph()->Name( aDataFlowName ) ;
304 SameName = !strcmp( DataFlowEditor()->Graph()->Name() , aDataFlowName ) ;
306 RetVal = DataFlowEditor()->Name( aDataFlowName ) ;
309 //JR Debug 06.09.2005 : UnValid was missing
311 DataFlowEditor()->UnValid() ;
312 DataFlowEditor()->IsValid() ;
315 // endService( "CNode_Impl::SetName" );
318 SUPERV::KindOfNode CNode_Impl::Kind() {
319 // beginService( "CNode_Impl::Kind" );
320 SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
322 RetVal = DataFlowNode()->Kind() ;
325 RetVal = DataFlowEditor()->Graph()->Kind() ;
327 // endService( "CNode_Impl::Kind" );
330 bool CNode_Impl::IsGraph() {
331 // beginService( "CNode_Impl::IsGraph" );
332 bool RetVal = false ;
334 RetVal = DataFlowNode()->IsDataFlowNode() ;
337 RetVal = DataFlowEditor()->Graph()->IsDataFlowNode() ;
339 // endService( "CNode_Impl::IsGraph" );
342 bool CNode_Impl::IsStreamGraph() {
343 beginService( "CNode_Impl::IsStreamGraph" );
344 bool RetVal = false ;
346 RetVal = DataFlowNode()->IsDataStreamNode() ;
349 RetVal = DataFlowEditor()->Graph()->IsDataStreamNode() ;
351 MESSAGE( "CNode_Impl::IsStreamGraph " << RetVal );
352 endService( "CNode_Impl::IsStreamGraph" );
355 bool CNode_Impl::IsMacro() {
356 // beginService( "CNode_Impl::IsMacro" );
357 bool RetVal = false ;
358 if ( _IsNode && DataFlowNode()->IsMacroNode() ) {
361 // endService( "CNode_Impl::IsMacro" );
364 bool CNode_Impl::IsFlowMacro() {
365 // beginService( "CNode_Impl::IsFlowMacro" );
366 bool RetVal = false ;
367 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsGraph() ) {
370 // endService( "CNode_Impl::IsFlowMacro" );
373 bool CNode_Impl::IsStreamMacro() {
374 // beginService( "CNode_Impl::IsStreamMacro" );
375 bool RetVal = false ;
376 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsStreamGraph() ) {
379 // endService( "CNode_Impl::IsStreamMacro" );
382 bool CNode_Impl::IsHeadGraph() {
383 bool RetVal = false ;
384 beginService( "CNode_Impl::IsHeadGraph" );
385 endService( "CNode_Impl::IsHeadGraph" );
388 CORBA::Long CNode_Impl::GraphLevel() {
389 CORBA::Long RetVal = 0 ;
390 beginService( "CNode_Impl::GraphLevel" );
391 RetVal = DataFlowEditor()->Graph()->GraphMacroLevel() ;
392 endService( "CNode_Impl::GraphLevel" );
396 bool CNode_Impl::IsComputing() {
397 // beginService( "CNode_Impl::IsComputing" );
398 bool RetVal = SUPERV::UnknownNode ;
400 RetVal = DataFlowNode()->IsComputingNode() ;
403 RetVal = DataFlowEditor()->Graph()->IsComputingNode() ;
405 // endService( "CNode_Impl::IsComputing" );
408 bool CNode_Impl::IsFactory() {
409 // beginService( "CNode_Impl::IsFactory" );
410 bool RetVal = SUPERV::UnknownNode ;
412 RetVal = DataFlowNode()->IsFactoryNode() ;
415 RetVal = DataFlowEditor()->Graph()->IsFactoryNode() ;
417 // endService( "CNode_Impl::IsFactory" );
420 bool CNode_Impl::IsInLine() {
421 // beginService( "CNode_Impl::IsInLine" );
422 bool RetVal = SUPERV::UnknownNode ;
424 RetVal = DataFlowNode()->IsInLineNode() ;
427 RetVal = DataFlowEditor()->Graph()->IsInLineNode() ;
429 // endService( "CNode_Impl::IsInLine" );
432 bool CNode_Impl::IsGOTO() {
433 // beginService( "CNode_Impl::IsGOTO" );
434 bool RetVal = SUPERV::UnknownNode ;
436 RetVal = DataFlowNode()->IsGOTONode() ;
439 RetVal = DataFlowEditor()->Graph()->IsGOTONode() ;
441 // endService( "CNode_Impl::IsGOTO" );
444 bool CNode_Impl::IsLoop() {
445 // beginService( "CNode_Impl::IsLoop" );
446 bool RetVal = SUPERV::UnknownNode ;
448 RetVal = DataFlowNode()->IsLoopNode() ;
451 RetVal = DataFlowEditor()->Graph()->IsLoopNode() ;
453 // endService( "CNode_Impl::IsLoop" );
456 bool CNode_Impl::IsEndLoop() {
457 // beginService( "CNode_Impl::IsEndLoop" );
458 bool RetVal = SUPERV::UnknownNode ;
460 RetVal = DataFlowNode()->IsEndLoopNode() ;
463 RetVal = DataFlowEditor()->Graph()->IsEndLoopNode() ;
465 // endService( "CNode_Impl::IsEndLoop" );
468 bool CNode_Impl::IsSwitch() {
469 // beginService( "CNode_Impl::IsSwitch" );
470 bool RetVal = SUPERV::UnknownNode ;
472 RetVal = DataFlowNode()->IsSwitchNode() ;
475 RetVal = DataFlowEditor()->Graph()->IsSwitchNode() ;
477 // endService( "CNode_Impl::IsSwitch" );
480 bool CNode_Impl::IsEndSwitch() {
481 // beginService( "CNode_Impl::IsEndSwitch" );
482 bool RetVal = SUPERV::UnknownNode ;
484 RetVal = DataFlowNode()->IsEndSwitchNode() ;
487 RetVal = DataFlowEditor()->Graph()->IsEndSwitchNode() ;
489 // endService( "CNode_Impl::IsEndSwitch" );
493 SUPERV::SDate CNode_Impl::CreationDate() {
494 // beginService( "CNode_Impl::CreationDate" );
495 SUPERV::SDate_var RetVal ;
497 RetVal = new SUPERV::SDate( DataFlowNode()->FirstCreation() ) ;
500 // cout << " CNode_Impl::CreationDate " << DataFlowEditor()->FirstCreation()
502 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->FirstCreation() ) ;
504 // endService( "CNode_Impl::CreationDate" );
505 return (RetVal._retn()) ;
507 SUPERV::SDate CNode_Impl::LastUpdateDate() {
508 // beginService( "CNode_Impl::LastUpdateDate" );
509 SUPERV::SDate_var RetVal ;
511 RetVal = new SUPERV::SDate( DataFlowNode()->LastModification() ) ;
514 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->LastModification() ) ;
516 // endService( "CNode_Impl::LastUpdateDate" );
517 return (RetVal._retn()) ;
519 char * CNode_Impl::Version() {
520 // beginService( "CNode_Impl::Version" );
523 RetVal = DataFlowNode()->EditorRelease() ;
526 RetVal = DataFlowEditor()->Graph()->EditorRelease() ;
528 // endService( "CNode_Impl::Version" );
529 return CORBA::string_dup( RetVal ) ;
531 char * CNode_Impl::Author() {
532 // beginService( "CNode_Impl::Author" );
535 RetVal = DataFlowNode()->Author() ;
538 RetVal = DataFlowEditor()->Graph()->Author() ;
540 // endService( "CNode_Impl::Author" );
541 return CORBA::string_dup( RetVal ) ;
543 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
544 // beginService( "CNode_Impl::SetAuthor" );
545 bool RetVal = false ;
546 if ( DataFlowEditor()->IsEditing() ) {
548 RetVal = DataFlowNode()->Author( aDataFlowAuthor ) ;
551 RetVal = DataFlowEditor()->Graph()->Author( aDataFlowAuthor ) ;
554 // endService( "CNode_Impl::SetAuthor" );
557 char * CNode_Impl::Comment() {
558 // beginService( "CNode_Impl::Comment" );
561 RetVal = DataFlowNode()->Comment() ;
564 RetVal = DataFlowEditor()->Graph()->Comment() ;
566 // endService( "CNode_Impl::Comment" );
567 return CORBA::string_dup( RetVal ) ;
569 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
570 // beginService( "CNode_Impl::SetComment" );
571 bool RetVal = false ;
572 if ( DataFlowEditor()->IsEditing() ) {
574 RetVal = DataFlowNode()->Comment( aDataFlowComment ) ;
577 RetVal = DataFlowEditor()->Graph()->Comment( aDataFlowComment ) ;
580 // endService( "CNode_Impl::SetComment" );
584 void CNode_Impl::Coords(CORBA::Long X , CORBA::Long Y ) {
585 // beginService( "CNode_Impl::Coords" );
586 if ( DataFlowEditor()->IsEditing() ) {
588 ((GraphEditor::InNode *) DataFlowNode())->Coordinates( X , Y ) ;
591 DataFlowEditor()->Graph()->Coordinates( X , Y ) ;
594 // endService( "CNode_Impl::Coords" );
596 CORBA::Long CNode_Impl::X() {
597 // beginService( "CNode_Impl::X" );
600 RetVal = DataFlowNode()->XCoordinate() ;
603 RetVal = DataFlowEditor()->Graph()->XCoordinate() ;
605 // endService( "CNode_Impl::X" );
608 CORBA::Long CNode_Impl::Y() {
609 // beginService( "CNode_Impl::Y" );
612 RetVal = DataFlowNode()->YCoordinate() ;
615 RetVal = DataFlowEditor()->Graph()->YCoordinate() ;
617 // endService( "CNode_Impl::Y" );
621 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
623 Port_Impl * myPort = NULL ;
624 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
627 aninport = DataFlowNode()->GetInPort( ServiceParameterName ) ;
630 aninport = DataFlowEditor()->GetInPort( ServiceParameterName ) ;
634 anoutport = DataFlowNode()->GetOutPort( ServiceParameterName ) ;
637 anoutport = DataFlowEditor()->GetOutPort( ServiceParameterName ) ;
640 GraphBase::InPort * anInPort ;
642 anInPort = DataFlowNode()->GetChangeInPort( ServiceParameterName ) ;
645 anInPort = DataFlowEditor()->GetChangeInPort( ServiceParameterName ) ;
647 if ( anInPort->IsDataStream() ) {
648 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
650 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
652 beginService( "CNode_Impl::Port" );
657 hasinput = DataFlowNode()->HasInput( anInPort->PortName() ) ;
660 hasinput = DataFlowEditor()->HasInput( anInPort->PortName() ) ;
663 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
664 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
665 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
666 instanceName() , interfaceName() ,
669 // ServiceParameterName ,
670 (GraphBase::Port * ) anInPort ,
675 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
676 instanceName() , interfaceName() ,
679 // ServiceParameterName ) ;
680 (GraphBase::Port * ) anInPort ,
683 PortableServer::ObjectId * id = myPort->getId() ;
684 CORBA::Object_var obj = _poa->id_to_reference(*id);
685 iobject = SUPERV::Port::_narrow(obj) ;
686 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
689 iobject = anInPort->ObjRef() ;
692 else if ( anoutport ) {
693 GraphBase::OutPort * anOutPort ;
695 anOutPort = DataFlowNode()->GetChangeOutPort( ServiceParameterName ) ;
698 anOutPort = DataFlowEditor()->GetChangeOutPort( ServiceParameterName ) ;
700 if ( anOutPort->IsDataStream() ) {
701 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
703 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
705 beginService( "CNode_Impl::Port" );
708 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
709 const CORBA::Any anAny = anOutPort->Value() ;
710 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
711 instanceName() , interfaceName() ,
714 // ServiceParameterName ,
715 (GraphBase::Port * ) anOutPort ,
718 PortableServer::ObjectId * id = myPort->getId() ;
719 CORBA::Object_var obj = _poa->id_to_reference(*id);
720 iobject = SUPERV::Port::_narrow(obj) ;
721 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
724 iobject = anOutPort->ObjRef() ;
728 endService( "CNode_Impl::Port" );
730 DataFlowEditor()->UnValid() ;
731 return SUPERV::Port::_duplicate( iobject ) ;
734 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
735 const SUPERV::Value_ptr aValue ) {
737 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
738 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
740 GraphBase::InPort * anInPort = NULL ;
741 if ( DataFlowEditor()->IsEditing() /*&& DataFlowEditor()->Graph()->GraphMacroLevel() == 0*/ ) {
743 sts = DataFlowEditor()->AddInputData( DataFlowNode()->Name() ,
744 ToServiceParameterName ,
746 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
749 sts = DataFlowEditor()->AddInputData( DataFlowEditor()->Graph()->Name() ,
750 ToServiceParameterName ,
752 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
754 if ( sts && anInPort ) {
755 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
757 beginService( "CNode_Impl::Input" );
761 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
762 instanceName() , interfaceName() ,
765 // ToServiceParameterName ,
766 (GraphBase::Port * ) anInPort ,
769 PortableServer::ObjectId * id = myPort->getId() ;
770 CORBA::Object_var obj = _poa->id_to_reference(*id);
771 iobject = SUPERV::Port::_narrow(obj) ;
772 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
775 iobject = anInPort->ObjRef() ;
778 DataFlowEditor()->UnValid() ;
780 else if ( aDataFlowExecutor ) {
782 sts = aDataFlowExecutor->ChangeInputData( DataFlowNode()->Name() ,
783 ToServiceParameterName ,
785 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
788 sts = aDataFlowExecutor->ChangeInputData( DataFlowEditor()->Graph()->Name() ,
789 ToServiceParameterName ,
791 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
793 if ( sts && anInPort ) {
794 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
796 beginService( "CNode_Impl::Input" );
800 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
801 instanceName() , interfaceName() ,
804 // ToServiceParameterName ,
805 (GraphBase::Port * ) anInPort ,
808 PortableServer::ObjectId * id = myPort->getId() ;
809 CORBA::Object_var obj = _poa->id_to_reference(*id);
810 iobject = SUPERV::Port::_narrow(obj) ;
811 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
814 iobject = anInPort->ObjRef() ;
819 endService( "CNode_Impl::Input" );
821 if ( CORBA::is_nil( iobject ) ) {
822 MESSAGE( "CNode_Impl::Input returns nil object _IsNode " << _IsNode << " sts " << sts
823 << " Node " << Name() << " ToServiceParameterName " << ToServiceParameterName
824 << " anInPort " << anInPort ) ;
826 return SUPERV::Port::_duplicate( iobject ) ;
830 SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) {
831 SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ;
832 Port_Impl * myInPort = NULL ;
833 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
834 if ( anInPort && !anInPort->IsDataStream() ) {
835 Inobject = anInPort->ObjRef() ;
836 if ( CORBA::is_nil( Inobject ) ) {
837 myInPort = new Port_Impl( _Orb , _Poa , _ContId ,
838 instanceName() , interfaceName() ,
841 (GraphBase::Port * ) anInPort ,
844 PortableServer::ObjectId * id = myInPort->getId() ;
845 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
846 Inobject = SUPERV::Port::_narrow(obj) ;
847 anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ;
851 return SUPERV::Port::_duplicate( Inobject ) ;
854 SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) {
855 Port_Impl * myOutPort = NULL ;
856 SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
857 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
858 if ( anOutPort && !anOutPort->IsDataStream() ) {
859 Outobject = anOutPort->ObjRef() ;
860 if ( CORBA::is_nil( Outobject ) ) {
861 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
862 const CORBA::Any anAny = anOutPort->Value() ;
863 myOutPort = new Port_Impl( _Orb , _Poa , _ContId ,
864 instanceName() , interfaceName() ,
867 (GraphBase::Port * ) anOutPort ,
871 PortableServer::ObjectId * id = myOutPort->getId() ;
872 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
873 Outobject = SUPERV::Port::_narrow(obj) ;
874 anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ;
878 return SUPERV::Port::_duplicate( Outobject );
881 SUPERV::StreamPort_ptr CNode_Impl::GetInStreamPort( const char *aParameterName ) {
882 SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ;
883 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
884 StreamPort_Impl * myInStreamPort = NULL ;
885 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
886 if ( anInPort && anInPort->IsDataStream() ) {
887 Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
888 if ( CORBA::is_nil( Inobject ) ) {
889 myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
890 instanceName() , interfaceName() ,
893 (GraphBase::Port * ) anInPort ,
895 if ( myInStreamPort ) {
896 PortableServer::ObjectId * id = myInStreamPort->getId() ;
897 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
898 Inobject = SUPERV::StreamPort::_narrow(obj) ;
899 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ;
904 return SUPERV::StreamPort::_duplicate( Inobject ) ;
907 SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName ) {
908 StreamPort_Impl * myOutStreamPort = NULL ;
909 SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ;
910 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
911 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
912 if ( anOutPort && anOutPort->IsDataStream() ) {
913 Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
914 if ( CORBA::is_nil( Outobject ) ) {
915 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
916 const CORBA::Any anAny = anOutPort->Value() ;
917 myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
918 instanceName() , interfaceName() ,
921 (GraphBase::Port * ) anOutPort ,
924 if ( myOutStreamPort ) {
925 PortableServer::ObjectId * id = myOutStreamPort->getId() ;
926 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
927 Outobject = SUPERV::StreamPort::_narrow(obj) ;
928 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ;
933 return SUPERV::StreamPort::_duplicate( Outobject );
936 bool CNode_Impl::HasStreamPort() {
937 bool RetVal = false ;
938 beginService( "CNode_Impl::HasStreamPort" );
939 endService( "CNode_Impl::HasStreamPort" );
943 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
945 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
947 char* FromServiceParameterName ;
948 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
949 ToServiceParameterName ,
951 & FromServiceParameterName ) ;
953 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
954 if ( !anInPort->IsDataStream() && anInPort->GetOutPort() ) {
955 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
956 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
958 beginService( "CNode_Impl::GetLink" );
962 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
963 instanceName() , interfaceName() ,
966 ToServiceParameterName ,
967 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
968 FromServiceParameterName ,
969 true , false , Success ) ;
971 PortableServer::ObjectId * id = myLink->getId() ;
972 CORBA::Object_var obj = _poa->id_to_reference(*id);
973 iobject = SUPERV::Link::_narrow(obj) ;
974 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
978 iobject = anOutPort->InPortObjRef( anInPort ) ;
983 endService( "CNode_Impl::GetLink" );
985 return SUPERV::Link::_duplicate( iobject ) ;
988 SUPERV::StreamLink_ptr CNode_Impl::GetStreamLink(const char * ToServiceParameterName ) {
990 SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
992 char* FromServiceParameterName ;
993 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
994 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
995 ToServiceParameterName ,
997 & FromServiceParameterName ) ;
999 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
1000 if ( anInPort->IsDataStream() && anInPort->GetOutPort() ) {
1001 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
1002 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
1004 beginService( "CNode_Impl::GetLink" );
1008 StreamLink_Impl * myStreamLink = new StreamLink_Impl(
1009 _Orb , _Poa , _ContId ,
1010 instanceName() , interfaceName() ,
1013 ToServiceParameterName ,
1014 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
1015 FromServiceParameterName ,
1018 PortableServer::ObjectId * id = myStreamLink->getId() ;
1019 CORBA::Object_var obj = _poa->id_to_reference(*id);
1020 iobject = SUPERV::StreamLink::_narrow(obj) ;
1021 anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
1025 iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
1031 endService( "CNode_Impl::GetLink" );
1033 return SUPERV::StreamLink::_duplicate( iobject ) ;
1036 SUPERV::ListOfPorts * CNode_Impl::Ports() {
1040 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
1042 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1043 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1044 if ( !anInPort->IsDataStream() ) {
1046 beginService( "CNode_Impl::Ports" );
1049 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1050 ( /*IsExecuting() || */DataFlowEditor()->IsReadOnly() ) ) ) { // mkr : IPAL11362
1051 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1053 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1054 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1055 // << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1056 // << "/" << anInPort->IsNotConnected() ) ;
1057 Port_Impl * myPort ;
1058 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1059 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1060 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1061 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1062 instanceName() , interfaceName() ,
1065 (GraphBase::Port * ) anInPort ,
1070 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1071 instanceName() , interfaceName() ,
1074 (GraphBase::Port * ) anInPort ,
1077 PortableServer::ObjectId * id = myPort->getId() ;
1078 CORBA::Object_var obj = _poa->id_to_reference(*id);
1079 SUPERV::Port_var iobject ;
1080 iobject = SUPERV::Port::_narrow(obj) ;
1082 RetVal->length( PortCount ) ;
1083 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1084 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1087 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1089 RetVal->length( PortCount ) ;
1090 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1094 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1097 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1098 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1099 if ( !anOutPort->IsDataStream() ) {
1101 beginService( "CNode_Impl::Ports" );
1104 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1105 ( /*IsExecuting() || */DataFlowEditor()->IsReadOnly() ) ) ) { // mkr : IPAL11362
1106 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1108 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1109 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1110 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1111 const CORBA::Any anAny = anOutPort->Value() ;
1112 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1113 instanceName() , interfaceName() ,
1116 (GraphBase::Port * ) anOutPort ,
1119 PortableServer::ObjectId * id = myPort->getId() ;
1120 CORBA::Object_var obj = _poa->id_to_reference(*id);
1121 SUPERV::Port_var iobject ;
1122 iobject = SUPERV::Port::_narrow(obj) ;
1124 RetVal->length( PortCount ) ;
1125 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1126 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1129 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1131 RetVal->length( PortCount ) ;
1132 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1136 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1141 if ( DataFlowEditor()->IsValid() ) {
1142 //DataFlowEditor()->Graph()->Values() ;
1143 RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1144 DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1145 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1146 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1147 if ( !anOutPort->IsDataStream() ) {
1148 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1150 beginService( "CNode_Impl::Ports" );
1153 Port_Impl * myPort ;
1154 if ( anOutPort->IsDataConnected() ) {
1155 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1156 const CORBA::Any anAny = anOutPort->Value() ;
1157 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1158 instanceName() , interfaceName() ,
1161 (GraphBase::Port * ) anOutPort ,
1166 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1167 instanceName() , interfaceName() ,
1170 (GraphBase::Port * ) anOutPort ,
1173 PortableServer::ObjectId * id = myPort->getId() ;
1174 CORBA::Object_var obj = _poa->id_to_reference(*id);
1175 SUPERV::Port_var iobject ;
1176 iobject = SUPERV::Port::_narrow(obj) ;
1178 RetVal->length( PortCount ) ;
1179 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1180 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1184 RetVal->length( PortCount ) ;
1185 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1191 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1192 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1193 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1194 if ( !anInPort->IsDataStream() ) {
1195 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1197 beginService( "CNode_Impl::Ports" );
1200 Port_Impl * myPort ;
1201 if ( anInPort->IsDataConnected() ) {
1202 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1203 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1204 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1205 instanceName() , interfaceName() ,
1208 (GraphBase::Port * ) anInPort ,
1213 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1214 instanceName() , interfaceName() ,
1220 PortableServer::ObjectId * id = myPort->getId() ;
1221 CORBA::Object_var obj = _poa->id_to_reference(*id);
1222 SUPERV::Port_var iobject ;
1223 iobject = SUPERV::Port::_narrow(obj) ;
1225 RetVal->length( PortCount ) ;
1226 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1227 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1231 RetVal->length( PortCount ) ;
1232 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1241 int RetVallength = (unsigned int ) RetVal->length() ;
1242 for ( i = 0 ; i < RetVallength ; i++ ) {
1243 MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1247 endService( "CNode_Impl::Ports " ) ;
1249 return ( RetVal._retn() ) ;
1252 SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() {
1256 SUPERV::ListOfStreamPorts_var RetVal = new SUPERV::ListOfStreamPorts ;
1257 if ( !DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1258 // MESSAGE("CNode_Impl::StreamPorts NOT a DataStreamNode" ) ;
1260 else if ( _IsNode ) {
1261 // RetVal->length( DataFlowNode()->GetNodeInPortsSize() +
1262 // DataFlowNode()->GetNodeOutPortsSize() ) ;
1263 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1264 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1265 if ( anInPort->IsDataStream() ) {
1267 beginService( "CNode_Impl::StreamPorts" );
1270 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1271 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1272 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1273 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1275 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1276 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1277 << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1278 << "/" << anInPort->IsNotConnected() ) ;
1279 StreamPort_Impl * myStreamPort ;
1280 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1281 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1282 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1283 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1284 instanceName() , interfaceName() ,
1287 (GraphBase::Port * ) anInPort ,
1292 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1293 instanceName() , interfaceName() ,
1296 (GraphBase::Port * ) anInPort ,
1299 PortableServer::ObjectId * id = myStreamPort->getId() ;
1300 CORBA::Object_var obj = _poa->id_to_reference(*id);
1301 SUPERV::StreamPort_var iobject ;
1302 iobject = SUPERV::StreamPort::_narrow(obj) ;
1304 RetVal->length( PortCount ) ;
1305 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1306 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1309 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1311 RetVal->length( PortCount ) ;
1312 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1316 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1319 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1320 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1321 if ( anOutPort->IsDataStream() ) {
1323 beginService( "CNode_Impl::StreamPorts" );
1326 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1327 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1328 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1329 // RetVal[ DataFlowNode()->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1331 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1332 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1333 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1334 const CORBA::Any anAny = anOutPort->Value() ;
1335 StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1336 instanceName() , interfaceName() ,
1339 (GraphBase::Port * ) anOutPort ,
1342 PortableServer::ObjectId * id = myStreamPort->getId() ;
1343 CORBA::Object_var obj = _poa->id_to_reference(*id);
1344 SUPERV::StreamPort_var iobject ;
1345 iobject = SUPERV::StreamPort::_narrow(obj) ;
1347 RetVal->length( PortCount ) ;
1348 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1349 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1352 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1354 RetVal->length( PortCount ) ;
1355 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1359 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1364 if ( DataFlowEditor()->IsValid() ) {
1365 // RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1366 // DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1367 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1368 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1369 if ( anOutPort->IsDataStream() ) {
1370 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1372 beginService( "CNode_Impl::StreamPorts" );
1375 StreamPort_Impl * myStreamPort ;
1376 if ( anOutPort->IsDataConnected() ) {
1377 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1378 const CORBA::Any anAny = anOutPort->Value() ;
1379 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1380 instanceName() , interfaceName() ,
1383 (GraphBase::Port * ) anOutPort ,
1388 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1389 instanceName() , interfaceName() ,
1392 (GraphBase::Port * ) anOutPort ,
1395 PortableServer::ObjectId * id = myStreamPort->getId() ;
1396 CORBA::Object_var obj = _poa->id_to_reference(*id);
1397 SUPERV::StreamPort_var iobject ;
1398 iobject = SUPERV::StreamPort::_narrow(obj) ;
1400 RetVal->length( PortCount ) ;
1401 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1402 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1406 RetVal->length( PortCount ) ;
1407 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1411 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1414 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1415 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1416 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1417 if ( anInPort->IsDataStream() ) {
1418 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1420 beginService( "CNode_Impl::StreamPorts" );
1423 StreamPort_Impl * myStreamPort ;
1424 if ( anInPort->IsDataConnected() ) {
1425 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1426 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1427 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1428 instanceName() , interfaceName() ,
1431 (GraphBase::Port * ) anInPort ,
1436 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1437 instanceName() , interfaceName() ,
1443 PortableServer::ObjectId * id = myStreamPort->getId() ;
1444 CORBA::Object_var obj = _poa->id_to_reference(*id);
1445 SUPERV::StreamPort_var iobject ;
1446 iobject = SUPERV::StreamPort::_narrow(obj) ;
1448 RetVal->length( PortCount ) ;
1449 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1450 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1454 RetVal->length( PortCount ) ;
1455 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1459 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1464 // int RetVallength = (unsigned int ) RetVal->length() ;
1465 // for ( i = 0 ; i < RetVallength ; i++ ) {
1466 // MESSAGE( "StreamPort " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1469 endService( "CNode_Impl::StreamPorts " ) ;
1471 return ( RetVal._retn() ) ;
1474 SUPERV::ListOfLinks * CNode_Impl::Links() {
1475 beginService( "CNode_Impl::Links" ) ;
1476 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
1477 if ( DataFlowNode() ) {
1478 // MESSAGE( "CNode_Impl::Links " << DataFlowEditor() << " " << DataFlowEditor()->Graph() << " " << DataFlowEditor()->Graph()->ObjImpl() << " " << DataFlowNode()->ComputingNode() << " " << DataFlowNode()->ComputingNode()->Name() ) ;
1479 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( DataFlowNode()->ComputingNode() , NULL ) ;
1482 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( NULL , NULL ) ;
1484 MESSAGE( "CNode_Impl::Links " << RetVal->length() << " Links" ) ;
1485 endService( "CNode_Impl::Links" ) ;
1486 return ( RetVal._retn() ) ;
1489 SUPERV::ListOfStreamLinks * CNode_Impl::StreamLinks() {
1490 beginService( "CNode_Impl::StreamLinks" ) ;
1491 SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
1492 if ( DataFlowNode() && DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1493 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( DataFlowNode()->ComputingNode() , NULL ) ;
1495 else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1496 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( NULL , NULL ) ;
1498 MESSAGE( "CNode_Impl::StreamLinks " << RetVal->length() << " StreamLinks" ) ;
1499 endService( "CNode_Impl::StreamLinks" ) ;
1500 return ( RetVal._retn() ) ;
1503 CORBA::Long CNode_Impl::SubGraph() {
1504 // beginService( "CNode_Impl::SubGraph" );
1505 CORBA::Long RetVal = 0 ;
1507 RetVal = DataFlowNode()->SubGraph() ;
1509 // endService( "CNode_Impl::SubGraph" );
1513 CORBA::Long CNode_Impl::SubStreamGraph() {
1514 // beginService( "CNode_Impl::SubStreamGraph" );
1515 CORBA::Long RetVal = 0 ;
1517 RetVal = DataFlowNode()->SubStreamGraph() ;
1519 // endService( "CNode_Impl::SubStreamGraph" );
1523 // mkr : PAL8060 : this method is not used
1524 /*bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
1525 beginService( "CNode_Impl::IsLinked" );
1526 bool RetVal = DataFlowNode()->IsLinked( ServiceParameterName ) ;
1527 MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
1528 endService( "CNode_Impl::IsLinked" );
1532 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
1533 // beginService( "CNode_Impl::HasInput" );
1534 bool RetVal = DataFlowNode()->HasInput( ServiceParameterName ) ;
1535 // endService( "CNode_Impl::HasInput" );
1539 SUPERV::GraphState CNode_Impl::State() {
1540 // beginService( "CNode_Impl::State" );
1541 SUPERV::GraphState RetVal = SUPERV::EditingState ;
1542 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1543 if ( aDataFlowExecutor && !DataFlowEditor()->EditedAfterExecution() ) {
1544 //JR : 12/06/03 if ( aDataFlowExecutor ) {
1546 RetVal = aDataFlowExecutor->State( Name() ) ;
1549 RetVal = aDataFlowExecutor->State() ;
1552 // endService( "CNode_Impl::State" );
1555 CORBA::Long CNode_Impl::Thread() {
1556 // beginService( "CNode_Impl::Thread" );
1557 CORBA::Long RetVal = 0 ;
1558 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1559 if ( aDataFlowExecutor ) {
1561 RetVal = aDataFlowExecutor->Thread( Name() ) ;
1564 RetVal = aDataFlowExecutor->Thread() ;
1567 // endService( "CNode_Impl::Thread" );
1570 GraphExecutor::AutomatonState CNode_Impl::AutoState() {
1571 // beginService( "CNode_Impl::AutoState" );
1572 GraphExecutor::AutomatonState RetVal = GraphExecutor::UnKnownState ;
1573 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1574 if ( aDataFlowExecutor ) {
1576 RetVal = aDataFlowExecutor->AutomatonState( Name() ) ;
1579 RetVal = aDataFlowExecutor->AutomatonState() ;
1582 // endService( "CNode_Impl::AutoState" );
1585 SUPERV::ControlState CNode_Impl::Control() {
1586 // beginService( "CNode_Impl::Control" );
1587 SUPERV::ControlState RetVal = SUPERV::VoidState ;
1588 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1589 if ( aDataFlowExecutor ) {
1591 RetVal = aDataFlowExecutor->ControlState( Name() ) ;
1594 RetVal = aDataFlowExecutor->ControlState() ;
1597 // endService( "CNode_Impl::Control" );
1600 void CNode_Impl::ControlClear() {
1601 // beginService( "CNode_Impl::ControlClear" );
1602 // SUPERV::ControlState RetVal = SUPERV::VoidState ;
1603 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1604 if ( aDataFlowExecutor ) {
1606 aDataFlowExecutor->ControlClear( Name() ) ;
1609 aDataFlowExecutor->ControlClear() ;
1612 // endService( "CNode_Impl::ControlClear" );
1616 bool CNode_Impl::IsReady() {
1617 // beginService( "CNode_Impl::IsReady" );
1618 bool RetVal = false ;
1619 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1620 if ( aDataFlowExecutor ) {
1622 RetVal = aDataFlowExecutor->IsReady( Name() ) ;
1625 RetVal = aDataFlowExecutor->IsReady() ;
1628 // endService( "CNode_Impl::IsReady" );
1632 bool CNode_Impl::IsWaiting() {
1633 // beginService( "CNode_Impl::IsWaiting" );
1634 bool RetVal = false ;
1635 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1636 if ( aDataFlowExecutor ) {
1638 RetVal = aDataFlowExecutor->IsWaiting( Name() ) ;
1641 RetVal = aDataFlowExecutor->IsWaiting() ;
1644 // endService( "CNode_Impl::IsWaiting" );
1648 bool CNode_Impl::IsRunning() {
1649 // beginService( "CNode_Impl::IsRunning" );
1650 bool RetVal = false ;
1651 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1652 if ( aDataFlowExecutor ) {
1654 RetVal = aDataFlowExecutor->IsRunning( Name() ) ;
1657 RetVal = aDataFlowExecutor->IsRunning() ;
1660 // endService( "CNode_Impl::IsRunning" );
1664 bool CNode_Impl::IsDone() {
1665 // beginService( "CNode_Impl::IsDone" );
1666 bool RetVal = false ;
1667 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1668 if ( aDataFlowExecutor ) {
1670 RetVal = aDataFlowExecutor->IsDone( Name() ) ;
1673 RetVal = aDataFlowExecutor->IsDone() ;
1676 // endService( "CNode_Impl::IsDone" );
1680 bool CNode_Impl::IsSuspended() {
1681 // beginService( "CNode_Impl::IsSuspended" );
1682 bool RetVal = false ;
1683 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1684 if ( aDataFlowExecutor ) {
1686 RetVal = aDataFlowExecutor->IsSuspended( Name() ) ;
1689 RetVal = aDataFlowExecutor->IsSuspended() ;
1692 // endService( "CNode_Impl::IsSuspended" );
1696 bool CNode_Impl::ReadyW() {
1697 // beginService( "CNode_Impl::ReadyW" );
1698 bool RetVal = false ;
1699 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1700 if ( aDataFlowExecutor ) {
1702 RetVal = aDataFlowExecutor->ReadyWait( Name() ) ;
1705 RetVal = aDataFlowExecutor->ReadyWait() ;
1708 // endService( "CNode_Impl::ReadyW" );
1712 bool CNode_Impl::RunningW() {
1713 // beginService( "CNode_Impl::RunningW" );
1714 bool RetVal = false ;
1715 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1716 if ( aDataFlowExecutor ) {
1718 RetVal = aDataFlowExecutor->RunningWait( Name() ) ;
1721 RetVal = aDataFlowExecutor->RunningWait() ;
1724 // endService( "CNode_Impl::RunningW" );
1728 bool CNode_Impl::DoneW() {
1729 // beginService( "CNode_Impl::DoneW" );
1730 bool RetVal = false ;
1731 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1732 if ( aDataFlowExecutor ) {
1734 RetVal = aDataFlowExecutor->DoneWait( Name() ) ;
1737 RetVal = aDataFlowExecutor->DoneWait() ;
1740 // endService( "CNode_Impl::DoneW" );
1744 bool CNode_Impl::SuspendedW() {
1745 // beginService( "CNode_Impl::SuspendedW" );
1746 bool RetVal = false ;
1747 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1748 if ( aDataFlowExecutor ) {
1750 RetVal = aDataFlowExecutor->SuspendedWait( Name() ) ;
1753 RetVal = aDataFlowExecutor->SuspendedWait() ;
1756 // endService( "CNode_Impl::SuspendedW" );
1760 void CNode_Impl::ping() {
1761 // beginService( "CNode_Impl::ping" );
1762 bool RetVal = false ;
1763 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1764 if ( aDataFlowExecutor ) {
1766 RetVal = aDataFlowExecutor->Ping( Name() ) ;
1772 if ( IsGraph() || IsStreamGraph() ) {
1773 theAutomaton->GraphImpl( (Graph_Impl * ) this ) ;
1775 // endService( "CNode_Impl::ping" );
1779 bool CNode_Impl::ContainerKill() {
1780 beginService( "CNode_Impl::ContainerKill" );
1781 bool RetVal = false ;
1782 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1783 if ( aDataFlowExecutor && IsExecuting() ) {
1785 RetVal = aDataFlowExecutor->ContainerKill( Name() ) ;
1788 RetVal = aDataFlowExecutor->ContainerKill() ;
1791 endService( "CNode_Impl::ContainerKill" );
1794 bool CNode_Impl::Kill() {
1795 beginService( "CNode_Impl::Kill" );
1796 bool RetVal = false ;
1797 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1798 if ( aDataFlowExecutor ) {
1800 RetVal = aDataFlowExecutor->Kill( Name() ) ;
1801 MESSAGE( "Node " << Name() << " execution was killed : " << RetVal ) ;
1804 RetVal = aDataFlowExecutor->Kill() ;
1805 MESSAGE( "Graph execution was killed : " << RetVal ) ;
1808 endService( "CNode_Impl::Kill" );
1811 bool CNode_Impl::KillDone() {
1812 // beginService( "CNode_Impl::KillDone" );
1813 bool RetVal = false ;
1814 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1815 if ( aDataFlowExecutor ) {
1817 RetVal = aDataFlowExecutor->KillDone( Name() ) ;
1820 // endService( "CNode_Impl::KillDone" );
1823 bool CNode_Impl::Stop() {
1824 // beginService( "CNode_Impl::Stop" );
1825 bool RetVal ; // = aDataFlowExecutor->Stop() ;
1826 // endService( "CNode_Impl::Stop" );
1829 bool CNode_Impl::Suspend() {
1830 beginService( "CNode_Impl::Suspend" );
1831 bool RetVal = false ;
1832 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1833 if ( aDataFlowExecutor ) {
1835 MESSAGE( "CNode_Impl::Suspend " << Name() ) ;
1836 RetVal = aDataFlowExecutor->Suspend( Name() ) ;
1839 MESSAGE( "CNode_Impl::Suspend " << aDataFlowExecutor->Graph()->Name() ) ;
1840 RetVal = aDataFlowExecutor->Suspend() ;
1843 endService( "CNode_Impl::Suspend" );
1846 bool CNode_Impl::SuspendDone() {
1847 // beginService( "CNode_Impl::SuspendDone" );
1848 bool RetVal = false ;
1849 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1850 if ( aDataFlowExecutor ) {
1852 RetVal = aDataFlowExecutor->SuspendDone( Name() ) ;
1855 RetVal = aDataFlowExecutor->SuspendDone() ;
1858 // endService( "CNode_Impl::SuspendDone" );
1861 bool CNode_Impl::Resume() {
1862 bool RetVal = false ;
1863 beginService( "CNode_Impl::Resume" );
1864 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1865 if ( aDataFlowExecutor ) {
1867 MESSAGE( "CNode_Impl::Resume " << Name() ) ;
1868 RetVal = aDataFlowExecutor->Resume( Name() ) ;
1871 MESSAGE( "CNode_Impl::Resume " << aDataFlowExecutor->Graph()->Name() ) ;
1872 RetVal = aDataFlowExecutor->Resume() ;
1875 endService( "CNode_Impl::Resume" );
1879 CORBA::Long CNode_Impl::CpuUsed() {
1880 CORBA::Long RetVal = 0 ;
1881 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1882 if ( aDataFlowExecutor ) {
1884 RetVal = aDataFlowExecutor->CpuUsed( Name() ) ;
1887 RetVal = aDataFlowExecutor->CpuUsed() ;
1893 bool CNode_Impl::IsExecuting() {
1894 bool RetVal = false;
1895 if ( !IsMacro() && DataFlowEditor() && DataFlowEditor()->Executor() ) {
1896 // asv : the statement below normally does not return true, Executor_OutNode
1897 // sets Editor->Editing() after finishing of execution (see Executor_OutNode.cxx)
1898 if ( DataFlowEditor()->IsExecuting() && DataFlowEditor()->Executor()->IsDone() ) {
1899 DataFlowEditor()->Editing();
1902 RetVal = DataFlowEditor()->IsExecuting();