Gaudi Framework, version v25r0

Home   Generated: Mon Feb 17 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
listcomponents.cpp
Go to the documentation of this file.
1 /*****************************************************************************\
2 * (c) Copyright 2013 CERN *
3 * *
4 * This software is distributed under the terms of the GNU General Public *
5 * Licence version 3 (GPL Version 3), copied verbatim in the file "LICENCE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \*****************************************************************************/
11 
13 
14 #include <iostream>
15 #include <string>
16 #include <set>
17 #include <cstdlib>
18 
19 #include <getopt.h>
20 #include <dlfcn.h>
21 
22 #include <Gaudi/PluginService.h>
23 
24 int main(int argc, char* argv[]) {
25  Gaudi::PluginService::Details::Registry &reg =
26  Gaudi::PluginService::Details::Registry::instance();
27  typedef Gaudi::PluginService::Details::Registry::KeyType key_type;
28 
29  // cache to keep track of the loaded factories
31  {
32  // initialize the local cache
33  std::set<key_type> base = reg.loadedFactories();
34  for (std::set<key_type>::const_iterator f = base.begin(); f != base.end(); ++f)
35  {
36  loaded.insert(std::make_pair(*f, std::string("<preloaded>")));
37  }
38  }
39 
40  // loop over the list of libraries passed on the command line
41  for (int i = 1; i < argc; ++i) {
42 
43  if (dlopen(argv[i], RTLD_LAZY | RTLD_LOCAL)) {
44 
45  std::set<key_type> factories = reg.loadedFactories();
47  for (f = factories.begin(); f != factories.end(); ++f) {
48  if (loaded.find(*f) == loaded.end())
49  {
50  std::cout << argv[i] << ":" << *f << std::endl;
51  loaded[*f] = argv[i];
52  }
53  else
54  std::cerr << "WARNING: factory '" << *f
55  << "' already found in " << loaded[*f]
56  << std::endl;
57  }
58 
59  } else {
60  std::cerr << "ERROR: failed to load " << argv[i] << std::endl;
61  return EXIT_FAILURE;
62  }
63  }
64 
65  return EXIT_SUCCESS;
66 }

Generated at Mon Feb 17 2014 14:37:46 for Gaudi Framework, version v25r0 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004