Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:29:02

0001 #include "FWCore/PluginManager/interface/PresenceFactory.h"
0002 #include "FWCore/Utilities/interface/EDMException.h"
0003 #include "FWCore/Utilities/interface/DebugMacros.h"
0004 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0005 
0006 #include <iostream>
0007 
0008 EDM_REGISTER_PLUGINFACTORY(edm::PresencePluginFactory, "CMS EDM Framework Presence");
0009 
0010 namespace edm {
0011 
0012   PresenceFactory::~PresenceFactory() {}
0013 
0014   PresenceFactory::PresenceFactory() {}
0015 
0016   PresenceFactory* PresenceFactory::get() {
0017     CMS_THREAD_SAFE static PresenceFactory singleInstance_;
0018     return &singleInstance_;
0019   }
0020 
0021   std::unique_ptr<Presence> PresenceFactory::makePresence(std::string const& presence_type) const {
0022     std::unique_ptr<Presence> sp(PresencePluginFactory::get()->create(presence_type));
0023 
0024     if (sp.get() == nullptr) {
0025       throw edm::Exception(errors::Configuration, "NoPresenceModule")
0026           << "Presence Factory:\n"
0027           << "Cannot find presence type: " << presence_type << "\n"
0028           << "Perhaps the name is misspelled or is not a Plugin?\n"
0029           << "Try running EdmPluginDump to obtain a list of available Plugins.";
0030     }
0031 
0032     FDEBUG(1) << "PresenceFactory: created presence " << presence_type << std::endl;
0033 
0034     return sp;
0035   }
0036 }  // namespace edm