CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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,
Maker * > 
MakerMap
 

Public Member Functions

std::auto_ptr< WorkermakeWorker (const WorkerParams &, sigc::signal< void, const ModuleDescription & > &pre, sigc::signal< void, const ModuleDescription & > &post) const
 
 ~Factory ()
 

Static Public Member Functions

static Factoryget ()
 

Private Member Functions

 Factory ()
 

Private Attributes

MakerMap makers_
 

Static Private Attributes

static Factory singleInstance_
 

Detailed Description

Definition at line 17 of file Factory.h.

Member Typedef Documentation

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

Definition at line 20 of file Factory.h.

Constructor & Destructor Documentation

edm::Factory::~Factory ( )

Definition at line 19 of file Factory.cc.

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

20  {
22  }
static void cleanup(const Factory::MakerMap::value_type &v)
Definition: Factory.cc:12
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
MakerMap makers_
Definition: Factory.h:34
edm::Factory::Factory ( )
private

Definition at line 24 of file Factory.cc.

24  : makers_()
25 
26  {
27  }
MakerMap makers_
Definition: Factory.h:34

Member Function Documentation

Factory * edm::Factory::get ( void  )
static
std::auto_ptr< Worker > edm::Factory::makeWorker ( const WorkerParams p,
sigc::signal< void, const ModuleDescription & > &  pre,
sigc::signal< void, const ModuleDescription & > &  post 
) const

Definition at line 34 of file Factory.cc.

References edm::errors::Configuration, SurfaceDeformationFactory::create(), FDEBUG, reco::get(), edm::ParameterSet::getParameter(), makers_, edm::WorkerParams::processConfiguration_, edm::WorkerParams::pset_, run_regression::ret, and w().

Referenced by edm::WorkerRegistry::getWorker().

37  {
38  std::string modtype = p.pset_->getParameter<std::string>("@module_type");
39  FDEBUG(1) << "Factory: module_type = " << modtype << std::endl;
40  MakerMap::iterator it = makers_.find(modtype);
41 
42  if(it == makers_.end())
43  {
44  std::auto_ptr<Maker> wm(MakerPluginFactory::get()->create(modtype));
45 
46  if(wm.get()==0)
47  throw edm::Exception(errors::Configuration,"UnknownModule")
48  << "Module " << modtype
49  << " with version " << p.processConfiguration_->releaseVersion()
50  << " was not registered.\n"
51  << "Perhaps your module type is misspelled or is not a "
52  << "framework plugin.\n"
53  << "Try running EdmPluginDump to obtain a list of "
54  << "available Plugins.";
55 
56  FDEBUG(1) << "Factory: created worker of type " << modtype << std::endl;
57 
58  std::pair<MakerMap::iterator,bool> ret =
59  makers_.insert(std::pair<std::string,Maker*>(modtype,wm.get()));
60 
61  // if(ret.second==false)
62  // throw runtime_error("Worker Factory map insert failed");
63 
64  it = ret.first;
65  wm.release();
66  }
67 
68  std::auto_ptr<Worker> w(it->second->makeWorker(p,pre,post));
69  return w;
70  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
SurfaceDeformation * create(int type, const std::vector< double > &params)
T get(const Candidate &c)
Definition: component.h:56
T w() const
MakerMap makers_
Definition: Factory.h:34

Member Data Documentation

MakerMap edm::Factory::makers_
mutableprivate

Definition at line 34 of file Factory.h.

Referenced by makeWorker(), and ~Factory().

Factory edm::Factory::singleInstance_
staticprivate

Definition at line 33 of file Factory.h.

Referenced by get().