2 //=============================================================================
3 // File : CNode_Impl.cxx
5 // Author : Jean Rahuel
8 //=============================================================================
15 #include "utilities.h"
17 #include "Graph_Impl.hxx"
19 #include "CNode_Impl.hxx"
21 #include "Port_Impl.hxx"
23 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
24 PortableServer::POA_ptr poa ,
25 PortableServer::ObjectId * contId ,
26 const char *instanceName ,
27 const char *interfaceName ,
28 const char *aDataFlowName ) :
29 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
30 // MESSAGE("CNode_Impl::CNode_Impl activate object instanceName("
31 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
32 // << hex << (void *) this << dec )
34 // _id = _poa->activate_object(_thisObj);
35 MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
36 beginService( "CNode_Impl::CNode_Impl" );
37 _Orb = CORBA::ORB::_duplicate(orb);
40 _DataFlowNode = NULL ;
42 endService( "CNode_Impl::CNode_Impl" );
45 CNode_Impl::CNode_Impl() {
48 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
49 PortableServer::POA_ptr poa ,
50 PortableServer::ObjectId * contId ,
51 const char *instanceName ,
52 const char *interfaceName ,
53 GraphEditor::DataFlow * DataFlowEditor ,
54 const SALOME_ModuleCatalog::Service &NodeService ,
55 const char * NodeName ,
56 const SUPERV::KindOfNode NodeKindOfNode ,
57 const char * FuncName ,
58 const SUPERV::ListOfStrings & PythonFunction ) :
59 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
60 beginService( "CNode_Impl::CNode_Impl" );
61 if ( FuncName && NodeName ) {
62 cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
63 << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
64 << " " << strlen( FuncName ) << endl ;
66 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
67 MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
69 _id = _poa->activate_object(_thisObj);
71 _Orb = CORBA::ORB::_duplicate(orb);
74 _DataFlowEditor = DataFlowEditor ;
75 GraphBase::ListOfFuncName aFuncName ;
76 GraphBase::ListOfPythonFunctions aPythonFunction ;
79 aFuncName[0] = my_strdup( FuncName ) ;
80 aPythonFunction.resize(1) ;
81 aPythonFunction[0] = &PythonFunction ;
83 _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName ,
88 endService( "CNode_Impl::CNode_Impl" );
91 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
92 PortableServer::POA_ptr poa ,
93 PortableServer::ObjectId * contId ,
94 const char *instanceName ,
95 const char *interfaceName ,
96 GraphEditor::DataFlow * DataFlowEditor ,
97 const SALOME_ModuleCatalog::Service &NodeService ,
98 const char * NodeName ,
99 const SUPERV::KindOfNode NodeKindOfNode ,
100 const GraphBase::ListOfFuncName & aFuncName ,
101 const GraphBase::ListOfPythonFunctions & aPythonFunction ) :
102 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
103 MESSAGE( NodeName << " " );
104 beginService( "CNode_Impl::CNode_Impl" );
106 MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ;
108 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
109 MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" );
111 _id = _poa->activate_object(_thisObj);
113 _Orb = CORBA::ORB::_duplicate(orb);
116 _DataFlowEditor = DataFlowEditor ;
117 _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName ,
122 endService( "CNode_Impl::CNode_Impl" );
125 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
126 PortableServer::POA_ptr poa ,
127 PortableServer::ObjectId * contId ,
128 const char *instanceName ,
129 const char *interfaceName ,
130 GraphEditor::DataFlow * DataFlowEditor ,
131 GraphEditor::InNode * DataFlowNode ) :
132 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
133 MESSAGE( DataFlowNode->Name() << " " );
134 beginService( "CNode_Impl::CNode_Impl" );
135 if ( DataFlowNode->IsComputingNode() ) {
136 MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" );
138 _id = _poa->activate_object(_thisObj);
140 _Orb = CORBA::ORB::_duplicate(orb);
143 _DataFlowEditor = DataFlowEditor ;
144 _DataFlowNode = DataFlowNode ;
146 endService( "CNode_Impl::CNode_Impl" );
149 CNode_Impl::~CNode_Impl() {
150 beginService( "CNode_Impl::~CNode_Impl" );
151 endService( "CNode_Impl::~CNode_Impl" );
154 void CNode_Impl::destroy() {
155 beginService( "CNode_Impl::Destroy" );
156 if ( _DataFlowEditor->IsEditing() ) {
158 _DataFlowNode = NULL ;
159 _poa->deactivate_object(*_id) ;
160 CORBA::release(_poa) ;
162 _thisObj->_remove_ref();
165 endService( "CNode_Impl::Destroy" );
168 bool CNode_Impl::Delete() {
169 beginService( "CNode_Impl::Delete" );
170 bool RetVal = false ;
171 if ( _DataFlowEditor->IsEditing() ) {
172 RetVal = _DataFlowEditor->RemoveNode( Name() ) ;
174 RetVal = _DataFlowEditor->IsValid() ;
176 endService( "CNode_Impl::Delete" );
180 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
181 // beginService( "CNode_Impl::Service" );
182 SALOME_ModuleCatalog::Service * RetVal ;
184 RetVal = new SALOME_ModuleCatalog::Service( *_DataFlowNode->GetService() ) ;
187 RetVal = new SALOME_ModuleCatalog::Service( *_DataFlowEditor->GetService() ) ;
189 // endService( "CNode_Impl::Service" );
193 char * CNode_Impl::Name() {
194 // beginService( "CNode_Impl::Name" );
195 char * RetVal = NULL ;
197 RetVal = _DataFlowNode->Name() ;
200 RetVal = _DataFlowEditor->Name() ;
202 // endService( "CNode_Impl::Name" );
203 return CORBA::string_dup( RetVal );
205 bool CNode_Impl::SetName( const char * aDataFlowName ) {
206 // beginService( "CNode_Impl::SetName" );
207 bool RetVal = false ;
208 if ( _DataFlowEditor->IsEditing() ) {
210 RetVal = _DataFlowEditor->ReNameNode( _DataFlowNode->Name() ,
214 RetVal = _DataFlowEditor->Name( aDataFlowName ) ;
217 // endService( "CNode_Impl::SetName" );
220 SUPERV::KindOfNode CNode_Impl::Kind() {
221 // beginService( "CNode_Impl::Kind" );
222 SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
224 RetVal = _DataFlowNode->Kind() ;
227 RetVal = _DataFlowEditor->Kind() ;
229 // endService( "CNode_Impl::Kind" );
232 bool CNode_Impl::IsGraph() {
233 // beginService( "CNode_Impl::IsGraph" );
234 bool RetVal = false ;
236 RetVal = _DataFlowNode->IsDataFlowNode() ;
239 RetVal = _DataFlowEditor->IsDataFlowNode() ;
241 // endService( "CNode_Impl::IsGraph" );
244 bool CNode_Impl::IsComputing() {
245 // beginService( "CNode_Impl::IsComputing" );
246 bool RetVal = SUPERV::UnknownNode ;
248 RetVal = _DataFlowNode->IsComputingNode() ;
251 RetVal = _DataFlowEditor->IsComputingNode() ;
253 // endService( "CNode_Impl::IsComputing" );
256 bool CNode_Impl::IsFactory() {
257 // beginService( "CNode_Impl::IsFactory" );
258 bool RetVal = SUPERV::UnknownNode ;
260 RetVal = _DataFlowNode->IsFactoryNode() ;
263 RetVal = _DataFlowEditor->IsFactoryNode() ;
265 // endService( "CNode_Impl::IsFactory" );
268 bool CNode_Impl::IsInLine() {
269 // beginService( "CNode_Impl::IsInLine" );
270 bool RetVal = SUPERV::UnknownNode ;
272 RetVal = _DataFlowNode->IsInLineNode() ;
275 RetVal = _DataFlowEditor->IsInLineNode() ;
277 // endService( "CNode_Impl::IsInLine" );
280 bool CNode_Impl::IsGOTO() {
281 // beginService( "CNode_Impl::IsGOTO" );
282 bool RetVal = SUPERV::UnknownNode ;
284 RetVal = _DataFlowNode->IsGOTONode() ;
287 RetVal = _DataFlowEditor->IsGOTONode() ;
289 // endService( "CNode_Impl::IsGOTO" );
292 bool CNode_Impl::IsLoop() {
293 // beginService( "CNode_Impl::IsLoop" );
294 bool RetVal = SUPERV::UnknownNode ;
296 RetVal = _DataFlowNode->IsLoopNode() ;
299 RetVal = _DataFlowEditor->IsLoopNode() ;
301 // endService( "CNode_Impl::IsLoop" );
304 bool CNode_Impl::IsEndLoop() {
305 // beginService( "CNode_Impl::IsEndLoop" );
306 bool RetVal = SUPERV::UnknownNode ;
308 RetVal = _DataFlowNode->IsEndLoopNode() ;
311 RetVal = _DataFlowEditor->IsEndLoopNode() ;
313 // endService( "CNode_Impl::IsEndLoop" );
316 bool CNode_Impl::IsSwitch() {
317 // beginService( "CNode_Impl::IsSwitch" );
318 bool RetVal = SUPERV::UnknownNode ;
320 RetVal = _DataFlowNode->IsSwitchNode() ;
323 RetVal = _DataFlowEditor->IsSwitchNode() ;
325 // endService( "CNode_Impl::IsSwitch" );
328 bool CNode_Impl::IsEndSwitch() {
329 // beginService( "CNode_Impl::IsEndSwitch" );
330 bool RetVal = SUPERV::UnknownNode ;
332 RetVal = _DataFlowNode->IsEndSwitchNode() ;
335 RetVal = _DataFlowEditor->IsEndSwitchNode() ;
337 // endService( "CNode_Impl::IsEndSwitch" );
341 SUPERV::SDate CNode_Impl::CreationDate() {
342 // beginService( "CNode_Impl::CreationDate" );
343 SUPERV::SDate_var RetVal ;
345 RetVal = new SUPERV::SDate( _DataFlowNode->FirstCreation() ) ;
348 // cout << " CNode_Impl::CreationDate " << _DataFlowEditor->FirstCreation()
350 RetVal = new SUPERV::SDate( _DataFlowEditor->FirstCreation() ) ;
352 // endService( "CNode_Impl::CreationDate" );
353 return (RetVal._retn()) ;
355 SUPERV::SDate CNode_Impl::LastUpdateDate() {
356 // beginService( "CNode_Impl::LastUpdateDate" );
357 SUPERV::SDate_var RetVal ;
359 RetVal = new SUPERV::SDate( _DataFlowNode->LastModification() ) ;
362 RetVal = new SUPERV::SDate( _DataFlowEditor->LastModification() ) ;
364 // endService( "CNode_Impl::LastUpdateDate" );
365 return (RetVal._retn()) ;
367 char * CNode_Impl::Version() {
368 // beginService( "CNode_Impl::Version" );
371 RetVal = _DataFlowNode->EditorRelease() ;
374 RetVal = _DataFlowEditor->EditorRelease() ;
376 // endService( "CNode_Impl::Version" );
377 return CORBA::string_dup( RetVal ) ;
379 char * CNode_Impl::Author() {
380 // beginService( "CNode_Impl::Author" );
383 RetVal = _DataFlowNode->Author() ;
386 RetVal = _DataFlowEditor->Author() ;
388 // endService( "CNode_Impl::Author" );
389 return CORBA::string_dup( RetVal ) ;
391 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
392 // beginService( "CNode_Impl::SetAuthor" );
393 bool RetVal = false ;
394 if ( _DataFlowEditor->IsEditing() ) {
396 RetVal = _DataFlowNode->Author( aDataFlowAuthor ) ;
399 RetVal = _DataFlowEditor->Author( aDataFlowAuthor ) ;
402 // endService( "CNode_Impl::SetAuthor" );
405 char * CNode_Impl::Comment() {
406 // beginService( "CNode_Impl::Comment" );
409 RetVal = _DataFlowNode->Comment() ;
412 RetVal = _DataFlowEditor->Comment() ;
414 // endService( "CNode_Impl::Comment" );
415 return CORBA::string_dup( RetVal ) ;
417 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
418 // beginService( "CNode_Impl::SetComment" );
419 bool RetVal = false ;
420 if ( _DataFlowEditor->IsEditing() ) {
422 RetVal = _DataFlowNode->Comment( aDataFlowComment ) ;
425 RetVal = _DataFlowEditor->Comment( aDataFlowComment ) ;
428 // endService( "CNode_Impl::SetComment" );
432 SUPERV::ListOfLinks * CNode_Impl::Links() {
433 beginService( "CNode_Impl::Links" ) ;
434 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
435 if ( _DataFlowNode ) {
436 RetVal = DataFlowEditor()->ObjImpl()->Links( _DataFlowNode->ComputingNode() , NULL ) ;
438 endService( "CNode_Impl::Links" ) ;
439 return ( RetVal._retn() ) ;
442 void CNode_Impl::Coords(long X , long Y ) {
443 // beginService( "CNode_Impl::Coords" );
444 if ( _DataFlowEditor->IsEditing() ) {
446 ((GraphEditor::InNode *) _DataFlowNode)->Coordinates( X , Y ) ;
449 _DataFlowEditor->Coordinates( X , Y ) ;
452 // endService( "CNode_Impl::Coords" );
454 long CNode_Impl::X() {
455 // beginService( "CNode_Impl::X" );
458 RetVal = _DataFlowNode->XCoordinate() ;
461 // RetVal = _DataFlowEditor->XCoordinate() ;
464 // endService( "CNode_Impl::X" );
467 long CNode_Impl::Y() {
468 // beginService( "CNode_Impl::Y" );
471 RetVal = _DataFlowNode->YCoordinate() ;
474 // RetVal = _DataFlowEditor->YCoordinate() ;
477 // endService( "CNode_Impl::Y" );
482 SUPERV::Link_ptr CNode_Impl::Link( const char * ToServiceParameterName ,
483 const SUPERV::Value_ptr aValue ) {
484 beginService( "CNode_Impl::Link" );
485 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
486 instanceName() , interfaceName() ,
489 ToServiceParameterName ,
491 PortableServer::ObjectId * id = myLink->getId() ;
492 CORBA::Object_var obj = _poa->id_to_reference(*id);
493 SUPERV::Link_var iobject ;
494 iobject = SUPERV::Link::_narrow(obj) ;
495 endService( "CNode_Impl::Link" );
496 return SUPERV::Link::_duplicate( iobject ) ;
500 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
502 Port_Impl * myPort = NULL ;
503 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
506 aninport = _DataFlowNode->GetInPort( ServiceParameterName ) ;
509 aninport = _DataFlowEditor->GetInPort( ServiceParameterName ) ;
513 anoutport = _DataFlowNode->GetOutPort( ServiceParameterName ) ;
516 anoutport = _DataFlowEditor->GetOutPort( ServiceParameterName ) ;
519 GraphBase::InPort * anInPort ;
521 anInPort = _DataFlowNode->GetChangeInPort( ServiceParameterName ) ;
524 anInPort = _DataFlowEditor->GetChangeInPort( ServiceParameterName ) ;
526 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
528 beginService( "CNode_Impl::Port" );
533 hasinput = _DataFlowNode->HasInput( anInPort->PortName() ) ;
536 hasinput = _DataFlowEditor->HasInput( anInPort->PortName() ) ;
539 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
540 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
541 instanceName() , interfaceName() ,
544 // ServiceParameterName ,
545 (GraphBase::Port * ) anInPort ,
550 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
551 instanceName() , interfaceName() ,
554 // ServiceParameterName ) ;
555 (GraphBase::Port * ) anInPort ,
558 PortableServer::ObjectId * id = myPort->getId() ;
559 CORBA::Object_var obj = _poa->id_to_reference(*id);
560 iobject = SUPERV::Port::_narrow(obj) ;
561 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
564 iobject = anInPort->ObjRef() ;
567 else if ( anoutport ) {
568 GraphBase::OutPort * anOutPort ;
570 anOutPort = _DataFlowNode->GetChangeOutPort( ServiceParameterName ) ;
573 anOutPort = _DataFlowEditor->GetChangeOutPort( ServiceParameterName ) ;
575 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
577 beginService( "CNode_Impl::Port" );
580 const CORBA::Any * anAny = anOutPort->Value() ;
581 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
582 instanceName() , interfaceName() ,
585 // ServiceParameterName ,
586 (GraphBase::Port * ) anOutPort ,
589 PortableServer::ObjectId * id = myPort->getId() ;
590 CORBA::Object_var obj = _poa->id_to_reference(*id);
591 iobject = SUPERV::Port::_narrow(obj) ;
592 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
595 iobject = anOutPort->ObjRef() ;
599 endService( "CNode_Impl::Port" );
601 return SUPERV::Port::_duplicate( iobject ) ;
604 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
605 const SUPERV::Value_ptr aValue ) {
607 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
608 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
609 if ( _DataFlowEditor->IsEditing() ) {
611 GraphBase::InPort * anInPort ;
613 sts = _DataFlowEditor->AddInputData( _DataFlowNode->Name() ,
614 ToServiceParameterName ,
616 anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
619 sts = _DataFlowEditor->AddInputData( _DataFlowEditor->Name() ,
620 ToServiceParameterName ,
622 anInPort = _DataFlowEditor->GetChangeInPort( ToServiceParameterName ) ;
624 if ( sts && anInPort ) {
625 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
627 beginService( "CNode_Impl::Input" );
631 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
632 instanceName() , interfaceName() ,
635 // ToServiceParameterName ,
636 (GraphBase::Port * ) anInPort ,
639 PortableServer::ObjectId * id = myPort->getId() ;
640 CORBA::Object_var obj = _poa->id_to_reference(*id);
641 iobject = SUPERV::Port::_narrow(obj) ;
642 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
645 iobject = anInPort->ObjRef() ;
649 else if ( _DataFlowExecutor ) {
651 GraphBase::InPort * anInPort ;
653 sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Name() ,
654 ToServiceParameterName ,
656 anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
659 sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Name() ,
660 ToServiceParameterName ,
662 anInPort = _DataFlowEditor->GetChangeInPort( ToServiceParameterName ) ;
664 if ( sts && anInPort ) {
665 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
667 beginService( "CNode_Impl::Input" );
671 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
672 instanceName() , interfaceName() ,
675 // ToServiceParameterName ,
676 (GraphBase::Port * ) anInPort ,
679 PortableServer::ObjectId * id = myPort->getId() ;
680 CORBA::Object_var obj = _poa->id_to_reference(*id);
681 iobject = SUPERV::Port::_narrow(obj) ;
682 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
685 iobject = anInPort->ObjRef() ;
690 endService( "CNode_Impl::Input" );
692 return SUPERV::Port::_duplicate( iobject ) ;
695 SUPERV::ListOfPorts * CNode_Impl::Ports() {
697 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
698 // if ( !_DataFlowNode->IsDataFlowNode() ) {
701 RetVal->length( _DataFlowNode->GetNodeInPortsSize() +
702 _DataFlowNode->GetNodeOutPortsSize() ) ;
703 for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) {
704 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ;
705 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
707 beginService( "CNode_Impl::Ports" );
711 if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) {
712 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
713 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
714 instanceName() , interfaceName() ,
717 // anInPort->PortName() ,
718 (GraphBase::Port * ) anInPort ,
723 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
724 instanceName() , interfaceName() ,
727 // anInPort->PortName() ) ;
728 (GraphBase::Port * ) anInPort ,
731 PortableServer::ObjectId * id = myPort->getId() ;
732 CORBA::Object_var obj = _poa->id_to_reference(*id);
733 SUPERV::Port_var iobject ;
734 iobject = SUPERV::Port::_narrow(obj) ;
735 RetVal[ i ] = SUPERV::Port::_duplicate( iobject ) ;
736 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
739 RetVal[ i ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
742 for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) {
743 GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ;
744 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
746 beginService( "CNode_Impl::Ports" );
749 const CORBA::Any * anAny = anOutPort->Value() ;
750 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
751 instanceName() , interfaceName() ,
754 // anOutPort->PortName() ,
755 (GraphBase::Port * ) anOutPort ,
758 PortableServer::ObjectId * id = myPort->getId() ;
759 CORBA::Object_var obj = _poa->id_to_reference(*id);
760 SUPERV::Port_var iobject ;
761 iobject = SUPERV::Port::_narrow(obj) ;
762 RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( iobject ) ;
763 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
766 RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
771 if ( _DataFlowEditor->IsValid() ) {
773 RetVal->length( _DataFlowEditor->GetNodeInDataNodePortsSize() +
774 _DataFlowEditor->GetNodeOutDataNodePortsSize() ) ;
775 for ( i = 0 ; i < _DataFlowEditor->GetNodeInDataNodePortsSize() ; i++ ) {
776 GraphBase::OutPort * anOutPort = _DataFlowEditor->GetChangeNodeInDataNodePort(i) ;
777 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
779 beginService( "CNode_Impl::Ports" );
783 if ( anOutPort->IsDataConnected() ) {
784 const CORBA::Any * anAny = anOutPort->Value() ;
785 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
786 instanceName() , interfaceName() ,
789 // anOutPort->PortName() ,
790 (GraphBase::Port * ) anOutPort ,
795 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
796 instanceName() , interfaceName() ,
799 // anOutPort->PortName() ) ;
800 (GraphBase::Port * ) anOutPort ,
803 PortableServer::ObjectId * id = myPort->getId() ;
804 CORBA::Object_var obj = _poa->id_to_reference(*id);
805 SUPERV::Port_var iobject ;
806 iobject = SUPERV::Port::_narrow(obj) ;
807 RetVal[ i ] = SUPERV::Port::_duplicate( iobject ) ;
808 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
811 RetVal[ i ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
814 j = _DataFlowEditor->GetNodeInDataNodePortsSize() ;
815 for ( i = 0 ; i < _DataFlowEditor->GetNodeOutDataNodePortsSize() ; i++ ) {
816 GraphBase::InPort * anInPort = _DataFlowEditor->GetChangeNodeOutDataNodePort(i) ;
817 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
819 beginService( "CNode_Impl::Ports" );
823 if ( anInPort->IsDataConnected() ) {
824 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
825 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
826 instanceName() , interfaceName() ,
829 // anInPort->PortName() ,
830 (GraphBase::Port * ) anInPort ,
835 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
836 instanceName() , interfaceName() ,
839 // anInPort->PortName() ) ;
843 PortableServer::ObjectId * id = myPort->getId() ;
844 CORBA::Object_var obj = _poa->id_to_reference(*id);
845 SUPERV::Port_var iobject ;
846 iobject = SUPERV::Port::_narrow(obj) ;
847 RetVal[ j + i ] = SUPERV::Port::_duplicate( iobject ) ;
848 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
851 RetVal[ j + i ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
857 endService( "CNode_Impl::Ports" );
859 return ( RetVal._retn() ) ;
862 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
864 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
866 char* FromServiceParameterName ;
867 bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
868 ToServiceParameterName ,
870 & FromServiceParameterName ) ;
872 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
873 if ( anInPort->GetOutPort() ) {
874 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
875 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
877 beginService( "CNode_Impl::GetLink" );
880 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
881 instanceName() , interfaceName() ,
884 ToServiceParameterName ,
885 (GraphEditor::InNode *) _DataFlowEditor->GetChangeGraphNode( FromNodeName )->GetInNode() ,
886 FromServiceParameterName ,
888 PortableServer::ObjectId * id = myLink->getId() ;
889 CORBA::Object_var obj = _poa->id_to_reference(*id);
890 iobject = SUPERV::Link::_narrow(obj) ;
891 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
894 iobject = anOutPort->InPortObjRef( anInPort ) ;
899 endService( "CNode_Impl::GetLink" );
901 return SUPERV::Link::_duplicate( iobject ) ;
904 long CNode_Impl::SubGraph() {
905 // beginService( "CNode_Impl::SubGraph" );
908 RetVal = _DataFlowNode->SubGraph() ;
910 // endService( "CNode_Impl::SubGraph" );
914 bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
915 // beginService( "CNode_Impl::IsLinked" );
916 bool RetVal = _DataFlowNode->IsLinked( ServiceParameterName ) ;
917 // endService( "CNode_Impl::IsLinked" );
921 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
922 // beginService( "CNode_Impl::HasInput" );
923 bool RetVal = _DataFlowNode->HasInput( ServiceParameterName ) ;
924 // endService( "CNode_Impl::HasInput" );
928 SUPERV::GraphState CNode_Impl::State() {
929 // beginService( "CNode_Impl::State" );
930 SUPERV::GraphState RetVal = SUPERV::EditingState ;
931 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
932 if ( _DataFlowExecutor ) {
934 RetVal = _DataFlowExecutor->State( Name() ) ;
937 RetVal = _DataFlowExecutor->State() ;
940 // endService( "CNode_Impl::State" );
943 long CNode_Impl::Thread() {
944 // beginService( "CNode_Impl::Thread" );
946 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
947 if ( _DataFlowExecutor ) {
949 RetVal = _DataFlowExecutor->Thread( Name() ) ;
952 RetVal = _DataFlowExecutor->Thread() ;
955 // endService( "CNode_Impl::Thread" );
958 SUPERV::AutomatonState CNode_Impl::AutoState() {
959 // beginService( "CNode_Impl::AutoState" );
960 SUPERV::AutomatonState RetVal = SUPERV::UnKnownState ;
961 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
962 if ( _DataFlowExecutor ) {
964 RetVal = _DataFlowExecutor->AutomatonState( Name() ) ;
967 RetVal = _DataFlowExecutor->AutomatonState() ;
970 // endService( "CNode_Impl::AutoState" );
973 SUPERV::ControlState CNode_Impl::Control() {
974 // beginService( "CNode_Impl::Control" );
975 SUPERV::ControlState RetVal = SUPERV::VoidState ;
976 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
977 if ( _DataFlowExecutor ) {
979 RetVal = _DataFlowExecutor->ControlState( Name() ) ;
982 RetVal = _DataFlowExecutor->ControlState() ;
985 // endService( "CNode_Impl::Control" );
988 void CNode_Impl::ControlClear() {
989 // beginService( "CNode_Impl::ControlClear" );
990 SUPERV::ControlState RetVal = SUPERV::VoidState ;
991 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
992 if ( _DataFlowExecutor ) {
994 _DataFlowExecutor->ControlClear( Name() ) ;
997 _DataFlowExecutor->ControlClear() ;
1000 // endService( "CNode_Impl::ControlClear" );
1004 bool CNode_Impl::IsReady() {
1005 // beginService( "CNode_Impl::IsReady" );
1006 bool RetVal = false ;
1007 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1008 if ( _DataFlowExecutor ) {
1010 RetVal = _DataFlowExecutor->IsReady( Name() ) ;
1013 RetVal = _DataFlowExecutor->IsReady() ;
1016 // endService( "CNode_Impl::IsReady" );
1020 bool CNode_Impl::IsWaiting() {
1021 // beginService( "CNode_Impl::IsWaiting" );
1022 bool RetVal = false ;
1023 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1024 if ( _DataFlowExecutor ) {
1026 RetVal = _DataFlowExecutor->IsWaiting( Name() ) ;
1029 RetVal = _DataFlowExecutor->IsWaiting() ;
1032 // endService( "CNode_Impl::IsWaiting" );
1036 bool CNode_Impl::IsRunning() {
1037 // beginService( "CNode_Impl::IsRunning" );
1038 bool RetVal = false ;
1039 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1040 if ( _DataFlowExecutor ) {
1042 RetVal = _DataFlowExecutor->IsRunning( Name() ) ;
1045 RetVal = _DataFlowExecutor->IsRunning() ;
1048 // endService( "CNode_Impl::IsRunning" );
1052 bool CNode_Impl::IsDone() {
1053 // beginService( "CNode_Impl::IsDone" );
1054 bool RetVal = false ;
1055 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1056 if ( _DataFlowExecutor ) {
1058 RetVal = _DataFlowExecutor->IsDone( Name() ) ;
1061 RetVal = _DataFlowExecutor->IsDone() ;
1064 // endService( "CNode_Impl::IsDone" );
1068 bool CNode_Impl::IsSuspended() {
1069 // beginService( "CNode_Impl::IsSuspended" );
1070 bool RetVal = false ;
1071 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1072 if ( _DataFlowExecutor ) {
1074 RetVal = _DataFlowExecutor->IsSuspended( Name() ) ;
1077 RetVal = _DataFlowExecutor->IsSuspended() ;
1080 // endService( "CNode_Impl::IsSuspended" );
1084 bool CNode_Impl::ReadyW() {
1085 // beginService( "CNode_Impl::ReadyW" );
1086 bool RetVal = false ;
1087 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1088 if ( _DataFlowExecutor ) {
1090 RetVal = _DataFlowExecutor->ReadyWait( Name() ) ;
1093 RetVal = _DataFlowExecutor->ReadyWait() ;
1096 // endService( "CNode_Impl::ReadyW" );
1100 bool CNode_Impl::RunningW() {
1101 // beginService( "CNode_Impl::RunningW" );
1102 bool RetVal = false ;
1103 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1104 if ( _DataFlowExecutor ) {
1106 RetVal = _DataFlowExecutor->RunningWait( Name() ) ;
1109 RetVal = _DataFlowExecutor->RunningWait() ;
1112 // endService( "CNode_Impl::RunningW" );
1116 bool CNode_Impl::DoneW() {
1117 // beginService( "CNode_Impl::DoneW" );
1118 bool RetVal = false ;
1119 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1120 if ( _DataFlowExecutor ) {
1122 RetVal = _DataFlowExecutor->DoneWait( Name() ) ;
1125 RetVal = _DataFlowExecutor->DoneWait() ;
1128 // endService( "CNode_Impl::DoneW" );
1132 bool CNode_Impl::SuspendedW() {
1133 // beginService( "CNode_Impl::SuspendedW" );
1134 bool RetVal = false ;
1135 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1136 if ( _DataFlowExecutor ) {
1138 RetVal = _DataFlowExecutor->SuspendedWait( Name() ) ;
1141 RetVal = _DataFlowExecutor->SuspendedWait() ;
1144 // endService( "CNode_Impl::SuspendedW" );
1148 void CNode_Impl::ping() {
1149 // beginService( "CNode_Impl::ping" );
1150 bool RetVal = false ;
1151 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1152 if ( _DataFlowExecutor ) {
1154 RetVal = _DataFlowExecutor->Ping( Name() ) ;
1160 // endService( "CNode_Impl::ping" );
1164 bool CNode_Impl::ContainerKill() {
1165 beginService( "CNode_Impl::ContainerKill" );
1166 bool RetVal = false ;
1167 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1168 if ( _DataFlowExecutor && _DataFlowEditor->IsExecuting() ) {
1170 RetVal = _DataFlowExecutor->ContainerKill( Name() ) ;
1173 RetVal = _DataFlowExecutor->ContainerKill() ;
1176 endService( "CNode_Impl::ContainerKill" );
1179 bool CNode_Impl::Kill() {
1180 // beginService( "CNode_Impl::Kill" );
1181 bool RetVal = false ;
1182 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1183 if ( _DataFlowExecutor ) {
1185 RetVal = _DataFlowExecutor->Kill( Name() ) ;
1188 RetVal = _DataFlowExecutor->Kill() ;
1191 // endService( "CNode_Impl::Kill" );
1194 bool CNode_Impl::KillDone() {
1195 // beginService( "CNode_Impl::KillDone" );
1196 bool RetVal = false ;
1197 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1198 if ( _DataFlowExecutor ) {
1200 RetVal = _DataFlowExecutor->KillDone( Name() ) ;
1203 // endService( "CNode_Impl::KillDone" );
1206 bool CNode_Impl::Stop() {
1207 // beginService( "CNode_Impl::Stop" );
1208 bool RetVal ; // = _DataFlowExecutor->Stop() ;
1209 // endService( "CNode_Impl::Stop" );
1212 bool CNode_Impl::Suspend() {
1213 // beginService( "CNode_Impl::Suspend" );
1214 bool RetVal = false ;
1215 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1216 if ( _DataFlowExecutor ) {
1218 RetVal = _DataFlowExecutor->Suspend( Name() ) ;
1221 RetVal = _DataFlowExecutor->Suspend() ;
1224 // endService( "CNode_Impl::Suspend" );
1227 bool CNode_Impl::SuspendDone() {
1228 // beginService( "CNode_Impl::SuspendDone" );
1229 bool RetVal = false ;
1230 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1231 if ( _DataFlowExecutor ) {
1233 RetVal = _DataFlowExecutor->SuspendDone( Name() ) ;
1236 RetVal = _DataFlowExecutor->SuspendDone() ;
1239 // endService( "CNode_Impl::SuspendDone" );
1242 bool CNode_Impl::Resume() {
1243 // beginService( "CNode_Impl::Resume" );
1244 bool RetVal = false ;
1245 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1246 if ( _DataFlowExecutor ) {
1248 RetVal = _DataFlowExecutor->Resume( Name() ) ;
1251 RetVal = _DataFlowExecutor->Resume() ;
1254 // endService( "CNode_Impl::Resume" );
1258 bool CNode_Impl::ReRun() {
1259 beginService( "CNode_Impl::ReRun" );
1260 bool RetVal = false ;
1261 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1262 if ( _DataFlowExecutor ) {
1264 RetVal = _DataFlowExecutor->Run( Name() , Name() , false ) ;
1267 RetVal = _DataFlowExecutor->Run( false ) ;
1270 endService( "CNode_Impl::ReRun" );
1274 bool CNode_Impl::ReRunAt( const char * aNodeName ) {
1275 beginService( "CNode_Impl::ReRunAt" );
1276 bool RetVal = false ;
1277 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1278 if ( _DataFlowExecutor ) {
1280 RetVal = _DataFlowExecutor->Run( Name() , aNodeName , false ) ;
1283 endService( "CNode_Impl::ReRunAt" );
1287 bool CNode_Impl::ReStart() {
1288 beginService( "CNode_Impl::ReStart" );
1289 bool RetVal = false ;
1290 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1291 if ( _DataFlowExecutor ) {
1293 RetVal = _DataFlowExecutor->Run( Name() , Name() , true ) ;
1296 RetVal = _DataFlowExecutor->Run( true ) ;
1299 endService( "CNode_Impl::ReStart" );
1303 bool CNode_Impl::ReStartAt( const char * aNodeName ) {
1304 beginService( "CNode_Impl::ReStartAt" );
1305 bool RetVal = false ;
1306 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1307 if ( _DataFlowExecutor ) {
1309 RetVal = _DataFlowExecutor->Run( Name() , aNodeName , true ) ;
1312 endService( "CNode_Impl::ReStartAt" );