File indexing completed on 2024-04-06 12:12:04
0001 #ifndef FWCore_Framework_ModuleFactory_h
0002 #define FWCore_Framework_ModuleFactory_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <memory>
0023 #include <string>
0024
0025
0026 #include "FWCore/Framework/interface/ComponentFactory.h"
0027 #include "FWCore/ParameterSet/interface/ParameterSetDescriptionFillerPluginFactory.h"
0028
0029
0030 namespace edm {
0031 class ParameterSet;
0032
0033 namespace eventsetup {
0034 class ESProductResolverProvider;
0035 class EventSetupsController;
0036
0037 struct ModuleMakerTraits {
0038 typedef ESProductResolverProvider base_type;
0039
0040 static std::string name();
0041 static std::string const& baseType();
0042 static void addTo(EventSetupProvider& iProvider,
0043 std::shared_ptr<ESProductResolverProvider> iComponent,
0044 ParameterSet const&,
0045 bool);
0046 static void replaceExisting(EventSetupProvider& iProvider, std::shared_ptr<ESProductResolverProvider> iComponent);
0047 static std::shared_ptr<base_type> getComponentAndRegisterProcess(EventSetupsController& esController,
0048 ParameterSet const& iConfiguration);
0049 static void putComponent(EventSetupsController& esController,
0050 ParameterSet& iConfiguration,
0051 std::shared_ptr<base_type> const& component);
0052 };
0053 template <class TType>
0054 struct ModuleMaker : public ComponentMaker<edm::eventsetup::ModuleMakerTraits, TType> {};
0055
0056 typedef ComponentFactory<ModuleMakerTraits> ModuleFactory;
0057 typedef edmplugin::PluginFactory<edm::eventsetup::ComponentMakerBase<ModuleMakerTraits>*()> ModulePluginFactory;
0058 }
0059 }
0060
0061 #define DEFINE_FWK_EVENTSETUP_MODULE(type) \
0062 DEFINE_EDM_PLUGIN(edm::eventsetup::ModulePluginFactory, edm::eventsetup::ModuleMaker<type>, #type); \
0063 DEFINE_DESC_FILLER_FOR_ESPRODUCERS(type)
0064
0065 #endif