X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FInterface.cxx;h=e4160c623869688f6cfe63bccf98208521651838;hb=a3f2018cdd92e865082fed86673f10207c21ec51;hp=332ace5db7ce76768bea1b1480fec2cd29d1c437;hpb=8c23766af88a29c3e830299dffc4b95d9fe61df9;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/Interface.cxx b/lib/cpPlugins/Interface/Interface.cxx index 332ace5..e4160c6 100644 --- a/lib/cpPlugins/Interface/Interface.cxx +++ b/lib/cpPlugins/Interface/Interface.cxx @@ -31,7 +31,7 @@ GetClasses( ) const } // ------------------------------------------------------------------------- -cpPlugins::Interface::Object* cpPlugins::Interface::Interface:: +cpPlugins::Interface::Object::Pointer cpPlugins::Interface::Interface:: CreateObject( const std::string& name ) const { TClassesIterator cIt = this->m_Classes.find( name ); @@ -40,12 +40,23 @@ CreateObject( const std::string& name ) const ObjectProvider* provider = dynamic_cast< ObjectProvider* >( this->m_Providers[ cIt->second ] ); if( provider != NULL ) - return( dynamic_cast< Object* >( provider->create( ) ) ); + return( provider->create( ) ); } // fi return( NULL ); } +// ------------------------------------------------------------------------- +cpPlugins::Interface::ProcessObject::Pointer +cpPlugins::Interface::Interface:: +CreateProcessObject( const std::string& name ) const +{ + cpPlugins::Interface::Object::Pointer o = this->CreateObject( name ); + cpPlugins::Interface::ProcessObject::Pointer p = + dynamic_cast< cpPlugins::Interface::ProcessObject* >( o.GetPointer( ) ); + return( p ); +} + // ------------------------------------------------------------------------- bool cpPlugins::Interface::Interface:: Load( const std::string& path ) @@ -134,9 +145,8 @@ _LoadClasses( ) // Get reader provider for( unsigned int i = 0; i < this->m_Providers.size( ); ++i ) { - Object* dummy = this->m_Providers[ i ]->create( ); + Object::Pointer dummy = this->m_Providers[ i ]->create( ); this->m_Classes[ dummy->GetClassName( ) ] = i; - delete dummy; } // rof }