]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/ProcessObject.hxx
Widget integration (step 6/6): Interactive architecture finished. Needs to be tested...
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.hxx
index 50c03ce82cdfc0fb4c7a13fc2bd1f30424a56b5d..10b4dbe99fcc7a66fb02a42d978523e57b3e5c61 100644 (file)
@@ -36,10 +36,11 @@ GetVTK( ) const
 // -------------------------------------------------------------------------
 template< class T >
 T* cpPlugins::Interface::ProcessObject::
-GetInput( unsigned int idx )
+GetInput( const std::string& id )
 {
-  if( idx < this->m_Inputs.size( ) )
-    return( dynamic_cast< T* >( this->m_Inputs[ idx ].GetPointer( ) ) );
+  _TDataContainer::iterator i = this->m_Inputs.find( id );
+  if( i != this->m_Inputs.end( ) )
+    return( dynamic_cast< T* >( i->second.GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -47,12 +48,11 @@ GetInput( unsigned int idx )
 // -------------------------------------------------------------------------
 template< class T >
 const T* cpPlugins::Interface::ProcessObject::
-GetInput( unsigned int idx ) const
+GetInput( const std::string& id ) const
 {
-  if( idx < this->m_Inputs.size( ) )
-    return(
-      dynamic_cast< const T* >( this->m_Inputs[ idx ].GetPointer( ) )
-      );
+  _TDataContainer::const_iterator i = this->m_Inputs.find( id );
+  if( i != this->m_Inputs.end( ) )
+    return( dynamic_cast< const T* >( i->second.GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -60,10 +60,11 @@ GetInput( unsigned int idx ) const
 // -------------------------------------------------------------------------
 template< class T >
 T* cpPlugins::Interface::ProcessObject::
-GetOutput( unsigned int idx )
+GetOutput( const std::string& id )
 {
-  if( idx < this->m_Outputs.size( ) )
-    return( dynamic_cast< T* >( this->m_Outputs[ idx ].GetPointer( ) ) );
+  _TDataContainer::iterator i = this->m_Outputs.find( id );
+  if( i != this->m_Outputs.end( ) )
+    return( dynamic_cast< T* >( i->second.GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -71,12 +72,11 @@ GetOutput( unsigned int idx )
 // -------------------------------------------------------------------------
 template< class T >
 const T* cpPlugins::Interface::ProcessObject::
-GetOutput( unsigned int idx ) const
+GetOutput( const std::string& id ) const
 {
-  if( idx < this->m_Outputs.size( ) )
-    return(
-      dynamic_cast< const T* >( this->m_Outputs[ idx ].GetPointer( ) )
-      );
+  _TDataContainer::const_iterator i = this->m_Outputs.find( id );
+  if( i != this->m_Outputs.end( ) )
+    return( dynamic_cast< const T* >( i->second.GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -117,12 +117,11 @@ _CreateVTK( )
 // -------------------------------------------------------------------------
 template< class O >
 void cpPlugins::Interface::ProcessObject::
-_MakeOutput( unsigned int idx )
+_MakeOutput( const std::string& id )
 {
-  if( idx >= this->m_Outputs.size( ) )
-    return;
-  this->m_Outputs[ idx ] = O::New( );
-  this->m_Outputs[ idx ]->SetSource( this );
+  this->m_Outputs[ id ] = O::New( );
+  this->m_Outputs[ id ]->SetSource( this );
+  this->Modified( );
 }
 
 #endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__