File indexing completed on 2024-04-06 12:13:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "FWCore/ServiceRegistry/interface/ServiceMaker.h"
0023
0024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0025 #include "FWCore/PluginManager/interface/PluginManager.h"
0026 #include "FWCore/PluginManager/interface/PluginCapabilities.h"
0027 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0028 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0029
0030 namespace edm {
0031 namespace service {
0032 class LoadAllDictionaries {
0033 public:
0034 LoadAllDictionaries(const edm::ParameterSet&);
0035 LoadAllDictionaries(const LoadAllDictionaries&) = delete;
0036 const LoadAllDictionaries& operator=(const LoadAllDictionaries&) = delete;
0037
0038
0039
0040
0041
0042
0043 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0044
0045
0046
0047 private:
0048
0049 };
0050 }
0051 }
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064 edm::service::LoadAllDictionaries::LoadAllDictionaries(const edm::ParameterSet& iConfig) {
0065 bool doLoad(iConfig.getUntrackedParameter<bool>("doLoad"));
0066 if (doLoad) {
0067 edmplugin::PluginManager* db = edmplugin::PluginManager::get();
0068
0069 typedef edmplugin::PluginManager::CategoryToInfos CatToInfos;
0070
0071 CatToInfos::const_iterator itFound = db->categoryToInfos().find("Capability");
0072
0073 if (itFound == db->categoryToInfos().end()) {
0074 return;
0075 }
0076 std::string lastClass;
0077 const std::string mystring("edm::Wrapper");
0078
0079 for (edmplugin::PluginManager::Infos::const_iterator itInfo = itFound->second.begin(),
0080 itInfoEnd = itFound->second.end();
0081 itInfo != itInfoEnd;
0082 ++itInfo) {
0083 if (lastClass == itInfo->name_) {
0084 continue;
0085 }
0086
0087 lastClass = itInfo->name_;
0088 if (lastClass.find(mystring) != std::string::npos) {
0089 edmplugin::PluginCapabilities::get()->load(lastClass);
0090 }
0091
0092 }
0093 }
0094 }
0095
0096 void edm::service::LoadAllDictionaries::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0097 edm::ParameterSetDescription desc;
0098 desc.addUntracked<bool>("doLoad", true)->setComment("Only if 'true' do we load all dictionaries");
0099 descriptions.add("LoadAllDictionaries", desc);
0100 descriptions.setComment(
0101 "This service allows you to force all known dictionaries to be loaded at the beginning of the job");
0102 }
0103
0104 using edm::service::LoadAllDictionaries;
0105 DEFINE_FWK_SERVICE_MAKER(LoadAllDictionaries, edm::serviceregistry::ParameterSetMaker<LoadAllDictionaries>);