{
Gaudi::PluginService::Details::Registry ® =
std::map<key_type, std::string> loaded;
{
std::set<key_type> base = reg.loadedFactories();
for (std::set<key_type>::const_iterator f = base.begin(); f != base.end(); ++f)
{
loaded.insert(std::make_pair(*f, std::string("<preloaded>")));
}
}
std::list<char*> libs;
std::string output_opt("-");
{
std::string argv0(
argv[0]);
{
auto i = argv0.rfind(
'/');
if (
i != std::string::npos)
argv0 = argv0.substr(
i+1);
}
const std::string arg(
argv[i]);
if (arg == "-o" || arg == "--output") {
} else {
std::cerr << "ERROR: missing argument for option " << arg << std::endl;
std::cerr << "See `" << argv0 << " -h' for more details." << std::endl;
return EXIT_FAILURE;
}
} else if (arg == "-h" || arg == "--help") {
return EXIT_SUCCESS;
} else {
}
}
if (libs.empty()) {
return EXIT_FAILURE;
}
}
std::unique_ptr<std::ostream> output_file;
if (output_opt != "-") {
output_file = std::unique_ptr<std::ostream>(new std::ofstream(output_opt.c_str()));
}
std::ostream &output = (output_file ? *output_file : std::cout);
for (char* lib: libs) {
if (dlopen(lib, RTLD_LAZY | RTLD_LOCAL)) {
std::set<key_type>
factories = reg.loadedFactories();
std::set<key_type>::const_iterator f;
for (f = factories.begin(); f != factories.end(); ++f) {
if (loaded.find(*f) == loaded.end())
{
output << lib << ":" << *f << std::endl;
loaded[*f] = lib;
}
else
std::cerr << "WARNING: factory '" << *f
<< "' already found in " << loaded[*f]
<< std::endl;
}
} else {
std::cerr << "ERROR: failed to load " << lib << std::endl;
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
}