- TMesh* mesh = this->m_MeshReader->GetOutput< TMesh >( "Output" );
- this->m_MeshReader->DisconnectOutputs( );
-
- // Add newly added data
- if( this->_InsertNewData( mesh, parent ) )
- return( mesh->GetName( ) );
- else
- return( "" );
- }
- else
- {
-#ifdef cpPlugins_Interface_QT4
- if( this->m_Widget != NULL )
- QMessageBox::critical(
- this->m_Widget,
- QMessageBox::tr( "Error reading mesh." ),
- QMessageBox::tr( err.c_str( ) )
- );
-#else // cpPlugins_Interface_QT4
- std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
- return( "" );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteImage( const std::string& fname, const std::string& name )
-{
- // Check if objects exist
- if( this->m_ImageWriter.IsNull( ) )
- return( false );
- TImage* image = this->GetImage( name );
- if( image == NULL )
- return( false );
-
- // Configure writer
- this->m_ImageWriter->GetParameters( )->SetString( "FileName", fname );
- this->m_ImageWriter->SetInput( "Input", image );
-
- // Execute filter
- this->BlockWidget( );
- std::string err = this->m_ImageWriter->Update( );
- this->UnblockWidget( );
-
- // Get result, if any
- if( err != "" )
- {
-#ifdef cpPlugins_Interface_QT4
- if( this->m_Widget != NULL )
- QMessageBox::critical(
- this->m_Widget,
- QMessageBox::tr( "Error reading mesh." ),
- QMessageBox::tr( err.c_str( ) )
- );
-#else // cpPlugins_Interface_QT4
- std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
- return( false );
- }
- else
- return( true );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteImage( const std::string& name )
-{
- // Check if objects exist
- if( this->m_ImageWriter.IsNull( ) )
- return( false );
- TImage* image = this->GetImage( name );
- if( image == NULL )
- return( false );
-
- // Configure writer
- TProcessObject::DialogResult dret =
- this->m_ImageWriter->ExecConfigurationDialog( this->m_Widget );
- if( dret == TProcessObject::DialogResult_Cancel )
- return( "" );
- this->m_ImageWriter->SetInput( "Input", image );
-
- // Execute filter
- this->BlockWidget( );
- std::string err = this->m_ImageWriter->Update( );
- this->UnblockWidget( );
-
- // Get result, if any
- if( err != "" )
- {
-#ifdef cpPlugins_Interface_QT4
- if( this->m_Widget != NULL )
- QMessageBox::critical(
- this->m_Widget,
- QMessageBox::tr( "Error reading mesh." ),
- QMessageBox::tr( err.c_str( ) )
+ std::string value, category, name;
+ str >> value;
+ if( value == "" )
+ continue;
+ std::replace( value.begin( ), value.end( ), ':', ' ' );
+ std::istringstream value_str( value );
+ value_str >> category >> name;
+
+ // Check if the filter has been already loaded
+ bool found = false;
+ auto fIt = this->m_Filters.find( category );
+ if( fIt != this->m_Filters.end( ) )
+ found = fIt->second.find( name ) != fIt->second.end( );
+ if( found )
+ {
+ cpPlugins::OS::DLLManager::UnLoad( hnd );
+ throw std::runtime_error(
+ std::string( "Filter \"" ) +
+ category + std::string( "::" ) + name +
+ std::string( "\" already exists." )