CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions
edm::Maker Class Referenceabstract

#include <WorkerMaker.h>

Inheritance diagram for edm::Maker:
edm::WorkerMaker< T >

Public Member Functions

std::unique_ptr< WorkermakeWorker (WorkerParams const &, signalslot::Signal< void(ModuleDescription const &)> &iPre, signalslot::Signal< void(ModuleDescription const &)> &iPost) const
 
void swapModule (Worker *, ParameterSet const &)
 
virtual ~Maker ()
 

Protected Member Functions

ModuleDescription createModuleDescription (WorkerParams const &p) const
 
void throwConfigurationException (ModuleDescription const &md, signalslot::Signal< void(ModuleDescription const &)> &post, cms::Exception &iException) const
 
void throwValidationException (WorkerParams const &p, cms::Exception &iException) const
 
void validateEDMType (std::string const &edmType, WorkerParams const &p) const
 

Private Member Functions

virtual const std::string & baseType () const =0
 
virtual void fillDescriptions (ConfigurationDescriptions &iDesc) const =0
 
virtual void implSwapModule (Worker *, ParameterSet const &)=0
 
virtual std::unique_ptr< WorkermakeWorker (WorkerParams const &p, ModuleDescription const &md) const =0
 

Detailed Description

Definition at line 17 of file WorkerMaker.h.

Constructor & Destructor Documentation

edm::Maker::~Maker ( )
virtual

Definition at line 15 of file WorkerMaker.cc.

15  {
16 }

Member Function Documentation

virtual const std::string& edm::Maker::baseType ( ) const
privatepure virtual

Implemented in edm::WorkerMaker< T >.

Referenced by makeWorker().

ModuleDescription edm::Maker::createModuleDescription ( WorkerParams const &  p) const
protected

Definition at line 19 of file WorkerMaker.cc.

References dbtoconf::conf, edm::ParameterSet::getParameter(), edm::ParameterSet::id(), edm::WorkerParams::processConfiguration_, edm::WorkerParams::pset_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeWorker().

19  {
20  ParameterSet const& conf = *p.pset_;
21  ModuleDescription md(conf.id(),
22  conf.getParameter<std::string>("@module_type"),
23  conf.getParameter<std::string>("@module_label"),
24  p.processConfiguration_.get());
25  return md;
26 }
tuple conf
Definition: dbtoconf.py:185
virtual void edm::Maker::fillDescriptions ( ConfigurationDescriptions iDesc) const
privatepure virtual

Implemented in edm::WorkerMaker< T >.

Referenced by makeWorker().

virtual void edm::Maker::implSwapModule ( Worker ,
ParameterSet const &   
)
privatepure virtual

Implemented in edm::WorkerMaker< T >.

Referenced by swapModule().

std::unique_ptr< Worker > edm::Maker::makeWorker ( WorkerParams const &  p,
signalslot::Signal< void(ModuleDescription const &)> &  iPre,
signalslot::Signal< void(ModuleDescription const &)> &  iPost 
) const

Definition at line 66 of file WorkerMaker.cc.

References edm::convertException::badAllocToEDM(), baseType(), trackerHits::c, edm::convertException::charPtrToEDM(), createModuleDescription(), alignCSCRings::e, cppFunctionSkipper::exception, fillDescriptions(), edm::ParameterSet::getParameter(), edm::WorkerParams::pset_, edm::ParameterSet::registerIt(), alignCSCRings::s, edm::convertException::stdToEDM(), AlCaHLTBitMon_QueryRunRegistry::string, edm::convertException::stringToEDM(), throwConfigurationException(), throwValidationException(), edm::convertException::unknownToEDM(), edm::ConfigurationDescriptions::validate(), and validateEDMType().

