CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/FWCore/Services/src/LoadAllDictionaries.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Services
00004 // Class  :     LoadAllDictionaries
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Thu Sep 15 09:47:48 EDT 2005
00011 // $Id: LoadAllDictionaries.cc,v 1.10 2010/07/20 22:13:22 chrjones Exp $
00012 //
00013 
00014 // system include files
00015 #include "Cintex/Cintex.h"
00016 
00017 // user include files
00018 #include "FWCore/Services/src/LoadAllDictionaries.h"
00019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00020 #include "FWCore/PluginManager/interface/PluginManager.h"
00021 #include "FWCore/PluginManager/interface/PluginCapabilities.h"
00022 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00023 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00024 
00025 //
00026 // constants, enums and typedefs
00027 //
00028 
00029 //
00030 // static data member definitions
00031 //
00032 
00033 //
00034 // constructors and destructor
00035 //
00036 edm::service::LoadAllDictionaries::LoadAllDictionaries(const edm::ParameterSet& iConfig)
00037 {
00038    bool doLoad(iConfig.getUntrackedParameter<bool>("doLoad"));
00039    if(doLoad) {
00040      ROOT::Cintex::Cintex::Enable();
00041 
00042      edmplugin::PluginManager*db =  edmplugin::PluginManager::get();
00043      
00044      typedef edmplugin::PluginManager::CategoryToInfos CatToInfos;
00045      
00046      CatToInfos::const_iterator itFound = db->categoryToInfos().find("Capability");
00047      
00048      if(itFound == db->categoryToInfos().end()) {
00049        return;
00050      }
00051      std::string lastClass;
00052      const std::string cPrefix("LCGReflex/");
00053      const std::string mystring("edm::Wrapper");
00054 
00055      for (edmplugin::PluginManager::Infos::const_iterator itInfo = itFound->second.begin(),
00056           itInfoEnd = itFound->second.end(); 
00057           itInfo != itInfoEnd; ++itInfo)
00058      {
00059        if (lastClass == itInfo->name_) {
00060          continue;
00061        }
00062        
00063        lastClass = itInfo->name_;
00064        if (lastClass.find(mystring) != std::string::npos) { 
00065          edmplugin::PluginCapabilities::get()->load(lastClass);
00066        }
00067        //NOTE: since we have the library already, we could be more efficient if we just load it ourselves
00068      }
00069    }
00070 }
00071 
00072 void edm::service::LoadAllDictionaries::fillDescriptions(edm::ConfigurationDescriptions & descriptions) {
00073   edm::ParameterSetDescription desc;
00074   desc.addUntracked<bool>("doLoad", true)->setComment("Only if 'true' do we load all dictionaries");
00075   descriptions.add("LoadAllDictionaries", desc);
00076   descriptions.setComment("This service allows you to force all known Reflex dictionaries to be loaded at the beginning of the job");
00077 }
00078