Go to the documentation of this file.00001
00002
00003
00004 #include <iostream>
00005 #include <utility>
00006 #include <cstdlib>
00007 #include <string>
00008 #include <set>
00009 #include <boost/program_options.hpp>
00010
00011 #include "FWCore/PluginManager/interface/PluginManager.h"
00012 #include "FWCore/PluginManager/interface/standard.h"
00013
00014
00015 using namespace edmplugin;
00016
00017
00018 int main (int argc, char **argv)
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
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
00070 PluginManager::configure(standard::config());
00071
00072 typedef edmplugin::PluginManager::CategoryToInfos CatToInfos;
00073
00074 const CatToInfos& catToInfos = edmplugin::PluginManager::get()->categoryToInfos();
00075
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 }