1 #ifndef Framework_ComponentFactory_h
2 #define Framework_ComponentFactory_h
25 #include "boost/shared_ptr.hpp"
37 namespace eventsetup {
39 class EventSetupsController;
50 typedef std::map<std::string, boost::shared_ptr<Maker> >
MakerMap;
56 bool replaceExisting =
false)
const
58 std::string modtype = iConfiguration.template getParameter<std::string>(
"@module_type");
60 typename MakerMap::iterator it =
makers_.find(modtype);
72 " has not been registered.\n"
73 "Perhaps your module type is misspelled or is not a "
75 "Try running EdmPluginDump to obtain a list of "
76 "available Plugins.");
81 std::pair<typename MakerMap::iterator,bool>
ret =
84 if(ret.second ==
false) {
93 return it->second->addTo(esController, iProvider, iConfiguration, replaceExisting);
103 std::string edmtype = iConfiguration.template getParameter<std::string>(
"@module_edm_type");
104 std::string label = iConfiguration.template getParameter<std::string>(
"@module_label");
105 std::ostringstream ost;
106 ost <<
"Constructing " << edmtype <<
": class=" << modtype <<
" label='" << label <<
"'";
110 return boost::shared_ptr<base_type>();
130 #define COMPONENTFACTORY_GET(_type_) \
131 EDM_REGISTER_PLUGINFACTORY(edmplugin::PluginFactory<edm::eventsetup::ComponentMakerBase<_type_>* ()>,_type_::name()); \
132 static edm::eventsetup::ComponentFactory<_type_> const s_dummyfactory; \
133 namespace edm { namespace eventsetup { \
134 template<> edm::eventsetup::ComponentFactory<_type_> const* edm::eventsetup::ComponentFactory<_type_>::get() \
135 { return &s_dummyfactory; } \
137 typedef int componentfactory_get_needs_semicolon
ComponentMakerBase< T > Maker
std::map< std::string, boost::shared_ptr< Maker > > MakerMap
boost::shared_ptr< base_type > addTo(EventSetupsController &esController, EventSetupProvider &iProvider, edm::ParameterSet const &iConfiguration, bool replaceExisting=false) const
const ComponentFactory & operator=(const ComponentFactory &)
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
void stdToEDM(std::exception const &e)
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
void addContext(std::string const &context)