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

Public Member Functions

std::shared_ptr< maker::ModuleHoldermakeModule (const MakeModuleParams &, const ModuleTypeResolverMaker *, 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 ()
 
Maker const * findMaker (const MakeModuleParams &p, const ModuleTypeResolverMaker *) 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, std::unique_ptr<Maker const> > 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 const * edm::Factory::findMaker ( const MakeModuleParams p,
const ModuleTypeResolverMaker resolverMaker 
) const
private

Definition at line 23 of file Factory.cc.

References FDEBUG, makers_, AlCaHLTBitMon_ParallelJobs::p, 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  if (it != makers_.end()) {
28  return it->second.get();
29  }
30  return detail::resolveMaker<MakerPluginFactory>(modtype, resolverMaker, *p.pset_, makers_);
31  }
#define FDEBUG(lev)
Definition: DebugMacros.h:19
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 ModuleTypeResolverMaker resolverMaker,
signalslot::Signal< void(const ModuleDescription &)> &  pre,
signalslot::Signal< void(const ModuleDescription &)> &  post 
) const

Definition at line 33 of file Factory.cc.

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

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

37  {
38  auto maker = findMaker(p, resolverMaker);
39  auto mod(maker->makeModule(p, pre, post));
40  return mod;
41  }
Maker const * findMaker(const MakeModuleParams &p, const ModuleTypeResolverMaker *) 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 43 of file Factory.cc.

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

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

43  {
44  std::string modtype = p.getParameter<std::string>("@module_type");
45  MakerMap::iterator it = makers_.find(modtype);
46  if (it != makers_.end()) {
47  return it->second->makeReplacementModule(p);
48  }
49  return std::shared_ptr<maker::ModuleHolder>{};
50  }
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().