test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SourceFactory.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_SourceFactory_h
2 #define FWCore_Framework_SourceFactory_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : SourceFactory
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 
32 namespace edm {
34  class ParameterSet;
35 
36  namespace eventsetup {
37  class DataProxyProvider;
38  class EventSetupsController;
39 
40  template<class T>
41  void addProviderTo(EventSetupProvider& iProvider, std::shared_ptr<T> iComponent, const DataProxyProvider*)
42  {
43  std::shared_ptr<DataProxyProvider> pProvider(iComponent);
44  ComponentDescription description = pProvider->description();
45  description.isSource_=true;
46  pProvider->setDescription(description);
47  iProvider.add(pProvider);
48  }
49  template<class T>
50  void addProviderTo(EventSetupProvider& /* iProvider */, std::shared_ptr<T> /*iComponent*/, const void*)
51  {
52  //do nothing
53  }
54 
57  static std::string name();
58  template<class T>
59  static void addTo(EventSetupProvider& iProvider,
60  std::shared_ptr<T> iComponent,
61  ParameterSet const& iConfiguration,
62  bool matchesPreceding)
63  {
64  if (matchesPreceding) {
65  logInfoWhenSharing(iConfiguration);
66  }
67  //a source does not always have to be a provider
68  addProviderTo(iProvider, iComponent, static_cast<const T*>(nullptr));
69  std::shared_ptr<EventSetupRecordIntervalFinder> pFinder(iComponent);
70  iProvider.add(pFinder);
71  }
72  static void replaceExisting(EventSetupProvider& iProvider, std::shared_ptr<EventSetupRecordIntervalFinder> iComponent);
73 
74  static std::shared_ptr<base_type> getComponentAndRegisterProcess(EventSetupsController& esController,
75  ParameterSet const& iConfiguration);
76 
77  static void putComponent(EventSetupsController& esController,
78  ParameterSet const& iConfiguration,
79  std::shared_ptr<base_type> const& component);
80 
81  static void logInfoWhenSharing(ParameterSet const& iConfiguration);
82  };
83 
84  template< class TType>
85  struct SourceMaker : public ComponentMaker<edm::eventsetup::SourceMakerTraits,TType> {};
87 
89  }
90 }
91 
92 #define DEFINE_FWK_EVENTSETUP_SOURCE(type) \
93 DEFINE_EDM_PLUGIN (edm::eventsetup::SourcePluginFactory,edm::eventsetup::SourceMaker<type>,#type); \
94 DEFINE_DESC_FILLER_FOR_ESSOURCES(type)
95 
96 #endif
static void replaceExisting(EventSetupProvider &iProvider, std::shared_ptr< EventSetupRecordIntervalFinder > iComponent)
static void addTo(EventSetupProvider &iProvider, std::shared_ptr< T > iComponent, ParameterSet const &iConfiguration, bool matchesPreceding)
Definition: SourceFactory.h:59
ComponentFactory< SourceMakerTraits > SourceFactory
Definition: SourceFactory.h:86
void add(std::shared_ptr< DataProxyProvider >)
EventSetupRecordIntervalFinder base_type
Definition: SourceFactory.h:56
static void logInfoWhenSharing(ParameterSet const &iConfiguration)
tuple description
Definition: idDealer.py:66
static std::shared_ptr< base_type > getComponentAndRegisterProcess(EventSetupsController &esController, ParameterSet const &iConfiguration)
static void putComponent(EventSetupsController &esController, ParameterSet const &iConfiguration, std::shared_ptr< base_type > const &component)
void addProviderTo(EventSetupProvider &iProvider, std::shared_ptr< T > iComponent, const DataProxyProvider *)
Definition: SourceFactory.h:41