#include <FWCore/PluginManager/interface/PluginFactoryBase.h>
Public Member Functions | |
virtual std::vector< PluginInfo > | available () const =0 |
return info about all plugins which are already available in the program | |
virtual const std::string & | category () const =0 |
returns the name of the category to which this plugin factory belongs | |
PluginFactoryBase () | |
virtual | ~PluginFactoryBase () |
Public Attributes | |
sigc::signal< void, const std::string &, const PluginInfo & > | newPluginAdded_ |
signal containing plugin category, and plugin info for newly added plugin | |
Protected Member Functions | |
template<typename Plugins> | |
Plugins::const_iterator | findPMaker (const std::string &iName, const Plugins &iPlugins) const |
void | finishedConstruction () |
call this as the last line in the constructor of inheriting classes this is done so that the virtual table will be properly initialized when the routine is called | |
void | newPlugin (const std::string &iName) |
template<typename Plugins> | |
Plugins::const_iterator | tryToFindPMaker (const std::string &iName, const Plugins &iPlugins) const |
Static Protected Member Functions | |
template<typename PluginsItr> | |
static void | fillAvailable (PluginsItr iBegin, PluginsItr iEnd, std::vector< PluginInfo > &iReturn) |
template<typename MakersItr> | |
static void | fillInfo (MakersItr iBegin, MakersItr iEnd, PluginInfo &iInfo, std::vector< PluginInfo > &iReturn) |
Private Member Functions | |
void | checkProperLoadable (const std::string &iName, const std::string &iLoadedFrom) const |
const PluginFactoryBase & | operator= (const PluginFactoryBase &) |
PluginFactoryBase (const PluginFactoryBase &) |
Definition at line 34 of file PluginFactoryBase.h.
edmplugin::PluginFactoryBase::PluginFactoryBase | ( | ) | [inline] |
PluginFactoryBase::~PluginFactoryBase | ( | ) | [virtual] |
edmplugin::PluginFactoryBase::PluginFactoryBase | ( | const PluginFactoryBase & | ) | [private] |
virtual std::vector<PluginInfo> edmplugin::PluginFactoryBase::available | ( | ) | const [pure virtual] |
return info about all plugins which are already available in the program
Implemented in edmplugin::PluginCapabilities, edmplugin::PluginFactory< R *(void)>, edmplugin::PluginFactory< R *(Arg)>, and edmplugin::PluginFactory< R *(Arg1, Arg2)>.
virtual const std::string& edmplugin::PluginFactoryBase::category | ( | ) | const [pure virtual] |
returns the name of the category to which this plugin factory belongs
Implemented in edmplugin::PluginCapabilities, edmplugin::PluginFactory< R *(void)>, edmplugin::PluginFactory< R *(Arg)>, and edmplugin::PluginFactory< R *(Arg1, Arg2)>.
Referenced by checkProperLoadable().
void edmplugin::PluginFactoryBase::checkProperLoadable | ( | const std::string & | iName, | |
const std::string & | iLoadedFrom | |||
) | const [inline, private] |
Definition at line 141 of file PluginFactoryBase.h.
References category(), Exception, edmplugin::PluginManager::get(), DBSPlugin::get(), edmplugin::PluginManager::isAvailable(), and edmplugin::PluginManager::staticallyLinkedLoadingFileName().
Referenced by findPMaker(), and tryToFindPMaker().
00141 { 00142 //should check to see if this is from the proper loadable if it 00143 // was not statically linked 00144 if (iLoadedFrom != PluginManager::staticallyLinkedLoadingFileName() && 00145 PluginManager::isAvailable()) { 00146 if( iLoadedFrom != PluginManager::get()->loadableFor(category(),iName).native_file_string() ) { 00147 throw cms::Exception("WrongPluginLoaded")<<"The plugin '"<<iName<<"' should have been loaded from\n '" 00148 <<PluginManager::get()->loadableFor(category(),iName).native_file_string() 00149 <<"'\n but instead it was already loaded from\n '" 00150 <<iLoadedFrom<<"'\n because some other plugin was loaded from the latter loadables.\n" 00151 "To work around the problem the plugin '"<<iName<<"' should only be defined in one of these loadables."; 00152 } 00153 } 00154 }
static void edmplugin::PluginFactoryBase::fillAvailable | ( | PluginsItr | iBegin, | |
PluginsItr | iEnd, | |||
std::vector< PluginInfo > & | iReturn | |||
) | [inline, static, protected] |
Definition at line 122 of file PluginFactoryBase.h.
References fillInfo(), info, it, and edmplugin::PluginInfo::name_.
00124 { 00125 PluginInfo info; 00126 for( PluginsItr it = iBegin; 00127 it != iEnd; 00128 ++it) { 00129 info.name_ = it->first; 00130 fillInfo(it->second.begin(),it->second.end(), 00131 info, iReturn); 00132 } 00133 }
static void edmplugin::PluginFactoryBase::fillInfo | ( | MakersItr | iBegin, | |
MakersItr | iEnd, | |||
PluginInfo & | iInfo, | |||
std::vector< PluginInfo > & | iReturn | |||
) | [inline, static, protected] |
Definition at line 111 of file PluginFactoryBase.h.
References it, and edmplugin::PluginInfo::loadable_.
Referenced by fillAvailable().
00113 { 00114 for(MakersItr it = iBegin; 00115 it != iEnd; 00116 ++it) { 00117 iInfo.loadable_ = it->second; 00118 iReturn.push_back(iInfo); 00119 } 00120 }
Plugins::const_iterator edmplugin::PluginFactoryBase::findPMaker | ( | const std::string & | iName, | |
const Plugins & | iPlugins | |||
) | const [inline, protected] |
Definition at line 69 of file PluginFactoryBase.h.
References checkProperLoadable(), Exception, DBSPlugin::get(), and path().
Referenced by edmplugin::PluginFactory< R *(Arg1, Arg2)>::create(), edmplugin::PluginFactory< R *(Arg)>::create(), and edmplugin::PluginFactory< R *(void)>::create().
00070 { 00071 //do we already have it? 00072 typename Plugins::const_iterator itFound = iPlugins.find(iName); 00073 if(itFound == iPlugins.end()) { 00074 std::string lib = PluginManager::get()->load(this->category(),iName).path().native_file_string(); 00075 itFound = iPlugins.find(iName); 00076 if(itFound == iPlugins.end()) { 00077 throw cms::Exception("PluginCacheError")<<"The plugin '"<<iName<<"' should have been in loadable\n '" 00078 <<lib<<"'\n but was not there. This means the plugin cache is incorrect. Please run 'EdmPluginRefresh "<<lib<<"'"; 00079 } 00080 } else { 00081 checkProperLoadable(iName,itFound->second.front().second); 00082 } 00083 return itFound; 00084 }
void PluginFactoryBase::finishedConstruction | ( | ) | [protected] |
call this as the last line in the constructor of inheriting classes this is done so that the virtual table will be properly initialized when the routine is called
Definition at line 58 of file PluginFactoryBase.cc.
References DBSPlugin::get().
00059 { 00060 PluginFactoryManager::get()->addFactory(this); 00061 }
void PluginFactoryBase::newPlugin | ( | const std::string & | iName | ) | [protected] |
Definition at line 64 of file PluginFactoryBase.cc.
References category, info, edmplugin::PluginInfo::loadable_, edmplugin::PluginInfo::name_, and path().
00065 { 00066 PluginInfo info; 00067 info.loadable_=boost::filesystem::path(PluginManager::loadingFile(),boost::filesystem::no_check); 00068 info.name_=iName; 00069 newPluginAdded_(category(),info); 00070 }
const PluginFactoryBase& edmplugin::PluginFactoryBase::operator= | ( | const PluginFactoryBase & | ) | [private] |
Plugins::const_iterator edmplugin::PluginFactoryBase::tryToFindPMaker | ( | const std::string & | iName, | |
const Plugins & | iPlugins | |||
) | const [inline, protected] |
Definition at line 88 of file PluginFactoryBase.h.
References checkProperLoadable(), Exception, DBSPlugin::get(), and edmplugin::SharedLibrary::path().
Referenced by edmplugin::PluginFactory< R *(Arg)>::tryToCreate(), edmplugin::PluginFactory< R *(Arg1, Arg2)>::tryToCreate(), and edmplugin::PluginFactory< R *(void)>::tryToCreate().
00090 { 00091 //do we already have it? 00092 typename Plugins::const_iterator itFound = iPlugins.find(iName); 00093 if(itFound == iPlugins.end()) { 00094 const SharedLibrary* slib = PluginManager::get()->tryToLoad(this->category(),iName); 00095 if(0!=slib) { 00096 std::string lib = slib->path().native_file_string(); 00097 itFound = iPlugins.find(iName); 00098 if(itFound == iPlugins.end()) { 00099 throw cms::Exception("PluginCacheError")<<"The plugin '"<<iName<<"' should have been in loadable\n '" 00100 <<lib<<"'\n but was not there. This means the plugin cache is incorrect. Please run 'EdmPluginRefresh "<<lib<<"'"; 00101 } 00102 } 00103 } else { 00104 checkProperLoadable(iName,itFound->second.front().second); 00105 } 00106 return itFound; 00107 }
sigc::signal<void,const std::string&, const PluginInfo&> edmplugin::PluginFactoryBase::newPluginAdded_ [mutable] |
signal containing plugin category, and plugin info for newly added plugin
Definition at line 50 of file PluginFactoryBase.h.