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 //
16 //
17 // Original Author:
18 // Created: Tue Nov 22 13:03:44 EST 2005
19 //
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
27 
28 // forward declarations
29 
30 template<class T>
32 {
33 
34  public:
36 
37  // ---------- const member functions ---------------------
38  virtual void make(const edm::ParameterSet& p,
40  std::shared_ptr<SimWatcher>& oWatcher,
41  std::shared_ptr<SimProducer>& oProd
42  ) const
43  {
44  auto returnValue = std::make_shared<T>(p);
45  SimActivityRegistryEnroller::enroll(reg, returnValue.get());
46  oWatcher = returnValue;
47 
48  //If this is also a SimProducer, set the value
49  oProd = this->getSimProducer(returnValue.get(), returnValue);
50  }
51 
52  private:
53  std::shared_ptr<SimProducer>
54  getSimProducer(SimProducer*, std::shared_ptr<T>& iProd) const{
55  return std::shared_ptr<SimProducer>(iProd);
56  }
57  std::shared_ptr<SimProducer>
58  getSimProducer(void*, std::shared_ptr<T>& iProd) const{
59  return std::shared_ptr<SimProducer>();
60  }
61 
62 };
63 
64 
65 #endif
virtual void make(const edm::ParameterSet &p, SimActivityRegistry &reg, std::shared_ptr< SimWatcher > &oWatcher, std::shared_ptr< SimProducer > &oProd) const
std::shared_ptr< SimProducer > getSimProducer(void *, std::shared_ptr< T > &iProd) const
static void enroll(SimActivityRegistry &iReg, T *iObj)
std::shared_ptr< SimProducer > getSimProducer(SimProducer *, std::shared_ptr< T > &iProd) const