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 
35  namespace eventsetup {
36  class DataProxyProvider;
37 
38  template<class T>
39  void addProviderTo(EventSetupProvider& iProvider, boost::shared_ptr<T> iComponent, const DataProxyProvider*)
40  {
41  boost::shared_ptr<DataProxyProvider> pProvider(iComponent);
42  ComponentDescription description = pProvider->description();
43  description.isSource_=true;
44  pProvider->setDescription(description);
45  iProvider.add(pProvider);
46  }
47  template<class T>
48  void addProviderTo(EventSetupProvider& /* iProvider */, boost::shared_ptr<T> /*iComponent*/, const void*)
49  {
50  //do nothing
51  }
52 
55  static std::string name();
56  template<class T>
57  static void addTo(EventSetupProvider& iProvider, boost::shared_ptr<T> iComponent)
58  {
59  //a source does not always have to be a provider
60  addProviderTo(iProvider, iComponent, static_cast<const T*>(0));
61  boost::shared_ptr<EventSetupRecordIntervalFinder> pFinder(iComponent);
62  iProvider.add(pFinder);
63  }
64 
65  };
66  template< class TType>
67  struct SourceMaker : public ComponentMaker<edm::eventsetup::SourceMakerTraits,TType> {};
69 
71  }
72 }
73 
74 #define DEFINE_FWK_EVENTSETUP_SOURCE(type) \
75 DEFINE_EDM_PLUGIN (edm::eventsetup::SourcePluginFactory,edm::eventsetup::SourceMaker<type>,#type); \
76 DEFINE_DESC_FILLER_FOR_ESSOURCES(type)
77 
78 #endif
void add(boost::shared_ptr< DataProxyProvider >)
ComponentFactory< SourceMakerTraits > SourceFactory
Definition: SourceFactory.h:68
EventSetupRecordIntervalFinder base_type
Definition: SourceFactory.h:54
tuple description
Definition: idDealer.py:66
void addProviderTo(EventSetupProvider &iProvider, boost::shared_ptr< T > iComponent, const DataProxyProvider *)
Definition: SourceFactory.h:39
static void addTo(EventSetupProvider &iProvider, boost::shared_ptr< T > iComponent)
Definition: SourceFactory.h:57