|
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. | |
| 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. | |
| bool | isLoaded (const std::string &filename) const |
| Check if the library has already been loaded. | |
| LibraryManagerImpl () | |
| Private Constructor. | |
| int | openLibraries (const std::filesystem::path &libpath, LoadLibraries loadingBehaviour, const std::vector< std::string > &excludes) |
| Load libraries from the given filesystem path Private so filesystem implementation doesn't leak to the public interface. | |
| int | openLibrary (const std::filesystem::path &filepath, const std::string &cacheKey) |
| Load a given library. | |
| bool | shouldBeLoaded (const std::string &filename, const std::vector< std::string > &excludes) const |
| Check if the library should be loaded. | |
| ~LibraryManagerImpl ()=default | |
| Private Destructor. | |
Private Attributes | |
| std::unordered_map< std::string, LibraryWrapper > | m_openedLibs |
| Storage for the LibraryWrappers. | |
Friends | |
| struct | Mantid::Kernel::CreateUsingNew< LibraryManagerImpl > |
| Enumerator | |
|---|---|
| Recursive | |
| NonRecursive | |
Definition at line 31 of file LibraryManager.h.
|
delete |
|
private |
Private Constructor.
Constructor.
Definition at line 22 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 115 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 101 of file LibraryManager.cpp.
References m_openedLibs.
Referenced by shouldBeLoaded().
|
private |
Load libraries from the given filesystem path Private so filesystem implementation doesn't leak to the public interface.
Opens suitable DLLs on a given path.
| libpath | An std::filesystem::path 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 60 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 33 of file LibraryManager.cpp.
References Mantid::Kernel::Logger::debug(), Mantid::Kernel::Logger::error(), Mantid::Kernel::DateAndTimeHelpers::g_log, and openLibraries().
Referenced by openLibraries(), and openLibraries().
|
private |
Load a given library.
Load a library.
| filepath | :: An std::filesystem::path The full path to a library as a string |
| cacheKey | :: An identifier for the cache if loading is successful |
Definition at line 126 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 92 of file LibraryManager.cpp.
References isExcluded(), isLoaded(), and Mantid::Kernel::DllOpen::isValidFilename().
Referenced by openLibraries().
|
friend |
Definition at line 35 of file LibraryManager.h.
|
private |
Storage for the LibraryWrappers.
Definition at line 59 of file LibraryManager.h.
Referenced by isLoaded(), and openLibrary().