68  {
69  ConfigurationDescriptions descriptions(baseType());
70  fillDescriptions(descriptions);
71  try {
72  try {
73  descriptions.validate(*p.pset_, p.pset_->getParameter<std::string>("@module_label"));
75  }
76  catch (cms::Exception& e) { throw; }
77  catch(std::bad_alloc& bda) { convertException::badAllocToEDM(); }
80  catch(char const* c) { convertException::charPtrToEDM(c); }
81  catch (...) { convertException::unknownToEDM(); }
82  }
83  catch (cms::Exception & iException) {
84  throwValidationException(p, iException);
85  }
86  p.pset_->registerIt();
87 
88  ModuleDescription md = createModuleDescription(p);
89 
90  std::unique_ptr<Worker> worker;
91  try {
92  try {
93  pre(md);
94  worker = makeWorker(p,md);
95  post(md);
96  }
97  catch (cms::Exception& e) { throw; }
98  catch(std::bad_alloc& bda) { convertException::badAllocToEDM(); }
101  catch(char const* c) { convertException::charPtrToEDM(c); }
102  catch (...) { convertException::unknownToEDM(); }
103  }
104  catch(cms::Exception & iException){
105  throwConfigurationException(md, post, iException);
106  }
107  return worker;
108 }
virtual const std::string & baseType() const =0
void validateEDMType(std::string const &edmType, WorkerParams const &p) const
Definition: WorkerMaker.cc:54
ModuleDescription createModuleDescription(WorkerParams const &p) const
Definition: WorkerMaker.cc:19
void stdToEDM(std::exception const &e)
virtual void fillDescriptions(ConfigurationDescriptions &iDesc) const =0
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
void throwConfigurationException(ModuleDescription const &md, signalslot::Signal< void(ModuleDescription const &)> &post, cms::Exception &iException) const
Definition: WorkerMaker.cc:43
std::unique_ptr< Worker > makeWorker(WorkerParams const &, signalslot::Signal< void(ModuleDescription const &)> &iPre, signalslot::Signal< void(ModuleDescription const &)> &iPost) const
Definition: WorkerMaker.cc:66
void throwValidationException(WorkerParams const &p, cms::Exception &iException) const
Definition: WorkerMaker.cc:29
virtual std::unique_ptr<Worker> edm::Maker::makeWorker ( WorkerParams const &  p,
ModuleDescription const &  md 
) const
privatepure virtual

Implemented in edm::WorkerMaker< T >.

void edm::Maker::swapModule ( Worker w,
ParameterSet const &  p 
)

Definition at line 111 of file WorkerMaker.cc.

References implSwapModule().

111  {
112  implSwapModule(w,p);
113 }
virtual void implSwapModule(Worker *, ParameterSet const &)=0
T w() const
void edm::Maker::throwConfigurationException ( ModuleDescription const &  md,
signalslot::Signal< void(ModuleDescription const &)> &  post,
cms::Exception iException 
) const
protected

Definition at line 43 of file WorkerMaker.cc.

References cms::Exception::addContext(), edm::ModuleDescription::moduleLabel(), and edm::ModuleDescription::moduleName().

Referenced by makeWorker().

45  {
46  std::ostringstream ost;
47  ost << "Constructing module: class=" << md.moduleName() << " label='" << md.moduleLabel() << "'";
48  iException.addContext(ost.str());
49  post(md);
50  throw;
51 }
void addContext(std::string const &context)
Definition: Exception.cc:227
void edm::Maker::throwValidationException ( WorkerParams const &  p,
cms::Exception iException 
) const
protected

Definition at line 29 of file WorkerMaker.cc.

References cms::Exception::addContext(), dbtoconf::conf, edm::ParameterSet::getParameter(), edm::WorkerParams::pset_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeWorker().

30  {
31  ParameterSet const& conf = *p.pset_;
32  std::string moduleName = conf.getParameter<std::string>("@module_type");
33  std::string moduleLabel = conf.getParameter<std::string>("@module_label");
34 
35  std::ostringstream ost;
36  ost << "Validating configuration of module: class=" << moduleName
37  << " label='" << moduleLabel << "'";
38  iException.addContext(ost.str());
39  throw;
40 }
tuple conf
Definition: dbtoconf.py:185
void addContext(std::string const &context)
Definition: Exception.cc:227
void edm::Maker::validateEDMType ( std::string const &  edmType,
WorkerParams const &  p 
) const
protected

Definition at line 54 of file WorkerMaker.cc.

References edm::errors::Configuration, edm::hlt::Exception, edm::ParameterSet::getParameter(), edm::WorkerParams::pset_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeWorker().

54  {
55  std::string expected = p.pset_->getParameter<std::string>("@module_edm_type");
56  if (edmType != expected) {
58  << "The base type in the python configuration is " << expected << ", but the base type\n"
59  << "for the module's C++ class is " << edmType << ". "
60  << "Please fix the configuration.\n"
61  << "It must use the same base type as the C++ class.\n";
62  }
63 }