1 #ifndef FWCore_PluginManager_PluginFactory_h
2 #define FWCore_PluginManager_PluginFactory_h
37 friend class DummyFriend;
40 virtual R*
create(
void)
const = 0;
44 struct PMaker :
public PMakerBase {
54 virtual const std::string&
category()
const ;
56 R*
create(
const std::string& iName)
const {
63 if(itFound ==m_plugins.end() ) {
66 return reinterpret_cast<PMakerBase*
>(itFound->second.front().first)->
create();
78 finishedConstruction();
86 template<
class R,
class Arg>
89 friend class DummyFriend;
92 virtual R*
create(Arg)
const = 0;
96 struct PMaker :
public PMakerBase {
101 return new TPlug(iArg);
106 virtual const std::string&
category()
const ;
108 R*
create(
const std::string& iName, Arg iArg)
const {
114 if(itFound ==m_plugins.end() ) {
117 return reinterpret_cast<PMakerBase *
>(itFound->second.front().first)->
create(iArg);
129 finishedConstruction();
137 template<
class R,
class Arg1,
class Arg2>
140 friend class DummyFriend;
143 virtual R*
create(Arg1, Arg2)
const = 0;
146 template<
class TPlug>
147 struct PMaker :
public PMakerBase {
151 virtual R*
create(Arg1 iArg1, Arg2 iArg2)
const {
152 return new TPlug(iArg1, iArg2);
157 virtual const std::string&
category()
const ;
159 R*
create(
const std::string& iName, Arg1 iArg1, Arg2 iArg2)
const {
163 R*
tryToCreate(
const std::string& iName, Arg1 iArg1, Arg2 iArg2)
const {
165 if(itFound ==m_plugins.end() ) {
168 return reinterpret_cast<PMakerBase *
>(itFound->second.front().first)->
create(iArg1,iArg2);
181 finishedConstruction();
190 #define CONCATENATE_HIDDEN(a,b) a ## b
191 #define CONCATENATE(a,b) CONCATENATE_HIDDEN(a,b)
192 #define EDM_REGISTER_PLUGINFACTORY(_factory_,_category_) \
193 namespace edmplugin {\
194 template<> _factory_* _factory_::get() { static _factory_ s_instance; return &s_instance;}\
195 template<> const std::string& _factory_::category() const { static std::string s_cat(_category_); return s_cat;}\
196 } enum {CONCATENATE(dummy_edm_register_pluginfactory_, __LINE__)}
200 #define EDM_PLUGIN_SYM(x,y) EDM_PLUGIN_SYM2(x,y)
201 #define EDM_PLUGIN_SYM2(x,y) x ## y
203 #define DEFINE_EDM_PLUGIN(factory,type,name) \
204 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 * 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)
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
void registerPMaker(PMakerBase *iPMaker, const std::string &iName)
Plugins::const_iterator findPMaker(const std::string &iName) const