CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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.11 2012/07/24 05:01:00 wmtan 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 mystring("edm::Wrapper");
00053 
00054      for (edmplugin::PluginManager::Infos::const_iterator itInfo = itFound->second.begin(),
00055           itInfoEnd = itFound->second.end(); 
00056           itInfo != itInfoEnd; ++itInfo)
00057      {
00058        if (lastClass == itInfo->name_) {
00059          continue;
00060        }
00061        
00062        lastClass = itInfo->name_;
00063        if (lastClass.find(mystring) != std::string::npos) { 
00064          edmplugin::PluginCapabilities::get()->load(lastClass);
00065        }
00066        //NOTE: since we have the library already, we could be more efficient if we just load it ourselves
00067      }
00068    }
00069 }
00070 
00071 void edm::service::LoadAllDictionaries::fillDescriptions(edm::ConfigurationDescriptions & descriptions) {
00072   edm::ParameterSetDescription desc;
00073   desc.addUntracked<bool>("doLoad", true)->setComment("Only if 'true' do we load all dictionaries");
00074   descriptions.add("LoadAllDictionaries", desc);
00075   descriptions.setComment("This service allows you to force all known dictionaries to be loaded at the beginning of the job");
00076 }
00077