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);
97 std::string edmtype = iConfiguration.template getParameter<std::string>(
"@module_edm_type");
98 std::string label = iConfiguration.template getParameter<std::string>(
"@module_label");
99 std::ostringstream ost;
100 ost <<
"Constructing " << edmtype <<
": class=" << modtype <<
" label='" << label <<
"'";
104 return boost::shared_ptr<base_type>();
124 #define COMPONENTFACTORY_GET(_type_) \
125 EDM_REGISTER_PLUGINFACTORY(edmplugin::PluginFactory<edm::eventsetup::ComponentMakerBase<_type_>* ()>,_type_::name()); \
126 static edm::eventsetup::ComponentFactory<_type_> const s_dummyfactory; \
127 namespace edm { namespace eventsetup { \
128 template<> edm::eventsetup::ComponentFactory<_type_> const* edm::eventsetup::ComponentFactory<_type_>::get() \
129 { return &s_dummyfactory; } \
131 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 addContext(std::string const &context)
auto wrap(F iFunc) -> decltype(iFunc())