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 : GNode_Impl.cxx
8 // Author : Jean Rahuel
18 //#include "utilities.h"
20 #include "GNode_Impl.hxx"
22 GNode_Impl::GNode_Impl() {
25 GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb ,
26 PortableServer::POA_ptr poa ,
27 PortableServer::ObjectId * contId ,
28 const char *instanceName ,
29 const char *interfaceName ,
30 const char *aDataFlowName ,
31 const SUPERV::KindOfNode aKindOfNode ) :
32 INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowName , aKindOfNode ) {
33 // MESSAGE("GNode_Impl::GNode_Impl activate object instanceName("
34 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
35 // << hex << (void *) this << dec )
37 // _id = _poa->activate_object(_thisObj);
38 // MESSAGE( "GNode_Impl::GNode_Impl " << aDataFlowName );
39 // beginService( "GNode_Impl::GNode_Impl" );
40 _Orb = CORBA::ORB::_duplicate(orb);
43 // endService( "INode_Impl::INode_Impl" );
46 GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb ,
47 PortableServer::POA_ptr poa ,
48 PortableServer::ObjectId * contId ,
49 const char *instanceName ,
50 const char *interfaceName ,
51 GraphEditor::DataFlow * aDataFlowEditor ,
52 const char * FuncName ,
53 const SUPERV::ListOfStrings & PythonFunction ,
54 const SUPERV::KindOfNode NodeKindOfNode ) :
55 // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
56 INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncName , PythonFunction , NodeKindOfNode ) {
57 // MESSAGE( NodeName << " " );
58 // beginService( "GNode_Impl::GNode_Impl" );
60 // cout << "GNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
61 // << " " << strlen( FuncName ) << endl ;
63 if ( NodeKindOfNode == SUPERV::GOTONode ) {
65 _id = _poa->activate_object(_thisObj);
67 _Orb = CORBA::ORB::_duplicate(orb);
70 // DataFlowNode( DataFlowEditor()->AddNode( NodeService , NodeComponentName ,
71 // NodeInterfaceName , NodeName ,
72 // NodeKindOfNode ) );
73 // DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() ,
75 // NodeKindOfNode ) ) ;
76 // endService( "GNode_Impl::GNode_Impl" );
79 GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb ,
80 PortableServer::POA_ptr poa ,
81 PortableServer::ObjectId * contId ,
82 const char *instanceName ,
83 const char *interfaceName ,
84 GraphEditor::DataFlow * aDataFlowEditor ,
85 GraphBase::ListOfFuncName FuncNameList ,
86 GraphBase::ListOfPythonFunctions PythonFunctionList ,
87 const SUPERV::KindOfNode NodeKindOfNode ) :
88 // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
89 INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncNameList , PythonFunctionList , NodeKindOfNode ) {
90 // MESSAGE( NodeName << " " );
91 // beginService( "GNode_Impl::GNode_Impl" );
92 if ( NodeKindOfNode == SUPERV::GOTONode ) {
94 _id = _poa->activate_object(_thisObj);
96 _Orb = CORBA::ORB::_duplicate(orb);
99 // DataFlowNode( DataFlowEditor()->AddNode( NodeService , NodeComponentName ,
100 // NodeInterfaceName , NodeName ,
101 // NodeKindOfNode ) );
102 // DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() ,
104 // NodeKindOfNode ) ) ;
105 // endService( "GNode_Impl::GNode_Impl" );
108 GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb ,
109 PortableServer::POA_ptr poa ,
110 PortableServer::ObjectId * contId ,
111 const char *instanceName ,
112 const char *interfaceName ,
113 GraphEditor::DataFlow * aDataFlowEditor ,
114 GraphEditor::InNode * aDataFlowNode ) :
115 // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
116 INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
117 // beginService( "GNode_Impl::GNode_Impl" );
118 if ( DataFlowNode() && DataFlowNode()->IsGOTONode() ) {
119 // MESSAGE( "GNode_Impl::GNode_Impl " << DataFlowNode()->PyFuncName()
120 // << " _poa->activate_object" );
122 _id = _poa->activate_object(_thisObj);
125 // MESSAGE( "GNode_Impl::GNode_Impl NO _poa->activate_object" );
127 _Orb = CORBA::ORB::_duplicate(orb);
130 // endService( "GNode_Impl::GNode_Impl" );
133 GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb ,
134 PortableServer::POA_ptr poa ,
135 PortableServer::ObjectId * contId ,
136 const char *instanceName ,
137 const char *interfaceName ,
138 GraphExecutor::DataFlow * aDataFlowExecutor ,
139 GraphExecutor::InNode * aDataFlowExecutorNode ) :
140 // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
141 INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowExecutor , aDataFlowExecutorNode ) {
142 // beginService( "GNode_Impl::GNode_Impl" );
143 if ( DataFlowExecutorNode() && DataFlowExecutorNode()->IsGOTONode() ) {
144 // MESSAGE( "GNode_Impl::GNode_Impl " << DataFlowExecutorNode()->Name()
145 // << " _poa->activate_object" );
147 _id = _poa->activate_object(_thisObj);
150 // MESSAGE( "GNode_Impl::GNode_Impl NO _poa->activate_object" );
152 _Orb = CORBA::ORB::_duplicate(orb);
155 // endService( "GNode_Impl::GNode_Impl" );
158 GNode_Impl::~GNode_Impl() {
159 beginService( "GNode_Impl::~GNode_Impl" );
160 endService( "GNode_Impl::~GNode_Impl" );
163 void GNode_Impl::destroy() {
164 beginService( "GNode_Impl::Destroy" );
165 if ( DataFlowEditor()->IsEditing() ) {
167 _poa->deactivate_object(*_id) ;
168 CORBA::release(_poa) ;
170 _thisObj->_remove_ref();
173 // endService( "GNode_Impl::Destroy" );
176 bool GNode_Impl::Delete() {
177 beginService( "GNode_Impl::Delete" );
178 bool RetVal = false ;
179 if ( DataFlowEditor()->IsEditing() ) {
181 RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
183 RetVal = DataFlowEditor()->IsValid() ;
185 endService( "GNode_Impl::Delete" );
189 SUPERV::INode_ptr GNode_Impl::Coupled() {
190 // beginService( "GNode_Impl::Coupled" );
191 SUPERV::INode_var iobject = SUPERV::INode::_nil() ;
192 if ( DataFlowNode() ) {
193 if ( DataFlowNode()->CoupledNode() ) {
194 if ( CORBA::is_nil( DataFlowNode()->CoupledNode()->ObjRef() ) ) {
195 INode_Impl * myNode = new INode_Impl( _Orb , _Poa , _ContId ,
196 instanceName() , interfaceName() ,
198 (GraphEditor::InNode *) DataFlowNode()->CoupledNode()->GetInNode() ) ;
199 PortableServer::ObjectId * id = myNode->getId() ;
200 CORBA::Object_var obj = _poa->id_to_reference(*id);
201 iobject = SUPERV::INode::_narrow(obj) ;
202 myNode->SetObjRef( SUPERV::INode::_duplicate( iobject ) ) ;
205 iobject = SUPERV::INode::_narrow( DataFlowNode()->CoupledNode()->ObjRef() ) ;
210 if ( DataFlowEditor()->Graph()->CoupledNode() ) {
211 if ( CORBA::is_nil( DataFlowEditor()->Graph()->CoupledNode()->ObjRef() ) ) {
212 INode_Impl * myNode = new INode_Impl( _Orb , _Poa , _ContId ,
213 instanceName() , interfaceName() ,
215 (GraphEditor::InNode *) DataFlowEditor()->Graph()->CoupledNode()->GetInNode() ) ;
216 PortableServer::ObjectId * id = myNode->getId() ;
217 CORBA::Object_var obj = _poa->id_to_reference(*id);
218 iobject = SUPERV::INode::_narrow(obj) ;
219 myNode->SetObjRef( SUPERV::INode::_duplicate( iobject ) ) ;
222 iobject = SUPERV::INode::_narrow( DataFlowEditor()->Graph()->CoupledNode()->ObjRef() ) ;
226 // endService( "GNode_Impl::Coupled" );
227 return SUPERV::INode::_duplicate( iobject ) ;