Salome HOME
PAL8521
[modules/superv.git] / src / Supervision / ESNode_Impl.cxx
index 5b20b25a79c14d78961e6236c68b38edc6e188d0..1cb438e4cfe77c0a0ddc71b75a8da921db9247c6 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "ESNode_Impl.hxx"
 
@@ -34,10 +34,10 @@ ESNode_Impl::ESNode_Impl( CORBA::ORB_ptr orb ,
   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncName , SUPERV::ListOfStrings() , NodeKindOfNode ) {
 //  MESSAGE( NodeName << " " );
   beginService( "ESNode_Impl::ESNode_Impl" );
-  if ( FuncName ) {
-    cout << "ESNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
-         << " " << strlen( FuncName ) << endl ;
-  }
+//  if ( FuncName ) {
+//    cout << "ESNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
+//         << " " << strlen( FuncName ) << endl ;
+//  }
   _thisObj = this ;
   _id = _poa->activate_object(_thisObj);
   _Orb = CORBA::ORB::_duplicate(orb);
@@ -79,25 +79,37 @@ ESNode_Impl::~ESNode_Impl() {
 void ESNode_Impl::destroy() {
   beginService( "ESNode_Impl::Destroy" );
   if ( DataFlowEditor()->IsEditing() ) {
+//    SUPERV::GNode_ptr aCoupled = SUPERV::GNode::_narrow( Coupled() ) ;
     if ( Delete() ) {
       _poa->deactivate_object(*_id) ;
       CORBA::release(_poa) ;
       delete(_id) ;
       _thisObj->_remove_ref();
     }
+    else {
+      MESSAGE("ESNode_Impl::destroy ERROR ") ;
+    }
+// destroy have to be used for the SwitchNode ==> destroy of the EndSwitchNode
+//    if ( !CORBA::is_nil( aCoupled ) ) {
+//      aCoupled->SetCoupled( "" ) ;
+//      aCoupled->destroy() ;
+//    }
   }
   endService( "ESNode_Impl::Destroy" );
 }
 
 bool ESNode_Impl::Delete() {
-//  beginService( "ESNode_Impl::Delete" );
+  beginService( "ESNode_Impl::Delete" );
   bool RetVal = false ;
   if ( DataFlowEditor()->IsEditing() ) {
+    DeletePorts() ;
     RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
-    if ( RetVal )
-      RetVal = DataFlowEditor()->IsValid() ;
+// IsValid is done in SNode_Impl::Delete
+//    if ( RetVal ) {
+//      RetVal = DataFlowEditor()->IsValid() ;
+//    }
   }
-//  endService( "ESNode_Impl::Delete" );
+  endService( "ESNode_Impl::Delete" );
   return RetVal ;
 }