From: stephan b. <sg...@us...> - 2004-12-26 06:02:02
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17821/include/pclasses/Plugin Modified Files: Plugin.h Log Message: Added factory aliasing support. Allows mapping multiple names to one factory. Index: Plugin.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Plugin/Plugin.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Plugin.h 25 Dec 2004 20:50:20 -0000 1.11 +++ Plugin.h 26 Dec 2004 06:01:52 -0000 1.12 @@ -79,17 +79,21 @@ The caller owns the returned object, which may be 0. */ virtual - ResultType create( const std::string & feature ) + ResultType create( const std::string & _feature ) { + std::string feature = this->expandAliases( _feature ); + //CERR << "create("<<_feature<<" ["<<feature<<"])\n"; InterfaceType * ret = ParentType::create( feature ); if( ret ) return ret; std::string dll = this->findPlugin( feature ); if( dll.empty() ) { + //CERR << "No dll found for feature '"<<feature<<"'!\n"; return 0; } try { + //CERR << "Adding plugin '"<<dll<<"'!\n"; this->addPlugin( dll ); ret = ParentType::create( feature ); } @@ -290,14 +294,24 @@ return pluginManager<T>().findPlugin( name ); } + /** + Convenience function returning + pluginManager<T>().searchPath(). + */ + template <typename T> + ::P::System::PathFinder & searchPath() + { + return pluginManager<T>().searchPath(); + } + } // namespace Plugin -#ifndef PCLASSES_DEFAULT_FACTORY_KNOWS_SHAREDLIBS -# define PCLASSES_DEFAULT_FACTORY_KNOWS_SHAREDLIBS 1 +#ifndef PCLASSES_ENABLE_PLUGINS_FACTORY_HOOK +# define PCLASSES_ENABLE_PLUGINS_FACTORY_HOOK 0 #endif -#if PCLASSES_DEFAULT_FACTORY_KNOWS_SHAREDLIBS +#if PCLASSES_ENABLE_PLUGINS_FACTORY_HOOK namespace Hook { /** @@ -318,7 +332,7 @@ */ void operator()( FactoryType & ) throw() { - CERR << "Initializing a PluginManager instance() we hacked in via FactoryInstanceHook!\n"; + // CERR << "Initializing a PluginManager instance() we hacked in via FactoryInstanceHook!\n"; } /** @@ -334,7 +348,7 @@ }; } // ns Hook -#endif // PCLASSES_DEFAULT_FACTORY_KNOWS_SHAREDLIBS +#endif // PCLASSES_ENABLE_PLUGINS_FACTORY_HOOK } // namespace P |