#include <cstdlib>
#include <fstream>
#include <iostream>
#include <list>
#include <memory>
#include <set>
#include <string>
#include <dlfcn.h>
#include <getopt.h>
#include <Gaudi/PluginService.h>
Go to the source code of this file.
- Author
- Marco Clemencic marco.nosp@m..cle.nosp@m.menci.nosp@m.c@ce.nosp@m.rn.ch
Definition at line 27 of file listcomponents.cpp.
29 std::cout <<
"Usage: " << argv0 <<
" [option] library1 [library2 ...]\n" 30 "\n list the component factories present in the given libraries\n\n" 32 " -h, --help show this help message and exit\n" 33 " -o OUTPUT, --output OUTPUT\n" 34 " write the list of factories on the file OUTPUT, use - for\n" 35 " standard output (default)\n"
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 47 of file listcomponents.cpp.
63 auto i = argv0.rfind(
'/' );
64 if ( i != std::string::npos ) argv0 = argv0.substr( i + 1 );
70 if ( arg ==
"-o" || arg ==
"--output" ) {
78 }
else if ( arg ==
"-h" || arg ==
"--help" ) {
94 if ( output_opt !=
"-" ) {
100 for (
char* lib : libs ) {
101 if ( dlopen( lib, RTLD_LAZY | RTLD_LOCAL ) ) {
103 auto f = loaded.
find( factory );
104 if ( f == loaded.
end() ) {
105 output << lib <<
":" << factory <<
std::endl;
106 loaded.
emplace( factory, lib );
108 std::cerr <<
"WARNING: factory '" << factory <<
"' already found in " << f->second <<
std::endl;
void usage(std::string argv0)
std::set< KeyType > loadedFactories() const
Return a list of all the known and loaded factories.
void help(std::string argv0)
static Registry & instance()
Retrieve the singleton instance of Registry.
In-memory database of the loaded factories.
Definition at line 39 of file listcomponents.cpp.
41 std::cout <<
"Usage: " << argv0 <<
" [option] library1 [library2 ...]\n" 43 << argv0 <<
" -h' for more information.\n"