1 #ifndef FWCore_PluginManager_PluginFactory_h 2 #define FWCore_PluginManager_PluginFactory_h 38 template <
typename R,
typename... Args>
40 friend class DummyFriend;
50 virtual std::unique_ptr<R>
create(Args...)
const = 0;
53 template <
class TPlug>
54 struct PMaker :
public PMakerBase {
57 return std::make_unique<TPlug>(std::forward<Args>(
args)...);
71 if (
found ==
nullptr) {
88 #define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_) \ 89 namespace edmplugin { \ 91 edmplugin::PluginFactory<_factory_::TemplateArgType>* edmplugin::PluginFactory<_factory_::TemplateArgType>::get() { \ 92 CMS_THREAD_SAFE static edmplugin::PluginFactory<_factory_::TemplateArgType> s_instance; \ 96 const std::string& edmplugin::PluginFactory<_factory_::TemplateArgType>::category() const { \ 97 static const std::string s_cat(_category_); \ 101 enum { EDM_CONCATENATE(dummy_edm_register_pluginfactory_, __LINE__) } 103 #define EDM_REGISTER_PLUGINFACTORY2(_factory_, _category_) \ 104 namespace edmplugin { \ 106 edmplugin::PluginFactory<_factory_::TemplateArgType>* edmplugin::PluginFactory<_factory_::TemplateArgType>::get() { \ 107 CMS_THREAD_SAFE static edmplugin::PluginFactory<_factory_::TemplateArgType> s_instance; \ 108 return &s_instance; \ 111 const std::string& edmplugin::PluginFactory<_factory_::TemplateArgType>::category() const { \ 112 static const std::string s_cat(_category_); \ 116 enum { EDM_CONCATENATE(dummy_edm_register_pluginfactory_2_, __LINE__) } 120 #define EDM_PLUGIN_SYM(x, y) EDM_PLUGIN_SYM2(x, y) 121 #define EDM_PLUGIN_SYM2(x, y) x##y 123 #define DEFINE_EDM_PLUGIN(factory, type, name) \ 124 static const factory::PMaker<type> EDM_PLUGIN_SYM(s_maker, __LINE__)(name) 126 #define DEFINE_EDM_PLUGIN2(factory, type, name) \ 127 static const factory::PMaker<type> EDM_PLUGIN_SYM(s_maker2_, __LINE__)(name)
def create(alignables, pedeDump, additionalData, outputFile, config)
std::unique_ptr< R > create(const std::string &iName, Args... args) const
void registerPMaker(void *iPMaker, const std::string &iName)
std::unique_ptr< R > tryToCreate(const std::string &iName, Args... args) const
like above but returns 0 if iName is unknown
std::unique_ptr< R > create(Args... args) const override
void registerPMaker(PMakerBase *iPMaker, const std::string &iName)
PMaker(const std::string &iName)
void * tryToFindPMaker(const std::string &iName) const
void * findPMaker(const std::string &iName) const
R *(Args...) TemplateArgType