1 #ifndef FWCore_PluginManager_PluginFactory_h 2 #define FWCore_PluginManager_PluginFactory_h 36 template <
typename R,
typename... Args>
38 friend class DummyFriend;
45 virtual R*
create(Args...)
const = 0;
48 template <
class TPlug>
49 struct PMaker :
public PMakerBase {
51 R*
create(Args...
args)
const override {
return new TPlug(std::forward<Args>(
args)...); }
64 if (
found ==
nullptr) {
84 #define FWCORE_CONCATENATE_HIDDEN(a, b) a##b 85 #define FWCORE_CONCATENATE(a, b) FWCORE_CONCATENATE_HIDDEN(a, b) 86 #define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_) \ 87 namespace edmplugin { \ 89 edmplugin::PluginFactory<_factory_::TemplateArgType>* edmplugin::PluginFactory<_factory_::TemplateArgType>::get() { \ 90 CMS_THREAD_SAFE static edmplugin::PluginFactory<_factory_::TemplateArgType> s_instance; \ 94 const std::string& edmplugin::PluginFactory<_factory_::TemplateArgType>::category() const { \ 95 static const std::string s_cat(_category_); \ 99 enum { FWCORE_CONCATENATE(dummy_edm_register_pluginfactory_, __LINE__) } 101 #define EDM_REGISTER_PLUGINFACTORY2(_factory_, _category_) \ 102 namespace edmplugin { \ 104 edmplugin::PluginFactory<_factory_::TemplateArgType>* edmplugin::PluginFactory<_factory_::TemplateArgType>::get() { \ 105 CMS_THREAD_SAFE static edmplugin::PluginFactory<_factory_::TemplateArgType> s_instance; \ 106 return &s_instance; \ 109 const std::string& edmplugin::PluginFactory<_factory_::TemplateArgType>::category() const { \ 110 static const std::string s_cat(_category_); \ 114 enum { FWCORE_CONCATENATE(dummy_edm_register_pluginfactory_2_, __LINE__) } 118 #define EDM_PLUGIN_SYM(x, y) EDM_PLUGIN_SYM2(x, y) 119 #define EDM_PLUGIN_SYM2(x, y) x##y 121 #define DEFINE_EDM_PLUGIN(factory, type, name) \ 122 static const factory::PMaker<type> EDM_PLUGIN_SYM(s_maker, __LINE__)(name) 124 #define DEFINE_EDM_PLUGIN2(factory, type, name) \ 125 static const factory::PMaker<type> EDM_PLUGIN_SYM(s_maker2, __LINE__)(name)
def create(alignables, pedeDump, additionalData, outputFile, config)
void registerPMaker(void *iPMaker, const std::string &iName)
R * create(const std::string &iName, Args...args) const
R * create(Args...args) const override
void registerPMaker(PMakerBase *iPMaker, const std::string &iName)
PMaker(const std::string &iName)
void * findPMaker(const std::string &iName) const
R * tryToCreate(const std::string &iName, Args...args) const
like above but returns 0 if iName is unknown
T get(const Candidate &c)
void * tryToFindPMaker(const std::string &iName) const
R *(Args...) TemplateArgType