#include <LibraryManager.h>
|
| LibraryManager (cet::search_path search_path, std::string lib_type) |
|
| LibraryManager (cet::search_path search_path, std::string lib_type, std::string pattern) |
|
| LibraryManager (std::string lib_type) |
|
| LibraryManager (std::string lib_type, std::string pattern) |
|
template<typename T > |
T | getSymbolByLibspec (std::string const &libspec, std::string const &sym_name) const |
|
template<typename T > |
void | getSymbolByLibspec (std::string const &libspec, std::string const &sym_name, T &sym) const |
|
template<typename T > |
T | getSymbolByPath (std::string const &lib_loc, std::string const &sym_name) const |
|
template<typename T > |
void | getSymbolByPath (std::string const &lib_loc, std::string const &sym_name, T &sym) const |
|
template<typename T > |
T | getSymbolByLibspec (std::string const &libspec, std::string const &sym_name, nothrow_t) const |
|
template<typename T > |
void | getSymbolByLibspec (std::string const &libspec, std::string const &sym_name, T &sym, nothrow_t) const |
|
template<typename T > |
T | getSymbolByPath (std::string const &lib_loc, std::string const &sym_name, nothrow_t) const |
|
template<typename T > |
void | getSymbolByPath (std::string const &lib_loc, std::string const &sym_name, T &sym, nothrow_t) const |
|
size_t | getLoadableLibraries (std::vector< std::string > &list) const |
|
template<class OutIter > |
size_t | getLoadableLibraries (OutIter dest) const |
|
size_t | getLoadedLibraries (std::vector< std::string > &list) const |
|
template<class OutIter > |
size_t | getLoadedLibraries (OutIter dest) const |
|
size_t | getValidLibspecs (std::vector< std::string > &list) const |
|
template<class OutIter > |
size_t | getValidLibspecs (OutIter dest) const |
|
std::pair< std::string, std::string > | getSpecsByPath (std::string const &lib_loc) const |
|
void | loadAllLibraries () const |
|
bool | libraryIsLoaded (std::string const &path) const |
|
bool | libraryIsLoadable (std::string const &path) const |
|
std::string | libType () const |
|
std::string | patternStem () const |
|
Definition at line 19 of file LibraryManager.h.
Definition at line 34 of file LibraryManager.cc.
LibraryManager(cet::search_path search_path, std::string lib_type)
Definition at line 41 of file LibraryManager.cc.
48 std::vector<std::string>
matches;
55 std::for_each(matches.rbegin(), matches.rend(), [
this](
auto const& match) {
void spec_trans_map_inserter(lib_loc_map_t::value_type const &entry)
void lib_loc_map_inserter(std::string const &path)
cet::search_path const search_path_
std::string const pattern_stem_
std::string shlib_prefix()
static std::string dllExtPattern()
spec_trans_map_t spec_trans_map_
std::size_t find_files(std::string const &filename_pattern, std::vector< std::string > &result) const
void good_spec_trans_map_inserter(spec_trans_map_t::value_type const &entry)
search_path plugin_search_path()
std::string const lib_type_
lib_loc_map_t lib_loc_map_
cet::LibraryManager::LibraryManager |
( |
std::string |
lib_type | ) |
|
|
explicit |
Definition at line 70 of file LibraryManager.cc.
LibraryManager(cet::search_path search_path, std::string lib_type)
Definition at line 74 of file LibraryManager.cc.
LibraryManager(cet::search_path search_path, std::string lib_type)
constexpr char const * plugin_libpath()
void * cet::LibraryManager::get_lib_ptr |
( |
std::string const & |
lib_loc | ) |
const |
|
private |
Definition at line 202 of file LibraryManager.cc.
205 if (it ==
lib_ptr_map_.cend() || it->second ==
nullptr) {
207 void* ptr = dlopen(lib_loc.c_str(), RTLD_LAZY | RTLD_GLOBAL);
lib_ptr_map_t lib_ptr_map_
Definition at line 81 of file LibraryManager.cc.
size_t getLoadableLibraries(std::vector< std::string > &list) const
template<class OutIter >
size_t cet::LibraryManager::getLoadableLibraries |
( |
OutIter |
dest | ) |
const |
Definition at line 87 of file LibraryManager.cc.
size_t getLoadedLibraries(std::vector< std::string > &list) const
template<class OutIter >
size_t cet::LibraryManager::getLoadedLibraries |
( |
OutIter |
dest | ) |
const |
Definition at line 99 of file LibraryManager.cc.
102 std::pair<std::string, std::string>
result;
104 auto const& spec = maybe_trim_shlib_prefix(
entry.
first);
105 auto const& paths =
entry.second;
107 auto const path_iter = paths.
find(lib_loc);
108 if (path_iter != paths.end()) {
109 if (spec.find(
"/") != std::string::npos)
110 result.second = spec;
114 if (!result.first.empty() && !result.second.empty())
int find(const type *d) const
QCollection::Item first()
spec_trans_map_t spec_trans_map_
Definition at line 180 of file LibraryManager.h.
PTR_T hard_cast(void *src)
void * getSymbolByLibspec_(std::string const &libspec, std::string const &sym_name, bool should_throw_on_dlsym=true) const
template<typename T >
void cet::LibraryManager::getSymbolByLibspec |
( |
std::string const & |
libspec, |
|
|
std::string const & |
sym_name, |
|
|
T & |
sym |
|
) |
| const |
|
inline |
Definition at line 188 of file LibraryManager.h.
PTR_T hard_cast(void *src)
void * getSymbolByLibspec_(std::string const &libspec, std::string const &sym_name, bool should_throw_on_dlsym=true) const
Definition at line 227 of file LibraryManager.h.
PTR_T hard_cast(void *src)
void * getSymbolByLibspec_(std::string const &libspec, std::string const &sym_name, bool should_throw_on_dlsym=true) const
Definition at line 236 of file LibraryManager.h.
PTR_T hard_cast(void *src)
void * getSymbolByLibspec_(std::string const &libspec, std::string const &sym_name, bool should_throw_on_dlsym=true) const
void * cet::LibraryManager::getSymbolByLibspec_ |
( |
std::string const & |
libspec, |
|
|
std::string const & |
sym_name, |
|
|
bool |
should_throw_on_dlsym = true |
|
) |
| const |
|
private |
Definition at line 215 of file LibraryManager.cc.
219 if (libspec.find(
"_") != std::string::npos) {
221 throw exception(
"LogicError",
"IllegalUnderscore.")
222 <<
"Library specification \"" << libspec
223 <<
"\" contains an illegal underscore.\n" 224 <<
"The class name and path to it may not contain an underscore. " 225 <<
"If this is a configuration error, plase correct it; " 226 <<
"if the module's class name or its location within its " 227 <<
"enclosing package really do have an underscore this situation " 228 <<
"must be rectified.\n";
233 std::ostringstream error_msg;
234 error_msg <<
"Library specification \"" << libspec <<
"\"";
237 error_msg <<
" corresponds to multiple libraries:\n";
239 std::ostream_iterator<std::string>(error_msg,
"\n"));
242 error_msg <<
" does not correspond to any library";
243 if (!path_name.empty()) {
244 error_msg <<
" in " << path_name;
246 error_msg <<
" of type \"" <<
lib_type_ <<
"\"\n";
248 throw exception(
"Configuration") << error_msg.str();
std::string const & showenv() const
void * getSymbolByPath_(std::string const &lib_loc, std::string const &sym_name, bool should_throw_on_dlsym=true) const
cet::search_path const search_path_
spec_trans_map_t spec_trans_map_
good_spec_trans_map_t good_spec_trans_map_
auto copy_all(FwdCont &, FwdIter)
std::string const lib_type_
cet::coded_exception< error, detail::translate > exception
Definition at line 197 of file LibraryManager.h.
PTR_T hard_cast(void *src)
void * getSymbolByPath_(std::string const &lib_loc, std::string const &sym_name, bool should_throw_on_dlsym=true) const
template<typename T >
void cet::LibraryManager::getSymbolByPath |
( |
std::string const & |
lib_loc, |
|
|
std::string const & |
sym_name, |
|
|
T & |
sym |
|
) |
| const |
|
inline |
Definition at line 205 of file LibraryManager.h.
PTR_T hard_cast(void *src)
void * getSymbolByPath_(std::string const &lib_loc, std::string const &sym_name, bool should_throw_on_dlsym=true) const
Definition at line 246 of file LibraryManager.h.
PTR_T hard_cast(void *src)
void * getSymbolByPath_(std::string const &lib_loc, std::string const &sym_name, bool should_throw_on_dlsym=true) const
Definition at line 255 of file LibraryManager.h.
PTR_T hard_cast(void *src)
void * getSymbolByPath_(std::string const &lib_loc, std::string const &sym_name, bool should_throw_on_dlsym=true) const
void * cet::LibraryManager::getSymbolByPath_ |
( |
std::string const & |
lib_loc, |
|
|
std::string const & |
sym_name, |
|
|
bool |
should_throw_on_dlsym = true |
|
) |
| const |
|
private |
Definition at line 254 of file LibraryManager.cc.
260 if (lib_ptr ==
nullptr) {
262 <<
"Unable to load requested library " << lib_loc <<
"\n" 263 << demangle_message(dlerror()) <<
"\n";
266 result = dlsym(lib_ptr, sym_name.c_str());
267 char const*
error = dlerror();
268 if (error !=
nullptr) {
270 if (should_throw_on_dlsym) {
272 <<
"Unable to load requested symbol " << demangle_symbol(sym_name)
273 <<
" from library " << lib_loc <<
"\n" 274 << demangle_message(error) <<
"\n";
void * get_lib_ptr(std::string const &lib_loc) const
cet::coded_exception< error, detail::translate > exception
Definition at line 93 of file LibraryManager.cc.
size_t getValidLibspecs(std::vector< std::string > &list) const
template<class OutIter >
size_t cet::LibraryManager::getValidLibspecs |
( |
OutIter |
dest | ) |
const |
void cet::LibraryManager::good_spec_trans_map_inserter |
( |
spec_trans_map_t::value_type const & |
entry | ) |
|
|
private |
Definition at line 193 of file LibraryManager.cc.
196 if (
entry.second.size() == 1) {
QCollection::Item first()
good_spec_trans_map_t good_spec_trans_map_
void cet::LibraryManager::lib_loc_map_inserter |
( |
std::string const & |
path | ) |
|
|
private |
bool cet::LibraryManager::libraryIsLoadable |
( |
std::string const & |
path | ) |
const |
Definition at line 140 of file LibraryManager.cc.
145 if (path == lib.second) {
lib_loc_map_t lib_loc_map_
bool cet::LibraryManager::libraryIsLoaded |
( |
std::string const & |
path | ) |
const |
void cet::LibraryManager::loadAllLibraries |
( |
| ) |
const |
Definition at line 122 of file LibraryManager.cc.
127 <<
"Unable to load requested library " << lib.second <<
"\n" 128 << demangle_message(dlerror()) <<
"\n";
void * get_lib_ptr(std::string const &lib_loc) const
lib_loc_map_t lib_loc_map_
cet::coded_exception< error, detail::translate > exception
void cet::LibraryManager::spec_trans_map_inserter |
( |
lib_loc_map_t::value_type const & |
entry | ) |
|
|
private |
Definition at line 159 of file LibraryManager.cc.
164 boost::match_results<std::string::const_iterator> match_results;
165 if (boost::regex_search(
entry.
first, match_results,
e)) {
169 <<
"Internal error in spec_trans_map_inserter for entry " <<
entry.
first 170 <<
" with pattern " <<
e.str();
173 std::ostringstream lib_name;
174 std::ostream_iterator<char, char> oi{lib_name};
175 boost::regex_replace(oi,
178 boost::regex{
"(_+)"},
180 boost::match_default | boost::format_all);
181 boost::regex
const stripper{
"^lib(.*)/" +
lib_type_ +
"\\..*$"};
183 if (boost::regex_search(lib_name_str, match_results, stripper)) {
187 <<
"Internal error in spec_trans_map_inserter stripping "
QCollection::Item first()
static std::string dllExtPattern()
spec_trans_map_t spec_trans_map_
std::string const lib_type_
cet::coded_exception< error, detail::translate > exception
The documentation for this class was generated from the following files: