CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/FWCore/Framework/src/InputSourceFactory.cc

Go to the documentation of this file.
00001 
00002 #include "FWCore/Framework/src/InputSourceFactory.h"
00003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00004 #include "FWCore/Utilities/interface/DebugMacros.h"
00005 #include "FWCore/Utilities/interface/EDMException.h"
00006 
00007 #include <iostream>
00008 
00009 EDM_REGISTER_PLUGINFACTORY(edm::InputSourcePluginFactory,"CMS EDM Framework InputSource");
00010 namespace edm {
00011 
00012 
00013   InputSourceFactory::~InputSourceFactory()
00014   {
00015   }
00016 
00017   InputSourceFactory::InputSourceFactory() 
00018   {
00019   }
00020 
00021   InputSourceFactory InputSourceFactory::singleInstance_;
00022 
00023   InputSourceFactory* InputSourceFactory::get()
00024   {
00025     // will not work with plugin factories
00026     //static InputSourceFactory f;
00027     //return &f;
00028 
00029     return &singleInstance_;
00030   }
00031 
00032   std::auto_ptr<InputSource>
00033   InputSourceFactory::makeInputSource(ParameterSet const& conf,
00034                                         InputSourceDescription const& desc) const
00035     
00036   {
00037     std::string modtype = conf.getParameter<std::string>("@module_type");
00038     FDEBUG(1) << "InputSourceFactory: module_type = " << modtype << std::endl;
00039     std::auto_ptr<InputSource> wm;
00040     wm = std::auto_ptr<InputSource>(InputSourcePluginFactory::get()->create(modtype,conf,desc));
00041     
00042     if(wm.get()==0) {
00043         throw edm::Exception(errors::Configuration,"NoSourceModule")
00044           << "InputSource Factory:\n"
00045           << "Cannot find source type from ParameterSet: "
00046           << modtype << "\n"
00047           << "Perhaps your source type is misspelled or is not an EDM Plugin?\n"
00048           << "Try running EdmPluginDump to obtain a list of available Plugins.";
00049     }
00050 
00051     wm->registerProducts();
00052 
00053     FDEBUG(1) << "InputSourceFactory: created input source "
00054               << modtype
00055               << std::endl;
00056 
00057     return wm;
00058   }
00059 
00060 }