Skip to content
Snippets Groups Projects
Commit 7b3b65b3 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Move methods to NexusFileLoader

parent 1dbb549a
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,6 @@ public: ...@@ -24,7 +24,6 @@ public:
/// Returns a value indicating whether or not loader wants to load multiple /// Returns a value indicating whether or not loader wants to load multiple
/// files into a single workspace /// files into a single workspace
virtual bool loadMutipleAsOne() { return false; } virtual bool loadMutipleAsOne() { return false; }
virtual void execLoader() {}
}; };
} // namespace API } // namespace API
......
...@@ -15,7 +15,8 @@ namespace Mantid::DataHandling { ...@@ -15,7 +15,8 @@ namespace Mantid::DataHandling {
class DLLExport NexusFileLoader class DLLExport NexusFileLoader
: public API::IFileLoader<Mantid::Kernel::NexusHDF5Descriptor> { : public API::IFileLoader<Mantid::Kernel::NexusHDF5Descriptor> {
public: public:
void exec() override; void exec() override final; // makes sure the NexusHDF5Descriptor is initialized
virtual void execLoader() = 0; // what would normally be called exec
boost::shared_ptr<Algorithm> createChildAlgorithm( boost::shared_ptr<Algorithm> createChildAlgorithm(
const std::string &name, const double startProgress = -1., const std::string &name, const double startProgress = -1.,
const double endProgress = -1., const bool enableLogging = true, const double endProgress = -1., const bool enableLogging = true,
......
...@@ -7,16 +7,24 @@ ...@@ -7,16 +7,24 @@
#include "MantidDataHandling/NexusFileLoader.h" #include "MantidDataHandling/NexusFileLoader.h"
namespace Mantid::DataHandling { namespace Mantid::DataHandling {
void NexusFileLoader::exec() { execLoader(); } void NexusFileLoader::exec() {
// make sure the descriptor is initialized
if (!m_fileInfo) {
const std::string filename = this->getPropertyValue("Filename"); // TODO be more generic
m_fileInfo = std::make_shared<Mantid::Kernel::NexusHDF5Descriptor>(filename);
}
// execute the algorithm as normal
execLoader();
}
boost::shared_ptr<Mantid::API::Algorithm> NexusFileLoader::createChildAlgorithm( boost::shared_ptr<Mantid::API::Algorithm> NexusFileLoader::createChildAlgorithm(
const std::string &name, const double startProgress, const std::string &name, const double startProgress,
const double endProgress, const bool enableLogging, const int &version) { const double endProgress, const bool enableLogging, const int &version) {
auto child = API::IFileLoader< auto child = IFileLoader::createChildAlgorithm(name,
Mantid::Kernel::NexusHDF5Descriptor>::createChildAlgorithm(name, startProgress, endProgress,
startProgress, enableLogging, version);
endProgress,
enableLogging, // set the NexusHDF5Descriptor on the child algorithm
version);
auto nfl = boost::dynamic_pointer_cast<NexusFileLoader>(child); auto nfl = boost::dynamic_pointer_cast<NexusFileLoader>(child);
if (nfl) { if (nfl) {
nfl->setFileInfo(m_fileInfo); nfl->setFileInfo(m_fileInfo);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment