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;
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, boost::shared_ptr<T> iComponent)
88  {
89  //a looper does not always have to be a provider or a finder
90  looper::addProviderTo(iProvider, iComponent, static_cast<const T*>(0));
91  looper::addFinderTo(iProvider, iComponent, static_cast<const T*>(0));
92  }
93 
94  static boost::shared_ptr<base_type> const* getAlreadyMadeComponent(EventSetupsController const& esController,
95  ParameterSet const& iConfiguration);
96  static void putComponent(EventSetupsController& esController,
97  ParameterSet const& iConfiguration,
98  boost::shared_ptr<base_type> const& component);
99  };
100  template< class TType>
101  struct LooperMaker : public ComponentMaker<edm::eventsetup::LooperMakerTraits,TType> {};
103 
105  }
106 }
107 
108 #define DEFINE_FWK_LOOPER(type) \
109 DEFINE_EDM_PLUGIN (edm::eventsetup::LooperPluginFactory,edm::eventsetup::LooperMaker<type>,#type)
110 
111 #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 > const * getAlreadyMadeComponent(EventSetupsController const &esController, ParameterSet const &iConfiguration)
tuple description
Definition: idDealer.py:66
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)
Definition: LooperFactory.h:87