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< std::unique_ptr< Maker > > > MakerMap
 

Public Member Functions

std::shared_ptr< maker::ModuleHoldermakeModule (const MakeModuleParams &, const ModuleTypeResolverBase *, 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 ModuleTypeResolverBase *) const
 

Private Attributes

MakerMap makers_
 

Static Private Attributes

static Factory const singleInstance_
 

Detailed Description

Definition at line 18 of file Factory.h.

Member Typedef Documentation

◆ MakerMap

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

Definition at line 20 of file Factory.h.

Constructor & Destructor Documentation

◆ ~Factory()

edm::Factory::~Factory ( )
default

◆ Factory()

edm::Factory::Factory ( )
privatedefault

Member Function Documentation

◆ findMaker()

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

Definition at line 23 of file Factory.cc.

References FDEBUG, makers_, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeModule().

23  {
24  std::string modtype = p.pset_->getParameter<std::string>("@module_type");
25  FDEBUG(1) << "Factory: module_type = " << modtype << std::endl;
26  MakerMap::iterator it = makers_.find(modtype);
27 
28  if (it == makers_.end()) {
29  std::unique_ptr<Maker> wm = detail::resolveMaker<MakerPluginFactory>(modtype, resolver);
30  FDEBUG(1) << "Factory: created worker of type " << modtype << std::endl;
31 
32  std::pair<MakerMap::iterator, bool> ret = makers_.insert({modtype, std::move(wm)});
33 
34  it = ret.first;
35  }
36  return it->second;
37  }
ret
prodAgent to be discontinued
#define FDEBUG(lev)
Definition: DebugMacros.h:19
def move(src, dest)
Definition: eostools.py:511
MakerMap makers_
Definition: Factory.h:39

◆ get()

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

◆ makeModule()

std::shared_ptr< maker::ModuleHolder > edm::Factory::makeModule ( const MakeModuleParams p,
const ModuleTypeResolverBase resolver,
signalslot::Signal< void(const ModuleDescription &)> &  pre,
signalslot::Signal< void(const ModuleDescription &)> &  post 
) const

Definition at line 39 of file Factory.cc.

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

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

43  {
44  auto maker = findMaker(p, resolver);
45  auto mod(maker->makeModule(p, pre, post));
46  return mod;
47  }
Maker * findMaker(const MakeModuleParams &p, const ModuleTypeResolverBase *) const
Definition: Factory.cc:23
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

◆ makeReplacementModule()

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

Definition at line 49 of file Factory.cc.

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

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

49  {
50  std::string modtype = p.getParameter<std::string>("@module_type");
51  MakerMap::iterator it = makers_.find(modtype);
52  if (it != makers_.end()) {
53  return it->second->makeReplacementModule(p);
54  }
55  return std::shared_ptr<maker::ModuleHolder>{};
56  }
MakerMap makers_
Definition: Factory.h:39

Member Data Documentation

◆ makers_

MakerMap edm::Factory::makers_
mutableprivate

Definition at line 39 of file Factory.h.

Referenced by findMaker(), and makeReplacementModule().

◆ singleInstance_

Factory const edm::Factory::singleInstance_
staticprivate

Definition at line 37 of file Factory.h.

Referenced by get().