Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:11

0001 
0002 #include "FWCore/Framework/interface/maker/InputSourceFactory.h"
0003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0004 #include "FWCore/Utilities/interface/DebugMacros.h"
0005 #include "FWCore/Utilities/interface/EDMException.h"
0006 
0007 #include <iostream>
0008 
0009 EDM_REGISTER_PLUGINFACTORY(edm::InputSourcePluginFactory, "CMS EDM Framework InputSource");
0010 namespace edm {
0011 
0012   InputSourceFactory::~InputSourceFactory() {}
0013 
0014   InputSourceFactory::InputSourceFactory() {}
0015 
0016   InputSourceFactory const InputSourceFactory::singleInstance_;
0017 
0018   InputSourceFactory const* InputSourceFactory::get() {
0019     // will not work with plugin factories
0020     //static InputSourceFactory f;
0021     //return &f;
0022 
0023     return &singleInstance_;
0024   }
0025 
0026   std::unique_ptr<InputSource> InputSourceFactory::makeInputSource(ParameterSet const& conf,
0027                                                                    InputSourceDescription const& desc) const
0028 
0029   {
0030     std::string modtype = conf.getParameter<std::string>("@module_type");
0031     FDEBUG(1) << "InputSourceFactory: module_type = " << modtype << std::endl;
0032     auto wm = InputSourcePluginFactory::get()->create(modtype, conf, desc);
0033 
0034     if (wm.get() == nullptr) {
0035       throw edm::Exception(errors::Configuration, "NoSourceModule")
0036           << "InputSource 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     wm->registerProducts();
0043 
0044     FDEBUG(1) << "InputSourceFactory: created input source " << modtype << std::endl;
0045 
0046     return wm;
0047   }
0048 
0049 }  // namespace edm