Go to the documentation of this file.00001 #ifndef FWCore_Framework_LooperFactory_h
00002 #define FWCore_Framework_LooperFactory_h
00003
00004
00005
00006
00007
00016
00017
00018
00019
00020
00021
00022 #include <string>
00023 #include "boost/shared_ptr.hpp"
00024
00025
00026 #include "FWCore/Framework/interface/ComponentFactory.h"
00027 #include "FWCore/Framework/interface/EventSetupProvider.h"
00028
00029
00030 namespace edm {
00031 class EDLooperBase;
00032 class EventSetupRecordIntervalFinder;
00033 class ParameterSet;
00034
00035 namespace eventsetup {
00036
00037 class DataProxyProvider;
00038 class EventSetupsController;
00039
00040 namespace looper {
00041 template<class T>
00042 void addProviderTo(EventSetupProvider& iProvider, boost::shared_ptr<T> iComponent, const DataProxyProvider*)
00043 {
00044 boost::shared_ptr<DataProxyProvider> pProvider(iComponent);
00045 ComponentDescription description = pProvider->description();
00046 description.isSource_=true;
00047 description.isLooper_=true;
00048 if(description.label_ =="@main_looper") {
00049
00050 description.label_ ="";
00051 }
00052 pProvider->setDescription(description);
00053 iProvider.add(pProvider);
00054 }
00055 template<class T>
00056 void addProviderTo(EventSetupProvider& , boost::shared_ptr<T> , const void*)
00057 {
00058
00059 }
00060
00061 template<class T>
00062 void addFinderTo(EventSetupProvider& iProvider, boost::shared_ptr<T> iComponent, const EventSetupRecordIntervalFinder*)
00063 {
00064 boost::shared_ptr<EventSetupRecordIntervalFinder> pFinder(iComponent);
00065
00066 ComponentDescription description = pFinder->descriptionForFinder();
00067 description.isSource_=true;
00068 description.isLooper_=true;
00069 if(description.label_ =="@main_looper") {
00070
00071 description.label_ ="";
00072 }
00073 pFinder->setDescriptionForFinder(description);
00074
00075 iProvider.add(pFinder);
00076 }
00077 template<class T>
00078 void addFinderTo(EventSetupProvider& , boost::shared_ptr<T> , const void*)
00079 {
00080
00081 }
00082 }
00083 struct LooperMakerTraits {
00084 typedef EDLooperBase base_type;
00085 static std::string name();
00086 template<class T>
00087 static void addTo(EventSetupProvider& iProvider,
00088 boost::shared_ptr<T> iComponent,
00089 ParameterSet const&,
00090 bool)
00091 {
00092
00093 looper::addProviderTo(iProvider, iComponent, static_cast<const T*>(nullptr));
00094 looper::addFinderTo(iProvider, iComponent, static_cast<const T*>(nullptr));
00095 }
00096
00097 static void replaceExisting(EventSetupProvider& iProvider, boost::shared_ptr<EDLooperBase> iComponent);
00098
00099 static boost::shared_ptr<base_type> getComponentAndRegisterProcess(EventSetupsController& esController,
00100 ParameterSet const& iConfiguration);
00101 static void putComponent(EventSetupsController& esController,
00102 ParameterSet const& iConfiguration,
00103 boost::shared_ptr<base_type> const& component);
00104 };
00105 template< class TType>
00106 struct LooperMaker : public ComponentMaker<edm::eventsetup::LooperMakerTraits,TType> {};
00107 typedef ComponentFactory<LooperMakerTraits> LooperFactory ;
00108
00109 typedef edmplugin::PluginFactory<edm::eventsetup::ComponentMakerBase<LooperMakerTraits>* ()> LooperPluginFactory;
00110 }
00111 }
00112
00113 #define DEFINE_FWK_LOOPER(type) \
00114 DEFINE_EDM_PLUGIN (edm::eventsetup::LooperPluginFactory,edm::eventsetup::LooperMaker<type>,#type)
00115
00116 #endif