#include <WorkerMaker.h>
Public Member Functions | |
std::auto_ptr< Worker > | makeWorker (WorkerParams const &, sigc::signal< void, ModuleDescription const & > &iPre, sigc::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, sigc::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::auto_ptr< Worker > | makeWorker (WorkerParams const &p, ModuleDescription const &md) const =0 |
Definition at line 17 of file WorkerMaker.h.
edm::Maker::~Maker | ( | ) | [virtual] |
Definition at line 15 of file WorkerMaker.cc.
{ }
virtual const std::string& edm::Maker::baseType | ( | ) | const [private, pure 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_, and edm::WorkerParams::pset_.
Referenced by makeWorker().
{ ParameterSet const& conf = *p.pset_; ModuleDescription md(conf.id(), conf.getParameter<std::string>("@module_type"), conf.getParameter<std::string>("@module_label"), p.processConfiguration_.get()); return md; }
virtual void edm::Maker::fillDescriptions | ( | ConfigurationDescriptions & | iDesc | ) | const [private, pure virtual] |
Implemented in edm::WorkerMaker< T >.
Referenced by makeWorker().
virtual void edm::Maker::implSwapModule | ( | Worker * | , |
ParameterSet const & | |||
) | [private, pure virtual] |
Implemented in edm::WorkerMaker< T >.
Referenced by swapModule().
virtual std::auto_ptr<Worker> edm::Maker::makeWorker | ( | WorkerParams const & | p, |
ModuleDescription const & | md | ||
) | const [private, pure virtual] |
Implemented in edm::WorkerMaker< T >.
std::auto_ptr< Worker > edm::Maker::makeWorker | ( | WorkerParams const & | p, |
sigc::signal< void, ModuleDescription const & > & | iPre, | ||
sigc::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, exception, fillDescriptions(), edm::ParameterSet::getParameter(), edm::WorkerParams::pset_, edm::ParameterSet::registerIt(), alignCSCRings::s, edm::convertException::stdToEDM(), edm::convertException::stringToEDM(), throwConfigurationException(), throwValidationException(), edm::convertException::unknownToEDM(), edm::ConfigurationDescriptions::validate(), and validateEDMType().
{ ConfigurationDescriptions descriptions(baseType()); fillDescriptions(descriptions); try { try { descriptions.validate(*p.pset_, p.pset_->getParameter<std::string>("@module_label")); validateEDMType(baseType(), p); } catch (cms::Exception& e) { throw; } catch(std::bad_alloc& bda) { convertException::badAllocToEDM(); } catch (std::exception& e) { convertException::stdToEDM(e); } catch(std::string& s) { convertException::stringToEDM(s); } catch(char const* c) { convertException::charPtrToEDM(c); } catch (...) { convertException::unknownToEDM(); } } catch (cms::Exception & iException) { throwValidationException(p, iException); } p.pset_->registerIt(); ModuleDescription md = createModuleDescription(p); std::auto_ptr<Worker> worker; try { try { pre(md); worker = makeWorker(p,md); post(md); } catch (cms::Exception& e) { throw; } catch(std::bad_alloc& bda) { convertException::badAllocToEDM(); } catch (std::exception& e) { convertException::stdToEDM(e); } catch(std::string& s) { convertException::stringToEDM(s); } catch(char const* c) { convertException::charPtrToEDM(c); } catch (...) { convertException::unknownToEDM(); } } catch(cms::Exception & iException){ throwConfigurationException(md, post, iException); } return worker; }
void edm::Maker::swapModule | ( | Worker * | w, |
ParameterSet const & | p | ||
) |
Definition at line 111 of file WorkerMaker.cc.
References implSwapModule().
{ implSwapModule(w,p); }
void edm::Maker::throwConfigurationException | ( | ModuleDescription const & | md, |
sigc::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().
{ std::ostringstream ost; ost << "Constructing module: class=" << md.moduleName() << " label='" << md.moduleLabel() << "'"; iException.addContext(ost.str()); post(md); throw; }
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(), and edm::WorkerParams::pset_.
Referenced by makeWorker().
{ ParameterSet const& conf = *p.pset_; std::string moduleName = conf.getParameter<std::string>("@module_type"); std::string moduleLabel = conf.getParameter<std::string>("@module_label"); std::ostringstream ost; ost << "Validating configuration of module: class=" << moduleName << " label='" << moduleLabel << "'"; iException.addContext(ost.str()); throw; }
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, Exception, edm::ParameterSet::getParameter(), and edm::WorkerParams::pset_.
Referenced by makeWorker().
{ std::string expected = p.pset_->getParameter<std::string>("@module_edm_type"); if (edmType != expected) { throw Exception(errors::Configuration) << "The base type in the python configuration is " << expected << ", but the base type\n" << "for the module's C++ class is " << edmType << ". " << "Please fix the configuration.\n" << "It must use the same base type as the C++ class.\n"; } }