Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:04

0001 #ifndef FWCore_Framework_ModuleFactory_h
0002 #define FWCore_Framework_ModuleFactory_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Framework
0006 // Class  :     ModuleFactory
0007 //
0008 /**\class ModuleFactory ModuleFactory.h FWCore/Framework/interface/ModuleFactory.h
0009 
0010  Description: Factory which is dynamically loadable and used to create an eventstore module
0011 
0012  Usage:
0013     Used by the EDM plugin-manager
0014 
0015 */
0016 //
0017 // Author:      Chris Jones
0018 // Created:     Wed May 25 18:01:31 EDT 2005
0019 //
0020 
0021 // system include files
0022 #include <memory>
0023 #include <string>
0024 
0025 // user include files
0026 #include "FWCore/Framework/interface/ComponentFactory.h"
0027 #include "FWCore/ParameterSet/interface/ParameterSetDescriptionFillerPluginFactory.h"
0028 
0029 // forward declarations
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   }  // namespace eventsetup
0059 }  // namespace edm
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