25 #define GAUDI_PLUGIN_SERVICE_V2
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"
43 <<
" [option] library1 [library2 ...]\n"
45 << argv0 <<
" -h' for more information.\n"
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](
const auto& reg,
const char* lib,
const char*
prefix ) {
102 for (
const auto& factoryName : reg.loadedFactoryNames() ) {
105 const auto& info = reg.factories().find( factoryName )->second;
106 if ( lib != info.library && !info.library.empty() && info.library !=
"unknown" ) {
107 std::cerr <<
"WARNING: library [" << lib <<
"] exposes factory [" << factoryName <<
"] which is declared in ["
111 auto f = loaded.
find( factoryName );
112 if ( f == loaded.
end() ) {
114 loaded.
emplace( factoryName, lib );
116 std::cerr <<
"WARNING: factory '" << factoryName <<
"' already found in " << f->second <<
std::endl;
121 for (
const char* lib : libs ) {
122 if ( dlopen( lib, RTLD_LAZY | RTLD_LOCAL ) ) {
123 dump_from( reg2, lib,
"v2" );
124 dump_from( reg1, lib,
"v1" );