Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:47

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 DataProxyProvider;
0035     class EventSetupsController;
0036 
0037     struct ModuleMakerTraits {
0038       typedef DataProxyProvider base_type;
0039 
0040       static std::string name();
0041       static void addTo(EventSetupProvider& iProvider,
0042                         std::shared_ptr<DataProxyProvider> iComponent,
0043                         ParameterSet const&,
0044                         bool);
0045       static void replaceExisting(EventSetupProvider& iProvider, std::shared_ptr<DataProxyProvider> iComponent);
0046       static std::shared_ptr<base_type> getComponentAndRegisterProcess(EventSetupsController& esController,
0047                                                                        ParameterSet const& iConfiguration);
0048       static void putComponent(EventSetupsController& esController,
0049                                ParameterSet const& iConfiguration,
0050                                std::shared_ptr<base_type> const& component);
0051     };
0052     template <class TType>
0053     struct ModuleMaker : public ComponentMaker<edm::eventsetup::ModuleMakerTraits, TType> {};
0054 
0055     typedef ComponentFactory<ModuleMakerTraits> ModuleFactory;
0056     typedef edmplugin::PluginFactory<edm::eventsetup::ComponentMakerBase<ModuleMakerTraits>*()> ModulePluginFactory;
0057   }  // namespace eventsetup
0058 }  // namespace edm
0059 
0060 #define DEFINE_FWK_EVENTSETUP_MODULE(type)                                                            \
0061   DEFINE_EDM_PLUGIN(edm::eventsetup::ModulePluginFactory, edm::eventsetup::ModuleMaker<type>, #type); \
0062   DEFINE_DESC_FILLER_FOR_ESPRODUCERS(type)
0063 
0064 #endif