CMS 3D CMS Logo

dump.cc
Go to the documentation of this file.
1 //<<<<<< INCLUDES >>>>>>
2 
3 #include <iostream>
4 #include <utility>
5 #include <cstdlib>
6 #include <string>
7 #include <set>
8 #include <boost/program_options.hpp>
9 
12 
13 using namespace edmplugin;
14 
15 int main(int argc, char** argv) {
16  using namespace boost::program_options;
17 
18  static const char* const kFilesOpt = "files";
19  static const char* const kFilesCommandOpt = "files,f";
20  static const char* const kAllFilesOpt = "all_files";
21  static const char* const kAllFilesCommandOpt = "all_files,a";
22  static const char* const kHelpOpt = "help";
23  static const char* const kHelpCommandOpt = "help,h";
24 
25  std::string descString(argv[0]);
26  descString += " [options]";
27  descString += "\nAllowed options";
28  options_description desc(descString);
29  desc.add_options()(kHelpCommandOpt, "produce help message")(kFilesCommandOpt,
30  "list the file from which a plugin will come")(
31  kAllFilesCommandOpt, "list all the files to which a plugin is registered")
32  //(kAllCommandOpt,"when no paths given, try to update caches for all known directories [default is to only scan the first directory]")
33  ;
34 
35  variables_map vm;
36  try {
37  store(command_line_parser(argc, argv).options(desc).run(), vm);
38  notify(vm);
39  } catch (const error& iException) {
40  std::cerr << iException.what();
41  return 1;
42  }
43 
44  if (vm.count(kHelpOpt)) {
45  std::cout << desc << std::endl;
46  return 0;
47  }
48 
49  bool printFiles = false;
50  if (vm.count(kFilesOpt)) {
51  printFiles = true;
52  }
53 
54  bool printAllFiles = false;
55  if (vm.count(kAllFilesOpt)) {
56  printFiles = true;
57  printAllFiles = true;
58  }
59 
60  int returnValue = EXIT_SUCCESS;
61  try {
62  //dump all know plugins
64 
66 
67  const CatToInfos& catToInfos = edmplugin::PluginManager::get()->categoryToInfos();
68  // map every module to its library. Code copied from EdmPluginDump
69  for (CatToInfos::const_iterator it = catToInfos.begin(), itEnd = catToInfos.end(); it != itEnd; ++it) {
70  std::cout << "Category " << it->first << ":" << std::endl;
71  std::string prevPluginName;
72  for (edmplugin::PluginManager::Infos::const_iterator itInfo = it->second.begin(), itInfoEnd = it->second.end();
73  itInfo != itInfoEnd;
74  ++itInfo) {
75  std::string pluginName = itInfo->name_;
76  if (pluginName != prevPluginName) {
77  std::cout << " " << pluginName << std::endl;
78  if (printFiles) {
79  std::cout << " " << itInfo->loadable_.string() << std::endl;
80  }
81  prevPluginName = pluginName;
82  } else if (printAllFiles) {
83  std::cout << " " << itInfo->loadable_.string() << std::endl;
84  }
85  }
86  }
87  } catch (std::exception& iException) {
88  std::cerr << "Caught exception " << iException.what() << std::endl;
89  returnValue = EXIT_FAILURE;
90  }
91 
92  return returnValue;
93 }
edmplugin
Definition: AlignmentAlgorithmPluginFactory.cc:9
cmsBatch.argv
argv
Definition: cmsBatch.py:279
dir2webdir.argc
argc
Definition: dir2webdir.py:39
kHelpCommandOpt
static const char *const kHelpCommandOpt
Definition: CmsShowMain.cc:104
gather_cfg.cout
cout
Definition: gather_cfg.py:144
relativeConstraints.error
error
Definition: relativeConstraints.py:53
edmplugin::PluginManager::get
static PluginManager * get()
Definition: PluginManager.cc:307
edmplugin::PluginManager::categoryToInfos
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:80
edmplugin::PluginManager::CategoryToInfos
std::map< std::string, Infos > CategoryToInfos
Definition: PluginManager.h:51
kHelpOpt
static const char *const kHelpOpt
Definition: CmsShowMain.cc:103
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
standard.h
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
edmplugin::PluginManager::configure
static PluginManager & configure(const Config &)
Definition: PluginManager.cc:316
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
main
int main(int argc, char **argv)
Definition: dump.cc:15
edmplugin::standard::config
PluginManager::Config config()
Definition: standard.cc:21
writedatasetfile.run
run
Definition: writedatasetfile.py:27
PluginManager.h
AlcaSiPixelAliHarvester0T_cff.options
options
Definition: AlcaSiPixelAliHarvester0T_cff.py:42