Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunecore
dunecore
ArtSupport
exe
liblist.cxx
Go to the documentation of this file.
1
// liblist.cxx
2
//
3
// David Adams
4
// September 2016
5
//
6
// List all libraries accessible on the library path.
7
8
#include <string>
9
#include <iostream>
10
#include <vector>
11
#include <sstream>
12
#include <memory>
13
#include "
cetlib/LibraryManager.h
"
14
15
using
std::string
;
16
using
std::cout;
17
using
std::endl
;
18
using
std::ostream;
19
using
std::istringstream;
20
using
cet::LibraryManager
;
21
22
typedef
std::vector<std::string>
NameList
;
23
24
int
main
(
int
argc,
char
**
argv
) {
25
const
string
myname =
"listlibs"
;
26
bool
help
=
false
;
27
string
libtype =
"tool"
;
28
string
pattern
;
29
if
( argc > 1 ) {
30
string
arg = argv[1];
31
if
( arg ==
"-h"
) help =
true
;
32
else
libtype = arg;
33
}
34
if
( argc > 2 ) {
35
string
arg = argv[2];
36
if
( arg ==
"-h"
) help =
true
;
37
else
pattern = arg;
38
}
39
if
( help ) {
40
cout <<
"Usage: "
<< argv[0] <<
" [type] [pattern]"
<<
endl
;
41
cout <<
" Lists plugin libraries of a specified type."
<<
endl
;
42
cout <<
" type [tool] - library type (tool, service, module, ...)"
<<
endl
;
43
cout <<
" pattern [] - pattern in library name"
<<
endl
;
44
return
0;
45
}
46
// Find the libs.
47
NameList
libnames;
48
LibraryManager
libmgr(libtype);
49
unsigned
int
nlib = libmgr.
getLoadableLibraries
(libnames);
50
if
( pattern.size() ) {
51
NameList
newnames;
52
for
(
string
libname : libnames ) {
53
if
( libname.find(pattern) != string::npos ) newnames.push_back(libname);
54
}
55
libnames = newnames;
56
}
57
unsigned
int
nsel = libnames.size();
58
if
( pattern.size() && nlib > 0 ) cout <<
"Selected "
<< nsel <<
" of "
;
59
else
cout <<
"Found "
;
60
cout << nlib <<
" "
<< libtype <<
" librar"
;
61
cout << (nlib==1 ?
"y"
:
"ies"
);
62
cout << (nsel ?
":"
:
"."
);
63
for
(
string
libname : libnames ) {
64
cout <<
"\n "
<< libname;
65
}
66
cout <<
endl
;
67
return
0;
68
}
main
int main(int argc, char **argv)
Definition:
liblist.cxx:24
string
std::string string
Definition:
nybbler.cc:12
freeze_graph.argv
argv
Definition:
freeze_graph.py:218
cet::LibraryManager::getLoadableLibraries
size_t getLoadableLibraries(std::vector< std::string > &list) const
Definition:
LibraryManager.cc:81
LibraryManager.h
cet::LibraryManager
Definition:
LibraryManager.h:19
pattern
std::string pattern
Definition:
regex_t.cc:35
ValidateOpDetReco.help
help
Definition:
ValidateOpDetReco.py:23
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
NameList
std::vector< std::string > NameList
Definition:
liblist.cxx:22
Generated by
1.8.11