CMS 3D CMS Logo

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::ModuleHoldermakeModule (const MakeModuleParams &, signalslot::Signal< void(const ModuleDescription &)> &pre, signalslot::Signal< void(const ModuleDescription &)> &post) const
 
std::shared_ptr< maker::ModuleHoldermakeReplacementModule (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 const Factory singleInstance_
 

Detailed Description

Definition at line 19 of file Factory.h.

Member Typedef Documentation

◆ MakerMap

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

Definition at line 21 of file Factory.h.

Constructor & Destructor Documentation

◆ ~Factory()

edm::Factory::~Factory ( )

Definition at line 16 of file Factory.cc.

16 { for_all(makers_, cleanup); }

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

◆ Factory()

edm::Factory::Factory ( )
private

Definition at line 18 of file Factory.cc.

19  : makers_()
20 
21  {}

Member Function Documentation

◆ findMaker()

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

Definition at line 25 of file Factory.cc.

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

References edm::errors::Configuration, beamerCreator::create(), FDEBUG, get, makers_, AlCaHLTBitMon_ParallelJobs::p, runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeModule().

◆ get()

Factory const * edm::Factory::get ( )
static

◆ makeModule()

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 55 of file Factory.cc.

58  {
59  auto maker = findMaker(p);
60  auto mod(maker->makeModule(p, pre, post));
61  return mod;
62  }

References findMaker(), mod(), and AlCaHLTBitMon_ParallelJobs::p.

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

◆ makeReplacementModule()

std::shared_ptr< maker::ModuleHolder > edm::Factory::makeReplacementModule ( const edm::ParameterSet p) const

Definition at line 64 of file Factory.cc.

64  {
65  std::string modtype = p.getParameter<std::string>("@module_type");
66  MakerMap::iterator it = makers_.find(modtype);
67  if (it != makers_.end()) {
68  return it->second->makeReplacementModule(p);
69  }
70  return std::shared_ptr<maker::ModuleHolder>{};
71  }

References makers_, AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Member Data Documentation

◆ makers_

MakerMap edm::Factory::makers_
mutableprivate

Definition at line 39 of file Factory.h.

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

◆ singleInstance_

const Factory edm::Factory::singleInstance_
staticprivate

Definition at line 37 of file Factory.h.

Referenced by get().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
edm::Exception
Definition: EDMException.h:77
edm::for_all
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:14
edm::Factory::findMaker
Maker * findMaker(const MakeModuleParams &p) const
Definition: Factory.cc:25
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Factory::singleInstance_
static const Factory singleInstance_
Definition: Factory.h:37
FDEBUG
#define FDEBUG(lev)
Definition: DebugMacros.h:19
get
#define get
edm::Factory::makers_
MakerMap makers_
Definition: Factory.h:39
edm::errors::Configuration
Definition: EDMException.h:36
edm::cleanup
static void cleanup(const Factory::MakerMap::value_type &v)
Definition: Factory.cc:12