Mantid
Loading...
Searching...
No Matches
LibraryWrapper.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
9
10namespace Mantid::Kernel {
11
16LibraryWrapper::LibraryWrapper(LibraryWrapper &&src) noexcept { *this = std::move(src); }
17
23 using std::swap;
24 swap(m_module, rhs.m_module);
25 return *this;
26}
27
30 // Close lib
31 if (m_module) {
33 m_module = nullptr;
34 }
35}
36
41bool LibraryWrapper::openLibrary(const std::string &filepath) {
42 if (!m_module) {
43 // Load dynamically loaded library
44 m_module = DllOpen::openDll(filepath);
45 if (!m_module) {
46 return false;
47 }
48 }
49 return true;
50}
51
52} // namespace Mantid::Kernel
const std::vector< double > & rhs
static void * openDll(const std::string &filepath)
Static method for opening the shared library.
Definition: DllOpen.cpp:96
static void closeDll(void *handle)
Static method for closing the shared library.
Definition: DllOpen.cpp:107
Class for wrapping a shared library.
bool openLibrary(const std::string &filepath)
Opens a DLL.
void * m_module
An untyped pointer to the loaded library.
LibraryWrapper & operator=(const LibraryWrapper &)=delete
void swap(MultiFileValidator &obj1, MultiFileValidator &obj2)