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" 41 std::cout <<
"Usage: " << argv0 <<
" [option] library1 [library2 ...]\n" 43 << argv0 <<
" -h' for more information.\n" 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.
int main(int argc, char *argv[])
void help(std::string argv0)
static Registry & instance()
Retrieve the singleton instance of Registry.
In-memory database of the loaded factories.