]> SALOME platform Git repositories - modules/superv.git/blob - src/Supervision/ESNode_Impl.cxx
Salome HOME
9daaa833f1070c501f5d7e09bf6b0938c95e40bc
[modules/superv.git] / src / Supervision / ESNode_Impl.cxx
1 //  SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : ESNode_Impl.cxx
23 //  Author : Jean Rahuel
24 //  Module : SUPERV
25
26 using namespace std;
27 #include <stdio.h>
28 #include <fstream>
29 //#include <sstream>
30 #include <string>
31
32 //#include "utilities.h"
33
34 #include "ESNode_Impl.hxx"
35
36 ESNode_Impl::ESNode_Impl() {
37 }
38
39 ESNode_Impl::ESNode_Impl( CORBA::ORB_ptr orb ,
40                         PortableServer::POA_ptr poa ,
41                         PortableServer::ObjectId * contId , 
42                         const char *instanceName ,
43                         const char *interfaceName ,
44                         GraphEditor::DataFlow * aDataFlowEditor ,
45                         const char * FuncName , 
46                         const SUPERV::KindOfNode NodeKindOfNode ) :
47 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
48   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncName , SUPERV::ListOfStrings() , NodeKindOfNode ) {
49 //  MESSAGE( NodeName << " " );
50   beginService( "ESNode_Impl::ESNode_Impl" );
51 //  if ( FuncName ) {
52 //    cout << "ESNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
53 //         << " " << strlen( FuncName ) << endl ;
54 //  }
55   _thisObj = this ;
56   _id = _poa->activate_object(_thisObj);
57   _Orb = CORBA::ORB::_duplicate(orb);
58   _Poa = poa ;
59   _ContId = contId ;
60 //  DataFlowNode( DataFlowEditor()->AddNode( NodeService , NodeComponentName ,
61 //                                           NodeInterfaceName , NodeName ,
62 //                                           NodeKindOfNode ) ) ;
63 //  DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() ,
64 //                                           "" , "" , "" ,
65 //                                           NodeKindOfNode ) ) ;
66   endService( "ESNode_Impl::ESNode_Impl" );  
67 }
68
69 ESNode_Impl::ESNode_Impl( CORBA::ORB_ptr orb ,
70                       PortableServer::POA_ptr poa ,
71                       PortableServer::ObjectId * contId , 
72                       const char *instanceName ,
73                       const char *interfaceName ,
74                       GraphEditor::DataFlow * aDataFlowEditor ,
75                       GraphEditor::InNode * aDataFlowNode ) :
76 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
77   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
78   MESSAGE( DataFlowNode()->Name() << " " );
79   beginService( "ESNode_Impl::ESNode_Impl" );
80   _thisObj = this ;
81   _id = _poa->activate_object(_thisObj);
82   _Orb = CORBA::ORB::_duplicate(orb);
83   _Poa = poa ;
84   _ContId = contId ;
85   endService( "ESNode_Impl::ESNode_Impl" );  
86 }
87
88 ESNode_Impl::~ESNode_Impl() {
89   beginService( "ESNode_Impl::~ESNode_Impl" );
90   endService( "ESNode_Impl::~ESNode_Impl" );
91 }
92
93 void ESNode_Impl::destroy() {
94   beginService( "ESNode_Impl::Destroy" );
95   if ( DataFlowEditor()->IsEditing() ) {
96 //    SUPERV::GNode_ptr aCoupled = SUPERV::GNode::_narrow( Coupled() ) ;
97     if ( Delete() ) {
98       _poa->deactivate_object(*_id) ;
99 //      CORBA::release(_poa) ;
100       delete(_id) ;
101 //      _thisObj->_remove_ref();
102     }
103     else {
104       MESSAGE("ESNode_Impl::destroy ERROR ") ;
105     }
106 // destroy have to be used for the SwitchNode ==> destroy of the EndSwitchNode
107 //    if ( !CORBA::is_nil( aCoupled ) ) {
108 //      aCoupled->SetCoupled( "" ) ;
109 //      aCoupled->destroy() ;
110 //    }
111   }
112   endService( "ESNode_Impl::Destroy" );
113 }
114
115 bool ESNode_Impl::Delete() {
116   beginService( "ESNode_Impl::Delete" );
117   bool RetVal = false ;
118   if ( DataFlowEditor()->IsEditing() ) {
119     DeletePorts() ;
120     RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
121 // IsValid is done in SNode_Impl::Delete
122 //    if ( RetVal ) {
123 //      RetVal = DataFlowEditor()->IsValid() ;
124 //    }
125   }
126   endService( "ESNode_Impl::Delete" );
127   return RetVal ;
128 }
129