CMS 3D CMS Logo

edm::Factory Class Reference

#include <FWCore/Framework/src/Factory.h>

List of all members.

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_.

00020   {
00021     for_all(makers_, cleanup);
00022   }

edm::Factory::Factory (  )  [private]

Definition at line 24 of file Factory.cc.

00024                   : makers_()
00025 
00026   {
00027   }


Member Function Documentation

Factory * edm::Factory::get ( void   )  [static]

Definition at line 29 of file Factory.cc.

References singleInstance_.

00030   {
00031     return &singleInstance_;
00032   }

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, lat::endl(), FDEBUG, DBSPlugin::get(), edm::ParameterSet::getParameter(), it, makers_, edm::WorkerParams::pset_, edm::WorkerParams::releaseVersion_, and w.

00037   {
00038     std::string modtype = p.pset_->getParameter<std::string>("@module_type");
00039     FDEBUG(1) << "Factory: module_type = " << modtype << std::endl;
00040     MakerMap::iterator it = makers_.find(modtype);
00041 
00042     if(it == makers_.end())
00043       {
00044         std::auto_ptr<Maker> wm(MakerPluginFactory::get()->create(modtype));
00045 
00046         if(wm.get()==0)
00047           throw edm::Exception(errors::Configuration,"UnknownModule")
00048             << "Module " << modtype
00049             << " with version " << p.releaseVersion_
00050             << " was not registered.\n"
00051             << "Perhaps your module type is misspelled or is not a "
00052             << "framework plugin.\n"
00053             << "Try running EdmPluginDump to obtain a list of "
00054             << "available Plugins.";
00055           
00056         FDEBUG(1) << "Factory:  created worker of type " << modtype << std::endl;
00057 
00058         std::pair<MakerMap::iterator,bool> ret =
00059           makers_.insert(std::make_pair<std::string,Maker*>(modtype,wm.get()));
00060 
00061         //      if(ret.second==false)
00062         //        throw runtime_error("Worker Factory map insert failed");
00063 
00064         it = ret.first;
00065         wm.release();
00066       }
00067 
00068     std::auto_ptr<Worker> w(it->second->makeWorker(p,pre,post));
00069     return w;
00070   }


Member Data Documentation

MakerMap edm::Factory::makers_ [mutable, private]

Definition at line 34 of file Factory.h.

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

Factory edm::Factory::singleInstance_ [static, private]

Definition at line 33 of file Factory.h.

Referenced by get().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:41:01 2009 for CMSSW by  doxygen 1.5.4