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 GraphEditor::DataFlow * aDataFlowEditor ,
31 const char * FuncName ,
32 const SUPERV::ListOfStrings & PythonFunction ,
33 const SUPERV::KindOfNode NodeKindOfNode ) :
34 // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
35 INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncName , PythonFunction , NodeKindOfNode ) {
36 // MESSAGE( NodeName << " " );
37 beginService( "GNode_Impl::GNode_Impl" );
39 cout << "GNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
40 << " " << strlen( FuncName ) << endl ;
42 if ( NodeKindOfNode == SUPERV::GOTONode ) {
44 _id = _poa->activate_object(_thisObj);
46 _Orb = CORBA::ORB::_duplicate(orb);
49 // DataFlowNode( DataFlowEditor()->AddNode( NodeService , NodeComponentName ,
50 // NodeInterfaceName , NodeName ,
51 // NodeKindOfNode ) );
52 // DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() ,
54 // NodeKindOfNode ) ) ;
55 endService( "GNode_Impl::GNode_Impl" );
58 GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb ,
59 PortableServer::POA_ptr poa ,
60 PortableServer::ObjectId * contId ,
61 const char *instanceName ,
62 const char *interfaceName ,
63 GraphEditor::DataFlow * aDataFlowEditor ,
64 GraphBase::ListOfFuncName FuncNameList ,
65 GraphBase::ListOfPythonFunctions PythonFunctionList ,
66 const SUPERV::KindOfNode NodeKindOfNode ) :
67 // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
68 INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncNameList , PythonFunctionList , NodeKindOfNode ) {
69 // MESSAGE( NodeName << " " );
70 beginService( "GNode_Impl::GNode_Impl" );
71 if ( NodeKindOfNode == SUPERV::GOTONode ) {
73 _id = _poa->activate_object(_thisObj);
75 _Orb = CORBA::ORB::_duplicate(orb);
78 // DataFlowNode( DataFlowEditor()->AddNode( NodeService , NodeComponentName ,
79 // NodeInterfaceName , NodeName ,
80 // NodeKindOfNode ) );
81 // DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() ,
83 // NodeKindOfNode ) ) ;
84 endService( "GNode_Impl::GNode_Impl" );
87 GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb ,
88 PortableServer::POA_ptr poa ,
89 PortableServer::ObjectId * contId ,
90 const char *instanceName ,
91 const char *interfaceName ,
92 GraphEditor::DataFlow * aDataFlowEditor ,
93 GraphEditor::InNode * aDataFlowNode ) :
94 // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
95 INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
96 MESSAGE( DataFlowNode()->Name() << " " );
97 beginService( "GNode_Impl::GNode_Impl" );
98 if ( DataFlowNode()->IsGOTONode() ) {
100 _id = _poa->activate_object(_thisObj);
102 _Orb = CORBA::ORB::_duplicate(orb);
105 endService( "GNode_Impl::GNode_Impl" );
108 GNode_Impl::~GNode_Impl() {
109 beginService( "GNode_Impl::~GNode_Impl" );
110 endService( "GNode_Impl::~GNode_Impl" );
113 void GNode_Impl::destroy() {
114 beginService( "GNode_Impl::Destroy" );
115 if ( DataFlowEditor()->IsEditing() ) {
117 _poa->deactivate_object(*_id) ;
118 CORBA::release(_poa) ;
120 _thisObj->_remove_ref();
123 endService( "GNode_Impl::Destroy" );
126 bool GNode_Impl::Delete() {
127 // beginService( "GNode_Impl::Delete" );
128 bool RetVal = false ;
129 if ( DataFlowEditor()->IsEditing() ) {
130 RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
132 RetVal = DataFlowEditor()->IsValid() ;
134 // endService( "GNode_Impl::Delete" );
138 SUPERV::INode_ptr GNode_Impl::Coupled() {
139 beginService( "GNode_Impl::Coupled" );
140 SUPERV::INode_var iobject = SUPERV::INode::_nil() ;
141 if ( DataFlowNode()->CoupledNode() ) {
142 if ( CORBA::is_nil( DataFlowNode()->CoupledNode()->ObjRef() ) ) {
143 INode_Impl * myNode = new INode_Impl( _Orb , _Poa , _ContId ,
144 instanceName() , interfaceName() ,
146 (GraphEditor::InNode *) DataFlowNode()->CoupledNode()->GetInNode() ) ;
147 PortableServer::ObjectId * id = myNode->getId() ;
148 CORBA::Object_var obj = _poa->id_to_reference(*id);
149 iobject = SUPERV::INode::_narrow(obj) ;
150 myNode->SetObjRef( SUPERV::INode::_duplicate( iobject ) ) ;
153 iobject = SUPERV::INode::_narrow( DataFlowNode()->CoupledNode()->ObjRef() ) ;
156 endService( "GNode_Impl::Coupled" );
157 return SUPERV::INode::_duplicate( iobject ) ;