CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ComponentMaker.h
Go to the documentation of this file.
1 #ifndef Framework_ComponentMaker_h
2 #define Framework_ComponentMaker_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : ComponentMaker
7 //
16 //
17 // Author: Chris Jones
18 // Created: Wed May 25 16:56:05 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 {
33  namespace eventsetup {
34  class EventSetupProvider;
35  class DataProxyProvider;
36 
38  {
39  public:
41  protected:
43  std::string const& iProcessName,
44  ReleaseVersion const& iVersion,
45  PassID const& iPass) const;
46  };
47 
48  template <class T>
50  public:
51  typedef typename T::base_type base_type;
52  virtual boost::shared_ptr<base_type> addTo(EventSetupProvider& iProvider,
53  ParameterSet const& iConfiguration,
54  std::string const& iProcessName,
55  ReleaseVersion const& iVersion,
56  PassID const& iPass) const = 0;
57  protected:
59  };
60 
61  template <class T, class TComponent>
63  {
64 
65  public:
67  //virtual ~ComponentMaker();
68  typedef typename T::base_type base_type;
69 
70  // ---------- const member functions ---------------------
71  virtual boost::shared_ptr<base_type> addTo(EventSetupProvider& iProvider,
72  ParameterSet const& iConfiguration,
73  std::string const& iProcessName,
74  ReleaseVersion const& iVersion,
75  PassID const& iPass) const;
76 
77  // ---------- static member functions --------------------
78 
79  // ---------- member functions ---------------------------
80  private:
81  ComponentMaker(const ComponentMaker&); // stop default
82 
83  const ComponentMaker& operator=(const ComponentMaker&); // stop default
84 
85  void setDescription(DataProxyProvider* iProv, const ComponentDescription& iDesc) const {
86  iProv->setDescription(iDesc);
87  }
89  iFinder->setDescriptionForFinder(iDesc);
90  }
91  void setPostConstruction(DataProxyProvider* iProv, const edm::ParameterSet& iPSet) const {
92  //The 'appendToDataLabel' parameter was added very late in the development cycle and since
93  // the ParameterSet is not sent to the base class we must set the value after construction
94  iProv->setAppendToDataLabel(iPSet);
95  }
96  void setDescription(void*, const ComponentDescription&) const {
97  }
98  void setDescriptionForFinder(void*, const ComponentDescription&) const {
99  }
100  void setPostConstruction(void*, const edm::ParameterSet&) const {
101  }
102  // ---------- member data --------------------------------
103 
104 };
105 
106 template< class T, class TComponent>
107 boost::shared_ptr<typename ComponentMaker<T,TComponent>::base_type>
109  ParameterSet const& iConfiguration,
110  std::string const& iProcessName,
111  ReleaseVersion const& iVersion,
112  PassID const& iPass) const
113 {
114  boost::shared_ptr<TComponent> component(new TComponent(iConfiguration));
116  this->createComponentDescription(iConfiguration,
117  iProcessName,
118  iVersion,
119  iPass);
120 
121  this->setDescription(component.get(),description);
122  this->setDescriptionForFinder(component.get(),description);
123  this->setPostConstruction(component.get(),iConfiguration);
124  T::addTo(iProvider, component);
125  return component;
126 }
127  }
128 }
129 #endif
void setDescription(const ComponentDescription &iDescription)
const ComponentMaker & operator=(const ComponentMaker &)
virtual boost::shared_ptr< base_type > addTo(EventSetupProvider &iProvider, ParameterSet const &iConfiguration, std::string const &iProcessName, ReleaseVersion const &iVersion, PassID const &iPass) const =0
ComponentDescription createComponentDescription(ParameterSet const &iConfiguration, std::string const &iProcessName, ReleaseVersion const &iVersion, PassID const &iPass) const
void setPostConstruction(DataProxyProvider *iProv, const edm::ParameterSet &iPSet) const
void setDescriptionForFinder(const eventsetup::ComponentDescription &iDescription)
tuple description
Definition: idDealer.py:66
std::string ReleaseVersion
Definition: ReleaseVersion.h:7
void setPostConstruction(void *, const edm::ParameterSet &) const
void setAppendToDataLabel(const edm::ParameterSet &)
virtual boost::shared_ptr< base_type > addTo(EventSetupProvider &iProvider, ParameterSet const &iConfiguration, std::string const &iProcessName, ReleaseVersion const &iVersion, PassID const &iPass) const
void setDescription(DataProxyProvider *iProv, const ComponentDescription &iDesc) const
void setDescription(void *, const ComponentDescription &) const
void setDescriptionForFinder(void *, const ComponentDescription &) const
std::string PassID
Definition: PassID.h:8
void setDescriptionForFinder(EventSetupRecordIntervalFinder *iFinder, const ComponentDescription &iDesc) const