Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:10

0001 
0002 #include "FWCore/Sources/interface/VectorInputSourceDescription.h"
0003 #include "FWCore/Sources/interface/VectorInputSourceFactory.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/Utilities/interface/DebugMacros.h"
0006 #include "FWCore/Utilities/interface/EDMException.h"
0007 
0008 #include <iostream>
0009 
0010 EDM_REGISTER_PLUGINFACTORY(edm::VectorInputSourcePluginFactory, "CMS EDM Framework VectorInputSource");
0011 
0012 namespace edm {
0013 
0014   VectorInputSourceFactory::~VectorInputSourceFactory() {}
0015 
0016   VectorInputSourceFactory::VectorInputSourceFactory() {}
0017 
0018   VectorInputSourceFactory const VectorInputSourceFactory::singleInstance_;
0019 
0020   VectorInputSourceFactory const* VectorInputSourceFactory::get() {
0021     // will not work with plugin factories
0022     //static InputSourceFactory f;
0023     //return &f;
0024 
0025     return &singleInstance_;
0026   }
0027 
0028   std::unique_ptr<VectorInputSource> VectorInputSourceFactory::makeVectorInputSource(
0029       ParameterSet const& conf, VectorInputSourceDescription const& desc) const {
0030     std::string modtype = conf.getParameter<std::string>("@module_type");
0031     FDEBUG(1) << "VectorInputSourceFactory: module_type = " << modtype << std::endl;
0032     std::unique_ptr<VectorInputSource> wm(VectorInputSourcePluginFactory::get()->create(modtype, conf, desc));
0033 
0034     if (wm.get() == nullptr) {
0035       throw edm::Exception(errors::Configuration, "NoSourceModule")
0036           << "VectorInputSource Factory:\n"
0037           << "Cannot find source type from ParameterSet: " << modtype << "\n"
0038           << "Perhaps your source type is misspelled or is not an EDM Plugin?\n"
0039           << "Try running EdmPluginDump to obtain a list of available Plugins.";
0040     }
0041 
0042     FDEBUG(1) << "VectorInputSourceFactory: created input source " << modtype << std::endl;
0043 
0044     return wm;
0045   }
0046 
0047 }  // namespace edm