CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/FWCore/Sources/src/VectorInputSourceFactory.cc

Go to the documentation of this file.
00001 
00002 #include "FWCore/Sources/interface/VectorInputSourceFactory.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::VectorInputSourcePluginFactory,"CMS EDM Framework VectorInputSource");
00010 
00011 namespace edm {
00012 
00013   VectorInputSourceFactory::~VectorInputSourceFactory()
00014   {
00015   }
00016 
00017   VectorInputSourceFactory::VectorInputSourceFactory()
00018   {
00019   }
00020 
00021   VectorInputSourceFactory VectorInputSourceFactory::singleInstance_;
00022 
00023   VectorInputSourceFactory* VectorInputSourceFactory::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<VectorInputSource>
00033   VectorInputSourceFactory::makeVectorInputSource(ParameterSet const& conf,
00034                                         InputSourceDescription const& desc) const
00035     
00036   {
00037     std::string modtype = conf.getParameter<std::string>("@module_type");
00038     FDEBUG(1) << "VectorInputSourceFactory: module_type = " << modtype << std::endl;
00039     std::auto_ptr<VectorInputSource> wm(VectorInputSourcePluginFactory::get()->create(modtype,conf,desc));
00040 
00041     if(wm.get()==0)
00042       {
00043         throw edm::Exception(errors::Configuration,"NoSourceModule")
00044           << "VectorInputSource 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     FDEBUG(1) << "VectorInputSourceFactory: created input source "
00052               << modtype
00053               << std::endl;
00054 
00055     return wm;
00056   }
00057 
00058 }