]> SALOME platform Git repositories - modules/superv.git/blob - src/Supervision/ESNode_Impl.cxx
Salome HOME
Update copyright information
[modules/superv.git] / src / Supervision / ESNode_Impl.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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 //  SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
23 //  File   : ESNode_Impl.cxx
24 //  Author : Jean Rahuel
25 //  Module : SUPERV
26 //
27 using namespace std;
28 #include <stdio.h>
29 #include <fstream>
30 //#include <sstream>
31 #include <string>
32
33 //#include "utilities.h"
34
35 #include "ESNode_Impl.hxx"
36
37 ESNode_Impl::ESNode_Impl() {
38 }
39
40 ESNode_Impl::ESNode_Impl( CORBA::ORB_ptr orb ,
41                         PortableServer::POA_ptr poa ,
42                         PortableServer::ObjectId * contId , 
43                         const char *instanceName ,
44                         const char *interfaceName ,
45                         GraphEditor::DataFlow * aDataFlowEditor ,
46                         const char * FuncName , 
47                         const SUPERV::KindOfNode NodeKindOfNode ) :
48 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
49   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncName , SUPERV::ListOfStrings() , NodeKindOfNode ) {
50 //  MESSAGE( NodeName << " " );
51   beginService( "ESNode_Impl::ESNode_Impl" );
52 //  if ( FuncName ) {
53 //    cout << "ESNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
54 //         << " " << strlen( FuncName ) << endl ;
55 //  }
56   _thisObj = this ;
57   _id = _poa->activate_object(_thisObj);
58   _Orb = CORBA::ORB::_duplicate(orb);
59   _Poa = poa ;
60   _ContId = contId ;
61 //  DataFlowNode( DataFlowEditor()->AddNode( NodeService , NodeComponentName ,
62 //                                           NodeInterfaceName , NodeName ,
63 //                                           NodeKindOfNode ) ) ;
64 //  DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() ,
65 //                                           "" , "" , "" ,
66 //                                           NodeKindOfNode ) ) ;
67   endService( "ESNode_Impl::ESNode_Impl" );  
68 }
69
70 ESNode_Impl::ESNode_Impl( CORBA::ORB_ptr orb ,
71                       PortableServer::POA_ptr poa ,
72                       PortableServer::ObjectId * contId , 
73                       const char *instanceName ,
74                       const char *interfaceName ,
75                       GraphEditor::DataFlow * aDataFlowEditor ,
76                       GraphEditor::InNode * aDataFlowNode ) :
77 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
78   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
79   MESSAGE( DataFlowNode()->Name() << " " );
80   beginService( "ESNode_Impl::ESNode_Impl" );
81   _thisObj = this ;
82   _id = _poa->activate_object(_thisObj);
83   _Orb = CORBA::ORB::_duplicate(orb);
84   _Poa = poa ;
85   _ContId = contId ;
86   endService( "ESNode_Impl::ESNode_Impl" );  
87 }
88
89 ESNode_Impl::~ESNode_Impl() {
90   beginService( "ESNode_Impl::~ESNode_Impl" );
91   endService( "ESNode_Impl::~ESNode_Impl" );
92 }
93
94 void ESNode_Impl::destroy() {
95   beginService( "ESNode_Impl::Destroy" );
96   if ( DataFlowEditor()->IsEditing() ) {
97 //    SUPERV::GNode_ptr aCoupled = SUPERV::GNode::_narrow( Coupled() ) ;
98     if ( Delete() ) {
99       _poa->deactivate_object(*_id) ;
100 //      CORBA::release(_poa) ;
101       delete(_id) ;
102 //      _thisObj->_remove_ref();
103     }
104     else {
105       MESSAGE("ESNode_Impl::destroy ERROR ") ;
106     }
107 // destroy have to be used for the SwitchNode ==> destroy of the EndSwitchNode
108 //    if ( !CORBA::is_nil( aCoupled ) ) {
109 //      aCoupled->SetCoupled( "" ) ;
110 //      aCoupled->destroy() ;
111 //    }
112   }
113   endService( "ESNode_Impl::Destroy" );
114 }
115
116 bool ESNode_Impl::Delete() {
117   beginService( "ESNode_Impl::Delete" );
118   bool RetVal = false ;
119   if ( DataFlowEditor()->IsEditing() ) {
120     DeletePorts() ;
121     RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
122 // IsValid is done in SNode_Impl::Delete
123 //    if ( RetVal ) {
124 //      RetVal = DataFlowEditor()->IsValid() ;
125 //    }
126   }
127   endService( "ESNode_Impl::Delete" );
128   return RetVal ;
129 }
130