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   beginService( "ELNode_Impl::Destroy" );
76   if ( DataFlowEditor()->IsEditing() ) {
77 //    SUPERV::GNode_ptr aCoupled = SUPERV::GNode::_narrow( Coupled() ) ;
78     if ( Delete() ) {
79       _poa->deactivate_object(*_id) ;
80       CORBA::release(_poa) ;
81       delete(_id) ;
82       _thisObj->_remove_ref();
83     }
84     else {
85       MESSAGE("ELNode_Impl::destroy ERROR ") ;
86     }
87 // destroy have to be used for the LoopNode ==> destroy of the EndLoopNode
88 //    if ( !CORBA::is_nil( aCoupled ) ) {
89 //      aCoupled->SetCoupled( "" ) ;
90 //      aCoupled->destroy() ;
91 //    }
92   }
93   endService( "ELNode_Impl::Destroy" );
94 }
95
96 bool ELNode_Impl::Delete() {
97   beginService( "ELNode_Impl::Delete" );
98   bool RetVal = false ;
99   if ( DataFlowEditor()->IsEditing() ) {
100     DeletePorts() ;
101     RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
102 // IsValid is done in LNode_Impl::Delete
103 //    if ( RetVal ) {
104 //      RetVal = DataFlowEditor()->IsValid() ;
105 //    }
106   }
107   endService( "ELNode_Impl::Delete" );
108   return RetVal ;
109 }