00001 #ifndef FWCore_Framework_ModuleFactory_h 00002 #define FWCore_Framework_ModuleFactory_h 00003 // -*- C++ -*- 00004 // 00005 // Package: Framework 00006 // Class : ModuleFactory 00007 // 00016 // 00017 // Author: Chris Jones 00018 // Created: Wed May 25 18:01:31 EDT 2005 00019 // 00020 00021 // system include files 00022 #include <string> 00023 #include "boost/shared_ptr.hpp" 00024 00025 // user include files 00026 #include "FWCore/Framework/interface/ComponentFactory.h" 00027 #include "FWCore/ParameterSet/interface/ParameterSetDescriptionFillerPluginFactory.h" 00028 00029 // forward declarations 00030 namespace edm { 00031 class ParameterSet; 00032 00033 namespace eventsetup { 00034 class DataProxyProvider; 00035 class EventSetupsController; 00036 00037 struct ModuleMakerTraits { 00038 typedef DataProxyProvider base_type; 00039 00040 static std::string name(); 00041 static void addTo(EventSetupProvider& iProvider, boost::shared_ptr<DataProxyProvider> iComponent) ; 00042 static boost::shared_ptr<base_type> const* getAlreadyMadeComponent(EventSetupsController const& esController, 00043 ParameterSet const& iConfiguration); 00044 static void putComponent(EventSetupsController& esController, 00045 ParameterSet const& iConfiguration, 00046 boost::shared_ptr<base_type> const& component); 00047 }; 00048 template< class TType> 00049 struct ModuleMaker : public ComponentMaker<edm::eventsetup::ModuleMakerTraits,TType> {}; 00050 00051 typedef ComponentFactory<ModuleMakerTraits> ModuleFactory ; 00052 typedef edmplugin::PluginFactory<edm::eventsetup::ComponentMakerBase<ModuleMakerTraits>* ()> ModulePluginFactory; 00053 } 00054 } 00055 00056 #define DEFINE_FWK_EVENTSETUP_MODULE(type) \ 00057 DEFINE_EDM_PLUGIN (edm::eventsetup::ModulePluginFactory,edm::eventsetup::ModuleMaker<type>,#type); \ 00058 DEFINE_DESC_FILLER_FOR_ESPRODUCERS(type) 00059 00060 #endif 00061