Skip to content
Snippets Groups Projects
NexusFileLoader.cpp 1.35 KiB
Newer Older
Hahn, Steven's avatar
Hahn, Steven committed
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
//     NScD Oak Ridge National Laboratory, European Spallation Source
//     & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidAPI/NexusFileLoader.h"
namespace Mantid::API {
void NexusFileLoader::exec() {
  // make sure the descriptor is initialized
  if (!m_fileInfo) {
    const std::string filename =
        this->getPropertyValue(this->getFilenamePropertyName());
    m_fileInfo =
        std::make_shared<Mantid::Kernel::NexusHDF5Descriptor>(filename);
  }

  // execute the algorithm as normal
  execLoader();
}
boost::shared_ptr<Mantid::API::Algorithm> NexusFileLoader::createChildAlgorithm(
    const std::string &name, const double startProgress,
    const double endProgress, const bool enableLogging, const int &version) {
  auto child = IFileLoader::createChildAlgorithm(
      name, startProgress, endProgress, enableLogging, version);

  // set the NexusHDF5Descriptor on the child algorithm
  auto nfl = boost::dynamic_pointer_cast<NexusFileLoader>(child);
  if (nfl) {
    nfl->setFileInfo(m_fileInfo);
  }
  return child;
Hahn, Steven's avatar
Hahn, Steven committed
}
Hahn, Steven's avatar
Hahn, Steven committed
void NexusFileLoader::setFileInfo(
    std::shared_ptr<Mantid::Kernel::NexusHDF5Descriptor> fileInfo) {
  m_fileInfo = std::move(fileInfo);
}
} // namespace Mantid::API