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, boost::shared_ptr<T> iComponent)
00088 {
00089
00090 looper::addProviderTo(iProvider, iComponent, static_cast<const T*>(0));
00091 looper::addFinderTo(iProvider, iComponent, static_cast<const T*>(0));
00092 }
00093
00094 static boost::shared_ptr<base_type> const* getAlreadyMadeComponent(EventSetupsController const& esController,
00095 ParameterSet const& iConfiguration);
00096 static void putComponent(EventSetupsController& esController,
00097 ParameterSet const& iConfiguration,
00098 boost::shared_ptr<base_type> const& component);
00099 };
00100 template< class TType>
00101 struct LooperMaker : public ComponentMaker<edm::eventsetup::LooperMakerTraits,TType> {};
00102 typedef ComponentFactory<LooperMakerTraits> LooperFactory ;
00103
00104 typedef edmplugin::PluginFactory<edm::eventsetup::ComponentMakerBase<LooperMakerTraits>* ()> LooperPluginFactory;
00105 }
00106 }
00107
00108 #define DEFINE_FWK_LOOPER(type) \
00109 DEFINE_EDM_PLUGIN (edm::eventsetup::LooperPluginFactory,edm::eventsetup::LooperMaker<type>,#type)
00110
00111 #endif