CMS 3D CMS Logo

SimWatcherMaker.h
Go to the documentation of this file.
1 #ifndef Watcher_SimWatcherMaker_h
2 #define Watcher_SimWatcherMaker_h
3 // -*- C++ -*-
4 //
5 // Package: Watcher
6 // Class : SimWatcherMaker
7 //
17 //
18 // Original Author:
19 // Created: Tue Nov 22 13:03:44 EST 2005
20 //
21 
22 // system include files
23 #include <memory>
24 
25 // user include files
28 
29 // forward declarations
30 
31 template <class T>
33 public:
35 
36  // ---------- const member functions ---------------------
37  void make(const edm::ParameterSet &p,
39  std::shared_ptr<SimWatcher> &oWatcher,
40  std::shared_ptr<SimProducer> &oProd) const override {
41  auto returnValue = std::make_shared<T>(p);
42  SimActivityRegistryEnroller::enroll(reg, returnValue.get());
43  oWatcher = returnValue;
44 
45  // If this is also a SimProducer, set the value
46  oProd = this->getSimProducer(returnValue.get(), returnValue);
47  }
48 
49 private:
50  std::shared_ptr<SimProducer> getSimProducer(SimProducer *, std::shared_ptr<T> &iProd) const {
51  return std::shared_ptr<SimProducer>(iProd);
52  }
53  std::shared_ptr<SimProducer> getSimProducer(void *, std::shared_ptr<T> &iProd) const {
54  return std::shared_ptr<SimProducer>();
55  }
56 };
57 
58 #endif
std::shared_ptr< SimProducer > getSimProducer(void *, std::shared_ptr< T > &iProd) const
std::shared_ptr< SimProducer > getSimProducer(SimProducer *, std::shared_ptr< T > &iProd) const
static void enroll(SimActivityRegistry &iReg, T *iObj)
void make(const edm::ParameterSet &p, SimActivityRegistry &reg, std::shared_ptr< SimWatcher > &oWatcher, std::shared_ptr< SimProducer > &oProd) const override