CMS 3D CMS Logo

LooperFactory.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_LooperFactory_h
2 #define FWCore_Framework_LooperFactory_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : LooperFactory
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
28 
29 // forward declarations
30 namespace edm {
31  class EDLooperBase;
33  class ParameterSet;
34 
35  namespace eventsetup {
36 
37  class DataProxyProvider;
38  class EventSetupsController;
39 
40  namespace looper {
41  template <class T>
42  void addProviderTo(EventSetupProvider& iProvider, std::shared_ptr<T> iComponent, const DataProxyProvider*) {
43  std::shared_ptr<DataProxyProvider> pProvider(iComponent);
44  ComponentDescription description = pProvider->description();
45  description.isSource_ = true;
46  description.isLooper_ = true;
47  if (description.label_ == "@main_looper") {
48  //remove the 'hidden' label so that es_prefer statements will work
49  description.label_ = "";
50  }
51  pProvider->setDescription(description);
52  iProvider.add(pProvider);
53  }
54  template <class T>
55  void addProviderTo(EventSetupProvider& /* iProvider */, std::shared_ptr<T> /*iComponent*/, const void*) {
56  //do nothing
57  }
58 
59  template <class T>
61  std::shared_ptr<T> iComponent,
63  std::shared_ptr<EventSetupRecordIntervalFinder> pFinder(iComponent);
64 
65  ComponentDescription description = pFinder->descriptionForFinder();
66  description.isSource_ = true;
67  description.isLooper_ = true;
68  if (description.label_ == "@main_looper") {
69  //remove the 'hidden' label so that es_prefer statements will work
70  description.label_ = "";
71  }
72  pFinder->setDescriptionForFinder(description);
73 
74  iProvider.add(pFinder);
75  }
76  template <class T>
77  void addFinderTo(EventSetupProvider& /* iProvider */, std::shared_ptr<T> /*iComponent*/, const void*) {
78  //do nothing
79  }
80  } // namespace looper
83  static std::string name();
84  template <class T>
85  static void addTo(EventSetupProvider& iProvider, std::shared_ptr<T> iComponent, ParameterSet const&, bool) {
86  //a looper does not always have to be a provider or a finder
87  looper::addProviderTo(iProvider, iComponent, static_cast<const T*>(nullptr));
88  looper::addFinderTo(iProvider, iComponent, static_cast<const T*>(nullptr));
89  }
90 
91  static void replaceExisting(EventSetupProvider& iProvider, std::shared_ptr<EDLooperBase> iComponent);
92 
93  static std::shared_ptr<base_type> getComponentAndRegisterProcess(EventSetupsController& esController,
94  ParameterSet const& iConfiguration);
95  static void putComponent(EventSetupsController& esController,
96  ParameterSet const& iConfiguration,
97  std::shared_ptr<base_type> const& component);
98  };
99  template <class TType>
100  struct LooperMaker : public ComponentMaker<edm::eventsetup::LooperMakerTraits, TType> {};
102 
104  } // namespace eventsetup
105 } // namespace edm
106 
107 #define DEFINE_FWK_LOOPER(type) \
108  DEFINE_EDM_PLUGIN(edm::eventsetup::LooperPluginFactory, edm::eventsetup::LooperMaker<type>, #type)
109 
110 #endif
edm::eventsetup::DataProxyProvider
Definition: DataProxyProvider.h:64
ComponentFactory.h
EventSetupRecordIntervalFinder
EventSetupProvider.h
edm::eventsetup::LooperFactory
ComponentFactory< LooperMakerTraits > LooperFactory
Definition: LooperFactory.h:101
edm::eventsetup::looper::addFinderTo
void addFinderTo(EventSetupProvider &iProvider, std::shared_ptr< T > iComponent, const EventSetupRecordIntervalFinder *)
Definition: LooperFactory.h:60
edm
HLT enums.
Definition: AlignableModifier.h:19
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
edm::EventSetupRecordIntervalFinder
Definition: EventSetupRecordIntervalFinder.h:33
edm::eventsetup::ComponentMaker
Definition: ComponentMaker.h:57
edm::eventsetup::LooperMakerTraits::getComponentAndRegisterProcess
static std::shared_ptr< base_type > getComponentAndRegisterProcess(EventSetupsController &esController, ParameterSet const &iConfiguration)
Definition: LooperFactory.cc:31
edm::eventsetup::EventSetupProvider
Definition: EventSetupProvider.h:49
edm::eventsetup::LooperMakerTraits::putComponent
static void putComponent(EventSetupsController &esController, ParameterSet const &iConfiguration, std::shared_ptr< base_type > const &component)
Definition: LooperFactory.cc:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::eventsetup::ComponentDescription
Definition: ComponentDescription.h:30
edm::eventsetup::LooperMakerTraits
Definition: LooperFactory.h:81
looper
Definition: looper.py:1
edm::ParameterSet
Definition: ParameterSet.h:47
ParameterSet
Definition: Functions.h:16
edmplugin::PluginFactory
Definition: PluginFactory.h:34
edm::eventsetup::LooperMakerTraits::base_type
EDLooperBase base_type
Definition: LooperFactory.h:82
edm::eventsetup::LooperMaker
Definition: LooperFactory.h:100
edm::eventsetup::LooperMakerTraits::name
static std::string name()
Definition: LooperFactory.cc:23
edm::eventsetup::EventSetupsController
Definition: EventSetupsController.h:79
edm::eventsetup::LooperMakerTraits::replaceExisting
static void replaceExisting(EventSetupProvider &iProvider, std::shared_ptr< EDLooperBase > iComponent)
Definition: LooperFactory.cc:25
edm::eventsetup::EventSetupProvider::add
void add(std::shared_ptr< DataProxyProvider >)
Definition: EventSetupProvider.cc:89
EDLooperBase
edm::eventsetup::ComponentFactory
Definition: ComponentFactory.h:43
edm::eventsetup::LooperMakerTraits::addTo
static void addTo(EventSetupProvider &iProvider, std::shared_ptr< T > iComponent, ParameterSet const &, bool)
Definition: LooperFactory.h:85
edm::eventsetup::looper::addProviderTo
void addProviderTo(EventSetupProvider &iProvider, std::shared_ptr< T > iComponent, const DataProxyProvider *)
Definition: LooperFactory.h:42
edm::EDLooperBase
Definition: EDLooperBase.h:77