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 // cout << "CNode_Impl::CNode_Impl -->" << endl ;
65 // if ( FuncName && NodeName ) {
66 // cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
67 // << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
68 // << " " << strlen( FuncName ) << endl ;
70 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
71 MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
73 _id = _poa->activate_object(_thisObj);
75 _Orb = CORBA::ORB::_duplicate(orb);
78 _DataFlowEditor = DataFlowEditor ;
79 GraphBase::ListOfFuncName aFuncName ;
80 GraphBase::ListOfPythonFunctions aPythonFunction ;
83 aFuncName[0] = my_strdup( FuncName ) ;
84 aPythonFunction.resize(1) ;
85 aPythonFunction[0] = &PythonFunction ;
87 _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName ,
92 endService( "CNode_Impl::CNode_Impl" );
93 // cout << "<-- CNode_Impl::CNode_Impl" << endl ;
96 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
97 PortableServer::POA_ptr poa ,
98 PortableServer::ObjectId * contId ,
99 const char *instanceName ,
100 const char *interfaceName ,
101 GraphEditor::DataFlow * DataFlowEditor ,
102 const SALOME_ModuleCatalog::Service &NodeService ,
103 const char * NodeName ,
104 const SUPERV::KindOfNode NodeKindOfNode ,
105 const GraphBase::ListOfFuncName & aFuncName ,
106 const GraphBase::ListOfPythonFunctions & aPythonFunction ) :
107 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
108 MESSAGE( NodeName << " " );
109 beginService( "CNode_Impl::CNode_Impl" );
111 MESSAGE("CNode_Impl::CNode_Impl " << NodeName << " " << strlen( NodeName ) ) ;
113 if ( NodeKindOfNode == SUPERV::ComputingNode ) {
114 MESSAGE( "CNode_Impl::CNode_Impl " << aFuncName[0] << " _poa->activate_object" );
116 _id = _poa->activate_object(_thisObj);
118 _Orb = CORBA::ORB::_duplicate(orb);
121 _DataFlowEditor = DataFlowEditor ;
122 _DataFlowNode = _DataFlowEditor->AddNode( NodeService , "" , "" , NodeName ,
127 endService( "CNode_Impl::CNode_Impl" );
130 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
131 PortableServer::POA_ptr poa ,
132 PortableServer::ObjectId * contId ,
133 const char *instanceName ,
134 const char *interfaceName ,
135 GraphEditor::DataFlow * DataFlowEditor ,
136 GraphEditor::InNode * DataFlowNode ) :
137 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
138 MESSAGE( DataFlowNode->Name() << " " );
139 beginService( "CNode_Impl::CNode_Impl" );
140 if ( DataFlowNode->IsComputingNode() ) {
141 MESSAGE( "CNode_Impl::CNode_Impl _poa->activate_object" );
143 _id = _poa->activate_object(_thisObj);
145 _Orb = CORBA::ORB::_duplicate(orb);
148 _DataFlowEditor = DataFlowEditor ;
149 _DataFlowNode = DataFlowNode ;
151 endService( "CNode_Impl::CNode_Impl" );
154 CNode_Impl::~CNode_Impl() {
155 beginService( "CNode_Impl::~CNode_Impl" );
156 endService( "CNode_Impl::~CNode_Impl" );
159 void CNode_Impl::destroy() {
160 beginService( "CNode_Impl::Destroy" );
161 if ( _DataFlowEditor->IsEditing() ) {
163 _DataFlowNode = NULL ;
164 _poa->deactivate_object(*_id) ;
165 CORBA::release(_poa) ;
167 _thisObj->_remove_ref();
170 endService( "CNode_Impl::Destroy" );
173 bool CNode_Impl::Delete() {
174 beginService( "CNode_Impl::Delete" );
175 bool RetVal = false ;
176 if ( _DataFlowEditor->IsEditing() ) {
177 RetVal = _DataFlowEditor->RemoveNode( Name() ) ;
179 RetVal = _DataFlowEditor->IsValid() ;
181 endService( "CNode_Impl::Delete" );
185 SALOME_ModuleCatalog::Service * CNode_Impl::Service() {
186 // beginService( "CNode_Impl::Service" );
187 SALOME_ModuleCatalog::Service * RetVal ;
189 RetVal = new SALOME_ModuleCatalog::Service( *_DataFlowNode->GetService() ) ;
192 RetVal = new SALOME_ModuleCatalog::Service( *_DataFlowEditor->GetService() ) ;
194 // endService( "CNode_Impl::Service" );
198 char * CNode_Impl::Name() {
199 // beginService( "CNode_Impl::Name" );
200 char * RetVal = NULL ;
202 RetVal = _DataFlowNode->Name() ;
205 RetVal = _DataFlowEditor->Name() ;
207 // endService( "CNode_Impl::Name" );
208 return CORBA::string_dup( RetVal );
210 bool CNode_Impl::SetName( const char * aDataFlowName ) {
211 // beginService( "CNode_Impl::SetName" );
212 bool RetVal = false ;
213 if ( _DataFlowEditor->IsEditing() ) {
215 RetVal = _DataFlowEditor->ReNameNode( _DataFlowNode->Name() ,
219 RetVal = _DataFlowEditor->Name( aDataFlowName ) ;
222 // endService( "CNode_Impl::SetName" );
225 SUPERV::KindOfNode CNode_Impl::Kind() {
226 // beginService( "CNode_Impl::Kind" );
227 SUPERV::KindOfNode RetVal = SUPERV::UnknownNode ;
229 RetVal = _DataFlowNode->Kind() ;
232 RetVal = _DataFlowEditor->Kind() ;
234 // endService( "CNode_Impl::Kind" );
237 bool CNode_Impl::IsGraph() {
238 // beginService( "CNode_Impl::IsGraph" );
239 bool RetVal = false ;
241 RetVal = _DataFlowNode->IsDataFlowNode() ;
244 RetVal = _DataFlowEditor->IsDataFlowNode() ;
246 // endService( "CNode_Impl::IsGraph" );
249 bool CNode_Impl::IsComputing() {
250 // beginService( "CNode_Impl::IsComputing" );
251 bool RetVal = SUPERV::UnknownNode ;
253 RetVal = _DataFlowNode->IsComputingNode() ;
256 RetVal = _DataFlowEditor->IsComputingNode() ;
258 // endService( "CNode_Impl::IsComputing" );
261 bool CNode_Impl::IsFactory() {
262 // beginService( "CNode_Impl::IsFactory" );
263 bool RetVal = SUPERV::UnknownNode ;
265 RetVal = _DataFlowNode->IsFactoryNode() ;
268 RetVal = _DataFlowEditor->IsFactoryNode() ;
270 // endService( "CNode_Impl::IsFactory" );
273 bool CNode_Impl::IsInLine() {
274 // beginService( "CNode_Impl::IsInLine" );
275 bool RetVal = SUPERV::UnknownNode ;
277 RetVal = _DataFlowNode->IsInLineNode() ;
280 RetVal = _DataFlowEditor->IsInLineNode() ;
282 // endService( "CNode_Impl::IsInLine" );
285 bool CNode_Impl::IsGOTO() {
286 // beginService( "CNode_Impl::IsGOTO" );
287 bool RetVal = SUPERV::UnknownNode ;
289 RetVal = _DataFlowNode->IsGOTONode() ;
292 RetVal = _DataFlowEditor->IsGOTONode() ;
294 // endService( "CNode_Impl::IsGOTO" );
297 bool CNode_Impl::IsLoop() {
298 // beginService( "CNode_Impl::IsLoop" );
299 bool RetVal = SUPERV::UnknownNode ;
301 RetVal = _DataFlowNode->IsLoopNode() ;
304 RetVal = _DataFlowEditor->IsLoopNode() ;
306 // endService( "CNode_Impl::IsLoop" );
309 bool CNode_Impl::IsEndLoop() {
310 // beginService( "CNode_Impl::IsEndLoop" );
311 bool RetVal = SUPERV::UnknownNode ;
313 RetVal = _DataFlowNode->IsEndLoopNode() ;
316 RetVal = _DataFlowEditor->IsEndLoopNode() ;
318 // endService( "CNode_Impl::IsEndLoop" );
321 bool CNode_Impl::IsSwitch() {
322 // beginService( "CNode_Impl::IsSwitch" );
323 bool RetVal = SUPERV::UnknownNode ;
325 RetVal = _DataFlowNode->IsSwitchNode() ;
328 RetVal = _DataFlowEditor->IsSwitchNode() ;
330 // endService( "CNode_Impl::IsSwitch" );
333 bool CNode_Impl::IsEndSwitch() {
334 // beginService( "CNode_Impl::IsEndSwitch" );
335 bool RetVal = SUPERV::UnknownNode ;
337 RetVal = _DataFlowNode->IsEndSwitchNode() ;
340 RetVal = _DataFlowEditor->IsEndSwitchNode() ;
342 // endService( "CNode_Impl::IsEndSwitch" );
346 SUPERV::SDate CNode_Impl::CreationDate() {
347 // beginService( "CNode_Impl::CreationDate" );
348 SUPERV::SDate_var RetVal ;
350 RetVal = new SUPERV::SDate( _DataFlowNode->FirstCreation() ) ;
353 // cout << " CNode_Impl::CreationDate " << _DataFlowEditor->FirstCreation()
355 RetVal = new SUPERV::SDate( _DataFlowEditor->FirstCreation() ) ;
357 // endService( "CNode_Impl::CreationDate" );
358 return (RetVal._retn()) ;
360 SUPERV::SDate CNode_Impl::LastUpdateDate() {
361 // beginService( "CNode_Impl::LastUpdateDate" );
362 SUPERV::SDate_var RetVal ;
364 RetVal = new SUPERV::SDate( _DataFlowNode->LastModification() ) ;
367 RetVal = new SUPERV::SDate( _DataFlowEditor->LastModification() ) ;
369 // endService( "CNode_Impl::LastUpdateDate" );
370 return (RetVal._retn()) ;
372 char * CNode_Impl::Version() {
373 // beginService( "CNode_Impl::Version" );
376 RetVal = _DataFlowNode->EditorRelease() ;
379 RetVal = _DataFlowEditor->EditorRelease() ;
381 // endService( "CNode_Impl::Version" );
382 return CORBA::string_dup( RetVal ) ;
384 char * CNode_Impl::Author() {
385 // beginService( "CNode_Impl::Author" );
388 RetVal = _DataFlowNode->Author() ;
391 RetVal = _DataFlowEditor->Author() ;
393 // endService( "CNode_Impl::Author" );
394 return CORBA::string_dup( RetVal ) ;
396 bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) {
397 // beginService( "CNode_Impl::SetAuthor" );
398 bool RetVal = false ;
399 if ( _DataFlowEditor->IsEditing() ) {
401 RetVal = _DataFlowNode->Author( aDataFlowAuthor ) ;
404 RetVal = _DataFlowEditor->Author( aDataFlowAuthor ) ;
407 // endService( "CNode_Impl::SetAuthor" );
410 char * CNode_Impl::Comment() {
411 // beginService( "CNode_Impl::Comment" );
414 RetVal = _DataFlowNode->Comment() ;
417 RetVal = _DataFlowEditor->Comment() ;
419 // endService( "CNode_Impl::Comment" );
420 return CORBA::string_dup( RetVal ) ;
422 bool CNode_Impl::SetComment( const char * aDataFlowComment ) {
423 // beginService( "CNode_Impl::SetComment" );
424 bool RetVal = false ;
425 if ( _DataFlowEditor->IsEditing() ) {
427 RetVal = _DataFlowNode->Comment( aDataFlowComment ) ;
430 RetVal = _DataFlowEditor->Comment( aDataFlowComment ) ;
433 // endService( "CNode_Impl::SetComment" );
437 SUPERV::ListOfLinks * CNode_Impl::Links() {
438 beginService( "CNode_Impl::Links" ) ;
439 SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ;
440 if ( _DataFlowNode ) {
441 RetVal = DataFlowEditor()->ObjImpl()->Links( _DataFlowNode->ComputingNode() , NULL ) ;
443 endService( "CNode_Impl::Links" ) ;
444 return ( RetVal._retn() ) ;
447 void CNode_Impl::Coords(long X , long Y ) {
448 // beginService( "CNode_Impl::Coords" );
449 if ( _DataFlowEditor->IsEditing() ) {
451 ((GraphEditor::InNode *) _DataFlowNode)->Coordinates( X , Y ) ;
454 _DataFlowEditor->Coordinates( X , Y ) ;
457 // endService( "CNode_Impl::Coords" );
459 long CNode_Impl::X() {
460 // beginService( "CNode_Impl::X" );
463 RetVal = _DataFlowNode->XCoordinate() ;
466 // RetVal = _DataFlowEditor->XCoordinate() ;
469 // endService( "CNode_Impl::X" );
472 long CNode_Impl::Y() {
473 // beginService( "CNode_Impl::Y" );
476 RetVal = _DataFlowNode->YCoordinate() ;
479 // RetVal = _DataFlowEditor->YCoordinate() ;
482 // endService( "CNode_Impl::Y" );
487 SUPERV::Link_ptr CNode_Impl::Link( const char * ToServiceParameterName ,
488 const SUPERV::Value_ptr aValue ) {
489 beginService( "CNode_Impl::Link" );
490 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
491 instanceName() , interfaceName() ,
494 ToServiceParameterName ,
496 PortableServer::ObjectId * id = myLink->getId() ;
497 CORBA::Object_var obj = _poa->id_to_reference(*id);
498 SUPERV::Link_var iobject ;
499 iobject = SUPERV::Link::_narrow(obj) ;
500 endService( "CNode_Impl::Link" );
501 return SUPERV::Link::_duplicate( iobject ) ;
505 SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
507 Port_Impl * myPort = NULL ;
508 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
511 aninport = _DataFlowNode->GetInPort( ServiceParameterName ) ;
514 aninport = _DataFlowEditor->GetInPort( ServiceParameterName ) ;
518 anoutport = _DataFlowNode->GetOutPort( ServiceParameterName ) ;
521 anoutport = _DataFlowEditor->GetOutPort( ServiceParameterName ) ;
524 GraphBase::InPort * anInPort ;
526 anInPort = _DataFlowNode->GetChangeInPort( ServiceParameterName ) ;
529 anInPort = _DataFlowEditor->GetChangeInPort( ServiceParameterName ) ;
531 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
533 beginService( "CNode_Impl::Port" );
538 hasinput = _DataFlowNode->HasInput( anInPort->PortName() ) ;
541 hasinput = _DataFlowEditor->HasInput( anInPort->PortName() ) ;
544 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
545 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
546 instanceName() , interfaceName() ,
549 // ServiceParameterName ,
550 (GraphBase::Port * ) anInPort ,
555 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
556 instanceName() , interfaceName() ,
559 // ServiceParameterName ) ;
560 (GraphBase::Port * ) anInPort ,
563 PortableServer::ObjectId * id = myPort->getId() ;
564 CORBA::Object_var obj = _poa->id_to_reference(*id);
565 iobject = SUPERV::Port::_narrow(obj) ;
566 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
569 iobject = anInPort->ObjRef() ;
572 else if ( anoutport ) {
573 GraphBase::OutPort * anOutPort ;
575 anOutPort = _DataFlowNode->GetChangeOutPort( ServiceParameterName ) ;
578 anOutPort = _DataFlowEditor->GetChangeOutPort( ServiceParameterName ) ;
580 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
582 beginService( "CNode_Impl::Port" );
585 const CORBA::Any * anAny = anOutPort->Value() ;
586 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
587 instanceName() , interfaceName() ,
590 // ServiceParameterName ,
591 (GraphBase::Port * ) anOutPort ,
594 PortableServer::ObjectId * id = myPort->getId() ;
595 CORBA::Object_var obj = _poa->id_to_reference(*id);
596 iobject = SUPERV::Port::_narrow(obj) ;
597 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
600 iobject = anOutPort->ObjRef() ;
604 endService( "CNode_Impl::Port" );
606 return SUPERV::Port::_duplicate( iobject ) ;
609 SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
610 const SUPERV::Value_ptr aValue ) {
612 SUPERV::Port_var iobject = SUPERV::Port::_nil() ;
613 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
614 if ( _DataFlowEditor->IsEditing() ) {
616 GraphBase::InPort * anInPort ;
618 sts = _DataFlowEditor->AddInputData( _DataFlowNode->Name() ,
619 ToServiceParameterName ,
621 anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
624 sts = _DataFlowEditor->AddInputData( _DataFlowEditor->Name() ,
625 ToServiceParameterName ,
627 anInPort = _DataFlowEditor->GetChangeInPort( ToServiceParameterName ) ;
629 if ( sts && anInPort ) {
630 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
632 beginService( "CNode_Impl::Input" );
636 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
637 instanceName() , interfaceName() ,
640 // ToServiceParameterName ,
641 (GraphBase::Port * ) anInPort ,
644 PortableServer::ObjectId * id = myPort->getId() ;
645 CORBA::Object_var obj = _poa->id_to_reference(*id);
646 iobject = SUPERV::Port::_narrow(obj) ;
647 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
650 iobject = anInPort->ObjRef() ;
654 else if ( _DataFlowExecutor ) {
656 GraphBase::InPort * anInPort ;
658 sts = _DataFlowExecutor->ChangeInputData( _DataFlowNode->Name() ,
659 ToServiceParameterName ,
661 anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
664 sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Name() ,
665 ToServiceParameterName ,
667 anInPort = _DataFlowEditor->GetChangeInPort( ToServiceParameterName ) ;
669 if ( sts && anInPort ) {
670 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
672 beginService( "CNode_Impl::Input" );
676 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
677 instanceName() , interfaceName() ,
680 // ToServiceParameterName ,
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() ;
695 endService( "CNode_Impl::Input" );
697 return SUPERV::Port::_duplicate( iobject ) ;
700 SUPERV::ListOfPorts * CNode_Impl::Ports() {
702 SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
705 RetVal->length( _DataFlowNode->GetNodeInPortsSize() +
706 _DataFlowNode->GetNodeOutPortsSize() ) ;
707 for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) {
708 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ;
710 beginService( "CNode_Impl::Ports" );
713 if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() &&
714 ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
715 MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
716 RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
718 else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
719 MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
720 << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
721 << "/" << anInPort->IsConnected() ) ;
723 if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) {
724 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
725 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
726 instanceName() , interfaceName() ,
729 // anInPort->PortName() ,
730 (GraphBase::Port * ) anInPort ,
735 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
736 instanceName() , interfaceName() ,
739 // anInPort->PortName() ) ;
740 (GraphBase::Port * ) anInPort ,
743 PortableServer::ObjectId * id = myPort->getId() ;
744 CORBA::Object_var obj = _poa->id_to_reference(*id);
745 SUPERV::Port_var iobject ;
746 iobject = SUPERV::Port::_narrow(obj) ;
747 RetVal[ i ] = SUPERV::Port::_duplicate( iobject ) ;
748 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
751 MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
752 RetVal[ i ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
755 for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) {
756 GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ;
758 beginService( "CNode_Impl::Ports" );
761 if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() &&
762 ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
763 MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
764 RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
766 else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
767 MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
768 const CORBA::Any * anAny = anOutPort->Value() ;
769 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
770 instanceName() , interfaceName() ,
773 // anOutPort->PortName() ,
774 (GraphBase::Port * ) anOutPort ,
777 PortableServer::ObjectId * id = myPort->getId() ;
778 CORBA::Object_var obj = _poa->id_to_reference(*id);
779 SUPERV::Port_var iobject ;
780 iobject = SUPERV::Port::_narrow(obj) ;
781 RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( iobject ) ;
782 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
785 MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
786 RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
789 for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) {
790 if ( CORBA::is_nil( RetVal[ i ] ) ) {
791 for ( j = i ; j < (int ) RetVal->length() - 1 ; j++ ) {
792 RetVal[ j ] = RetVal[ j + 1 ] ;
794 RetVal->length( RetVal->length() - 1 ) ;
800 if ( _DataFlowEditor->IsValid() ) {
802 RetVal->length( _DataFlowEditor->GetNodeInDataNodePortsSize() +
803 _DataFlowEditor->GetNodeOutDataNodePortsSize() ) ;
804 for ( i = 0 ; i < _DataFlowEditor->GetNodeInDataNodePortsSize() ; i++ ) {
805 GraphBase::OutPort * anOutPort = _DataFlowEditor->GetChangeNodeInDataNodePort(i) ;
806 if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
808 beginService( "CNode_Impl::Ports" );
812 if ( anOutPort->IsDataConnected() ) {
813 const CORBA::Any * anAny = anOutPort->Value() ;
814 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
815 instanceName() , interfaceName() ,
818 // anOutPort->PortName() ,
819 (GraphBase::Port * ) anOutPort ,
824 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
825 instanceName() , interfaceName() ,
828 // anOutPort->PortName() ) ;
829 (GraphBase::Port * ) anOutPort ,
832 PortableServer::ObjectId * id = myPort->getId() ;
833 CORBA::Object_var obj = _poa->id_to_reference(*id);
834 SUPERV::Port_var iobject ;
835 iobject = SUPERV::Port::_narrow(obj) ;
836 RetVal[ i ] = SUPERV::Port::_duplicate( iobject ) ;
837 anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
840 RetVal[ i ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
843 j = _DataFlowEditor->GetNodeInDataNodePortsSize() ;
844 for ( i = 0 ; i < _DataFlowEditor->GetNodeOutDataNodePortsSize() ; i++ ) {
845 GraphBase::InPort * anInPort = _DataFlowEditor->GetChangeNodeOutDataNodePort(i) ;
846 if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
848 beginService( "CNode_Impl::Ports" );
852 if ( anInPort->IsDataConnected() ) {
853 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
854 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
855 instanceName() , interfaceName() ,
858 // anInPort->PortName() ,
859 (GraphBase::Port * ) anInPort ,
864 myPort = new Port_Impl( _Orb , _Poa , _ContId ,
865 instanceName() , interfaceName() ,
868 // anInPort->PortName() ) ;
872 PortableServer::ObjectId * id = myPort->getId() ;
873 CORBA::Object_var obj = _poa->id_to_reference(*id);
874 SUPERV::Port_var iobject ;
875 iobject = SUPERV::Port::_narrow(obj) ;
876 RetVal[ j + i ] = SUPERV::Port::_duplicate( iobject ) ;
877 anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
880 RetVal[ j + i ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
886 endService( "CNode_Impl::Ports" );
888 return ( RetVal._retn() ) ;
891 SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) {
893 SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
895 char* FromServiceParameterName ;
896 bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
897 ToServiceParameterName ,
899 & FromServiceParameterName ) ;
901 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
902 if ( anInPort->GetOutPort() ) {
903 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
904 if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
906 beginService( "CNode_Impl::GetLink" );
909 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
910 instanceName() , interfaceName() ,
913 ToServiceParameterName ,
914 (GraphEditor::InNode *) _DataFlowEditor->GetChangeGraphNode( FromNodeName )->GetInNode() ,
915 FromServiceParameterName ,
917 PortableServer::ObjectId * id = myLink->getId() ;
918 CORBA::Object_var obj = _poa->id_to_reference(*id);
919 iobject = SUPERV::Link::_narrow(obj) ;
920 anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ;
923 iobject = anOutPort->InPortObjRef( anInPort ) ;
928 endService( "CNode_Impl::GetLink" );
930 return SUPERV::Link::_duplicate( iobject ) ;
933 long CNode_Impl::SubGraph() {
934 // beginService( "CNode_Impl::SubGraph" );
937 RetVal = _DataFlowNode->SubGraph() ;
939 // endService( "CNode_Impl::SubGraph" );
943 bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
944 beginService( "CNode_Impl::IsLinked" );
945 bool RetVal = _DataFlowNode->IsLinked( ServiceParameterName ) ;
946 MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
947 endService( "CNode_Impl::IsLinked" );
951 bool CNode_Impl::HasInput(const char * ServiceParameterName ) {
952 // beginService( "CNode_Impl::HasInput" );
953 bool RetVal = _DataFlowNode->HasInput( ServiceParameterName ) ;
954 // endService( "CNode_Impl::HasInput" );
958 SUPERV::GraphState CNode_Impl::State() {
959 // beginService( "CNode_Impl::State" );
960 SUPERV::GraphState RetVal = SUPERV::EditingState ;
961 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
962 if ( _DataFlowExecutor && !_DataFlowEditor->EditedAfterExecution() ) {
963 //JR : 12/06/03 if ( _DataFlowExecutor ) {
965 RetVal = _DataFlowExecutor->State( Name() ) ;
968 RetVal = _DataFlowExecutor->State() ;
971 // endService( "CNode_Impl::State" );
974 long CNode_Impl::Thread() {
975 // beginService( "CNode_Impl::Thread" );
977 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
978 if ( _DataFlowExecutor ) {
980 RetVal = _DataFlowExecutor->Thread( Name() ) ;
983 RetVal = _DataFlowExecutor->Thread() ;
986 // endService( "CNode_Impl::Thread" );
989 SUPERV::AutomatonState CNode_Impl::AutoState() {
990 // beginService( "CNode_Impl::AutoState" );
991 SUPERV::AutomatonState RetVal = SUPERV::UnKnownState ;
992 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
993 if ( _DataFlowExecutor ) {
995 RetVal = _DataFlowExecutor->AutomatonState( Name() ) ;
998 RetVal = _DataFlowExecutor->AutomatonState() ;
1001 // endService( "CNode_Impl::AutoState" );
1004 SUPERV::ControlState CNode_Impl::Control() {
1005 // beginService( "CNode_Impl::Control" );
1006 SUPERV::ControlState RetVal = SUPERV::VoidState ;
1007 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1008 if ( _DataFlowExecutor ) {
1010 RetVal = _DataFlowExecutor->ControlState( Name() ) ;
1013 RetVal = _DataFlowExecutor->ControlState() ;
1016 // endService( "CNode_Impl::Control" );
1019 void CNode_Impl::ControlClear() {
1020 // beginService( "CNode_Impl::ControlClear" );
1021 // SUPERV::ControlState RetVal = SUPERV::VoidState ;
1022 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1023 if ( _DataFlowExecutor ) {
1025 _DataFlowExecutor->ControlClear( Name() ) ;
1028 _DataFlowExecutor->ControlClear() ;
1031 // endService( "CNode_Impl::ControlClear" );
1035 bool CNode_Impl::IsReady() {
1036 // beginService( "CNode_Impl::IsReady" );
1037 bool RetVal = false ;
1038 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1039 if ( _DataFlowExecutor ) {
1041 RetVal = _DataFlowExecutor->IsReady( Name() ) ;
1044 RetVal = _DataFlowExecutor->IsReady() ;
1047 // endService( "CNode_Impl::IsReady" );
1051 bool CNode_Impl::IsWaiting() {
1052 // beginService( "CNode_Impl::IsWaiting" );
1053 bool RetVal = false ;
1054 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1055 if ( _DataFlowExecutor ) {
1057 RetVal = _DataFlowExecutor->IsWaiting( Name() ) ;
1060 RetVal = _DataFlowExecutor->IsWaiting() ;
1063 // endService( "CNode_Impl::IsWaiting" );
1067 bool CNode_Impl::IsRunning() {
1068 // beginService( "CNode_Impl::IsRunning" );
1069 bool RetVal = false ;
1070 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1071 if ( _DataFlowExecutor ) {
1073 RetVal = _DataFlowExecutor->IsRunning( Name() ) ;
1076 RetVal = _DataFlowExecutor->IsRunning() ;
1079 // endService( "CNode_Impl::IsRunning" );
1083 bool CNode_Impl::IsDone() {
1084 // beginService( "CNode_Impl::IsDone" );
1085 bool RetVal = false ;
1086 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1087 if ( _DataFlowExecutor ) {
1089 RetVal = _DataFlowExecutor->IsDone( Name() ) ;
1092 RetVal = _DataFlowExecutor->IsDone() ;
1095 // endService( "CNode_Impl::IsDone" );
1099 bool CNode_Impl::IsSuspended() {
1100 // beginService( "CNode_Impl::IsSuspended" );
1101 bool RetVal = false ;
1102 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1103 if ( _DataFlowExecutor ) {
1105 RetVal = _DataFlowExecutor->IsSuspended( Name() ) ;
1108 RetVal = _DataFlowExecutor->IsSuspended() ;
1111 // endService( "CNode_Impl::IsSuspended" );
1115 bool CNode_Impl::ReadyW() {
1116 // beginService( "CNode_Impl::ReadyW" );
1117 bool RetVal = false ;
1118 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1119 if ( _DataFlowExecutor ) {
1121 RetVal = _DataFlowExecutor->ReadyWait( Name() ) ;
1124 RetVal = _DataFlowExecutor->ReadyWait() ;
1127 // endService( "CNode_Impl::ReadyW" );
1131 bool CNode_Impl::RunningW() {
1132 // beginService( "CNode_Impl::RunningW" );
1133 bool RetVal = false ;
1134 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1135 if ( _DataFlowExecutor ) {
1137 RetVal = _DataFlowExecutor->RunningWait( Name() ) ;
1140 RetVal = _DataFlowExecutor->RunningWait() ;
1143 // endService( "CNode_Impl::RunningW" );
1147 bool CNode_Impl::DoneW() {
1148 // beginService( "CNode_Impl::DoneW" );
1149 bool RetVal = false ;
1150 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1151 if ( _DataFlowExecutor ) {
1153 RetVal = _DataFlowExecutor->DoneWait( Name() ) ;
1156 RetVal = _DataFlowExecutor->DoneWait() ;
1159 // endService( "CNode_Impl::DoneW" );
1163 bool CNode_Impl::SuspendedW() {
1164 // beginService( "CNode_Impl::SuspendedW" );
1165 bool RetVal = false ;
1166 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1167 if ( _DataFlowExecutor ) {
1169 RetVal = _DataFlowExecutor->SuspendedWait( Name() ) ;
1172 RetVal = _DataFlowExecutor->SuspendedWait() ;
1175 // endService( "CNode_Impl::SuspendedW" );
1179 void CNode_Impl::ping() {
1180 // beginService( "CNode_Impl::ping" );
1181 bool RetVal = false ;
1182 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1183 if ( _DataFlowExecutor ) {
1185 RetVal = _DataFlowExecutor->Ping( Name() ) ;
1191 // endService( "CNode_Impl::ping" );
1195 bool CNode_Impl::ContainerKill() {
1196 beginService( "CNode_Impl::ContainerKill" );
1197 bool RetVal = false ;
1198 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1199 if ( _DataFlowExecutor && _DataFlowEditor->IsExecuting() ) {
1201 RetVal = _DataFlowExecutor->ContainerKill( Name() ) ;
1204 RetVal = _DataFlowExecutor->ContainerKill() ;
1207 endService( "CNode_Impl::ContainerKill" );
1210 bool CNode_Impl::Kill() {
1211 // beginService( "CNode_Impl::Kill" );
1212 bool RetVal = false ;
1213 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1214 if ( _DataFlowExecutor ) {
1216 RetVal = _DataFlowExecutor->Kill( Name() ) ;
1219 RetVal = _DataFlowExecutor->Kill() ;
1222 // endService( "CNode_Impl::Kill" );
1225 bool CNode_Impl::KillDone() {
1226 // beginService( "CNode_Impl::KillDone" );
1227 bool RetVal = false ;
1228 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1229 if ( _DataFlowExecutor ) {
1231 RetVal = _DataFlowExecutor->KillDone( Name() ) ;
1234 // endService( "CNode_Impl::KillDone" );
1237 bool CNode_Impl::Stop() {
1238 // beginService( "CNode_Impl::Stop" );
1239 bool RetVal ; // = _DataFlowExecutor->Stop() ;
1240 // endService( "CNode_Impl::Stop" );
1243 bool CNode_Impl::Suspend() {
1244 // beginService( "CNode_Impl::Suspend" );
1245 bool RetVal = false ;
1246 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1247 if ( _DataFlowExecutor ) {
1249 RetVal = _DataFlowExecutor->Suspend( Name() ) ;
1252 RetVal = _DataFlowExecutor->Suspend() ;
1255 // endService( "CNode_Impl::Suspend" );
1258 bool CNode_Impl::SuspendDone() {
1259 // beginService( "CNode_Impl::SuspendDone" );
1260 bool RetVal = false ;
1261 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1262 if ( _DataFlowExecutor ) {
1264 RetVal = _DataFlowExecutor->SuspendDone( Name() ) ;
1267 RetVal = _DataFlowExecutor->SuspendDone() ;
1270 // endService( "CNode_Impl::SuspendDone" );
1273 bool CNode_Impl::Resume() {
1274 // beginService( "CNode_Impl::Resume" );
1275 bool RetVal = false ;
1276 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1277 if ( _DataFlowExecutor ) {
1279 RetVal = _DataFlowExecutor->Resume( Name() ) ;
1282 RetVal = _DataFlowExecutor->Resume() ;
1285 // endService( "CNode_Impl::Resume" );
1289 bool CNode_Impl::Run() {
1290 beginService( "CNode_Impl::Run" );
1291 bool RetVal = false ;
1292 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1293 if ( _DataFlowExecutor ) {
1294 _DataFlowEditor->EditedAfterExecution( false ) ;
1296 RetVal = _DataFlowExecutor->Run( Name() , Name() , false ) ;
1299 RetVal = _DataFlowExecutor->Run( false ) ;
1302 endService( "CNode_Impl::Run" );
1306 bool CNode_Impl::ReRun() {
1307 beginService( "CNode_Impl::ReRun" );
1308 bool RetVal = false ;
1309 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1310 if ( _DataFlowExecutor ) {
1311 _DataFlowEditor->EditedAfterExecution( false ) ;
1313 RetVal = _DataFlowExecutor->Run( Name() , Name() , false ) ;
1315 else if ( DataFlowEditor()->IsEditing() ) {
1316 // RetVal = _DataFlowExecutor->Run( false ) ;
1317 return ((Graph_Impl::Graph_Impl *) this)->Graph_Impl::Run() ;
1320 endService( "CNode_Impl::ReRun" );
1324 bool CNode_Impl::ReRunAt( const char * aNodeName ) {
1325 beginService( "CNode_Impl::ReRunAt" );
1326 bool RetVal = false ;
1327 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1328 if ( _DataFlowExecutor ) {
1329 _DataFlowEditor->EditedAfterExecution( false ) ;
1331 RetVal = _DataFlowExecutor->Run( Name() , aNodeName , false ) ;
1334 endService( "CNode_Impl::ReRunAt" );
1338 bool CNode_Impl::ReStart() {
1339 beginService( "CNode_Impl::ReStart" );
1340 bool RetVal = false ;
1341 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1342 if ( _DataFlowExecutor ) {
1344 RetVal = _DataFlowExecutor->Run( Name() , Name() , true ) ;
1347 RetVal = _DataFlowExecutor->Run( true ) ;
1350 endService( "CNode_Impl::ReStart" );
1354 bool CNode_Impl::ReStartAt( const char * aNodeName ) {
1355 beginService( "CNode_Impl::ReStartAt" );
1356 bool RetVal = false ;
1357 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1358 if ( _DataFlowExecutor ) {
1360 RetVal = _DataFlowExecutor->Run( Name() , aNodeName , true ) ;
1363 endService( "CNode_Impl::ReStartAt" );
1367 long CNode_Impl::CpuUsed() {
1369 GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
1370 if ( _DataFlowExecutor ) {
1372 RetVal = _DataFlowExecutor->CpuUsed( Name() ) ;
1375 RetVal = _DataFlowExecutor->CpuUsed() ;