| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
listcomponents.cpp File Reference
`#include <iostream>`
`#include <string>`
`#include <set>`
`#include <cstdlib>`
`#include <getopt.h>`
`#include <dlfcn.h>`
`#include <Gaudi/PluginService.h>`
Include dependency graph for listcomponents.cpp:

Go to the source code of this file.

## Functions
int | main (int argc, char *argv[])

## Function Documentation

int main | ( | int | argc,
|  | char * | argv[]
| ) |  |

Author
  Marco Clemencic marco.nosp@m..cle.nosp@m.menci.nosp@m.c@ce.nosp@m.rn.ch

Definition at line 24 of file listcomponents.cpp.

{
Gaudi::PluginService::Details::Registry &reg =
Gaudi::PluginService::Details::Registry::instance();
typedef Gaudi::PluginService::Details::Registry::KeyType key_type;
// cache to keep track of the loaded factories
std::map<key_type, std::string> loaded;
{
// initialize the local cache
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>")));
}
}
// loop over the list of libraries passed on the command line
for (int i = 1; i < argc; ++i) {
if (dlopen(argv[i], 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())
{
std::cout << argv[i] << ":" << *f << std::endl;
loaded[*f] = argv[i];
}
else
std::cerr << "WARNING: factory '" << *f
<< "' already found in " << loaded[*f]
<< std::endl;
}
} else {
std::cerr << "ERROR: failed to load " << argv[i] << std::endl;
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
}