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 <string>
23 #include "boost/shared_ptr.hpp"
24 
25 // user include files
29 
30 // forward declarations
31 
32 namespace edm {
34  class ParameterSet;
35 
36  namespace eventsetup {
37  class DataProxyProvider;
39 
40  template<class T>
41  void addProviderTo(EventSetupProvider& iProvider, boost::shared_ptr<T> iComponent, const DataProxyProvider*)
42  {
43  boost::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 */, boost::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, boost::shared_ptr<T> iComponent)
60  {
61  //a source does not always have to be a provider
62  addProviderTo(iProvider, iComponent, static_cast<const T*>(0));
63  boost::shared_ptr<EventSetupRecordIntervalFinder> pFinder(iComponent);
64  iProvider.add(pFinder);
65  }
66 
67  static boost::shared_ptr<base_type> const* getAlreadyMadeComponent(EventSetupsController const& esController,
68  ParameterSet const& iConfiguration);
69 
70  static void putComponent(EventSetupsController& esController,
71  ParameterSet const& iConfiguration,
72  boost::shared_ptr<base_type> const& component);
73  };
74  template< class TType>
75  struct SourceMaker : public ComponentMaker<edm::eventsetup::SourceMakerTraits,TType> {};
77 
79  }
80 }
81 
82 #define DEFINE_FWK_EVENTSETUP_SOURCE(type) \
83 DEFINE_EDM_PLUGIN (edm::eventsetup::SourcePluginFactory,edm::eventsetup::SourceMaker<type>,#type); \
84 DEFINE_DESC_FILLER_FOR_ESSOURCES(type)
85 
86 #endif
void add(boost::shared_ptr< DataProxyProvider >)
ComponentFactory< SourceMakerTraits > SourceFactory
Definition: SourceFactory.h:76
static void putComponent(EventSetupsController &esController, ParameterSet const &iConfiguration, boost::shared_ptr< base_type > const &component)
EventSetupRecordIntervalFinder base_type
Definition: SourceFactory.h:56
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: SourceFactory.h:41
static void addTo(EventSetupProvider &iProvider, boost::shared_ptr< T > iComponent)
Definition: SourceFactory.h:59