]> SALOME platform Git repositories - modules/superv.git/blob - src/Supervision/ELNode_Impl.cxx
Salome HOME
*** empty log message ***
[modules/superv.git] / src / Supervision / ELNode_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   : ELNode_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 "ELNode_Impl.hxx"
21
22 ELNode_Impl::ELNode_Impl() {
23 }
24
25 ELNode_Impl::ELNode_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 * EndName , 
32                         const SUPERV::KindOfNode NodeKindOfNode ) :
33 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
34   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , EndName , SUPERV::ListOfStrings() , NodeKindOfNode ) {
35 //  MESSAGE( NodeName << " " );
36   beginService( "ELNode_Impl::ELNode_Impl" );
37   _thisObj = this ;
38   _id = _poa->activate_object(_thisObj);
39   _Orb = CORBA::ORB::_duplicate(orb);
40   _Poa = poa ;
41   _ContId = contId ;
42 //  DataFlowNode( DataFlowEditor()->AddNode( InitFunction , MoreFunction , NextFunction ,
43 //                                           NodeName , NodeKindOfNode ) ) ;
44 //  DataFlowNode( DataFlowEditor()->AddNode( SALOME_ModuleCatalog::Service() ,
45 //                                           "" , "" , "" ,
46 //                                           NodeKindOfNode ) ) ;
47   endService( "ELNode_Impl::ELNode_Impl" );  
48 }
49
50 ELNode_Impl::ELNode_Impl( CORBA::ORB_ptr orb ,
51                       PortableServer::POA_ptr poa ,
52                       PortableServer::ObjectId * contId , 
53                       const char *instanceName ,
54                       const char *interfaceName ,
55                       GraphEditor::DataFlow * aDataFlowEditor ,
56                       GraphEditor::InNode * aDataFlowNode ) :
57 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
58   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
59   MESSAGE( DataFlowNode()->Name() << " " );
60   beginService( "ELNode_Impl::ELNode_Impl" );
61   _thisObj = this ;
62   _id = _poa->activate_object(_thisObj);
63   _Orb = CORBA::ORB::_duplicate(orb);
64   _Poa = poa ;
65   _ContId = contId ;
66   endService( "ELNode_Impl::ELNode_Impl" );  
67 }
68
69 ELNode_Impl::~ELNode_Impl() {
70   beginService( "ELNode_Impl::~ELNode_Impl" );
71   endService( "ELNode_Impl::~ELNode_Impl" );
72 }
73
74 void ELNode_Impl::destroy() {
75   MESSAGE("-------->  ELNode_Impl::destroy()  BEGIN");
76   beginService( "ELNode_Impl::Destroy" );
77   if ( DataFlowEditor()->IsEditing() ) {
78     MESSAGE("-------->  Editing dataflow");
79     SUPERV::GNode_ptr aCoupled = SUPERV::GNode::_narrow( Coupled() ) ;
80     if ( Delete() ) {
81       MESSAGE("-------->  Delete return true");
82       _poa->deactivate_object(*_id) ;
83       CORBA::release(_poa) ;
84       delete(_id) ;
85       _thisObj->_remove_ref();
86     }
87     if ( !CORBA::is_nil( aCoupled ) ) {
88       aCoupled->SetCoupled( "" ) ;
89       aCoupled->destroy() ;
90     }
91   }
92   endService( "ELNode_Impl::Destroy" );
93   MESSAGE("-------->  ELNode_Impl::destroy()  END");
94 }
95
96 bool ELNode_Impl::Delete() {
97 //  beginService( "ELNode_Impl::Delete" );
98   MESSAGE("-------->  ELNode_Impl::Delete()  BEGIN");
99   bool RetVal = false ;
100   if ( DataFlowEditor()->IsEditing() ) {
101     MESSAGE("-------->  In Delete: Editing dataflow");
102     RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
103     MESSAGE("-------->  RetVal = "<<RetVal);
104     if ( RetVal ) {
105       MESSAGE("-------->  Before IsValid");
106       RetVal = DataFlowEditor()->IsValid() ;
107       MESSAGE("-------->  After IsValid");
108     }
109   }
110 //  endService( "ELNode_Impl::Delete" );
111   MESSAGE("-------->  ELNode_Impl::Delete()  END");
112   return RetVal ;
113 }