#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 const &iException) const |
void | throwValidationException (WorkerParams const &p, cms::Exception const &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 10 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 14 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_); 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 61 of file WorkerMaker.cc.
References baseType(), createModuleDescription(), fillDescriptions(), edm::ParameterSet::getParameter(), edm::WorkerParams::pset_, edm::ParameterSet::registerIt(), throwConfigurationException(), throwValidationException(), edm::ConfigurationDescriptions::validate(), and validateEDMType().
{ try { ConfigurationDescriptions descriptions(baseType()); fillDescriptions(descriptions); descriptions.validate(*p.pset_, p.pset_->getParameter<std::string>("@module_label")); p.pset_->registerIt(); } catch (cms::Exception& iException) { throwValidationException(p, iException); } ModuleDescription md = createModuleDescription(p); std::auto_ptr<Worker> worker; validateEDMType(baseType(), p); try { pre(md); worker = makeWorker(p,md); post(md); } catch( cms::Exception& iException){ throwConfigurationException(md, post, iException); } return worker; }
void edm::Maker::swapModule | ( | Worker * | w, |
ParameterSet const & | p | ||
) |
void edm::Maker::throwConfigurationException | ( | ModuleDescription const & | md, |
sigc::signal< void, ModuleDescription const & > & | post, | ||
cms::Exception const & | iException | ||
) | const [protected] |
Definition at line 38 of file WorkerMaker.cc.
References cms::Exception::append(), edm::errors::Configuration, edm::ModuleDescription::moduleLabel(), and edm::ModuleDescription::moduleName().
Referenced by makeWorker().
{ Exception toThrow(errors::Configuration,"Error occurred while creating "); toThrow << "for module of type \'"<<md.moduleName() << "\' with label \'" << md.moduleLabel() << "'\n"; toThrow.append(iException); post(md); throw toThrow; }
void edm::Maker::throwValidationException | ( | WorkerParams const & | p, |
cms::Exception const & | iException | ||
) | const [protected] |
Definition at line 24 of file WorkerMaker.cc.
References dbtoconf::conf, edm::errors::Configuration, edm::ParameterSet::getParameter(), moduleLabel(), 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"); Exception toThrow(errors::Configuration, "Error occurred while validating and registering configuration\n"); toThrow << "for module of type \'" << moduleName << "\' with label \'" << moduleLabel << "\'\n"; toThrow.append(iException); throw toThrow; }
void edm::Maker::validateEDMType | ( | std::string const & | edmType, |
WorkerParams const & | p | ||
) | const [protected] |
Definition at line 49 of file WorkerMaker.cc.
References edm::errors::Configuration, edm::ParameterSet::getParameter(), and edm::WorkerParams::pset_.
Referenced by makeWorker().
{ std::string expected = p.pset_->getParameter<std::string>("@module_edm_type"); if(edmType != expected) { Exception toThrow(errors::Configuration,"Error occurred while creating module.\n"); toThrow <<"Module of type \'"<< p.pset_->getParameter<std::string>("@module_type") << "' with label '" << p.pset_->getParameter<std::string>("@module_label") << "' is of type " << edmType << ", but declared in the configuration as " << expected << ".\n" << "Please replace " << expected << " with " << edmType << " in the appropriate configuration file(s).\n"; throw toThrow; } }