Mantid
|
Class for opening shared libraries. More...
#include <LibraryManager.h>
Public Types | |
enum | LoadLibraries { Recursive , NonRecursive } |
Public Member Functions | |
LibraryManagerImpl (const LibraryManagerImpl &)=delete | |
int | openLibraries (const std::string &libpath, LoadLibraries loadingBehaviour, const std::vector< std::string > &excludes) |
Opens suitable DLLs on a given path. More... | |
LibraryManagerImpl & | operator= (const LibraryManagerImpl &)=delete |
Private Member Functions | |
bool | isExcluded (const std::string &filename, const std::vector< std::string > &excludes) const |
Returns true if the library has been requested to be excluded. More... | |
bool | isLoaded (const std::string &filename) const |
Check if the library has already been loaded. More... | |
LibraryManagerImpl () | |
Private Constructor. More... | |
int | openLibraries (const Poco::File &libpath, LoadLibraries loadingBehaviour, const std::vector< std::string > &excludes) |
Load libraries from the given Poco::File path Private so Poco::File doesn't leak to the public interface. More... | |
int | openLibrary (const Poco::File &filepath, const std::string &cacheKey) |
Load a given library. More... | |
bool | shouldBeLoaded (const std::string &filename, const std::vector< std::string > &excludes) const |
Check if the library should be loaded. More... | |
~LibraryManagerImpl ()=default | |
Private Destructor. More... | |
Private Attributes | |
std::unordered_map< std::string, LibraryWrapper > | m_openedLibs |
Storage for the LibraryWrappers. More... | |
Friends | |
struct | Mantid::Kernel::CreateUsingNew< LibraryManagerImpl > |
Enumerator | |
---|---|
Recursive | |
NonRecursive |
Definition at line 35 of file LibraryManager.h.
|
delete |
|
private |
Private Constructor.
Constructor.
Definition at line 25 of file LibraryManager.cpp.
References Mantid::Kernel::Logger::debug(), and Mantid::Kernel::DateAndTimeHelpers::g_log.
|
privatedefault |
Private Destructor.
|
private |
Returns true if the library has been requested to be excluded.
Returns true if the name contains one of the strings given in the exclude list.
Each string from the variable is searched for with the filename so an exact match is not necessary. This avoids having to specify prefixes and suffixes for different platforms, i.e. 'plugins.exclude = MantidKernel' will exclude libMantidKernel.so
filename | The filename of the library (no directory) |
excludes | A list of substrings to exclude library from loading |
Definition at line 118 of file LibraryManager.cpp.
Referenced by shouldBeLoaded().
|
private |
Check if the library has already been loaded.
Check if the library been loaded already?
filename | The filename of the library, i.e no directory |
Definition at line 104 of file LibraryManager.cpp.
References m_openedLibs.
Referenced by shouldBeLoaded().
|
private |
Load libraries from the given Poco::File path Private so Poco::File doesn't leak to the public interface.
Opens suitable DLLs on a given path.
libpath | A Poco::File object pointing to a directory where the libraries are. |
loadingBehaviour | Control how libraries are searched for |
excludes | If not empty then each string is considered as a substring to search within each library to be opened. If the substring is found then the library is not opened. |
Definition at line 63 of file LibraryManager.cpp.
References Mantid::Kernel::Logger::error(), Mantid::Kernel::DateAndTimeHelpers::g_log, openLibraries(), openLibrary(), Recursive, and shouldBeLoaded().
int Mantid::Kernel::LibraryManagerImpl::openLibraries | ( | const std::string & | filepath, |
LoadLibraries | loadingBehaviour, | ||
const std::vector< std::string > & | excludes | ||
) |
Opens suitable DLLs on a given path.
filepath | The filepath to the directory where the libraries are. |
loadingBehaviour | Control how libraries are searched for |
excludes | If not empty then each string is considered as a substring to search within each library to be opened. If the substring is found then the library is not opened. |
Definition at line 36 of file LibraryManager.cpp.
References Mantid::Kernel::Logger::debug(), Mantid::Kernel::Logger::error(), Mantid::Kernel::DateAndTimeHelpers::g_log, and openLibraries().
Referenced by openLibraries().
|
private |
Load a given library.
Load a library.
filepath | :: A Poco::File The full path to a library as a string |
cacheKey | :: An identifier for the cache if loading is successful |
Definition at line 133 of file LibraryManager.cpp.
References Mantid::Kernel::Logger::debug(), Mantid::Kernel::DateAndTimeHelpers::g_log, Mantid::Kernel::Logger::is(), m_openedLibs, and Mantid::Kernel::LibraryWrapper::openLibrary().
Referenced by openLibraries().
|
delete |
|
private |
Check if the library should be loaded.
filename | The filename of the library, i.e no directory |
excludes | If not empty then each string is considered as a substring to search within each library to be opened. If the substring is found then the library is not opened. |
Definition at line 95 of file LibraryManager.cpp.
References isExcluded(), isLoaded(), and Mantid::Kernel::DllOpen::isValidFilename().
Referenced by openLibraries().
|
friend |
Definition at line 39 of file LibraryManager.h.
|
private |
Storage for the LibraryWrappers.
Definition at line 63 of file LibraryManager.h.
Referenced by isLoaded(), and openLibrary().