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