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