]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/ProcessObject.cxx
...
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.cxx
index c710a8ff823a1cbb912c6389cddbb8a984e03fe5..5434319fb09c1d9e7a8b47169e15185d83cda862 100644 (file)
@@ -46,7 +46,9 @@ GetNumberOfOutputs( ) const
 
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::ProcessObject::
-SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj )
+SetInput(
+  const std::string& id, cpPlugins::Interface::DataObject::Pointer* dobj
+  )
 {
   _TDataContainer::iterator i = this->m_Inputs.find( id );
   if( i != this->m_Inputs.end( ) )
@@ -69,9 +71,9 @@ Update( )
   _TDataContainer::iterator i = this->m_Inputs.begin( );
   for( ; i != this->m_Inputs.end( ) && r == ""; ++i )
   {
-    if( i->second.IsNotNull( ) )
+    if( i->second->IsNotNull( ) )
     {
-      Self* src = dynamic_cast< Self* >( i->second->GetSource( ) );
+      Self* src = dynamic_cast< Self* >( ( *( i->second ) )->GetSource( ) );
       if( src != NULL )
         r = src->Update( );
     }
@@ -94,8 +96,8 @@ DisconnectOutputs( )
 {
   _TDataContainer::iterator i = this->m_Outputs.begin( );
   for( ; i != this->m_Outputs.end( ); ++i )
-    if( i->second.IsNotNull( ) )
-      i->second->DisconnectPipeline( );
+    if( i->second->IsNotNull( ) )
+      ( *( i->second ) )->DisconnectPipeline( );
 }
 
 // -------------------------------------------------------------------------
@@ -184,14 +186,31 @@ cpPlugins::Interface::ProcessObject::
   if( this->m_ParametersDialog != NULL )
     delete this->m_ParametersDialog;
 #endif // cpPlugins_Interface_QT4
+
+  /*
+    auto iIt = this->m_Inputs.begin( );
+    for( ; iIt != this->m_Inputs.end( ); ++iIt )
+    delete iIt->second;
+    this->m_Inputs.clear( );
+  */
+
+  auto oIt = this->m_Outputs.begin( );
+  for( ; oIt != this->m_Outputs.end( ); ++oIt )
+    delete oIt->second;
+  this->m_Outputs.clear( );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::ProcessObject::
 _AddInput( const std::string& name )
 {
-  this->m_Inputs[ name ] = NULL;
-  this->Modified( );
+  auto i = this->m_Inputs.find( name );
+  if( i == this->m_Inputs.end( ) )
+  {
+    this->m_Inputs[ name ] = NULL;
+    this->Modified( );
+
+  } // fi
 }
 
 // eof - $RCSfile$