CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

edm::Factory Class Reference

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

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

Definition at line 24 of file Factory.cc.

                  : makers_()

  {
  }

Member Function Documentation

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

Definition at line 29 of file Factory.cc.

References singleInstance_.

  {
    return &singleInstance_;
  }
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_, and runTheMatrix::ret.

  {
    std::string modtype = p.pset_->getParameter<std::string>("@module_type");
    FDEBUG(1) << "Factory: module_type = " << modtype << std::endl;
    MakerMap::iterator it = makers_.find(modtype);

    if(it == makers_.end())
      {
        std::auto_ptr<Maker> wm(MakerPluginFactory::get()->create(modtype));

        if(wm.get()==0)
          throw edm::Exception(errors::Configuration,"UnknownModule")
            << "Module " << modtype
            << " with version " << p.processConfiguration_->releaseVersion()
            << " was not registered.\n"
            << "Perhaps your module type is misspelled or is not a "
            << "framework plugin.\n"
            << "Try running EdmPluginDump to obtain a list of "
            << "available Plugins.";
          
        FDEBUG(1) << "Factory:  created worker of type " << modtype << std::endl;

        std::pair<MakerMap::iterator,bool> ret =
          makers_.insert(std::pair<std::string,Maker*>(modtype,wm.get()));

        //      if(ret.second==false)
        //        throw runtime_error("Worker Factory map insert failed");

        it = ret.first;
        wm.release();
      }

    std::auto_ptr<Worker> w(it->second->makeWorker(p,pre,post));
    return w;
  }

Member Data Documentation

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

Definition at line 34 of file Factory.h.

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

Definition at line 33 of file Factory.h.

Referenced by get().