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