1 // SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : CNode_Impl.cxx
8 // Author : Jean Rahuel
18 #include "utilities.h"
20 #include "Graph_Impl.hxx"
22 #include "CNode_Impl.hxx"
24 #include "Port_Impl.hxx"
26 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
27 PortableServer::POA_ptr poa ,
28 PortableServer::ObjectId * contId ,
29 const char *instanceName ,
30 const char *interfaceName ,
31 const char *aDataFlowName ) :
32 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
33 // MESSAGE("CNode_Impl::CNode_Impl activate object instanceName("
34 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
35 // << hex << (void *) this << dec )
37 // _id = _poa->activate_object(_thisObj);
38 MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
39 beginService( "CNode_Impl::CNode_Impl" );
40 _Orb = CORBA::ORB::_duplicate(orb);
43 _DataFlowNode = NULL ;
45 endService( "CNode_Impl::CNode_Impl" );
48 CNode_Impl::CNode_Impl() {
51 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
52 PortableServer::POA_ptr poa ,
53 PortableServer::ObjectId * contId ,
54 const char *instanceName ,
55 const char *interfaceName ,
56 GraphEditor::DataFlow * DataFlowEditor ,
57 const SALOME_ModuleCatalog::Service &NodeService ,
58 const char * NodeName ,
59 const SUPERV::KindOfNode NodeKindOfNode ,
60 const char * FuncName ,
61 const SUPERV::ListOfStrings & PythonFunction ) :
62 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
63 // beginService( "CNode_Impl::CNode_Impl" );
64 if ( FuncName && NodeName ) {
65 cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
66 << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
67 << " " << strlen( FuncName ) << endl ;
69 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
70 MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
72 _id = _poa->activate_object(_thisObj);
74 _Orb = CORBA::ORB::_duplicate(orb);
77 _DataFlowEditor = DataFlowEditor ;
78 GraphBase::ListOfFuncName aFuncName ;
79 GraphBase::ListOfPythonFunctions aPythonFunction ;
82 aFuncName[0] = my_strdup( FuncName ) ;
83 aPythonFunction.resize(1) ;
84 aPythonFunction[0] = &PythonFunction ;
86 _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName ,
91 // endService( "CNode_Impl::CNode_Impl" );
94 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
95 PortableServer::POA_ptr poa ,
96 PortableServer::ObjectId * contId ,
97 const char *instanceName ,
98 const char *interfaceName ,
99 GraphEditor::DataFlow * DataFlowEditor ,
100 const SALOME_ModuleCatalog::Service &NodeService ,
101 const char * NodeName ,
102 const SUPERV::KindOfNode NodeKindOfNode ,
103 const GraphBase::ListOfFuncName & aFuncName ,
104 const GraphBase::ListOfPythonFunctions & aPythonFunction ) :
105 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
106 MESSAGE( NodeName << " " );
107 beginService( "CNode_Impl::CNode_Impl" );
109 MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ;
111 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
112 MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" );
114 _id = _poa->activate_object(_thisObj);
116 _Orb = CORBA::ORB::_duplicate(orb);
119 _DataFlowEditor = DataFlowEditor ;
120 _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName ,
125 endService( "CNode_Impl::CNode_Impl" );
128 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
129 PortableServer::POA_ptr poa ,
130 PortableServer::ObjectId * contId ,
131 const char *instanceName ,
132 const char *interfaceName ,
133 GraphEditor::DataFlow * DataFlowEditor ,
134 GraphEditor::InNode * DataFlowNode ) :
135 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
136 MESSAGE( DataFlowNode->Name() << " " );
137 beginService( "CNode_Impl::CNode_Impl" );
138 if ( DataFlowNode->IsComputingNode() ) {
139 MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" );
141 _id = _poa->activate_object(_thisObj);
143 _Orb = CORBA::ORB::_duplicate(orb);
146 _DataFlowEditor = DataFlowEditor ;
147 _DataFlowNode = DataFlowNode ;
149 endService( "CNode_Impl::CNode_Impl" );
152 CNode_Impl::~CNode_Impl() {
153 beginService( "CNode_Impl::~CNode_Impl" );
154 endService( "CNode_Impl::~CNode_Impl" );
157 void CNode_Impl::destroy() {
158 beginService( "CNode_Impl::Destroy" );
159 if ( _DataFlowEditor->IsEditing() ) {
161 _DataFlowNode = NULL ;
162 _poa->deactivate_object(*_id) ;
163 CORBA::release(_poa) ;
165 _thisObj->_remove_ref();
168 endService( "CNode_Impl::Destroy" );
171 bool CNode_Impl::Delete() {
172 beginService( "CNode_Impl::Delete" );
173 bool RetVal = false ;
174 if ( _DataFlowEditor->IsEditing() ) {
175 RetVal = _DataFlowEditor->RemoveNode( Name() ) ;
177 RetVal = _DataFlowEditor->IsValid() ;
179 endService( "CNode_Impl::Delete" );
183 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
184 // beginService( "CNode_Impl::Service" );
185 SALOME_ModuleCatalog::Service * RetVal ;
187 RetVal = new SALOME_ModuleCatalog::Service( *_DataFlowNode->GetService() ) ;
190 RetVal = new SALOME_ModuleCatalog::Service( *_DataFlowEditor->GetService() ) ;
192 // endService( "CNode_Impl::Service" );
196 char * CNode_Impl::Name() {
197 // beginService( "CNode_Impl::Name" );
198 char * RetVal = NULL ;
200 RetVal = _DataFlowNode->Name() ;
203 RetVal = _DataFlowEditor->Name() ;
205 // endService( "CNode_Impl::Name" );
206 return CORBA::string_dup( RetVal );
208 bool CNode_Impl::SetName( const char * aDataFlowName ) {
209 // beginService( "CNode_Impl::SetName" );
210 bool RetVal = false ;
211 if ( _DataFlowEditor->IsEditing() ) {
213 RetVal = _DataFlowEditor->ReNameNode( _DataFlowNode->Name() ,
217 RetVal = _DataFlowEditor->Name( aDataFlowName ) ;
220 // endService( "CNode_Impl::SetName" );
223 SUPERV::KindOfNode CNode_Impl::Kind() {
224 // beginService( "CNode_Impl::Kind" );
225 SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
227 RetVal = _DataFlowNode->Kind() ;
230 RetVal = _DataFlowEditor->Kind() ;
232 // endService( "CNode_Impl::Kind" );
235 bool CNode_Impl::IsGraph() {
236 // beginService( "CNode_Impl::IsGraph" );
237 bool RetVal = false ;
239 RetVal = _DataFlowNode->IsDataFlowNode() ;
242 RetVal = _DataFlowEditor->IsDataFlowNode() ;
244 // endService( "CNode_Impl::IsGraph" );
247 bool CNode_Impl::IsComputing() {
248 // beginService( "CNode_Impl::IsComputing" );
249 bool RetVal = SUPERV::UnknownNode ;
251 RetVal = _DataFlowNode->IsComputingNode() ;
254 RetVal = _DataFlowEditor->IsComputingNode() ;
256 // endService( "CNode_Impl::IsComputing" );
259 bool CNode_Impl::IsFactory() {
260 // beginService( "CNode_Impl::IsFactory" );
261 bool RetVal = SUPERV::UnknownNode ;
263 RetVal = _DataFlowNode->IsFactoryNode() ;
266 RetVal = _DataFlowEditor->IsFactoryNode() ;
268 // endService( "CNode_Impl::IsFactory" );
271 bool CNode_Impl::IsInLine() {
272 // beginService( "CNode_Impl::IsInLine" );
273 bool RetVal = SUPERV::UnknownNode ;
275 RetVal = _DataFlowNode->IsInLineNode() ;
278 RetVal = _DataFlowEditor->IsInLineNode() ;
280 // endService( "CNode_Impl::IsInLine" );
283 bool CNode_Impl::IsGOTO() {
284 // beginService( "CNode_Impl::IsGOTO" );
285 bool RetVal = SUPERV::UnknownNode ;
287 RetVal = _DataFlowNode->IsGOTONode() ;
290 RetVal = _DataFlowEditor->IsGOTONode() ;
292 // endService( "CNode_Impl::IsGOTO" );
295 bool CNode_Impl::IsLoop() {
296 // beginService( "CNode_Impl::IsLoop" );
297 bool RetVal = SUPERV::UnknownNode ;
299 RetVal = _DataFlowNode->IsLoopNode() ;
302 RetVal = _DataFlowEditor->IsLoopNode() ;
304 // endService( "CNode_Impl::IsLoop" );
307 bool CNode_Impl::IsEndLoop() {
308 // beginService( "CNode_Impl::IsEndLoop" );
309 bool RetVal = SUPERV::UnknownNode ;
311 RetVal = _DataFlowNode->IsEndLoopNode() ;
314 RetVal = _DataFlowEditor->IsEndLoopNode() ;
316 // endService( "CNode_Impl::IsEndLoop" );
319 bool CNode_Impl::IsSwitch() {
320 // beginService( "CNode_Impl::IsSwitch" );
321 bool RetVal = SUPERV::UnknownNode ;
323 RetVal = _DataFlowNode->IsSwitchNode() ;
326 RetVal = _DataFlowEditor->IsSwitchNode() ;
328 // endService( "CNode_Impl::IsSwitch" );
331 bool CNode_Impl::IsEndSwitch() {
332 // beginService( "CNode_Impl::IsEndSwitch" );
333 bool RetVal = SUPERV::UnknownNode ;
335 RetVal = _DataFlowNode->IsEndSwitchNode() ;
338 RetVal = _DataFlowEditor->IsEndSwitchNode() ;
340 // endService( "CNode_Impl::IsEndSwitch" );
344 SUPERV::SDate CNode_Impl::CreationDate() {
345 // beginService( "CNode_Impl::CreationDate" );
346 SUPERV::SDate_var RetVal ;
348 RetVal = new SUPERV::SDate( _DataFlowNode->FirstCreation() ) ;
351 // cout << " CNode_Impl::CreationDate " << _DataFlowEditor->FirstCreation()
353 RetVal = new SUPERV::SDate( _DataFlowEditor->FirstCreation() ) ;
355 // endService( "CNode_Impl::CreationDate" );
356 return (RetVal._retn()) ;
358 SUPERV::SDate CNode_Impl::LastUpdateDate() {
359 // beginService( "CNode_Impl::LastUpdateDate" );
360 SUPERV::SDate_var RetVal ;
362 RetVal = new SUPERV::SDate( _DataFlowNode->LastModification() ) ;
365 RetVal = new SUPERV::SDate( _DataFlowEditor->LastModification() ) ;
367 // endService( "CNode_Impl::LastUpdateDate" );
368 return (RetVal._retn()) ;
370 char * CNode_Impl::Version() {
371 // beginService( "CNode_Impl::Version" );
374 RetVal = _DataFlowNode->EditorRelease() ;
377 RetVal = _DataFlowEditor->EditorRelease() ;
379 // endService( "CNode_Impl::Version" );
380 return CORBA::string_dup( RetVal ) ;
382 char * CNode_Impl::Author() {
383 // beginService( "CNode_Impl::Author" );
386 RetVal = _DataFlowNode->Author() ;
389 RetVal = _DataFlowEditor->Author() ;
391 // endService( "CNode_Impl::Author" );
392 return CORBA::string_dup( RetVal ) ;
394 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
395 // beginService( "CNode_Impl::SetAuthor" );
396 bool RetVal = false ;
397 if ( _DataFlowEditor->IsEditing() ) {
399 RetVal = _DataFlowNode->Author( aDataFlowAuthor ) ;
402 RetVal = _DataFlowEditor->Author( aDataFlowAuthor ) ;
405 // endService( "CNode_Impl::SetAuthor" );
408 char * CNode_Impl::Comment() {
409 // beginService( "CNode_Impl::Comment" );
412 RetVal = _DataFlowNode->Comment() ;
415 RetVal = _DataFlowEditor->Comment() ;
417 // endService( "CNode_Impl::Comment" );
418 return CORBA::string_dup( RetVal ) ;
420 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
421 // beginService( "CNode_Impl::SetComment" );
422 bool RetVal = false ;
423 if ( _DataFlowEditor->IsEditing() ) {
425 RetVal = _DataFlowNode->Comment( aDataFlowComment ) ;
428 RetVal = _DataFlowEditor->Comment( aDataFlowComment ) ;
431 // endService( "CNode_Impl::SetComment" );
435 SUPERV::ListOfLinks * CNode_Impl::Links() {
436 beginService( "CNode_Impl::Links" ) ;
437 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
438 if ( _DataFlowNode ) {
439 RetVal = DataFlowEditor()->ObjImpl()->Links( _DataFlowNode->ComputingNode() , NULL ) ;
441 endService( "CNode_Impl::Links" ) ;
442 return ( RetVal._retn() ) ;
445 void CNode_Impl::Coords(long X , long Y ) {
446 // beginService( "CNode_Impl::Coords" );
447 if ( _DataFlowEditor->IsEditing() ) {
449 ((GraphEditor::InNode *) _DataFlowNode)->Coordinates( X , Y ) ;
452 _DataFlowEditor->Coordinates( X , Y ) ;
455 // endService( "CNode_Impl::Coords" );
457 long CNode_Impl::X() {
458 // beginService( "CNode_Impl::X" );
461 RetVal = _DataFlowNode->XCoordinate() ;
464 // RetVal = _DataFlowEditor->XCoordinate() ;
467 // endService( "CNode_Impl::X" );
470 long CNode_Impl::Y() {
471 // beginService( "CNode_Impl::Y" );
474 RetVal = _DataFlowNode->YCoordinate() ;
477 // RetVal = _DataFlowEditor->YCoordinate() ;
480 // endService( "CNode_Impl::Y" );
485 SUPERV::Link_ptr CNode_Impl::Link( const char * ToServiceParameterName ,
486 const SUPERV::Value_ptr aValue ) {
487 beginService( "CNode_Impl::Link" );
488 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
489 instanceName() , interfaceName() ,
492 ToServiceParameterName ,
494 PortableServer::ObjectId * id = myLink->getId() ;
495 CORBA::Object_var obj = _poa->id_to_reference(*id);
496 SUPERV::Link_var iobject ;
497 iobject = SUPERV::Link::_narrow(obj) ;
498 endService( "CNode_Impl::Link" );
499 return SUPERV::Link::_duplicate( iobject ) ;
503 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
505 Port_Impl * myPort = NULL ;
506 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
509 aninport = _DataFlowNode->GetInPort( ServiceParameterName ) ;
512 aninport = _DataFlowEditor->GetInPort( ServiceParameterName ) ;
516 anoutport = _DataFlowNode->GetOutPort( ServiceParameterName ) ;
519 anoutport = _DataFlowEditor->GetOutPort( ServiceParameterName ) ;
522 GraphBase::InPort * anInPort ;
524 anInPort = _DataFlowNode->GetChangeInPort( ServiceParameterName ) ;
527 anInPort = _DataFlowEditor->GetChangeInPort( ServiceParameterName ) ;
529 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
531 beginService( "CNode_Impl::Port" );
536 hasinput = _DataFlowNode->HasInput( anInPort->PortName() ) ;
539 hasinput = _DataFlowEditor->HasInput( anInPort->PortName() ) ;
542 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
543 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
544 instanceName() , interfaceName() ,
547 // ServiceParameterName ,
548 (GraphBase::Port * ) anInPort ,
553 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
554 instanceName() , interfaceName() ,
557 // ServiceParameterName ) ;
558 (GraphBase::Port * ) anInPort ,
561 PortableServer::ObjectId * id = myPort->getId() ;
562 CORBA::Object_var obj = _poa->id_to_reference(*id);
563 iobject = SUPERV::Port::_narrow(obj) ;
564 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
567 iobject = anInPort->ObjRef() ;
570 else if ( anoutport ) {
571 GraphBase::OutPort * anOutPort ;
573 anOutPort = _DataFlowNode->GetChangeOutPort( ServiceParameterName ) ;
576 anOutPort = _DataFlowEditor->GetChangeOutPort( ServiceParameterName ) ;
578 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
580 beginService( "CNode_Impl::Port" );
583 const CORBA::Any * anAny = anOutPort->Value() ;
584 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
585 instanceName() , interfaceName() ,
588 // ServiceParameterName ,
589 (GraphBase::Port * ) anOutPort ,
592 PortableServer::ObjectId * id = myPort->getId() ;
593 CORBA::Object_var obj = _poa->id_to_reference(*id);
594 iobject = SUPERV::Port::_narrow(obj) ;
595 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
598 iobject = anOutPort->ObjRef() ;
602 endService( "CNode_Impl::Port" );
604 return SUPERV::Port::_duplicate( iobject ) ;
607 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
608 const SUPERV::Value_ptr aValue ) {
610 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
611 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
612 if ( _DataFlowEditor->IsEditing() ) {
614 GraphBase::InPort * anInPort ;
616 sts = _DataFlowEditor->AddInputData( _DataFlowNode->Name() ,
617 ToServiceParameterName ,
619 anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
622 sts = _DataFlowEditor->AddInputData( _DataFlowEditor->Name() ,
623 ToServiceParameterName ,
625 anInPort = _DataFlowEditor->GetChangeInPort( ToServiceParameterName ) ;
627 if ( sts && anInPort ) {
628 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
630 beginService( "CNode_Impl::Input" );
634 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
635 instanceName() , interfaceName() ,
638 // ToServiceParameterName ,
639 (GraphBase::Port * ) anInPort ,
642 PortableServer::ObjectId * id = myPort->getId() ;
643 CORBA::Object_var obj = _poa->id_to_reference(*id);
644 iobject = SUPERV::Port::_narrow(obj) ;
645 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
648 iobject = anInPort->ObjRef() ;
652 else if ( _DataFlowExecutor ) {
654 GraphBase::InPort * anInPort ;
656 sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Name() ,
657 ToServiceParameterName ,
659 anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
662 sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Name() ,
663 ToServiceParameterName ,
665 anInPort = _DataFlowEditor->GetChangeInPort( ToServiceParameterName ) ;
667 if ( sts && anInPort ) {
668 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
670 beginService( "CNode_Impl::Input" );
674 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
675 instanceName() , interfaceName() ,
678 // ToServiceParameterName ,
679 (GraphBase::Port * ) anInPort ,
682 PortableServer::ObjectId * id = myPort->getId() ;
683 CORBA::Object_var obj = _poa->id_to_reference(*id);
684 iobject = SUPERV::Port::_narrow(obj) ;
685 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
688 iobject = anInPort->ObjRef() ;
693 endService( "CNode_Impl::Input" );
695 return SUPERV::Port::_duplicate( iobject ) ;
698 SUPERV::ListOfPorts * CNode_Impl::Ports() {
700 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
701 // if ( !_DataFlowNode->IsDataFlowNode() ) {
704 RetVal->length( _DataFlowNode->GetNodeInPortsSize() +
705 _DataFlowNode->GetNodeOutPortsSize() ) ;
706 for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) {
707 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ;
708 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
710 beginService( "CNode_Impl::Ports" );
714 if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) {
715 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
716 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
717 instanceName() , interfaceName() ,
720 // anInPort->PortName() ,
721 (GraphBase::Port * ) anInPort ,
726 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
727 instanceName() , interfaceName() ,
730 // anInPort->PortName() ) ;
731 (GraphBase::Port * ) anInPort ,
734 PortableServer::ObjectId * id = myPort->getId() ;
735 CORBA::Object_var obj = _poa->id_to_reference(*id);
736 SUPERV::Port_var iobject ;
737 iobject = SUPERV::Port::_narrow(obj) ;
738 RetVal[ i ] = SUPERV::Port::_duplicate( iobject ) ;
739 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
742 RetVal[ i ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
745 for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) {
746 GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ;
747 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
749 beginService( "CNode_Impl::Ports" );
752 const CORBA::Any * anAny = anOutPort->Value() ;
753 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
754 instanceName() , interfaceName() ,
757 // anOutPort->PortName() ,
758 (GraphBase::Port * ) anOutPort ,
761 PortableServer::ObjectId * id = myPort->getId() ;
762 CORBA::Object_var obj = _poa->id_to_reference(*id);
763 SUPERV::Port_var iobject ;
764 iobject = SUPERV::Port::_narrow(obj) ;
765 RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( iobject ) ;
766 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
769 RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
774 if ( _DataFlowEditor->IsValid() ) {
776 RetVal->length( _DataFlowEditor->GetNodeInDataNodePortsSize() +
777 _DataFlowEditor->GetNodeOutDataNodePortsSize() ) ;
778 for ( i = 0 ; i < _DataFlowEditor->GetNodeInDataNodePortsSize() ; i++ ) {
779 GraphBase::OutPort * anOutPort = _DataFlowEditor->GetChangeNodeInDataNodePort(i) ;
780 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
782 beginService( "CNode_Impl::Ports" );
786 if ( anOutPort->IsDataConnected() ) {
787 const CORBA::Any * anAny = anOutPort->Value() ;
788 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
789 instanceName() , interfaceName() ,
792 // anOutPort->PortName() ,
793 (GraphBase::Port * ) anOutPort ,
798 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
799 instanceName() , interfaceName() ,
802 // anOutPort->PortName() ) ;
803 (GraphBase::Port * ) anOutPort ,
806 PortableServer::ObjectId * id = myPort->getId() ;
807 CORBA::Object_var obj = _poa->id_to_reference(*id);
808 SUPERV::Port_var iobject ;
809 iobject = SUPERV::Port::_narrow(obj) ;
810 RetVal[ i ] = SUPERV::Port::_duplicate( iobject ) ;
811 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
814 RetVal[ i ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
817 j = _DataFlowEditor->GetNodeInDataNodePortsSize() ;
818 for ( i = 0 ; i < _DataFlowEditor->GetNodeOutDataNodePortsSize() ; i++ ) {
819 GraphBase::InPort * anInPort = _DataFlowEditor->GetChangeNodeOutDataNodePort(i) ;
820 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
822 beginService( "CNode_Impl::Ports" );
826 if ( anInPort->IsDataConnected() ) {
827 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
828 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
829 instanceName() , interfaceName() ,
832 // anInPort->PortName() ,
833 (GraphBase::Port * ) anInPort ,
838 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
839 instanceName() , interfaceName() ,
842 // anInPort->PortName() ) ;
846 PortableServer::ObjectId * id = myPort->getId() ;
847 CORBA::Object_var obj = _poa->id_to_reference(*id);
848 SUPERV::Port_var iobject ;
849 iobject = SUPERV::Port::_narrow(obj) ;
850 RetVal[ j + i ] = SUPERV::Port::_duplicate( iobject ) ;
851 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
854 RetVal[ j + i ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
860 endService( "CNode_Impl::Ports" );
862 return ( RetVal._retn() ) ;
865 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
867 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
869 char* FromServiceParameterName ;
870 bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
871 ToServiceParameterName ,
873 & FromServiceParameterName ) ;
875 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
876 if ( anInPort->GetOutPort() ) {
877 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
878 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
880 beginService( "CNode_Impl::GetLink" );
883 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
884 instanceName() , interfaceName() ,
887 ToServiceParameterName ,
888 (GraphEditor::InNode *) _DataFlowEditor->GetChangeGraphNode( FromNodeName )->GetInNode() ,
889 FromServiceParameterName ,
891 PortableServer::ObjectId * id = myLink->getId() ;
892 CORBA::Object_var obj = _poa->id_to_reference(*id);
893 iobject = SUPERV::Link::_narrow(obj) ;
894 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
897 iobject = anOutPort->InPortObjRef( anInPort ) ;
902 endService( "CNode_Impl::GetLink" );
904 return SUPERV::Link::_duplicate( iobject ) ;
907 long CNode_Impl::SubGraph() {
908 // beginService( "CNode_Impl::SubGraph" );
911 RetVal = _DataFlowNode->SubGraph() ;
913 // endService( "CNode_Impl::SubGraph" );
917 bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
918 // beginService( "CNode_Impl::IsLinked" );
919 bool RetVal = _DataFlowNode->IsLinked( ServiceParameterName ) ;
920 // endService( "CNode_Impl::IsLinked" );
924 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
925 // beginService( "CNode_Impl::HasInput" );
926 bool RetVal = _DataFlowNode->HasInput( ServiceParameterName ) ;
927 // endService( "CNode_Impl::HasInput" );
931 SUPERV::GraphState CNode_Impl::State() {
932 // beginService( "CNode_Impl::State" );
933 SUPERV::GraphState RetVal = SUPERV::EditingState ;
934 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
935 if ( _DataFlowExecutor && !_DataFlowEditor->EditedAfterExecution() ) {
936 //JR : 12/06/03 if ( _DataFlowExecutor ) {
938 RetVal = _DataFlowExecutor->State( Name() ) ;
941 RetVal = _DataFlowExecutor->State() ;
944 // endService( "CNode_Impl::State" );
947 long CNode_Impl::Thread() {
948 // beginService( "CNode_Impl::Thread" );
950 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
951 if ( _DataFlowExecutor ) {
953 RetVal = _DataFlowExecutor->Thread( Name() ) ;
956 RetVal = _DataFlowExecutor->Thread() ;
959 // endService( "CNode_Impl::Thread" );
962 SUPERV::AutomatonState CNode_Impl::AutoState() {
963 // beginService( "CNode_Impl::AutoState" );
964 SUPERV::AutomatonState RetVal = SUPERV::UnKnownState ;
965 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
966 if ( _DataFlowExecutor ) {
968 RetVal = _DataFlowExecutor->AutomatonState( Name() ) ;
971 RetVal = _DataFlowExecutor->AutomatonState() ;
974 // endService( "CNode_Impl::AutoState" );
977 SUPERV::ControlState CNode_Impl::Control() {
978 // beginService( "CNode_Impl::Control" );
979 SUPERV::ControlState RetVal = SUPERV::VoidState ;
980 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
981 if ( _DataFlowExecutor ) {
983 RetVal = _DataFlowExecutor->ControlState( Name() ) ;
986 RetVal = _DataFlowExecutor->ControlState() ;
989 // endService( "CNode_Impl::Control" );
992 void CNode_Impl::ControlClear() {
993 // beginService( "CNode_Impl::ControlClear" );
994 SUPERV::ControlState RetVal = SUPERV::VoidState ;
995 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
996 if ( _DataFlowExecutor ) {
998 _DataFlowExecutor->ControlClear( Name() ) ;
1001 _DataFlowExecutor->ControlClear() ;
1004 // endService( "CNode_Impl::ControlClear" );
1008 bool CNode_Impl::IsReady() {
1009 // beginService( "CNode_Impl::IsReady" );
1010 bool RetVal = false ;
1011 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1012 if ( _DataFlowExecutor ) {
1014 RetVal = _DataFlowExecutor->IsReady( Name() ) ;
1017 RetVal = _DataFlowExecutor->IsReady() ;
1020 // endService( "CNode_Impl::IsReady" );
1024 bool CNode_Impl::IsWaiting() {
1025 // beginService( "CNode_Impl::IsWaiting" );
1026 bool RetVal = false ;
1027 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1028 if ( _DataFlowExecutor ) {
1030 RetVal = _DataFlowExecutor->IsWaiting( Name() ) ;
1033 RetVal = _DataFlowExecutor->IsWaiting() ;
1036 // endService( "CNode_Impl::IsWaiting" );
1040 bool CNode_Impl::IsRunning() {
1041 // beginService( "CNode_Impl::IsRunning" );
1042 bool RetVal = false ;
1043 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1044 if ( _DataFlowExecutor ) {
1046 RetVal = _DataFlowExecutor->IsRunning( Name() ) ;
1049 RetVal = _DataFlowExecutor->IsRunning() ;
1052 // endService( "CNode_Impl::IsRunning" );
1056 bool CNode_Impl::IsDone() {
1057 // beginService( "CNode_Impl::IsDone" );
1058 bool RetVal = false ;
1059 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1060 if ( _DataFlowExecutor ) {
1062 RetVal = _DataFlowExecutor->IsDone( Name() ) ;
1065 RetVal = _DataFlowExecutor->IsDone() ;
1068 // endService( "CNode_Impl::IsDone" );
1072 bool CNode_Impl::IsSuspended() {
1073 // beginService( "CNode_Impl::IsSuspended" );
1074 bool RetVal = false ;
1075 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1076 if ( _DataFlowExecutor ) {
1078 RetVal = _DataFlowExecutor->IsSuspended( Name() ) ;
1081 RetVal = _DataFlowExecutor->IsSuspended() ;
1084 // endService( "CNode_Impl::IsSuspended" );
1088 bool CNode_Impl::ReadyW() {
1089 // beginService( "CNode_Impl::ReadyW" );
1090 bool RetVal = false ;
1091 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1092 if ( _DataFlowExecutor ) {
1094 RetVal = _DataFlowExecutor->ReadyWait( Name() ) ;
1097 RetVal = _DataFlowExecutor->ReadyWait() ;
1100 // endService( "CNode_Impl::ReadyW" );
1104 bool CNode_Impl::RunningW() {
1105 // beginService( "CNode_Impl::RunningW" );
1106 bool RetVal = false ;
1107 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1108 if ( _DataFlowExecutor ) {
1110 RetVal = _DataFlowExecutor->RunningWait( Name() ) ;
1113 RetVal = _DataFlowExecutor->RunningWait() ;
1116 // endService( "CNode_Impl::RunningW" );
1120 bool CNode_Impl::DoneW() {
1121 // beginService( "CNode_Impl::DoneW" );
1122 bool RetVal = false ;
1123 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1124 if ( _DataFlowExecutor ) {
1126 RetVal = _DataFlowExecutor->DoneWait( Name() ) ;
1129 RetVal = _DataFlowExecutor->DoneWait() ;
1132 // endService( "CNode_Impl::DoneW" );
1136 bool CNode_Impl::SuspendedW() {
1137 // beginService( "CNode_Impl::SuspendedW" );
1138 bool RetVal = false ;
1139 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1140 if ( _DataFlowExecutor ) {
1142 RetVal = _DataFlowExecutor->SuspendedWait( Name() ) ;
1145 RetVal = _DataFlowExecutor->SuspendedWait() ;
1148 // endService( "CNode_Impl::SuspendedW" );
1152 void CNode_Impl::ping() {
1153 // beginService( "CNode_Impl::ping" );
1154 bool RetVal = false ;
1155 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1156 if ( _DataFlowExecutor ) {
1158 RetVal = _DataFlowExecutor->Ping( Name() ) ;
1164 // endService( "CNode_Impl::ping" );
1168 bool CNode_Impl::ContainerKill() {
1169 beginService( "CNode_Impl::ContainerKill" );
1170 bool RetVal = false ;
1171 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1172 if ( _DataFlowExecutor && _DataFlowEditor->IsExecuting() ) {
1174 RetVal = _DataFlowExecutor->ContainerKill( Name() ) ;
1177 RetVal = _DataFlowExecutor->ContainerKill() ;
1180 endService( "CNode_Impl::ContainerKill" );
1183 bool CNode_Impl::Kill() {
1184 // beginService( "CNode_Impl::Kill" );
1185 bool RetVal = false ;
1186 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1187 if ( _DataFlowExecutor ) {
1189 RetVal = _DataFlowExecutor->Kill( Name() ) ;
1192 RetVal = _DataFlowExecutor->Kill() ;
1195 // endService( "CNode_Impl::Kill" );
1198 bool CNode_Impl::KillDone() {
1199 // beginService( "CNode_Impl::KillDone" );
1200 bool RetVal = false ;
1201 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1202 if ( _DataFlowExecutor ) {
1204 RetVal = _DataFlowExecutor->KillDone( Name() ) ;
1207 // endService( "CNode_Impl::KillDone" );
1210 bool CNode_Impl::Stop() {
1211 // beginService( "CNode_Impl::Stop" );
1212 bool RetVal ; // = _DataFlowExecutor->Stop() ;
1213 // endService( "CNode_Impl::Stop" );
1216 bool CNode_Impl::Suspend() {
1217 // beginService( "CNode_Impl::Suspend" );
1218 bool RetVal = false ;
1219 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1220 if ( _DataFlowExecutor ) {
1222 RetVal = _DataFlowExecutor->Suspend( Name() ) ;
1225 RetVal = _DataFlowExecutor->Suspend() ;
1228 // endService( "CNode_Impl::Suspend" );
1231 bool CNode_Impl::SuspendDone() {
1232 // beginService( "CNode_Impl::SuspendDone" );
1233 bool RetVal = false ;
1234 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1235 if ( _DataFlowExecutor ) {
1237 RetVal = _DataFlowExecutor->SuspendDone( Name() ) ;
1240 RetVal = _DataFlowExecutor->SuspendDone() ;
1243 // endService( "CNode_Impl::SuspendDone" );
1246 bool CNode_Impl::Resume() {
1247 // beginService( "CNode_Impl::Resume" );
1248 bool RetVal = false ;
1249 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1250 if ( _DataFlowExecutor ) {
1252 RetVal = _DataFlowExecutor->Resume( Name() ) ;
1255 RetVal = _DataFlowExecutor->Resume() ;
1258 // endService( "CNode_Impl::Resume" );
1262 bool CNode_Impl::Run() {
1263 beginService( "CNode_Impl::Run" );
1264 bool RetVal = false ;
1265 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1266 if ( _DataFlowExecutor ) {
1267 _DataFlowEditor->EditedAfterExecution( false ) ;
1269 RetVal = _DataFlowExecutor->Run( Name() , Name() , false ) ;
1272 RetVal = _DataFlowExecutor->Run( false ) ;
1275 endService( "CNode_Impl::Run" );
1279 bool CNode_Impl::ReRun() {
1280 beginService( "CNode_Impl::ReRun" );
1281 bool RetVal = false ;
1282 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1283 if ( _DataFlowExecutor ) {
1284 _DataFlowEditor->EditedAfterExecution( false ) ;
1286 RetVal = _DataFlowExecutor->Run( Name() , Name() , false ) ;
1288 else if ( DataFlowEditor()->IsEditing() ) {
1289 // RetVal = _DataFlowExecutor->Run( false ) ;
1290 return ((Graph_Impl::Graph_Impl *) this)->Graph_Impl::Run() ;
1293 endService( "CNode_Impl::ReRun" );
1297 bool CNode_Impl::ReRunAt( const char * aNodeName ) {
1298 beginService( "CNode_Impl::ReRunAt" );
1299 bool RetVal = false ;
1300 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1301 if ( _DataFlowExecutor ) {
1302 _DataFlowEditor->EditedAfterExecution( false ) ;
1304 RetVal = _DataFlowExecutor->Run( Name() , aNodeName , false ) ;
1307 endService( "CNode_Impl::ReRunAt" );
1311 bool CNode_Impl::ReStart() {
1312 beginService( "CNode_Impl::ReStart" );
1313 bool RetVal = false ;
1314 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1315 if ( _DataFlowExecutor ) {
1317 RetVal = _DataFlowExecutor->Run( Name() , Name() , true ) ;
1320 RetVal = _DataFlowExecutor->Run( true ) ;
1323 endService( "CNode_Impl::ReStart" );
1327 bool CNode_Impl::ReStartAt( const char * aNodeName ) {
1328 beginService( "CNode_Impl::ReStartAt" );
1329 bool RetVal = false ;
1330 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1331 if ( _DataFlowExecutor ) {
1333 RetVal = _DataFlowExecutor->Run( Name() , aNodeName , true ) ;
1336 endService( "CNode_Impl::ReStartAt" );
1340 long CNode_Impl::CpuUsed() {
1342 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1343 if ( _DataFlowExecutor ) {
1345 // RetVal = _DataFlowExecutor->CpuUsed( Name() ) ;
1348 // RetVal = _DataFlowExecutor->CpuUsed() ;