25 #define GAUDI_PLUGIN_SERVICE_V2 31 std::cout <<
"Usage: " << argv0 <<
" [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 std::cout <<
"Usage: " << argv0 <<
" [option] library1 [library2 ...]\n" 45 << argv0 <<
" -h' for more information.\n" 51 auto& reg2 = Gaudi::PluginService::v2::Details::Registry::instance();
54 using key_type = Gaudi::PluginService::v2::Details::Registry::KeyType;
59 for (
const auto&
name : reg2.loadedFactoryNames() ) loaded.
emplace(
name,
"<preloaded>" );
60 for (
const auto&
name : reg1.loadedFactoryNames() ) loaded.
emplace(
name,
"<preloaded>" );
68 auto i = argv0.
rfind(
'/' );
69 if ( i != std::string::npos ) argv0 = argv0.
substr( i + 1 );
75 if ( arg ==
"-o" || arg ==
"--output" ) {
83 }
else if ( arg ==
"-h" || arg ==
"--help" ) {
99 if ( output_opt !=
"-" ) {
104 auto dump_from = [&
output, &loaded](
auto& reg,
const char* lib,
const char*
prefix ) {
105 for (
const auto& factoryName : reg.loadedFactoryNames() ) {
106 auto f = loaded.
find( factoryName );
107 if ( f == loaded.
end() ) {
109 loaded.
emplace( factoryName, lib );
111 std::cerr <<
"WARNING: factory '" << factoryName <<
"' already found in " << f->second <<
std::endl;
116 for (
const char* lib : libs ) {
117 if ( dlopen( lib, RTLD_LAZY | RTLD_LOCAL ) ) {
118 dump_from( reg2, lib,
"v2" );
119 dump_from( reg1, lib,
"v1" );
static Registry & instance()
Retrieve the singleton instance of Registry.
void usage(std::string argv0)
int main(int argc, char *argv[])
void help(std::string argv0)