CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <string>
23 #include "boost/shared_ptr.hpp"
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, boost::shared_ptr<T> iComponent, const DataProxyProvider*)
43  {
44  boost::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 */, boost::shared_ptr<T> /*iComponent*/, const void*)
57  {
58  //do nothing
59  }
60 
61  template<class T>
62  void addFinderTo(EventSetupProvider& iProvider, boost::shared_ptr<T> iComponent, const EventSetupRecordIntervalFinder*)
63  {
64  boost::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 */, boost::shared_ptr<T> /*iComponent*/, const void*)
79  {
80  //do nothing
81  }
82  }
85  static std::string name();
86  template<class T>
87  static void addTo(EventSetupProvider& iProvider,
88  boost::shared_ptr<T> iComponent,
89  ParameterSet const&,
90  bool)
91  {
92  //a looper does not always have to be a provider or a finder
93  looper::addProviderTo(iProvider, iComponent, static_cast<const T*>(nullptr));
94  looper::addFinderTo(iProvider, iComponent, static_cast<const T*>(nullptr));
95  }
96 
97  static void replaceExisting(EventSetupProvider& iProvider, boost::shared_ptr<EDLooperBase> iComponent);
98 
99  static boost::shared_ptr<base_type> getComponentAndRegisterProcess(EventSetupsController& esController,
100  ParameterSet const& iConfiguration);
101  static void putComponent(EventSetupsController& esController,
102  ParameterSet const& iConfiguration,
103  boost::shared_ptr<base_type> const& component);
104  };
105  template< class TType>
106  struct LooperMaker : public ComponentMaker<edm::eventsetup::LooperMakerTraits,TType> {};
108 
110  }
111 }
112 
113 #define DEFINE_FWK_LOOPER(type) \
114 DEFINE_EDM_PLUGIN (edm::eventsetup::LooperPluginFactory,edm::eventsetup::LooperMaker<type>,#type)
115 
116 #endif
void addFinderTo(EventSetupProvider &iProvider, boost::shared_ptr< T > iComponent, const EventSetupRecordIntervalFinder *)
Definition: LooperFactory.h:62
static void putComponent(EventSetupsController &esController, ParameterSet const &iConfiguration, boost::shared_ptr< base_type > const &component)
ComponentFactory< LooperMakerTraits > LooperFactory
void add(boost::shared_ptr< DataProxyProvider >)
static boost::shared_ptr< base_type > getComponentAndRegisterProcess(EventSetupsController &esController, ParameterSet const &iConfiguration)
tuple description
Definition: idDealer.py:66
static void replaceExisting(EventSetupProvider &iProvider, boost::shared_ptr< EDLooperBase > iComponent)
void addProviderTo(EventSetupProvider &iProvider, boost::shared_ptr< T > iComponent, const DataProxyProvider *)
Definition: LooperFactory.h:42
static void addTo(EventSetupProvider &iProvider, boost::shared_ptr< T > iComponent, ParameterSet const &, bool)
Definition: LooperFactory.h:87