Skip to content

Commit

Permalink
Merge pull request #314 from ktf/revert-pluginmanager-changes
Browse files Browse the repository at this point in the history
Revert "Use 'perfect forwarding' of arguments to plugins"
  • Loading branch information
ktf committed Aug 14, 2013
2 parents fe5e542 + c4fdedd commit 412dc44
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions FWCore/PluginManager/interface/PluginFactory.h
Expand Up @@ -39,33 +39,33 @@ class PluginFactory<R*(Args...)> : public PluginFactoryBase
typedef R* TemplateArgType(Args...);

struct PMakerBase {
virtual R* create(Args&&...) const = 0;
virtual R* create(Args...) const = 0;
virtual ~PMakerBase() {}
};
template<class TPlug>
struct PMaker : public PMakerBase {
PMaker(const std::string& iName) {
PluginFactory<R*(Args...)>::get()->registerPMaker(this,iName);
}
virtual R* create(Args&&... args) const {
return new TPlug(std::forward<Args>(args)...);
virtual R* create(Args... args) const {
return new TPlug(args...);
}
};

// ---------- const member functions ---------------------
virtual const std::string& category() const ;

R* create(const std::string& iName, Args&&... args) const {
return reinterpret_cast<PMakerBase*>(PluginFactoryBase::findPMaker(iName)->second.front().first)->create(std::forward<Args>(args)...);
R* create(const std::string& iName, Args... args) const {
return reinterpret_cast<PMakerBase*>(PluginFactoryBase::findPMaker(iName)->second.front().first)->create(args...);
}

///like above but returns 0 if iName is unknown
R* tryToCreate(const std::string& iName, Args&&... args) const {
R* tryToCreate(const std::string& iName, Args... args) const {
typename Plugins::const_iterator itFound = PluginFactoryBase::tryToFindPMaker(iName);
if(itFound ==m_plugins.end() ) {
return 0;
}
return reinterpret_cast<PMakerBase*>(itFound->second.front().first)->create(std::forward<Args>(args)...);
return reinterpret_cast<PMakerBase*>(itFound->second.front().first)->create(args...);
}
// ---------- static member functions --------------------

Expand Down

0 comments on commit 412dc44

Please sign in to comment.