]> SALOME platform Git repositories - modules/superv.git/blob - src/Supervision/SNode_Impl.cxx
Salome HOME
dd2c45fa189e71f406858c87e3ccdd7331fe84dc
[modules/superv.git] / src / Supervision / SNode_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   : SNode_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 "SNode_Impl.hxx"
35
36 SNode_Impl::SNode_Impl() {
37 }
38
39 SNode_Impl::SNode_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::ListOfStrings & PythonFunction ,
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 , PythonFunction , NodeKindOfNode ) {
50 //  MESSAGE( NodeName << " " );
51   beginService( "SNode_Impl::SNode_Impl" );
52   _thisObj = this ;
53   _id = _poa->activate_object(_thisObj);
54   _Orb = CORBA::ORB::_duplicate(orb);
55   _Poa = poa ;
56   _ContId = contId ;
57 //  DataFlowNode( DataFlowEditor()->AddNode( NodeService , NodeComponentName ,
58 //                                           NodeInterfaceName , NodeName ,
59 //                                           NodeKindOfNode ) ) ;
60 //  DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() ,
61 //                                           "" , "" , "" ,
62 //                                           NodeKindOfNode ) ) ;
63   endService( "SNode_Impl::SNode_Impl" );  
64 }
65
66 SNode_Impl::SNode_Impl( CORBA::ORB_ptr orb ,
67                       PortableServer::POA_ptr poa ,
68                       PortableServer::ObjectId * contId , 
69                       const char *instanceName ,
70                       const char *interfaceName ,
71                       GraphEditor::DataFlow * aDataFlowEditor ,
72                       GraphEditor::InNode * aDataFlowNode ) :
73 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
74   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
75   MESSAGE( DataFlowNode()->Name() << " " );
76   beginService( "SNode_Impl::SNode_Impl" );
77   _thisObj = this ;
78   _id = _poa->activate_object(_thisObj);
79   _Orb = CORBA::ORB::_duplicate(orb);
80   _Poa = poa ;
81   _ContId = contId ;
82   endService( "SNode_Impl::SNode_Impl" );  
83 }
84
85 SNode_Impl::~SNode_Impl() {
86   beginService( "SNode_Impl::~SNode_Impl" );
87   endService( "SNode_Impl::~SNode_Impl" );
88 }
89
90 void SNode_Impl::destroy() {
91   beginService( "SNode_Impl::Destroy" );
92   if ( DataFlowEditor()->IsEditing() ) {
93     SUPERV::GNode_ptr aCoupled = SUPERV::GNode::_narrow( Coupled() ) ;
94     if ( Delete() ) {
95       _poa->deactivate_object(*_id) ;
96 //      CORBA::release(_poa) ;
97       delete(_id) ;
98 //      _thisObj->_remove_ref();
99     }
100     else {
101       MESSAGE("SNode_Impl::destroy ERROR ") ;
102     }
103     if ( !CORBA::is_nil( aCoupled ) ) {
104 //      aCoupled->SetCoupled( "" ) ; : Used in GraphBase::Graph::RemoveNode( EndSwitchNode ) :
105       aCoupled->destroy() ;
106     }
107 // Valid() only after deletion of the corresponding EndSwitchNode :
108     DataFlowEditor()->UnValid() ;
109   }
110   endService( "SNode_Impl::Destroy" );
111 }
112
113 bool SNode_Impl::Delete() {
114   beginService( "SNode_Impl::Delete" );
115   bool RetVal = false ;
116   if ( DataFlowEditor()->IsEditing() ) {
117     DeletePorts() ;
118     RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
119 // Valid() only after deletion of the corresponding EndLoopNode :
120 //    if ( RetVal ) {
121 //      RetVal = DataFlowEditor()->IsValid() ;
122 //    }
123   }
124   endService( "SNode_Impl::Delete" );
125   return RetVal ;
126 }
127