Skip to content
Snippets Groups Projects
LibraryWrapper.cpp 1.06 KiB
Newer Older
#include "MantidKernel/LibraryWrapper.h"
#include "MantidKernel/DllOpen.h"
namespace Mantid {
namespace Kernel {
/**
 * Move constructor
 * @param src Constructor from this temporary
 */
Hahn, Steven's avatar
Hahn, Steven committed
LibraryWrapper::LibraryWrapper(LibraryWrapper &&src) noexcept {
  *this = std::move(src);
}

/**
 * Move assignment
 * @param rhs Temporary object as source of assignment
 */
Hahn, Steven's avatar
Hahn, Steven committed
LibraryWrapper &LibraryWrapper::operator=(LibraryWrapper &&rhs) noexcept {
  using std::swap;
  swap(m_module, rhs.m_module);
  return *this;
}

LibraryWrapper::~LibraryWrapper() {
  // Close lib
  if (m_module) {
    DllOpen::closeDll(m_module);
    m_module = nullptr;
 *  @param filepath :: The filepath to the directory where the library is.
 *  @return True if DLL is opened or already open
bool LibraryWrapper::openLibrary(const std::string &filepath) {
  if (!m_module) {
    // Load dynamically loaded library
    m_module = DllOpen::openDll(filepath);
    if (!m_module) {
} // namespace Kernel
} // namespace Mantid