1 #ifndef FWCore_PluginManager_PluginFactory_h
2 #define FWCore_PluginManager_PluginFactory_h
37 friend class DummyFriend;
42 virtual R*
create(
void)
const = 0;
46 struct PMaker :
public PMakerBase {
56 virtual const std::string&
category()
const ;
58 R*
create(
const std::string& iName)
const {
65 if(itFound ==m_plugins.end() ) {
68 return reinterpret_cast<PMakerBase*
>(itFound->second.front().first)->
create();
80 finishedConstruction();
88 template<
class R,
class Arg>
91 friend class DummyFriend;
95 virtual R*
create(Arg)
const = 0;
99 struct PMaker :
public PMakerBase {
104 return new TPlug(iArg);
109 virtual const std::string&
category()
const ;
111 R*
create(
const std::string& iName, Arg iArg)
const {
117 if(itFound ==m_plugins.end() ) {
120 return reinterpret_cast<PMakerBase *
>(itFound->second.front().first)->
create(iArg);
132 finishedConstruction();
140 template<
class R,
class Arg1,
class Arg2>
143 friend class DummyFriend;
147 virtual R*
create(Arg1, Arg2)
const = 0;
150 template<
class TPlug>
151 struct PMaker :
public PMakerBase {
155 virtual R*
create(Arg1 iArg1, Arg2 iArg2)
const {
156 return new TPlug(iArg1, iArg2);
161 virtual const std::string&
category()
const ;
163 R*
create(
const std::string& iName, Arg1 iArg1, Arg2 iArg2)
const {
167 R*
tryToCreate(
const std::string& iName, Arg1 iArg1, Arg2 iArg2)
const {
169 if(itFound ==m_plugins.end() ) {
172 return reinterpret_cast<PMakerBase *
>(itFound->second.front().first)->
create(iArg1,iArg2);
185 finishedConstruction();
194 #define CONCATENATE_HIDDEN(a,b) a ## b
195 #define CONCATENATE(a,b) CONCATENATE_HIDDEN(a,b)
196 #define EDM_REGISTER_PLUGINFACTORY(_factory_,_category_) \
197 namespace edmplugin {\
198 template<> edmplugin::PluginFactory<_factory_::TemplateArgType>* edmplugin::PluginFactory<_factory_::TemplateArgType>::get() { static edmplugin::PluginFactory<_factory_::TemplateArgType> s_instance; return &s_instance;}\
199 template<> const std::string& edmplugin::PluginFactory<_factory_::TemplateArgType>::category() const { static std::string s_cat(_category_); return s_cat;}\
200 } enum {CONCATENATE(dummy_edm_register_pluginfactory_, __LINE__)}
204 #define EDM_PLUGIN_SYM(x,y) EDM_PLUGIN_SYM2(x,y)
205 #define EDM_PLUGIN_SYM2(x,y) x ## y
207 #define DEFINE_EDM_PLUGIN(factory,type,name) \
208 static factory::PMaker<type> EDM_PLUGIN_SYM(s_maker , __LINE__ ) (name)
PMaker(const std::string &iName)
nocap nocap const skelname & operator=(const skelname &)
void registerPMaker(PMakerBase *iPMaker, const std::string &iName)
PMaker(const std::string &iName)
void registerPMaker(PMakerBase *iPMaker, const std::string &iName)
virtual R * create(Arg1 iArg1, Arg2 iArg2) const
void registerPMaker(void *iPMaker, const std::string &iName)
R * TemplateArgType(void)
R * tryToCreate(const std::string &iName, Arg1 iArg1, Arg2 iArg2) const
like above but returns 0 if iName is unknown
virtual R * create() const
R * create(const std::string &iName, Arg1 iArg1, Arg2 iArg2) const
R * tryToCreate(const std::string &iName, Arg iArg) const
like above but returns 0 if iName is unknown
R * create(const std::string &iName) const
R * tryToCreate(const std::string &iName) const
like above but returns 0 if iName is unknown
virtual R * create(Arg iArg) const
R * create(const std::string &iName, Arg iArg) const
Plugins::const_iterator tryToFindPMaker(const std::string &iName) const
PMaker(const std::string &iName)
void registerPMaker(PMakerBase *iPMaker, const std::string &iName)
Plugins::const_iterator findPMaker(const std::string &iName) const
R * TemplateArgType(Arg1, Arg2)