CMS 3D CMS Logo

SourceFactory.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_SourceFactory_h
2 #define FWCore_Framework_SourceFactory_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : SourceFactory
7 //
16 //
17 // Author: Chris Jones
18 // Created: Wed May 25 18:01:38 EDT 2005
19 //
20 
21 // system include files
22 #include <memory>
23 #include <string>
24 
25 // user include files
29 
30 // forward declarations
31 
32 namespace edm {
34  class ParameterSet;
35 
36  namespace eventsetup {
37  class DataProxyProvider;
38  class EventSetupsController;
39 
40  template <class T>
41  void addProviderTo(EventSetupProvider& iProvider, std::shared_ptr<T> iComponent, const DataProxyProvider*) {
42  std::shared_ptr<DataProxyProvider> pProvider(iComponent);
43  ComponentDescription description = pProvider->description();
44  description.isSource_ = true;
45  pProvider->setDescription(description);
46  iProvider.add(pProvider);
47  }
48  template <class T>
49  void addProviderTo(EventSetupProvider& /* iProvider */, std::shared_ptr<T> /*iComponent*/, const void*) {
50  //do nothing
51  }
52 
55  static std::string name();
56  template <class T>
57  static void addTo(EventSetupProvider& iProvider,
58  std::shared_ptr<T> iComponent,
59  ParameterSet const& iConfiguration,
60  bool matchesPreceding) {
61  if (matchesPreceding) {
62  logInfoWhenSharing(iConfiguration);
63  }
64  //a source does not always have to be a provider
65  addProviderTo(iProvider, iComponent, static_cast<const T*>(nullptr));
66  std::shared_ptr<EventSetupRecordIntervalFinder> pFinder(iComponent);
67  iProvider.add(pFinder);
68  }
69  static void replaceExisting(EventSetupProvider& iProvider,
70  std::shared_ptr<EventSetupRecordIntervalFinder> iComponent);
71 
72  static std::shared_ptr<base_type> getComponentAndRegisterProcess(EventSetupsController& esController,
73  ParameterSet const& iConfiguration);
74 
75  static void putComponent(EventSetupsController& esController,
76  ParameterSet const& iConfiguration,
77  std::shared_ptr<base_type> const& component);
78 
79  static void logInfoWhenSharing(ParameterSet const& iConfiguration);
80  };
81 
82  template <class TType>
83  struct SourceMaker : public ComponentMaker<edm::eventsetup::SourceMakerTraits, TType> {};
85 
88  } // namespace eventsetup
89 } // namespace edm
90 
91 #define DEFINE_FWK_EVENTSETUP_SOURCE(type) \
92  DEFINE_EDM_PLUGIN(edm::eventsetup::SourcePluginFactory, edm::eventsetup::SourceMaker<type>, #type); \
93  DEFINE_DESC_FILLER_FOR_ESSOURCES(type)
94 
95 #endif
edm::eventsetup::DataProxyProvider
Definition: DataProxyProvider.h:64
edm::eventsetup::SourceMaker
Definition: SourceFactory.h:83
ComponentFactory.h
EventSetupRecordIntervalFinder
EventSetupProvider.h
edm::eventsetup::SourceMakerTraits::name
static std::string name()
Definition: SourceFactory.cc:28
edm
HLT enums.
Definition: AlignableModifier.h:19
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
edm::EventSetupRecordIntervalFinder
Definition: EventSetupRecordIntervalFinder.h:33
ParameterSetDescriptionFillerPluginFactory.h
edm::eventsetup::ComponentMaker
Definition: ComponentMaker.h:57
edm::eventsetup::addProviderTo
void addProviderTo(EventSetupProvider &iProvider, std::shared_ptr< T > iComponent, const DataProxyProvider *)
Definition: SourceFactory.h:41
edm::eventsetup::EventSetupProvider
Definition: EventSetupProvider.h:50
edm::eventsetup::SourceMakerTraits::logInfoWhenSharing
static void logInfoWhenSharing(ParameterSet const &iConfiguration)
Definition: SourceFactory.cc:47
edm::eventsetup::SourceMakerTraits::replaceExisting
static void replaceExisting(EventSetupProvider &iProvider, std::shared_ptr< EventSetupRecordIntervalFinder > iComponent)
Definition: SourceFactory.cc:30
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::eventsetup::ComponentDescription
Definition: ComponentDescription.h:30
edm::eventsetup::SourceMakerTraits
Definition: SourceFactory.h:53
edm::ParameterSet
Definition: ParameterSet.h:47
ParameterSet
Definition: Functions.h:16
edmplugin::PluginFactory
Definition: PluginFactory.h:34
edm::eventsetup::SourceMakerTraits::base_type
EventSetupRecordIntervalFinder base_type
Definition: SourceFactory.h:54
edm::eventsetup::EventSetupsController
Definition: EventSetupsController.h:80
edm::eventsetup::SourceMakerTraits::putComponent
static void putComponent(EventSetupsController &esController, ParameterSet const &iConfiguration, std::shared_ptr< base_type > const &component)
Definition: SourceFactory.cc:41
edm::eventsetup::EventSetupProvider::add
void add(std::shared_ptr< DataProxyProvider >)
Definition: EventSetupProvider.cc:91
edm::eventsetup::SourceFactory
ComponentFactory< SourceMakerTraits > SourceFactory
Definition: SourceFactory.h:84
edm::eventsetup::ComponentFactory
Definition: ComponentFactory.h:43
edm::eventsetup::SourceMakerTraits::getComponentAndRegisterProcess
static std::shared_ptr< base_type > getComponentAndRegisterProcess(EventSetupsController &esController, ParameterSet const &iConfiguration)
Definition: SourceFactory.cc:36
edm::eventsetup::SourceMakerTraits::addTo
static void addTo(EventSetupProvider &iProvider, std::shared_ptr< T > iComponent, ParameterSet const &iConfiguration, bool matchesPreceding)
Definition: SourceFactory.h:57