#include <cstdlib>
#include <fstream>
#include <iostream>
#include <list>
#include <memory>
#include <set>
#include <string>
#include <dlfcn.h>
#include <getopt.h>
#include <Gaudi/PluginService.h>
#include <Gaudi/PluginServiceV1.h>
Go to the source code of this file.
#define GAUDI_PLUGIN_SERVICE_V2 |
Definition at line 29 of file listcomponents.cpp.
31 <<
" [option] library1 [library2 ...]\n" 32 "\n list the component factories present in the given libraries\n\n" 34 " -h, --help show this help message and exit\n" 35 " -o OUTPUT, --output OUTPUT\n" 36 " write the list of factories on the file OUTPUT, use - for\n" 37 " standard output (default)\n"
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 49 of file listcomponents.cpp.
50 auto& reg2 = Gaudi::PluginService::v2::Details::Registry::instance();
53 using key_type = Gaudi::PluginService::v2::Details::Registry::KeyType;
58 for (
const auto&
name : reg2.loadedFactoryNames() ) loaded.
emplace(
name,
"<preloaded>" );
59 for (
const auto&
name : reg1.loadedFactoryNames() ) loaded.
emplace(
name,
"<preloaded>" );
67 auto i = argv0.rfind(
'/' );
68 if ( i != std::string::npos ) argv0 = argv0.substr( i + 1 );
74 if ( arg ==
"-o" || arg ==
"--output" ) {
82 }
else if ( arg ==
"-h" || arg ==
"--help" ) {
101 auto dump_from = [&
output, &loaded](
auto& reg,
const char* lib,
const char*
prefix ) {
102 for (
const auto& factoryName : reg.loadedFactoryNames() ) {
103 auto f = loaded.
find( factoryName );
104 if ( f == loaded.
end() ) {
106 loaded.
emplace( factoryName, lib );
108 std::cerr <<
"WARNING: factory '" << factoryName <<
"' already found in " << f->second <<
std::endl;
113 for (
const char* lib : libs ) {
114 if ( dlopen( lib, RTLD_LAZY | RTLD_LOCAL ) ) {
115 dump_from( reg2, lib,
"v2" );
116 dump_from( reg1, lib,
"v1" );
static Registry & instance()
Retrieve the singleton instance of Registry.
void usage(std::string argv0)
void help(std::string argv0)
Definition at line 41 of file listcomponents.cpp.
43 <<
" [option] library1 [library2 ...]\n" 45 << argv0 <<
" -h' for more information.\n"