1 #ifndef Framework_ComponentFactory_h
2 #define Framework_ComponentFactory_h
38 namespace eventsetup {
39 class EventSetupProvider;
40 class EventSetupsController;
49 typedef std::map<std::string, std::shared_ptr<Maker> >
MakerMap;
55 bool replaceExisting =
false)
const {
56 std::string modtype = iConfiguration.template getParameter<std::string>(
"@module_type");
58 typename MakerMap::iterator it =
makers_.find(modtype);
63 if (wm.get() ==
nullptr) {
69 " has not been registered.\n"
70 "Perhaps your module type is misspelled or is not a "
72 "Try running EdmPluginDump to obtain a list of "
73 "available Plugins.");
78 std::pair<typename MakerMap::iterator, bool>
ret =
81 if (ret.second ==
false) {
90 return it->second->addTo(esController, iProvider, iConfiguration, replaceExisting);
93 std::string edmtype = iConfiguration.template getParameter<std::string>(
"@module_edm_type");
94 std::string label = iConfiguration.template getParameter<std::string>(
"@module_label");
95 std::ostringstream ost;
96 ost <<
"Constructing " << edmtype <<
": class=" << modtype <<
" label='" << label <<
"'";
100 return std::shared_ptr<base_type>();
120 #define COMPONENTFACTORY_GET(_type_) \
121 EDM_REGISTER_PLUGINFACTORY(edmplugin::PluginFactory<edm::eventsetup::ComponentMakerBase<_type_>*()>, \
123 static edm::eventsetup::ComponentFactory<_type_> const s_dummyfactory; \
125 namespace eventsetup { \
127 edm::eventsetup::ComponentFactory<_type_> const* edm::eventsetup::ComponentFactory<_type_>::get() { \
128 return &s_dummyfactory; \
132 typedef int componentfactory_get_needs_semicolon
tuple ret
prodAgent to be discontinued
ComponentMakerBase< T > Maker
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="")
std::shared_ptr< base_type > addTo(EventSetupsController &esController, EventSetupProvider &iProvider, edm::ParameterSet const &iConfiguration, bool replaceExisting=false) const
void addContext(std::string const &context)
std::map< std::string, std::shared_ptr< Maker > > MakerMap
auto wrap(F iFunc) -> decltype(iFunc())