Salome HOME
DCQ:prepare 2.0.0
[modules/superv.git] / src / Supervision / INode_Impl.cxx
index cd5e83ed06cad700b0cdeab06d09ed3cacc9aaaa..a17f538e7005b58f152a406a9b358149080821c3 100644 (file)
@@ -24,20 +24,21 @@ INode_Impl::INode_Impl( CORBA::ORB_ptr orb ,
                       PortableServer::ObjectId * contId , 
                       const char *instanceName ,
                        const char *interfaceName ,
-                       const char *aDataFlowName ) :
+                       const char *aDataFlowName ,
+                       const SUPERV::KindOfNode aKindOfNode ) :
 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
-  CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowName ) {
+  CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowName , aKindOfNode ) {
 //  MESSAGE("INode_Impl::INode_Impl activate object instanceName("
 //          << instanceName << ") interfaceName(" << interfaceName << ") --> "
 //          << hex << (void *) this << dec )
 //  _thisObj = this ;
 //  _id = _poa->activate_object(_thisObj);
-  MESSAGE( "INode_Impl::INode_Impl " << aDataFlowName );
-  beginService( "INode_Impl::INode_Impl" );
+//  MESSAGE( "INode_Impl::INode_Impl " << aDataFlowName );
+//  beginService( "INode_Impl::INode_Impl" );
   _Orb = CORBA::ORB::_duplicate(orb);
   _Poa = poa ;
   _ContId = contId ;
-  endService( "INode_Impl::INode_Impl" );  
+//  endService( "INode_Impl::INode_Impl" );  
 }
 
 INode_Impl::INode_Impl() {
@@ -54,22 +55,22 @@ INode_Impl::INode_Impl( CORBA::ORB_ptr orb ,
                         const SUPERV::KindOfNode NodeKindOfNode ) :
 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
   CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , SALOME_ModuleCatalog::Service() , FuncName , NodeKindOfNode , FuncName , aPythonFunction ) {
-  beginService( "INode_Impl::INode_Impl" );
+//  beginService( "INode_Impl::INode_Impl" );
   if ( FuncName ) {
 //    cout << "INode_Impl::CNode_Impl " << (void *) FuncName << " " << FuncName
 //         << " " << strlen( FuncName ) << endl ;
   }
   if ( NodeKindOfNode == SUPERV::InLineNode ) {
-    MESSAGE( "INode_Impl::INode_Impl " << FuncName << " _poa->activate_object" );
+//    MESSAGE( "INode_Impl::INode_Impl " << FuncName << " _poa->activate_object" );
     _thisObj = this ;
     _id = _poa->activate_object(_thisObj);
   }
-  MESSAGE("INode_Impl::INode_Impl " << FuncName << " " << strlen( FuncName ) ) ;
+//  MESSAGE("INode_Impl::INode_Impl " << FuncName << " " << strlen( FuncName ) ) ;
   _Orb = CORBA::ORB::_duplicate(orb);
   _Poa = poa ;
   _ContId = contId ;
 //  DataFlowNode()->SetPythonFunction( FuncName , aPythonFunction ) ;
-  endService( "INode_Impl::INode_Impl" );  
+//  endService( "INode_Impl::INode_Impl" );  
 }
 
 INode_Impl::INode_Impl( CORBA::ORB_ptr orb ,
@@ -83,18 +84,18 @@ INode_Impl::INode_Impl( CORBA::ORB_ptr orb ,
                         const SUPERV::KindOfNode NodeKindOfNode ) :
 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
   CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , SALOME_ModuleCatalog::Service() , FuncName[0].c_str() , NodeKindOfNode , FuncName , aPythonFunction ) {
-  beginService( "INode_Impl::INode_Impl" );
+//  beginService( "INode_Impl::INode_Impl" );
   if ( NodeKindOfNode == SUPERV::InLineNode ) {
-    MESSAGE( "INode_Impl::INode_Impl " << FuncName[0] << " _poa->activate_object" );
+//    MESSAGE( "INode_Impl::INode_Impl " << FuncName[0] << " _poa->activate_object" );
     _thisObj = this ;
     _id = _poa->activate_object(_thisObj);
   }
-  MESSAGE("INode_Impl::INode_Impl " << FuncName[0].c_str() << " " << strlen( FuncName[0].c_str() ) ) ;
+//  MESSAGE("INode_Impl::INode_Impl " << FuncName[0].c_str() << " " << strlen( FuncName[0].c_str() ) ) ;
   _Orb = CORBA::ORB::_duplicate(orb);
   _Poa = poa ;
   _ContId = contId ;
 //  DataFlowNode()->SetPythonFunction( FuncName , aPythonFunction ) ;
-  endService( "INode_Impl::INode_Impl" );  
+//  endService( "INode_Impl::INode_Impl" );  
 }
 
 INode_Impl::INode_Impl( CORBA::ORB_ptr orb ,
@@ -106,18 +107,45 @@ INode_Impl::INode_Impl( CORBA::ORB_ptr orb ,
                         GraphEditor::InNode * aDataFlowNode ) :
 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
   CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
-  MESSAGE( DataFlowNode()->Name() << " " );
-  beginService( "INode_Impl::INode_Impl" );
-  if ( DataFlowNode()->IsInLineNode() ) {
-    MESSAGE( "INode_Impl::INode_Impl " << DataFlowNode()->PyFuncName()
-             << " _poa->activate_object" );
+//  beginService( "INode_Impl::INode_Impl" );
+  if ( DataFlowNode() && DataFlowNode()->IsInLineNode() ) {
+//    MESSAGE( "INode_Impl::INode_Impl " << DataFlowNode()->PyFuncName()
+//             << " _poa->activate_object" );
     _thisObj = this ;
     _id = _poa->activate_object(_thisObj);
   }
+  else {
+//    MESSAGE( "INode_Impl::INode_Impl NO _poa->activate_object" );
+  }
+  _Orb = CORBA::ORB::_duplicate(orb);
+  _Poa = poa ;
+  _ContId = contId ;
+//  endService( "INode_Impl::INode_Impl" );  
+}
+
+INode_Impl::INode_Impl( CORBA::ORB_ptr orb ,
+                       PortableServer::POA_ptr poa ,
+                       PortableServer::ObjectId * contId , 
+                       const char *instanceName ,
+                        const char *interfaceName ,
+                        GraphExecutor::DataFlow * aDataFlowExecutor ,
+                        GraphExecutor::InNode * aDataFlowExecutorNode ) :
+//  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
+  CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowExecutor , aDataFlowExecutorNode ) {
+//  beginService( "INode_Impl::INode_Impl" );
+  if ( DataFlowExecutorNode() && DataFlowExecutorNode()->IsInLineNode() ) {
+//    MESSAGE( "INode_Impl::INode_Impl " << DataFlowExecutorNode()->Name()
+//             << " _poa->activate_object" );
+    _thisObj = this ;
+    _id = _poa->activate_object(_thisObj);
+  }
+  else {
+//    MESSAGE( "INode_Impl::INode_Impl NO _poa->activate_object" );
+  }
   _Orb = CORBA::ORB::_duplicate(orb);
   _Poa = poa ;
   _ContId = contId ;
-  endService( "INode_Impl::INode_Impl" );  
+//  endService( "INode_Impl::INode_Impl" );  
 }
 
 INode_Impl::~INode_Impl() {
@@ -142,6 +170,7 @@ bool INode_Impl::Delete() {
 //  beginService( "INode_Impl::Delete" );
   bool RetVal = false ;
   if ( DataFlowEditor()->IsEditing() ) {
+    DeletePorts() ;
     RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
     if ( RetVal )
       RetVal = DataFlowEditor()->UnValid() ;
@@ -184,8 +213,8 @@ SUPERV::Port_ptr INode_Impl::InPort( const char *aParameterName ,
   SUPERV::Port_ptr InEndobject = SUPERV::Port::_nil() ;
   Port_Impl * myInPort = NULL ;
   bool InPortCreated = false ;
-  MESSAGE( "CNode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , "
-           << aParameterType << " )" ) ;
+//  MESSAGE( "CNode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , "
+//           << aParameterType << " )" ) ;
   GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
   if ( anInPort == NULL ) {
     anInPort = DataFlowNode()->AddInPort( aParameterName , aParameterType , SUPERV::InLineParameter ) ;
@@ -227,8 +256,8 @@ SUPERV::Port_ptr INode_Impl::OutPort( const char *aParameterName ,
                                       const char *aParameterType ) {
   Port_Impl * myOutPort = NULL ;
   SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
-  MESSAGE( "CNode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , "
-           << aParameterType << " )" ) ;
+//  MESSAGE( "CNode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , "
+//           << aParameterType << " )" ) ;
   GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
   if ( anOutPort == NULL ) {
     anOutPort = DataFlowNode()->AddOutPort( aParameterName , aParameterType , SUPERV::InLineParameter ) ;