1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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 // SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
23 // File : CNode_Impl.cxx
24 // Author : Jean Rahuel
33 //#include "utilities.h"
35 #include "StreamGraph_Impl.hxx"
37 #include "CNode_Impl.hxx"
39 #include "StreamPort_Impl.hxx"
41 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
42 PortableServer::POA_ptr poa ,
43 PortableServer::ObjectId * contId ,
44 const char *instanceName ,
45 const char *interfaceName ,
46 const char *aDataFlowName ,
47 const SUPERV::KindOfNode aKindOfNode ) :
48 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
49 // MESSAGE("CNode_Impl::CNode_Impl activate object instanceName("
50 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
51 // << hex << (void *) this << dec )
53 // _id = _poa->activate_object(_thisObj);
54 // MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
55 // beginService( "CNode_Impl::CNode_Impl" );
56 _Orb = CORBA::ORB::_duplicate(orb);
59 _DataFlowEditor = NULL ;
60 _DataFlowNode = NULL ;
61 if ( aKindOfNode == SUPERV::MacroNode ) {
67 // endService( "CNode_Impl::CNode_Impl" );
70 CNode_Impl::CNode_Impl() {
73 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
74 PortableServer::POA_ptr poa ,
75 PortableServer::ObjectId * contId ,
76 const char *instanceName ,
77 const char *interfaceName ,
78 GraphEditor::DataFlow * aDataFlowEditor ,
79 const SALOME_ModuleCatalog::Service &NodeService ,
80 const char * NodeName ,
81 const SUPERV::KindOfNode NodeKindOfNode ,
82 const char * FuncName ,
83 const SUPERV::ListOfStrings & PythonFunction ,
85 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
86 // beginService( "CNode_Impl::CNode_Impl" );
87 // cout << "CNode_Impl::CNode_Impl -->" << endl ;
88 // if ( FuncName && NodeName ) {
89 // cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
90 // << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
91 // << " " << strlen( FuncName ) << endl ;
93 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
94 // MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
96 _id = _poa->activate_object(_thisObj);
98 _Orb = CORBA::ORB::_duplicate(orb);
101 _DataFlowEditor = aDataFlowEditor ;
102 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
103 GraphBase::ListOfFuncName aFuncName ;
104 GraphBase::ListOfPythonFunctions aPythonFunction ;
106 aFuncName.resize(1) ;
107 aFuncName[0] = my_strdup( FuncName ) ;
108 aPythonFunction.resize(1) ;
109 aPythonFunction[0] = &PythonFunction ;
112 // mkr : PAL11273 -->
113 if ( isCimpl ) // C++ implementation
114 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
118 else // Python implementation
119 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
128 // mkr : PAL11273 <--
131 // endService( "CNode_Impl::CNode_Impl" );
132 // cout << "<-- CNode_Impl::CNode_Impl" << endl ;
135 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
136 PortableServer::POA_ptr poa ,
137 PortableServer::ObjectId * contId ,
138 const char *instanceName ,
139 const char *interfaceName ,
140 GraphEditor::DataFlow * aDataFlowEditor ,
141 const SALOME_ModuleCatalog::Service &NodeService ,
142 const char * NodeName ,
143 const SUPERV::KindOfNode NodeKindOfNode ,
144 const GraphBase::ListOfFuncName & aFuncName ,
145 const GraphBase::ListOfPythonFunctions & aPythonFunction ) :
146 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
147 // MESSAGE( NodeName << " " );
148 // beginService( "CNode_Impl::CNode_Impl" );
150 // MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ;
152 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
153 // MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" );
155 _id = _poa->activate_object(_thisObj);
157 _Orb = CORBA::ORB::_duplicate(orb);
160 _DataFlowEditor = aDataFlowEditor ;
161 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
162 _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName ,
167 // endService( "CNode_Impl::CNode_Impl" );
170 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
171 PortableServer::POA_ptr poa ,
172 PortableServer::ObjectId * contId ,
173 const char *instanceName ,
174 const char *interfaceName ,
175 GraphEditor::DataFlow * aDataFlowEditor ,
176 GraphEditor::InNode * aDataFlowNode ) :
177 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
178 // beginService( "CNode_Impl::CNode_Impl" );
179 if ( aDataFlowNode && aDataFlowNode->IsComputingNode() ) {
180 // MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" );
182 _id = _poa->activate_object(_thisObj);
185 // MESSAGE( "CNode_Impl::CNode_Impl NO _poa->activate_object " );
187 _Orb = CORBA::ORB::_duplicate(orb);
190 _DataFlowEditor = aDataFlowEditor ;
191 DataFlowEditor()->Graph()->GraphEditor( aDataFlowEditor ) ;
192 _DataFlowNode = aDataFlowNode ;
193 if ( aDataFlowNode ) {
199 // endService( "CNode_Impl::CNode_Impl" );
202 CNode_Impl::~CNode_Impl() {
203 beginService( "CNode_Impl::~CNode_Impl" );
204 endService( "CNode_Impl::~CNode_Impl" );
207 void CNode_Impl::destroy() {
208 beginService( "CNode_Impl::Destroy" );
209 if ( DataFlowEditor()->IsEditing() ) {
211 _DataFlowNode = NULL ;
212 _poa->deactivate_object(*_id) ;
213 // CORBA::release(_poa) ;
215 // _thisObj->_remove_ref();
218 MESSAGE("CNode_Impl::destroy ERROR ") ;
221 // endService( "CNode_Impl::Destroy" );
224 bool CNode_Impl::Delete() {
225 beginService( "CNode_Impl::Delete" );
226 bool RetVal = false ;
227 if ( DataFlowEditor()->IsEditing() ) {
229 RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
231 DataFlowEditor()->UnValid() ;
234 endService( "CNode_Impl::Delete" );
238 void CNode_Impl::DeletePorts() {
239 beginService( "CNode_Impl::DeletePorts" );
240 if ( DataFlowEditor()->IsEditing() && DataFlowNode() ) {
242 //JR Debug 06.09.2005 : Ports must be explored in the reversed side because deletion
243 // of a port changes indexes !!!...
244 // for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeInPortsSize() ; i++ ) {
245 for ( i = DataFlowNode()->ComputingNode()->GetNodeInPortsSize()-1 ; i >= 0 ; i-- ) {
246 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeInPort( i )->ObjRef() ;
247 if ( !CORBA::is_nil( aPort ) ) {
251 // for ( i = 0 ; i < DataFlowNode()->ComputingNode()->GetNodeOutPortsSize() ; i++ ) {
252 for ( i = DataFlowNode()->ComputingNode()->GetNodeOutPortsSize()-1 ; i >= 0 ; i-- ) {
253 SUPERV::Port_var aPort = DataFlowNode()->ComputingNode()->GetChangeNodeOutPort( i )->ObjRef() ;
254 if ( !CORBA::is_nil( aPort ) ) {
259 endService( "CNode_Impl::DeletePorts" );
262 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
263 // beginService( "CNode_Impl::Service" );
264 SALOME_ModuleCatalog::Service * RetVal ;
266 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowNode()->GetService() ) ;
269 RetVal = new SALOME_ModuleCatalog::Service( *DataFlowEditor()->GetService() ) ;
271 // endService( "CNode_Impl::Service" );
275 char * CNode_Impl::Name() {
276 // beginService( "CNode_Impl::Name" );
277 char * RetVal = NULL ;
279 RetVal = DataFlowNode()->Name() ;
282 RetVal = DataFlowEditor()->Graph()->Name() ;
284 // endService( "CNode_Impl::Name" );
285 return CORBA::string_dup( RetVal );
287 bool CNode_Impl::SetName( const char * aDataFlowName ) {
288 // beginService( "CNode_Impl::SetName" );
289 bool RetVal = false ;
291 if ( DataFlowEditor()->IsEditing() ) {
293 //JR 29.06.2005 debug :
294 char * OldNodeName = my_strdup( DataFlowNode()->Name() ) ;
295 // RetVal = DataFlowEditor()->ReNameNode( DataFlowNode()->Name() ,
296 SameName = !strcmp( OldNodeName , aDataFlowName ) ;
298 RetVal = DataFlowEditor()->ReNameNode( OldNodeName ,
301 delete [] OldNodeName ;
304 // RetVal = DataFlowEditor()->Graph()->Name( aDataFlowName ) ;
305 SameName = !strcmp( DataFlowEditor()->Graph()->Name() , aDataFlowName ) ;
307 RetVal = DataFlowEditor()->Name( aDataFlowName ) ;
310 //JR Debug 06.09.2005 : UnValid was missing
312 DataFlowEditor()->UnValid() ;
313 DataFlowEditor()->IsValid() ;
316 // endService( "CNode_Impl::SetName" );
319 SUPERV::KindOfNode CNode_Impl::Kind() {
320 // beginService( "CNode_Impl::Kind" );
321 SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
323 RetVal = DataFlowNode()->Kind() ;
326 RetVal = DataFlowEditor()->Graph()->Kind() ;
328 // endService( "CNode_Impl::Kind" );
331 bool CNode_Impl::IsGraph() {
332 // beginService( "CNode_Impl::IsGraph" );
333 bool RetVal = false ;
335 RetVal = DataFlowNode()->IsDataFlowNode() ;
338 RetVal = DataFlowEditor()->Graph()->IsDataFlowNode() ;
340 // endService( "CNode_Impl::IsGraph" );
343 bool CNode_Impl::IsStreamGraph() {
344 beginService( "CNode_Impl::IsStreamGraph" );
345 bool RetVal = false ;
347 RetVal = DataFlowNode()->IsDataStreamNode() ;
350 RetVal = DataFlowEditor()->Graph()->IsDataStreamNode() ;
352 MESSAGE( "CNode_Impl::IsStreamGraph " << RetVal );
353 endService( "CNode_Impl::IsStreamGraph" );
356 bool CNode_Impl::IsMacro() {
357 // beginService( "CNode_Impl::IsMacro" );
358 bool RetVal = false ;
359 if ( _IsNode && DataFlowNode()->IsMacroNode() ) {
362 // endService( "CNode_Impl::IsMacro" );
365 bool CNode_Impl::IsFlowMacro() {
366 // beginService( "CNode_Impl::IsFlowMacro" );
367 bool RetVal = false ;
368 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsGraph() ) {
371 // endService( "CNode_Impl::IsFlowMacro" );
374 bool CNode_Impl::IsStreamMacro() {
375 // beginService( "CNode_Impl::IsStreamMacro" );
376 bool RetVal = false ;
377 if ( _IsNode && DataFlowNode()->IsMacroNode() && DataFlowNode()->ComputingNode()->MacroObject()->IsStreamGraph() ) {
380 // endService( "CNode_Impl::IsStreamMacro" );
383 bool CNode_Impl::IsHeadGraph() {
384 bool RetVal = false ;
385 beginService( "CNode_Impl::IsHeadGraph" );
386 endService( "CNode_Impl::IsHeadGraph" );
389 CORBA::Long CNode_Impl::GraphLevel() {
390 CORBA::Long RetVal = 0 ;
391 beginService( "CNode_Impl::GraphLevel" );
392 RetVal = DataFlowEditor()->Graph()->GraphMacroLevel() ;
393 endService( "CNode_Impl::GraphLevel" );
397 bool CNode_Impl::IsComputing() {
398 // beginService( "CNode_Impl::IsComputing" );
399 bool RetVal = SUPERV::UnknownNode ;
401 RetVal = DataFlowNode()->IsComputingNode() ;
404 RetVal = DataFlowEditor()->Graph()->IsComputingNode() ;
406 // endService( "CNode_Impl::IsComputing" );
409 bool CNode_Impl::IsFactory() {
410 // beginService( "CNode_Impl::IsFactory" );
411 bool RetVal = SUPERV::UnknownNode ;
413 RetVal = DataFlowNode()->IsFactoryNode() ;
416 RetVal = DataFlowEditor()->Graph()->IsFactoryNode() ;
418 // endService( "CNode_Impl::IsFactory" );
421 bool CNode_Impl::IsInLine() {
422 // beginService( "CNode_Impl::IsInLine" );
423 bool RetVal = SUPERV::UnknownNode ;
425 RetVal = DataFlowNode()->IsInLineNode() ;
428 RetVal = DataFlowEditor()->Graph()->IsInLineNode() ;
430 // endService( "CNode_Impl::IsInLine" );
433 bool CNode_Impl::IsGOTO() {
434 // beginService( "CNode_Impl::IsGOTO" );
435 bool RetVal = SUPERV::UnknownNode ;
437 RetVal = DataFlowNode()->IsGOTONode() ;
440 RetVal = DataFlowEditor()->Graph()->IsGOTONode() ;
442 // endService( "CNode_Impl::IsGOTO" );
445 bool CNode_Impl::IsLoop() {
446 // beginService( "CNode_Impl::IsLoop" );
447 bool RetVal = SUPERV::UnknownNode ;
449 RetVal = DataFlowNode()->IsLoopNode() ;
452 RetVal = DataFlowEditor()->Graph()->IsLoopNode() ;
454 // endService( "CNode_Impl::IsLoop" );
457 bool CNode_Impl::IsEndLoop() {
458 // beginService( "CNode_Impl::IsEndLoop" );
459 bool RetVal = SUPERV::UnknownNode ;
461 RetVal = DataFlowNode()->IsEndLoopNode() ;
464 RetVal = DataFlowEditor()->Graph()->IsEndLoopNode() ;
466 // endService( "CNode_Impl::IsEndLoop" );
469 bool CNode_Impl::IsSwitch() {
470 // beginService( "CNode_Impl::IsSwitch" );
471 bool RetVal = SUPERV::UnknownNode ;
473 RetVal = DataFlowNode()->IsSwitchNode() ;
476 RetVal = DataFlowEditor()->Graph()->IsSwitchNode() ;
478 // endService( "CNode_Impl::IsSwitch" );
481 bool CNode_Impl::IsEndSwitch() {
482 // beginService( "CNode_Impl::IsEndSwitch" );
483 bool RetVal = SUPERV::UnknownNode ;
485 RetVal = DataFlowNode()->IsEndSwitchNode() ;
488 RetVal = DataFlowEditor()->Graph()->IsEndSwitchNode() ;
490 // endService( "CNode_Impl::IsEndSwitch" );
494 SUPERV::SDate CNode_Impl::CreationDate() {
495 // beginService( "CNode_Impl::CreationDate" );
496 SUPERV::SDate_var RetVal ;
498 RetVal = new SUPERV::SDate( DataFlowNode()->FirstCreation() ) ;
501 // cout << " CNode_Impl::CreationDate " << DataFlowEditor()->FirstCreation()
503 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->FirstCreation() ) ;
505 // endService( "CNode_Impl::CreationDate" );
506 return (RetVal._retn()) ;
508 SUPERV::SDate CNode_Impl::LastUpdateDate() {
509 // beginService( "CNode_Impl::LastUpdateDate" );
510 SUPERV::SDate_var RetVal ;
512 RetVal = new SUPERV::SDate( DataFlowNode()->LastModification() ) ;
515 RetVal = new SUPERV::SDate( DataFlowEditor()->Graph()->LastModification() ) ;
517 // endService( "CNode_Impl::LastUpdateDate" );
518 return (RetVal._retn()) ;
520 char * CNode_Impl::Version() {
521 // beginService( "CNode_Impl::Version" );
524 RetVal = DataFlowNode()->EditorRelease() ;
527 RetVal = DataFlowEditor()->Graph()->EditorRelease() ;
529 // endService( "CNode_Impl::Version" );
530 return CORBA::string_dup( RetVal ) ;
532 char * CNode_Impl::Author() {
533 // beginService( "CNode_Impl::Author" );
536 RetVal = DataFlowNode()->Author() ;
539 RetVal = DataFlowEditor()->Graph()->Author() ;
541 // endService( "CNode_Impl::Author" );
542 return CORBA::string_dup( RetVal ) ;
544 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
545 // beginService( "CNode_Impl::SetAuthor" );
546 bool RetVal = false ;
547 if ( DataFlowEditor()->IsEditing() ) {
549 RetVal = DataFlowNode()->Author( aDataFlowAuthor ) ;
552 RetVal = DataFlowEditor()->Graph()->Author( aDataFlowAuthor ) ;
555 // endService( "CNode_Impl::SetAuthor" );
558 char * CNode_Impl::Comment() {
559 // beginService( "CNode_Impl::Comment" );
562 RetVal = DataFlowNode()->Comment() ;
565 RetVal = DataFlowEditor()->Graph()->Comment() ;
567 // endService( "CNode_Impl::Comment" );
568 return CORBA::string_dup( RetVal ) ;
570 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
571 // beginService( "CNode_Impl::SetComment" );
572 bool RetVal = false ;
573 if ( DataFlowEditor()->IsEditing() ) {
575 RetVal = DataFlowNode()->Comment( aDataFlowComment ) ;
578 RetVal = DataFlowEditor()->Graph()->Comment( aDataFlowComment ) ;
581 // endService( "CNode_Impl::SetComment" );
585 void CNode_Impl::Coords(CORBA::Long X , CORBA::Long Y ) {
586 // beginService( "CNode_Impl::Coords" );
587 if ( DataFlowEditor()->IsEditing() ) {
589 ((GraphEditor::InNode *) DataFlowNode())->Coordinates( X , Y ) ;
592 DataFlowEditor()->Graph()->Coordinates( X , Y ) ;
595 // endService( "CNode_Impl::Coords" );
597 CORBA::Long CNode_Impl::X() {
598 // beginService( "CNode_Impl::X" );
601 RetVal = DataFlowNode()->XCoordinate() ;
604 RetVal = DataFlowEditor()->Graph()->XCoordinate() ;
606 // endService( "CNode_Impl::X" );
609 CORBA::Long CNode_Impl::Y() {
610 // beginService( "CNode_Impl::Y" );
613 RetVal = DataFlowNode()->YCoordinate() ;
616 RetVal = DataFlowEditor()->Graph()->YCoordinate() ;
618 // endService( "CNode_Impl::Y" );
622 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
624 Port_Impl * myPort = NULL ;
625 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
628 aninport = DataFlowNode()->GetInPort( ServiceParameterName ) ;
631 aninport = DataFlowEditor()->GetInPort( ServiceParameterName ) ;
635 anoutport = DataFlowNode()->GetOutPort( ServiceParameterName ) ;
638 anoutport = DataFlowEditor()->GetOutPort( ServiceParameterName ) ;
641 GraphBase::InPort * anInPort ;
643 anInPort = DataFlowNode()->GetChangeInPort( ServiceParameterName ) ;
646 anInPort = DataFlowEditor()->GetChangeInPort( ServiceParameterName ) ;
648 if ( anInPort->IsDataStream() ) {
649 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
651 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
653 beginService( "CNode_Impl::Port" );
658 hasinput = DataFlowNode()->HasInput( anInPort->PortName() ) ;
661 hasinput = DataFlowEditor()->HasInput( anInPort->PortName() ) ;
664 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
665 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
666 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
667 instanceName() , interfaceName() ,
670 // ServiceParameterName ,
671 (GraphBase::Port * ) anInPort ,
676 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
677 instanceName() , interfaceName() ,
680 // ServiceParameterName ) ;
681 (GraphBase::Port * ) anInPort ,
684 PortableServer::ObjectId * id = myPort->getId() ;
685 CORBA::Object_var obj = _poa->id_to_reference(*id);
686 iobject = SUPERV::Port::_narrow(obj) ;
687 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
690 iobject = anInPort->ObjRef() ;
693 else if ( anoutport ) {
694 GraphBase::OutPort * anOutPort ;
696 anOutPort = DataFlowNode()->GetChangeOutPort( ServiceParameterName ) ;
699 anOutPort = DataFlowEditor()->GetChangeOutPort( ServiceParameterName ) ;
701 if ( anOutPort->IsDataStream() ) {
702 MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ;
704 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
706 beginService( "CNode_Impl::Port" );
709 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
710 const CORBA::Any anAny = anOutPort->Value() ;
711 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
712 instanceName() , interfaceName() ,
715 // ServiceParameterName ,
716 (GraphBase::Port * ) anOutPort ,
719 PortableServer::ObjectId * id = myPort->getId() ;
720 CORBA::Object_var obj = _poa->id_to_reference(*id);
721 iobject = SUPERV::Port::_narrow(obj) ;
722 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
725 iobject = anOutPort->ObjRef() ;
729 endService( "CNode_Impl::Port" );
731 DataFlowEditor()->UnValid() ;
732 return SUPERV::Port::_duplicate( iobject ) ;
735 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
736 const SUPERV::Value_ptr aValue ) {
738 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
739 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
741 GraphBase::InPort * anInPort = NULL ;
742 if ( DataFlowEditor()->IsEditing() /*&& DataFlowEditor()->Graph()->GraphMacroLevel() == 0*/ ) {
744 sts = DataFlowEditor()->AddInputData( DataFlowNode()->Name() ,
745 ToServiceParameterName ,
747 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
750 sts = DataFlowEditor()->AddInputData( DataFlowEditor()->Graph()->Name() ,
751 ToServiceParameterName ,
753 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
755 if ( sts && anInPort ) {
756 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
758 beginService( "CNode_Impl::Input" );
762 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
763 instanceName() , interfaceName() ,
766 // ToServiceParameterName ,
767 (GraphBase::Port * ) anInPort ,
770 PortableServer::ObjectId * id = myPort->getId() ;
771 CORBA::Object_var obj = _poa->id_to_reference(*id);
772 iobject = SUPERV::Port::_narrow(obj) ;
773 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
776 iobject = anInPort->ObjRef() ;
779 DataFlowEditor()->UnValid() ;
781 else if ( aDataFlowExecutor ) {
783 sts = aDataFlowExecutor->ChangeInputData( DataFlowNode()->Name() ,
784 ToServiceParameterName ,
786 anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
789 sts = aDataFlowExecutor->ChangeInputData( DataFlowEditor()->Graph()->Name() ,
790 ToServiceParameterName ,
792 anInPort = DataFlowEditor()->Graph()->GetChangeInPort( ToServiceParameterName ) ;
794 if ( sts && anInPort ) {
795 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
797 beginService( "CNode_Impl::Input" );
801 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
802 instanceName() , interfaceName() ,
805 // ToServiceParameterName ,
806 (GraphBase::Port * ) anInPort ,
809 PortableServer::ObjectId * id = myPort->getId() ;
810 CORBA::Object_var obj = _poa->id_to_reference(*id);
811 iobject = SUPERV::Port::_narrow(obj) ;
812 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
815 iobject = anInPort->ObjRef() ;
820 endService( "CNode_Impl::Input" );
822 if ( CORBA::is_nil( iobject ) ) {
823 MESSAGE( "CNode_Impl::Input returns nil object _IsNode " << _IsNode << " sts " << sts
824 << " Node " << Name() << " ToServiceParameterName " << ToServiceParameterName
825 << " anInPort " << anInPort ) ;
827 return SUPERV::Port::_duplicate( iobject ) ;
831 SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) {
832 SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ;
833 Port_Impl * myInPort = NULL ;
834 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
835 if ( anInPort && !anInPort->IsDataStream() ) {
836 Inobject = anInPort->ObjRef() ;
837 if ( CORBA::is_nil( Inobject ) ) {
838 myInPort = new Port_Impl( _Orb , _Poa , _ContId ,
839 instanceName() , interfaceName() ,
842 (GraphBase::Port * ) anInPort ,
845 PortableServer::ObjectId * id = myInPort->getId() ;
846 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
847 Inobject = SUPERV::Port::_narrow(obj) ;
848 anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ;
852 return SUPERV::Port::_duplicate( Inobject ) ;
855 SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) {
856 Port_Impl * myOutPort = NULL ;
857 SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
858 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
859 if ( anOutPort && !anOutPort->IsDataStream() ) {
860 Outobject = anOutPort->ObjRef() ;
861 if ( CORBA::is_nil( Outobject ) ) {
862 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
863 const CORBA::Any anAny = anOutPort->Value() ;
864 myOutPort = new Port_Impl( _Orb , _Poa , _ContId ,
865 instanceName() , interfaceName() ,
868 (GraphBase::Port * ) anOutPort ,
872 PortableServer::ObjectId * id = myOutPort->getId() ;
873 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
874 Outobject = SUPERV::Port::_narrow(obj) ;
875 anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ;
879 return SUPERV::Port::_duplicate( Outobject );
882 SUPERV::StreamPort_ptr CNode_Impl::GetInStreamPort( const char *aParameterName ) {
883 SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ;
884 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
885 StreamPort_Impl * myInStreamPort = NULL ;
886 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
887 if ( anInPort && anInPort->IsDataStream() ) {
888 Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
889 if ( CORBA::is_nil( Inobject ) ) {
890 myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
891 instanceName() , interfaceName() ,
894 (GraphBase::Port * ) anInPort ,
896 if ( myInStreamPort ) {
897 PortableServer::ObjectId * id = myInStreamPort->getId() ;
898 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
899 Inobject = SUPERV::StreamPort::_narrow(obj) ;
900 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ;
905 return SUPERV::StreamPort::_duplicate( Inobject ) ;
908 SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName ) {
909 StreamPort_Impl * myOutStreamPort = NULL ;
910 SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ;
911 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
912 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
913 if ( anOutPort && anOutPort->IsDataStream() ) {
914 Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
915 if ( CORBA::is_nil( Outobject ) ) {
916 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
917 const CORBA::Any anAny = anOutPort->Value() ;
918 myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
919 instanceName() , interfaceName() ,
922 (GraphBase::Port * ) anOutPort ,
925 if ( myOutStreamPort ) {
926 PortableServer::ObjectId * id = myOutStreamPort->getId() ;
927 CORBA::Object_var obj = _poa->id_to_reference(*id) ;
928 Outobject = SUPERV::StreamPort::_narrow(obj) ;
929 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ;
934 return SUPERV::StreamPort::_duplicate( Outobject );
937 bool CNode_Impl::HasStreamPort() {
938 bool RetVal = false ;
939 beginService( "CNode_Impl::HasStreamPort" );
940 endService( "CNode_Impl::HasStreamPort" );
944 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
946 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
948 char* FromServiceParameterName ;
949 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
950 ToServiceParameterName ,
952 & FromServiceParameterName ) ;
954 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
955 if ( !anInPort->IsDataStream() && anInPort->GetOutPort() ) {
956 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
957 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
959 beginService( "CNode_Impl::GetLink" );
963 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
964 instanceName() , interfaceName() ,
967 ToServiceParameterName ,
968 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
969 FromServiceParameterName ,
970 true , false , Success ) ;
972 PortableServer::ObjectId * id = myLink->getId() ;
973 CORBA::Object_var obj = _poa->id_to_reference(*id);
974 iobject = SUPERV::Link::_narrow(obj) ;
975 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
979 iobject = anOutPort->InPortObjRef( anInPort ) ;
984 endService( "CNode_Impl::GetLink" );
986 return SUPERV::Link::_duplicate( iobject ) ;
989 SUPERV::StreamLink_ptr CNode_Impl::GetStreamLink(const char * ToServiceParameterName ) {
991 SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
993 char* FromServiceParameterName ;
994 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
995 bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
996 ToServiceParameterName ,
998 & FromServiceParameterName ) ;
1000 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( ToServiceParameterName ) ;
1001 if ( anInPort->IsDataStream() && anInPort->GetOutPort() ) {
1002 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
1003 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
1005 beginService( "CNode_Impl::GetLink" );
1009 StreamLink_Impl * myStreamLink = new StreamLink_Impl(
1010 _Orb , _Poa , _ContId ,
1011 instanceName() , interfaceName() ,
1014 ToServiceParameterName ,
1015 (GraphEditor::InNode *) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
1016 FromServiceParameterName ,
1019 PortableServer::ObjectId * id = myStreamLink->getId() ;
1020 CORBA::Object_var obj = _poa->id_to_reference(*id);
1021 iobject = SUPERV::StreamLink::_narrow(obj) ;
1022 anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
1026 iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
1032 endService( "CNode_Impl::GetLink" );
1034 return SUPERV::StreamLink::_duplicate( iobject ) ;
1037 SUPERV::ListOfPorts * CNode_Impl::Ports() {
1041 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
1043 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1044 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1045 if ( !anInPort->IsDataStream() ) {
1047 beginService( "CNode_Impl::Ports" );
1050 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1051 ( /*IsExecuting() || */DataFlowEditor()->IsReadOnly() ) ) ) { // mkr : IPAL11362
1052 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1054 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1055 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1056 // << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1057 // << "/" << anInPort->IsNotConnected() ) ;
1058 Port_Impl * myPort ;
1059 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1060 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1061 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1062 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1063 instanceName() , interfaceName() ,
1066 (GraphBase::Port * ) anInPort ,
1071 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1072 instanceName() , interfaceName() ,
1075 (GraphBase::Port * ) anInPort ,
1078 PortableServer::ObjectId * id = myPort->getId() ;
1079 CORBA::Object_var obj = _poa->id_to_reference(*id);
1080 SUPERV::Port_var iobject ;
1081 iobject = SUPERV::Port::_narrow(obj) ;
1083 RetVal->length( PortCount ) ;
1084 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1085 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1088 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1090 RetVal->length( PortCount ) ;
1091 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1095 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1098 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1099 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1100 if ( !anOutPort->IsDataStream() ) {
1102 beginService( "CNode_Impl::Ports" );
1105 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1106 ( /*IsExecuting() || */DataFlowEditor()->IsReadOnly() ) ) ) { // mkr : IPAL11362
1107 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1109 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1110 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1111 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1112 const CORBA::Any anAny = anOutPort->Value() ;
1113 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1114 instanceName() , interfaceName() ,
1117 (GraphBase::Port * ) anOutPort ,
1120 PortableServer::ObjectId * id = myPort->getId() ;
1121 CORBA::Object_var obj = _poa->id_to_reference(*id);
1122 SUPERV::Port_var iobject ;
1123 iobject = SUPERV::Port::_narrow(obj) ;
1125 RetVal->length( PortCount ) ;
1126 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1127 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1130 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1132 RetVal->length( PortCount ) ;
1133 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1137 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ;
1142 if ( DataFlowEditor()->IsValid() ) {
1143 //DataFlowEditor()->Graph()->Values() ;
1144 RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1145 DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1146 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1147 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1148 if ( !anOutPort->IsDataStream() ) {
1149 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1151 beginService( "CNode_Impl::Ports" );
1154 Port_Impl * myPort ;
1155 if ( anOutPort->IsDataConnected() ) {
1156 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1157 const CORBA::Any anAny = anOutPort->Value() ;
1158 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1159 instanceName() , interfaceName() ,
1162 (GraphBase::Port * ) anOutPort ,
1167 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1168 instanceName() , interfaceName() ,
1171 (GraphBase::Port * ) anOutPort ,
1174 PortableServer::ObjectId * id = myPort->getId() ;
1175 CORBA::Object_var obj = _poa->id_to_reference(*id);
1176 SUPERV::Port_var iobject ;
1177 iobject = SUPERV::Port::_narrow(obj) ;
1179 RetVal->length( PortCount ) ;
1180 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1181 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1185 RetVal->length( PortCount ) ;
1186 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
1192 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1193 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1194 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1195 if ( !anInPort->IsDataStream() ) {
1196 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1198 beginService( "CNode_Impl::Ports" );
1201 Port_Impl * myPort ;
1202 if ( anInPort->IsDataConnected() ) {
1203 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1204 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1205 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1206 instanceName() , interfaceName() ,
1209 (GraphBase::Port * ) anInPort ,
1214 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
1215 instanceName() , interfaceName() ,
1221 PortableServer::ObjectId * id = myPort->getId() ;
1222 CORBA::Object_var obj = _poa->id_to_reference(*id);
1223 SUPERV::Port_var iobject ;
1224 iobject = SUPERV::Port::_narrow(obj) ;
1226 RetVal->length( PortCount ) ;
1227 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ;
1228 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
1232 RetVal->length( PortCount ) ;
1233 RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
1242 int RetVallength = (unsigned int ) RetVal->length() ;
1243 for ( i = 0 ; i < RetVallength ; i++ ) {
1244 MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1248 endService( "CNode_Impl::Ports " ) ;
1250 return ( RetVal._retn() ) ;
1253 SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() {
1257 SUPERV::ListOfStreamPorts_var RetVal = new SUPERV::ListOfStreamPorts ;
1258 if ( !DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1259 // MESSAGE("CNode_Impl::StreamPorts NOT a DataStreamNode" ) ;
1261 else if ( _IsNode ) {
1262 // RetVal->length( DataFlowNode()->GetNodeInPortsSize() +
1263 // DataFlowNode()->GetNodeOutPortsSize() ) ;
1264 for ( i = 0 ; i < DataFlowNode()->GetNodeInPortsSize() ; i++ ) {
1265 GraphBase::InPort * anInPort = DataFlowNode()->GetChangeNodeInPort( i ) ;
1266 if ( anInPort->IsDataStream() ) {
1268 beginService( "CNode_Impl::StreamPorts" );
1271 if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() &&
1272 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1273 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
1274 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1276 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1277 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
1278 << IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
1279 << "/" << anInPort->IsNotConnected() ) ;
1280 StreamPort_Impl * myStreamPort ;
1281 if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) {
1282 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1283 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1284 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1285 instanceName() , interfaceName() ,
1288 (GraphBase::Port * ) anInPort ,
1293 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1294 instanceName() , interfaceName() ,
1297 (GraphBase::Port * ) anInPort ,
1300 PortableServer::ObjectId * id = myStreamPort->getId() ;
1301 CORBA::Object_var obj = _poa->id_to_reference(*id);
1302 SUPERV::StreamPort_var iobject ;
1303 iobject = SUPERV::StreamPort::_narrow(obj) ;
1305 RetVal->length( PortCount ) ;
1306 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1307 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1310 MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
1312 RetVal->length( PortCount ) ;
1313 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1317 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1320 for ( i = 0 ; i < DataFlowNode()->GetNodeOutPortsSize() ; i++ ) {
1321 GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeNodeOutPort( i ) ;
1322 if ( anOutPort->IsDataStream() ) {
1324 beginService( "CNode_Impl::StreamPorts" );
1327 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() &&
1328 ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) {
1329 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
1330 // RetVal[ DataFlowNode()->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1332 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1333 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1334 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1335 const CORBA::Any anAny = anOutPort->Value() ;
1336 StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1337 instanceName() , interfaceName() ,
1340 (GraphBase::Port * ) anOutPort ,
1343 PortableServer::ObjectId * id = myStreamPort->getId() ;
1344 CORBA::Object_var obj = _poa->id_to_reference(*id);
1345 SUPERV::StreamPort_var iobject ;
1346 iobject = SUPERV::StreamPort::_narrow(obj) ;
1348 RetVal->length( PortCount ) ;
1349 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1350 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1353 MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
1355 RetVal->length( PortCount ) ;
1356 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1360 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1365 if ( DataFlowEditor()->IsValid() ) {
1366 // RetVal->length( DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() +
1367 // DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ) ;
1368 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ; i++ ) {
1369 GraphBase::OutPort * anOutPort = DataFlowEditor()->Graph()->GetChangeNodeInDataNodePort(i) ;
1370 if ( anOutPort->IsDataStream() ) {
1371 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
1373 beginService( "CNode_Impl::StreamPorts" );
1376 StreamPort_Impl * myStreamPort ;
1377 if ( anOutPort->IsDataConnected() ) {
1378 //JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ;
1379 const CORBA::Any anAny = anOutPort->Value() ;
1380 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1381 instanceName() , interfaceName() ,
1384 (GraphBase::Port * ) anOutPort ,
1389 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1390 instanceName() , interfaceName() ,
1393 (GraphBase::Port * ) anOutPort ,
1396 PortableServer::ObjectId * id = myStreamPort->getId() ;
1397 CORBA::Object_var obj = _poa->id_to_reference(*id);
1398 SUPERV::StreamPort_var iobject ;
1399 iobject = SUPERV::StreamPort::_narrow(obj) ;
1401 RetVal->length( PortCount ) ;
1402 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1403 anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1407 RetVal->length( PortCount ) ;
1408 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ;
1412 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1415 j = DataFlowEditor()->Graph()->GetNodeInDataNodePortsSize() ;
1416 for ( i = 0 ; i < DataFlowEditor()->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) {
1417 GraphBase::InPort * anInPort = DataFlowEditor()->Graph()->GetChangeNodeOutDataNodePort(i) ;
1418 if ( anInPort->IsDataStream() ) {
1419 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
1421 beginService( "CNode_Impl::StreamPorts" );
1424 StreamPort_Impl * myStreamPort ;
1425 if ( anInPort->IsDataConnected() ) {
1426 //JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
1427 const CORBA::Any anAny = anInPort->GetOutPort()->Value() ;
1428 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1429 instanceName() , interfaceName() ,
1432 (GraphBase::Port * ) anInPort ,
1437 myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId ,
1438 instanceName() , interfaceName() ,
1444 PortableServer::ObjectId * id = myStreamPort->getId() ;
1445 CORBA::Object_var obj = _poa->id_to_reference(*id);
1446 SUPERV::StreamPort_var iobject ;
1447 iobject = SUPERV::StreamPort::_narrow(obj) ;
1449 RetVal->length( PortCount ) ;
1450 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ;
1451 anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
1455 RetVal->length( PortCount ) ;
1456 RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ;
1460 // RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ;
1465 // int RetVallength = (unsigned int ) RetVal->length() ;
1466 // for ( i = 0 ; i < RetVallength ; i++ ) {
1467 // MESSAGE( "StreamPort " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ;
1470 endService( "CNode_Impl::StreamPorts " ) ;
1472 return ( RetVal._retn() ) ;
1475 SUPERV::ListOfLinks * CNode_Impl::Links() {
1476 beginService( "CNode_Impl::Links" ) ;
1477 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
1478 if ( DataFlowNode() ) {
1479 // MESSAGE( "CNode_Impl::Links " << DataFlowEditor() << " " << DataFlowEditor()->Graph() << " " << DataFlowEditor()->Graph()->ObjImpl() << " " << DataFlowNode()->ComputingNode() << " " << DataFlowNode()->ComputingNode()->Name() ) ;
1480 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( DataFlowNode()->ComputingNode() , NULL ) ;
1483 RetVal = ((Graph_Impl * ) DataFlowEditor()->Graph()->ObjImpl())->Links( NULL , NULL ) ;
1485 MESSAGE( "CNode_Impl::Links " << RetVal->length() << " Links" ) ;
1486 endService( "CNode_Impl::Links" ) ;
1487 return ( RetVal._retn() ) ;
1490 SUPERV::ListOfStreamLinks * CNode_Impl::StreamLinks() {
1491 beginService( "CNode_Impl::StreamLinks" ) ;
1492 SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
1493 if ( DataFlowNode() && DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1494 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( DataFlowNode()->ComputingNode() , NULL ) ;
1496 else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
1497 RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( NULL , NULL ) ;
1499 MESSAGE( "CNode_Impl::StreamLinks " << RetVal->length() << " StreamLinks" ) ;
1500 endService( "CNode_Impl::StreamLinks" ) ;
1501 return ( RetVal._retn() ) ;
1504 CORBA::Long CNode_Impl::SubGraph() {
1505 // beginService( "CNode_Impl::SubGraph" );
1506 CORBA::Long RetVal = 0 ;
1508 RetVal = DataFlowNode()->SubGraph() ;
1510 // endService( "CNode_Impl::SubGraph" );
1514 CORBA::Long CNode_Impl::SubStreamGraph() {
1515 // beginService( "CNode_Impl::SubStreamGraph" );
1516 CORBA::Long RetVal = 0 ;
1518 RetVal = DataFlowNode()->SubStreamGraph() ;
1520 // endService( "CNode_Impl::SubStreamGraph" );
1524 // mkr : PAL8060 : this method is not used
1525 /*bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
1526 beginService( "CNode_Impl::IsLinked" );
1527 bool RetVal = DataFlowNode()->IsLinked( ServiceParameterName ) ;
1528 MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
1529 endService( "CNode_Impl::IsLinked" );
1533 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
1534 // beginService( "CNode_Impl::HasInput" );
1535 bool RetVal = DataFlowNode()->HasInput( ServiceParameterName ) ;
1536 // endService( "CNode_Impl::HasInput" );
1540 SUPERV::GraphState CNode_Impl::State() {
1541 // beginService( "CNode_Impl::State" );
1542 SUPERV::GraphState RetVal = SUPERV::EditingState ;
1543 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1544 if ( aDataFlowExecutor && !DataFlowEditor()->EditedAfterExecution() ) {
1545 //JR : 12/06/03 if ( aDataFlowExecutor ) {
1547 RetVal = aDataFlowExecutor->State( Name() ) ;
1550 RetVal = aDataFlowExecutor->State() ;
1553 // endService( "CNode_Impl::State" );
1556 CORBA::Long CNode_Impl::Thread() {
1557 // beginService( "CNode_Impl::Thread" );
1558 CORBA::Long RetVal = 0 ;
1559 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1560 if ( aDataFlowExecutor ) {
1562 RetVal = aDataFlowExecutor->Thread( Name() ) ;
1565 RetVal = aDataFlowExecutor->Thread() ;
1568 // endService( "CNode_Impl::Thread" );
1571 GraphExecutor::AutomatonState CNode_Impl::AutoState() {
1572 // beginService( "CNode_Impl::AutoState" );
1573 GraphExecutor::AutomatonState RetVal = GraphExecutor::UnKnownState ;
1574 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1575 if ( aDataFlowExecutor ) {
1577 RetVal = aDataFlowExecutor->AutomatonState( Name() ) ;
1580 RetVal = aDataFlowExecutor->AutomatonState() ;
1583 // endService( "CNode_Impl::AutoState" );
1586 SUPERV::ControlState CNode_Impl::Control() {
1587 // beginService( "CNode_Impl::Control" );
1588 SUPERV::ControlState RetVal = SUPERV::VoidState ;
1589 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1590 if ( aDataFlowExecutor ) {
1592 RetVal = aDataFlowExecutor->ControlState( Name() ) ;
1595 RetVal = aDataFlowExecutor->ControlState() ;
1598 // endService( "CNode_Impl::Control" );
1601 void CNode_Impl::ControlClear() {
1602 // beginService( "CNode_Impl::ControlClear" );
1603 // SUPERV::ControlState RetVal = SUPERV::VoidState ;
1604 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1605 if ( aDataFlowExecutor ) {
1607 aDataFlowExecutor->ControlClear( Name() ) ;
1610 aDataFlowExecutor->ControlClear() ;
1613 // endService( "CNode_Impl::ControlClear" );
1617 bool CNode_Impl::IsReady() {
1618 // beginService( "CNode_Impl::IsReady" );
1619 bool RetVal = false ;
1620 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1621 if ( aDataFlowExecutor ) {
1623 RetVal = aDataFlowExecutor->IsReady( Name() ) ;
1626 RetVal = aDataFlowExecutor->IsReady() ;
1629 // endService( "CNode_Impl::IsReady" );
1633 bool CNode_Impl::IsWaiting() {
1634 // beginService( "CNode_Impl::IsWaiting" );
1635 bool RetVal = false ;
1636 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1637 if ( aDataFlowExecutor ) {
1639 RetVal = aDataFlowExecutor->IsWaiting( Name() ) ;
1642 RetVal = aDataFlowExecutor->IsWaiting() ;
1645 // endService( "CNode_Impl::IsWaiting" );
1649 bool CNode_Impl::IsRunning() {
1650 // beginService( "CNode_Impl::IsRunning" );
1651 bool RetVal = false ;
1652 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1653 if ( aDataFlowExecutor ) {
1655 RetVal = aDataFlowExecutor->IsRunning( Name() ) ;
1658 RetVal = aDataFlowExecutor->IsRunning() ;
1661 // endService( "CNode_Impl::IsRunning" );
1665 bool CNode_Impl::IsDone() {
1666 // beginService( "CNode_Impl::IsDone" );
1667 bool RetVal = false ;
1668 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1669 if ( aDataFlowExecutor ) {
1671 RetVal = aDataFlowExecutor->IsDone( Name() ) ;
1674 RetVal = aDataFlowExecutor->IsDone() ;
1677 // endService( "CNode_Impl::IsDone" );
1681 bool CNode_Impl::IsSuspended() {
1682 // beginService( "CNode_Impl::IsSuspended" );
1683 bool RetVal = false ;
1684 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1685 if ( aDataFlowExecutor ) {
1687 RetVal = aDataFlowExecutor->IsSuspended( Name() ) ;
1690 RetVal = aDataFlowExecutor->IsSuspended() ;
1693 // endService( "CNode_Impl::IsSuspended" );
1697 bool CNode_Impl::ReadyW() {
1698 // beginService( "CNode_Impl::ReadyW" );
1699 bool RetVal = false ;
1700 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1701 if ( aDataFlowExecutor ) {
1703 RetVal = aDataFlowExecutor->ReadyWait( Name() ) ;
1706 RetVal = aDataFlowExecutor->ReadyWait() ;
1709 // endService( "CNode_Impl::ReadyW" );
1713 bool CNode_Impl::RunningW() {
1714 // beginService( "CNode_Impl::RunningW" );
1715 bool RetVal = false ;
1716 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1717 if ( aDataFlowExecutor ) {
1719 RetVal = aDataFlowExecutor->RunningWait( Name() ) ;
1722 RetVal = aDataFlowExecutor->RunningWait() ;
1725 // endService( "CNode_Impl::RunningW" );
1729 bool CNode_Impl::DoneW() {
1730 // beginService( "CNode_Impl::DoneW" );
1731 bool RetVal = false ;
1732 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1733 if ( aDataFlowExecutor ) {
1735 RetVal = aDataFlowExecutor->DoneWait( Name() ) ;
1738 RetVal = aDataFlowExecutor->DoneWait() ;
1741 // endService( "CNode_Impl::DoneW" );
1745 bool CNode_Impl::SuspendedW() {
1746 // beginService( "CNode_Impl::SuspendedW" );
1747 bool RetVal = false ;
1748 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1749 if ( aDataFlowExecutor ) {
1751 RetVal = aDataFlowExecutor->SuspendedWait( Name() ) ;
1754 RetVal = aDataFlowExecutor->SuspendedWait() ;
1757 // endService( "CNode_Impl::SuspendedW" );
1761 void CNode_Impl::ping() {
1762 // beginService( "CNode_Impl::ping" );
1763 bool RetVal = false ;
1764 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1765 if ( aDataFlowExecutor ) {
1767 RetVal = aDataFlowExecutor->Ping( Name() ) ;
1773 if ( IsGraph() || IsStreamGraph() ) {
1774 theAutomaton->GraphImpl( (Graph_Impl * ) this ) ;
1776 // endService( "CNode_Impl::ping" );
1780 bool CNode_Impl::ContainerKill() {
1781 beginService( "CNode_Impl::ContainerKill" );
1782 bool RetVal = false ;
1783 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1784 if ( aDataFlowExecutor && IsExecuting() ) {
1786 RetVal = aDataFlowExecutor->ContainerKill( Name() ) ;
1789 RetVal = aDataFlowExecutor->ContainerKill() ;
1792 endService( "CNode_Impl::ContainerKill" );
1795 bool CNode_Impl::Kill() {
1796 beginService( "CNode_Impl::Kill" );
1797 bool RetVal = false ;
1798 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1799 if ( aDataFlowExecutor ) {
1801 RetVal = aDataFlowExecutor->Kill( Name() ) ;
1802 MESSAGE( "Node " << Name() << " execution was killed : " << RetVal ) ;
1805 RetVal = aDataFlowExecutor->Kill() ;
1806 MESSAGE( "Graph execution was killed : " << RetVal ) ;
1809 endService( "CNode_Impl::Kill" );
1812 bool CNode_Impl::KillDone() {
1813 // beginService( "CNode_Impl::KillDone" );
1814 bool RetVal = false ;
1815 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1816 if ( aDataFlowExecutor ) {
1818 RetVal = aDataFlowExecutor->KillDone( Name() ) ;
1821 // endService( "CNode_Impl::KillDone" );
1824 bool CNode_Impl::Stop() {
1825 // beginService( "CNode_Impl::Stop" );
1826 bool RetVal ; // = aDataFlowExecutor->Stop() ;
1827 // endService( "CNode_Impl::Stop" );
1830 bool CNode_Impl::Suspend() {
1831 beginService( "CNode_Impl::Suspend" );
1832 bool RetVal = false ;
1833 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1834 if ( aDataFlowExecutor ) {
1836 MESSAGE( "CNode_Impl::Suspend " << Name() ) ;
1837 RetVal = aDataFlowExecutor->Suspend( Name() ) ;
1840 MESSAGE( "CNode_Impl::Suspend " << aDataFlowExecutor->Graph()->Name() ) ;
1841 RetVal = aDataFlowExecutor->Suspend() ;
1844 endService( "CNode_Impl::Suspend" );
1847 bool CNode_Impl::SuspendDone() {
1848 // beginService( "CNode_Impl::SuspendDone" );
1849 bool RetVal = false ;
1850 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1851 if ( aDataFlowExecutor ) {
1853 RetVal = aDataFlowExecutor->SuspendDone( Name() ) ;
1856 RetVal = aDataFlowExecutor->SuspendDone() ;
1859 // endService( "CNode_Impl::SuspendDone" );
1862 bool CNode_Impl::Resume() {
1863 bool RetVal = false ;
1864 beginService( "CNode_Impl::Resume" );
1865 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1866 if ( aDataFlowExecutor ) {
1868 MESSAGE( "CNode_Impl::Resume " << Name() ) ;
1869 RetVal = aDataFlowExecutor->Resume( Name() ) ;
1872 MESSAGE( "CNode_Impl::Resume " << aDataFlowExecutor->Graph()->Name() ) ;
1873 RetVal = aDataFlowExecutor->Resume() ;
1876 endService( "CNode_Impl::Resume" );
1880 CORBA::Long CNode_Impl::CpuUsed() {
1881 CORBA::Long RetVal = 0 ;
1882 GraphExecutor::DataFlow * aDataFlowExecutor = DataFlowEditor()->Executor() ;
1883 if ( aDataFlowExecutor ) {
1885 RetVal = aDataFlowExecutor->CpuUsed( Name() ) ;
1888 RetVal = aDataFlowExecutor->CpuUsed() ;
1894 bool CNode_Impl::IsExecuting() {
1895 bool RetVal = false;
1896 if ( !IsMacro() && DataFlowEditor() && DataFlowEditor()->Executor() ) {
1897 // asv : the statement below normally does not return true, Executor_OutNode
1898 // sets Editor->Editing() after finishing of execution (see Executor_OutNode.cxx)
1899 if ( DataFlowEditor()->IsExecuting() && DataFlowEditor()->Executor()->IsDone() ) {
1900 DataFlowEditor()->Editing();
1903 RetVal = DataFlowEditor()->IsExecuting();