Salome HOME
e716e6012df0c319aa937e636513cda6ba5b4abb
[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  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : SNode_Impl.cxx
8 //  Author : Jean Rahuel
9 //  Module : SUPERV
10 //  $Header: 
11
12 using namespace std;
13 #include <stdio.h>
14 #include <fstream>
15 //#include <sstream>
16 #include <string>
17
18 //#include "utilities.h"
19
20 #include "SNode_Impl.hxx"
21
22 SNode_Impl::SNode_Impl() {
23 }
24
25 SNode_Impl::SNode_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   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncName , PythonFunction , NodeKindOfNode ) {
36 //  MESSAGE( NodeName << " " );
37   beginService( "SNode_Impl::SNode_Impl" );
38   _thisObj = this ;
39   _id = _poa->activate_object(_thisObj);
40   _Orb = CORBA::ORB::_duplicate(orb);
41   _Poa = poa ;
42   _ContId = contId ;
43 //  DataFlowNode( DataFlowEditor()->AddNode( NodeService , NodeComponentName ,
44 //                                           NodeInterfaceName , NodeName ,
45 //                                           NodeKindOfNode ) ) ;
46 //  DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() ,
47 //                                           "" , "" , "" ,
48 //                                           NodeKindOfNode ) ) ;
49   endService( "SNode_Impl::SNode_Impl" );  
50 }
51
52 SNode_Impl::SNode_Impl( CORBA::ORB_ptr orb ,
53                       PortableServer::POA_ptr poa ,
54                       PortableServer::ObjectId * contId , 
55                       const char *instanceName ,
56                       const char *interfaceName ,
57                       GraphEditor::DataFlow * aDataFlowEditor ,
58                       GraphEditor::InNode * aDataFlowNode ) :
59 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
60   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
61   MESSAGE( DataFlowNode()->Name() << " " );
62   beginService( "SNode_Impl::SNode_Impl" );
63   _thisObj = this ;
64   _id = _poa->activate_object(_thisObj);
65   _Orb = CORBA::ORB::_duplicate(orb);
66   _Poa = poa ;
67   _ContId = contId ;
68   endService( "SNode_Impl::SNode_Impl" );  
69 }
70
71 SNode_Impl::~SNode_Impl() {
72   beginService( "SNode_Impl::~SNode_Impl" );
73   endService( "SNode_Impl::~SNode_Impl" );
74 }
75
76 void SNode_Impl::destroy() {
77   beginService( "SNode_Impl::Destroy" );
78   if ( DataFlowEditor()->IsEditing() ) {
79     if ( Delete() ) {
80       _poa->deactivate_object(*_id) ;
81       CORBA::release(_poa) ;
82       delete(_id) ;
83       _thisObj->_remove_ref();
84     }
85   }
86   endService( "SNode_Impl::Destroy" );
87 }
88
89 bool SNode_Impl::Delete() {
90 //  beginService( "SNode_Impl::Delete" );
91   bool RetVal = false ;
92   if ( DataFlowEditor()->IsEditing() ) {
93     RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
94     if ( RetVal )
95       RetVal = DataFlowEditor()->IsValid() ;
96   }
97 //  endService( "SNode_Impl::Delete" );
98   return RetVal ;
99 }
100