]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/ProcessObject.hxx
...
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.hxx
index 33b4a2022cb558bc9a943c4be8a8c4240038116d..a3362fc5b8ce25de6305aa15d636456cb575c7cc 100644 (file)
@@ -4,11 +4,11 @@
 // -------------------------------------------------------------------------
 template< class T >
 T* cpPlugins::Interface::ProcessObject::
-GetInput( const std::string& id )
+GetInputData( const std::string& id )
 {
   _TDataContainer::iterator i = this->m_Inputs.find( id );
   if( i != this->m_Inputs.end( ) )
-    return( dynamic_cast< T* >( i->second.GetPointer( ) ) );
+    return( dynamic_cast< T* >( i->second->GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -16,11 +16,11 @@ GetInput( const std::string& id )
 // -------------------------------------------------------------------------
 template< class T >
 const T* cpPlugins::Interface::ProcessObject::
-GetInput( const std::string& id ) const
+GetInputData( const std::string& id ) const
 {
   _TDataContainer::const_iterator i = this->m_Inputs.find( id );
   if( i != this->m_Inputs.end( ) )
-    return( dynamic_cast< const T* >( i->second.GetPointer( ) ) );
+    return( dynamic_cast< const T* >( i->second->GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -28,11 +28,11 @@ GetInput( const std::string& id ) const
 // -------------------------------------------------------------------------
 template< class T >
 T* cpPlugins::Interface::ProcessObject::
-GetOutput( const std::string& id )
+GetOutputData( const std::string& id )
 {
   _TDataContainer::iterator i = this->m_Outputs.find( id );
   if( i != this->m_Outputs.end( ) )
-    return( dynamic_cast< T* >( i->second.GetPointer( ) ) );
+    return( dynamic_cast< T* >( i->second->GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -40,11 +40,11 @@ GetOutput( const std::string& id )
 // -------------------------------------------------------------------------
 template< class T >
 const T* cpPlugins::Interface::ProcessObject::
-GetOutput( const std::string& id ) const
+GetOutputData( const std::string& id ) const
 {
   _TDataContainer::const_iterator i = this->m_Outputs.find( id );
   if( i != this->m_Outputs.end( ) )
-    return( dynamic_cast< const T* >( i->second.GetPointer( ) ) );
+    return( dynamic_cast< const T* >( i->second->GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -54,8 +54,15 @@ template< class O >
 void cpPlugins::Interface::ProcessObject::
 _AddOutput( const std::string& id )
 {
-  this->m_Outputs[ id ] = O::New( );
-  this->m_Outputs[ id ]->SetSource( this );
+  auto oIt = this->m_Outputs.find( id );
+  if( oIt == this->m_Outputs.end( ) )
+  {
+    this->m_Outputs[ id ] = new DataObject::Pointer( );
+    oIt = this->m_Outputs.find( id );
+
+  } // fi
+  *( oIt->second ) = O::New( );
+  ( *( oIt->second ) )->SetSource( this );
   this->Modified( );
 }