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::auto_ptr< WorkermakeWorker (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< 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 10 of file WorkerMaker.cc.

10  {
11 }

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 14 of file WorkerMaker.cc.

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

Referenced by makeWorker().

14  {
15  ParameterSet const& conf = *p.pset_;
16  ModuleDescription md(conf.id(),
17  conf.getParameter<std::string>("@module_type"),
18  conf.getParameter<std::string>("@module_label"),
19  p.processConfiguration_);
20  return md;
21 }
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::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().

63  {
64  try {
65  ConfigurationDescriptions descriptions(baseType());
66  fillDescriptions(descriptions);
67  descriptions.validate(*p.pset_, p.pset_->getParameter<std::string>("@module_label"));
68  p.pset_->registerIt();
69  }
70  catch (cms::Exception& iException) {
71  throwValidationException(p, iException);
72  }
73 
74  ModuleDescription md = createModuleDescription(p);
75 
76  std::auto_ptr<Worker> worker;
78  try {
79  pre(md);
80  worker = makeWorker(p,md);
81 
82  post(md);
83  } catch( cms::Exception& iException){
84  throwConfigurationException(md, post, iException);
85  }
86  return worker;
87 }
void throwValidationException(WorkerParams const &p, cms::Exception const &iException) const
Definition: WorkerMaker.cc:24
std::auto_ptr< Worker > makeWorker(WorkerParams const &, sigc::signal< void, ModuleDescription const & > &iPre, sigc::signal< void, ModuleDescription const & > &iPost) const
Definition: WorkerMaker.cc:61
virtual const std::string & baseType() const =0
void validateEDMType(std::string const &edmType, WorkerParams const &p) const
Definition: WorkerMaker.cc:49
ModuleDescription createModuleDescription(WorkerParams const &p) const
Definition: WorkerMaker.cc:14
virtual void fillDescriptions(ConfigurationDescriptions &iDesc) const =0
void throwConfigurationException(ModuleDescription const &md, sigc::signal< void, ModuleDescription const & > &post, cms::Exception const &iException) const
Definition: WorkerMaker.cc:38
virtual std::auto_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 90 of file WorkerMaker.cc.

References implSwapModule().

90  {
91  implSwapModule(w,p);
92 }
virtual void implSwapModule(Worker *, ParameterSet const &)=0
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().

40  {
41  Exception toThrow(errors::Configuration,"Error occurred while creating ");
42  toThrow << "for module of type \'"<<md.moduleName() << "\' with label \'" << md.moduleLabel() << "'\n";
43  toThrow.append(iException);
44  post(md);
45  throw toThrow;
46 }
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().

25  {
26  ParameterSet const& conf = *p.pset_;
27  std::string moduleName = conf.getParameter<std::string>("@module_type");
28  std::string moduleLabel = conf.getParameter<std::string>("@module_label");
29 
31  "Error occurred while validating and registering configuration\n");
32  toThrow << "for module of type \'" << moduleName << "\' with label \'" << moduleLabel << "\'\n";
33  toThrow.append(iException);
34  throw toThrow;
35 }
tuple conf
Definition: dbtoconf.py:185
const std::string * moduleLabel() const
Definition: HLTadd.h:40
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().

49  {
50  std::string expected = p.pset_->getParameter<std::string>("@module_edm_type");
51  if(edmType != expected) {
52  Exception toThrow(errors::Configuration,"Error occurred while creating module.\n");
53  toThrow <<"Module of type \'"<< p.pset_->getParameter<std::string>("@module_type") << "' with label '" << p.pset_->getParameter<std::string>("@module_label")
54  << "' is of type " << edmType << ", but declared in the configuration as " << expected << ".\n"
55  << "Please replace " << expected << " with " << edmType << " in the appropriate configuration file(s).\n";
56  throw toThrow;
57  }
58 }