#include <iostream>
#include <utility>
#include <cstdlib>
#include <string>
#include <set>
#include <boost/program_options.hpp>
#include "FWCore/PluginManager/interface/PluginManager.h"
#include "FWCore/PluginManager/interface/standard.h"
Go to the source code of this file.
Functions | |
int | main (int argc, char **argv) |
Definition at line 18 of file dump.cc.
References edmplugin::PluginManager::categoryToInfos(), TestMuL1L2Filter_cff::cerr, edmplugin::standard::config(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), error, exception, edmplugin::PluginManager::get(), it, Config::options, and mergeAndRegister_online::run.
00019 { 00020 using namespace boost::program_options; 00021 00022 static const char* const kFilesOpt = "files"; 00023 static const char* const kFilesCommandOpt = "files,f"; 00024 static const char* const kAllFilesOpt = "all_files"; 00025 static const char* const kAllFilesCommandOpt = "all_files,a"; 00026 static const char* const kHelpOpt = "help"; 00027 static const char* const kHelpCommandOpt = "help,h"; 00028 00029 std::string descString(argv[0]); 00030 descString += " [options]"; 00031 descString += "\nAllowed options"; 00032 options_description desc(descString); 00033 desc.add_options() 00034 (kHelpCommandOpt, "produce help message") 00035 (kFilesCommandOpt 00036 , "list the file from which a plugin will come") 00037 (kAllFilesCommandOpt 00038 , "list all the files to which a plugin is registered") 00039 //(kAllCommandOpt,"when no paths given, try to update caches for all known directories [default is to only scan the first directory]") 00040 ; 00041 00042 variables_map vm; 00043 try { 00044 store(command_line_parser(argc,argv).options(desc).run(),vm); 00045 notify(vm); 00046 } catch(const error& iException) { 00047 std::cerr <<iException.what(); 00048 return 1; 00049 } 00050 00051 if(vm.count(kHelpOpt)) { 00052 std::cout << desc <<std::endl; 00053 return 0; 00054 } 00055 00056 bool printFiles = false; 00057 if(vm.count(kFilesOpt) ) { 00058 printFiles = true; 00059 } 00060 00061 bool printAllFiles = false; 00062 if(vm.count(kAllFilesOpt) ) { 00063 printFiles = true; 00064 printAllFiles = true; 00065 } 00066 00067 int returnValue = EXIT_SUCCESS; 00068 try { 00069 //dump all know plugins 00070 PluginManager::configure(standard::config()); 00071 00072 typedef edmplugin::PluginManager::CategoryToInfos CatToInfos; 00073 00074 const CatToInfos& catToInfos = edmplugin::PluginManager::get()->categoryToInfos(); 00075 // map every module to its library. Code copied from EdmPluginDump 00076 for (CatToInfos::const_iterator it = catToInfos.begin(), itEnd=catToInfos.end(); 00077 it != itEnd; ++it) 00078 { 00079 std::cout <<"Category "<<it->first<<":"<<std::endl; 00080 std::string prevPluginName; 00081 for (edmplugin::PluginManager::Infos::const_iterator itInfo = it->second.begin(), itInfoEnd = it->second.end(); 00082 itInfo != itInfoEnd; ++itInfo) 00083 { 00084 std::string pluginName = itInfo->name_; 00085 if(pluginName != prevPluginName) { 00086 std::cout <<" "<<pluginName<<std::endl; 00087 if(printFiles) { 00088 std::cout <<" "<<itInfo->loadable_.native_file_string()<<std::endl; 00089 } 00090 prevPluginName=pluginName; 00091 } 00092 else if(printAllFiles) { 00093 std::cout <<" "<<itInfo->loadable_.native_file_string()<<std::endl; 00094 } 00095 } 00096 } 00097 }catch(std::exception& iException) { 00098 std::cerr <<"Caught exception "<<iException.what()<<std::endl; 00099 returnValue = 1; 00100 } 00101 00102 return returnValue; 00103 }