1 #ifndef Framework_ComponentFactory_h 2 #define Framework_ComponentFactory_h 39 class ModuleTypeResolverMaker;
41 namespace eventsetup {
42 class EventSetupProvider;
43 class EventSetupsController;
52 typedef std::map<std::string, std::shared_ptr<Maker const>>
MakerMap;
59 bool replaceExisting =
false)
const {
60 std::string modtype = iConfiguration.template getParameter<std::string>(
"@module_type");
62 typename MakerMap::iterator
it =
makers_.find(modtype);
63 Maker const* maker =
nullptr;
66 maker = detail::resolveMaker<edmplugin::PluginFactory<ComponentMakerBase<T>*()>>(
67 modtype, resolverMaker, iConfiguration,
makers_);
73 maker =
it->second.get();
78 return maker->
addTo(esController, iProvider, iConfiguration, replaceExisting);
81 std::string edmtype = iConfiguration.template getParameter<std::string>(
"@module_edm_type");
82 std::string label = iConfiguration.template getParameter<std::string>(
"@module_label");
83 std::ostringstream ost;
84 ost <<
"Constructing " << edmtype <<
": class=" << modtype <<
" label='" <<
label <<
"'";
88 return std::shared_ptr<base_type>();
108 #define COMPONENTFACTORY_GET(_type_) \ 109 EDM_REGISTER_PLUGINFACTORY(edmplugin::PluginFactory<edm::eventsetup::ComponentMakerBase<_type_>*()>, \ 111 static edm::eventsetup::ComponentFactory<_type_> const s_dummyfactory; \ 113 namespace eventsetup { \ 115 edm::eventsetup::ComponentFactory<_type_> const* edm::eventsetup::ComponentFactory<_type_>::get() { \ 116 return &s_dummyfactory; \ 120 typedef int componentfactory_get_needs_semicolon
ComponentMakerBase< T > Maker
virtual std::shared_ptr< base_type > addTo(EventSetupsController &esController, EventSetupProvider &iProvider, ParameterSet &iConfiguration, bool replaceExisting) const =0
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::map< std::string, std::shared_ptr< Maker const > > MakerMap
void addContext(std::string const &context)
std::shared_ptr< base_type > addTo(EventSetupsController &esController, EventSetupProvider &iProvider, edm::ParameterSet &iConfiguration, ModuleTypeResolverMaker const *resolverMaker, bool replaceExisting=false) const
auto wrap(F iFunc) -> decltype(iFunc())