CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
edm::Factory Class Reference

#include <Factory.h>

Public Types

typedef std::map< std::string,
edm::propagate_const< Maker * > > 
MakerMap
 

Public Member Functions

std::shared_ptr
< maker::ModuleHolder
makeModule (const MakeModuleParams &, signalslot::Signal< void(const ModuleDescription &)> &pre, signalslot::Signal< void(const ModuleDescription &)> &post) const
 
std::shared_ptr
< maker::ModuleHolder
makeReplacementModule (const edm::ParameterSet &) const
 
 ~Factory ()
 

Static Public Member Functions

static Factory const * get ()
 

Private Member Functions

 Factory ()
 
MakerfindMaker (const MakeModuleParams &p) const
 

Private Attributes

MakerMap makers_
 

Static Private Attributes

static Factory const singleInstance_
 

Detailed Description

Definition at line 16 of file Factory.h.

Member Typedef Documentation

typedef std::map<std::string, edm::propagate_const<Maker*> > edm::Factory::MakerMap

Definition at line 18 of file Factory.h.

Constructor & Destructor Documentation

edm::Factory::~Factory ( )

Definition at line 17 of file Factory.cc.

References edm::cleanup(), edm::for_all(), and makers_.

17 { for_all(makers_, cleanup); }
static void cleanup(const Factory::MakerMap::value_type &v)
Definition: Factory.cc:13
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:14
MakerMap makers_
Definition: Factory.h:36
edm::Factory::Factory ( )
private

Definition at line 19 of file Factory.cc.

20  : makers_()
21 
22  {}
MakerMap makers_
Definition: Factory.h:36

Member Function Documentation

Maker * edm::Factory::findMaker ( const MakeModuleParams p) const
private

Definition at line 26 of file Factory.cc.

References edm::errors::Configuration, beamerCreator::create(), FDEBUG, get, edm::ParameterSet::getParameter(), makers_, edm::MakeModuleParams::processConfiguration_, edm::MakeModuleParams::pset_, runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeModule().

26  {
27  std::string modtype = p.pset_->getParameter<std::string>("@module_type");
28  FDEBUG(1) << "Factory: module_type = " << modtype << std::endl;
29  MakerMap::iterator it = makers_.find(modtype);
30 
31  if (it == makers_.end()) {
32  std::unique_ptr<Maker> wm(MakerPluginFactory::get()->create(modtype));
33 
34  if (wm.get() == nullptr)
35  throw edm::Exception(errors::Configuration, "UnknownModule")
36  << "Module " << modtype << " with version " << p.processConfiguration_->releaseVersion()
37  << " was not registered.\n"
38  << "Perhaps your module type is misspelled or is not a "
39  << "framework plugin.\n"
40  << "Try running EdmPluginDump to obtain a list of "
41  << "available Plugins.";
42 
43  FDEBUG(1) << "Factory: created worker of type " << modtype << std::endl;
44 
45  std::pair<MakerMap::iterator, bool> ret = makers_.insert(std::pair<std::string, Maker*>(modtype, wm.get()));
46 
47  // if(ret.second==false)
48  // throw runtime_error("Worker Factory map insert failed");
49 
50  it = ret.first;
51  wm.release();
52  }
53  return it->second;
54  }
tuple ret
prodAgent to be discontinued
#define FDEBUG(lev)
Definition: DebugMacros.h:19
#define get
MakerMap makers_
Definition: Factory.h:36
Factory const * edm::Factory::get ( )
static
std::shared_ptr< maker::ModuleHolder > edm::Factory::makeModule ( const MakeModuleParams p,
signalslot::Signal< void(const ModuleDescription &)> &  pre,
signalslot::Signal< void(const ModuleDescription &)> &  post 
) const

Definition at line 56 of file Factory.cc.

References findMaker(), and mod().

Referenced by edm::ModuleRegistry::getModule().

59  {
60  auto maker = findMaker(p);
61  auto mod(maker->makeModule(p, pre, post));
62  return mod;
63  }
Maker * findMaker(const MakeModuleParams &p) const
Definition: Factory.cc:26
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::shared_ptr< maker::ModuleHolder > edm::Factory::makeReplacementModule ( const edm::ParameterSet p) const

Definition at line 65 of file Factory.cc.

References edm::ParameterSet::getParameter(), makers_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::ModuleRegistry::replaceModule().

65  {
66  std::string modtype = p.getParameter<std::string>("@module_type");
67  MakerMap::iterator it = makers_.find(modtype);
68  if (it != makers_.end()) {
69  return it->second->makeReplacementModule(p);
70  }
71  return std::shared_ptr<maker::ModuleHolder>{};
72  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MakerMap makers_
Definition: Factory.h:36

Member Data Documentation

MakerMap edm::Factory::makers_
mutableprivate

Definition at line 36 of file Factory.h.

Referenced by findMaker(), makeReplacementModule(), and ~Factory().

Factory const edm::Factory::singleInstance_
staticprivate

Definition at line 34 of file Factory.h.

Referenced by get().