Go to the documentation of this file.00001 #ifndef FWCore_Framework_SourceFactory_h
00002 #define FWCore_Framework_SourceFactory_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 #include "FWCore/ParameterSet/interface/ParameterSetDescriptionFillerPluginFactory.h"
00029
00030
00031
00032 namespace edm {
00033 class EventSetupRecordIntervalFinder;
00034
00035 namespace eventsetup {
00036 class DataProxyProvider;
00037
00038 template<class T>
00039 void addProviderTo(EventSetupProvider& iProvider, boost::shared_ptr<T> iComponent, const DataProxyProvider*)
00040 {
00041 boost::shared_ptr<DataProxyProvider> pProvider(iComponent);
00042 ComponentDescription description = pProvider->description();
00043 description.isSource_=true;
00044 pProvider->setDescription(description);
00045 iProvider.add(pProvider);
00046 }
00047 template<class T>
00048 void addProviderTo(EventSetupProvider& , boost::shared_ptr<T> , const void*)
00049 {
00050
00051 }
00052
00053 struct SourceMakerTraits {
00054 typedef EventSetupRecordIntervalFinder base_type;
00055 static std::string name();
00056 template<class T>
00057 static void addTo(EventSetupProvider& iProvider, boost::shared_ptr<T> iComponent)
00058 {
00059
00060 addProviderTo(iProvider, iComponent, static_cast<const T*>(0));
00061 boost::shared_ptr<EventSetupRecordIntervalFinder> pFinder(iComponent);
00062 iProvider.add(pFinder);
00063 }
00064
00065 };
00066 template< class TType>
00067 struct SourceMaker : public ComponentMaker<edm::eventsetup::SourceMakerTraits,TType> {};
00068 typedef ComponentFactory<SourceMakerTraits> SourceFactory ;
00069
00070 typedef edmplugin::PluginFactory<edm::eventsetup::ComponentMakerBase<edm::eventsetup::SourceMakerTraits>* ()> SourcePluginFactory;
00071 }
00072 }
00073
00074 #define DEFINE_FWK_EVENTSETUP_SOURCE(type) \
00075 DEFINE_EDM_PLUGIN (edm::eventsetup::SourcePluginFactory,edm::eventsetup::SourceMaker<type>,#type); \
00076 DEFINE_DESC_FILLER_FOR_ESSOURCES(type)
00077
00078 #endif